[jboss-cvs] JBossAS SVN: r80789 - in projects/jboss-cl/trunk: classloading-vfs and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 11 02:37:53 EST 2008


Author: anil.saldhana at jboss.com
Date: 2008-11-11 02:37:53 -0500 (Tue, 11 Nov 2008)
New Revision: 80789

Added:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java
Removed:
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/CodeSourceGenerator.java
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/DefaultCodeSourceGenerator.java
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/FileProtocolCodeSourceGenerator.java
Modified:
   projects/jboss-cl/trunk/classloading-vfs/.classpath
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
   projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
   projects/jboss-cl/trunk/pom.xml
Log:
JBCL-64

Modified: projects/jboss-cl/trunk/classloading-vfs/.classpath
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/.classpath	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/.classpath	2008-11-11 07:37:53 UTC (rev 80789)
@@ -1,35 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/tests-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/tests-classes" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
-  <classpathentry kind="src" path="/jboss-classloader"/>
-  <classpathentry kind="src" path="/jboss-classloading"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/integration/jboss-classloading-spi/5.0.0.CR2/jboss-classloading-spi-5.0.0.CR2.jar" sourcepath="M2_REPO/org/jboss/integration/jboss-classloading-spi/5.0.0.CR2/jboss-classloading-spi-5.0.0.CR2-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR1/jboss-dependency-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR1/jboss-dependency-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR1/jboss-kernel-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR1/jboss-kernel-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.CR1/jboss-managed-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.CR1/jboss-managed-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.CR1/jboss-metatype-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.CR1/jboss-metatype-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR14/jbossxb-2.0.0.CR14.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR14/jbossxb-2.0.0.CR14-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/tests-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" kind="src" output="target/tests-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
+	<classpathentry kind="src" path="/jboss-classloader"/>
+	<classpathentry kind="src" path="/jboss-classloading"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/integration/jboss-classloading-spi/5.0.0.CR2/jboss-classloading-spi-5.0.0.CR2.jar" sourcepath="M2_REPO/org/jboss/integration/jboss-classloading-spi/5.0.0.CR2/jboss-classloading-spi-5.0.0.CR2-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR1/jboss-dependency-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR1/jboss-dependency-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR1/jboss-kernel-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR1/jboss-kernel-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.0.0.CR1/jboss-managed-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/man/jboss-managed/2.0.0.CR1/jboss-managed-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.CR1/jboss-metatype-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/man/jboss-metatype/2.0.0.CR1/jboss-metatype-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.2.0-SNAPSHOT/jboss-vfs-2.2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.CR1/jboss-vfs-2.0.0.CR1-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR14/jbossxb-2.0.0.CR14.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR14/jbossxb-2.0.0.CR14-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -209,6 +209,7 @@
    {
       VirtualFile[] roots = determineVFSRoots();
       VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy(getContextName(), roots);
+      
       String[] packageNames = getPackageNames();
       policy.setExportedPackages(packageNames);
       policy.setIncluded(getIncluded());
@@ -243,5 +244,5 @@
          ClassFilter excluded = getExcluded();
          VFSResourceVisitor.visit(roots, null, included, excluded, classLoader, visitor, filter, recurseFilter, urls);
       }
-   }
+   } 
 }

Deleted: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/CodeSourceGenerator.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/CodeSourceGenerator.java	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/CodeSourceGenerator.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.classloading.spi.vfs.policy;
-
-import java.net.URL;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-
-/**
- * Generates a CodeSource for a VFS URL
- *
- * @author Anil.Saldhana at redhat.com
- */
-public interface CodeSourceGenerator
-{
-   /**
-    * Generate a CodeSource for the vfs url.
-    * 
-    * @param url the vfs url
-    * @param certs the certificates
-    * @return new code source
-    * @throws Exception for any error
-    */
-   CodeSource getCodeSource(URL url, Certificate[] certs) throws Exception;
-}
\ No newline at end of file

Deleted: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/DefaultCodeSourceGenerator.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/DefaultCodeSourceGenerator.java	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/DefaultCodeSourceGenerator.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.classloading.spi.vfs.policy;
-
-import java.net.URL;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-
-/**
- * Default code source generator.
- *
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- */
-public class DefaultCodeSourceGenerator implements CodeSourceGenerator
-{
-   public static final CodeSourceGenerator INSTANCE = new DefaultCodeSourceGenerator();
-   
-   public CodeSource getCodeSource(URL url, Certificate[] certs) throws Exception
-   {
-      return new CodeSource(url, certs);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/FileProtocolCodeSourceGenerator.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/FileProtocolCodeSourceGenerator.java	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/FileProtocolCodeSourceGenerator.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors. 
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.classloading.spi.vfs.policy;
-
-import java.net.URL;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-
-/**
- * JBCL-64: Generates a CodeSource from a vfs URL
- * with the substitution of file as protocol
- *
- * @author Anil.Saldhana at redhat.com
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- */
-public class FileProtocolCodeSourceGenerator implements CodeSourceGenerator
-{
-   public static final CodeSourceGenerator INSTANCE = new FileProtocolCodeSourceGenerator();
-
-   /**
-    * Constant representing the URL file protocol
-    */
-   private static final String FILE_PROTOCOL = "file";
-   
-   public CodeSource getCodeSource(URL url, Certificate[] certs) throws Exception
-   {
-      URL codesourceURL = new URL(FILE_PROTOCOL, url.getHost(), url.getPort(), url.getFile());
-      return new CodeSource(codesourceURL, certs);
-   } 
-}

Added: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java	                        (rev 0)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/SecurityActions.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.classloading.spi.vfs.policy;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana at redhat.com
+ * @since Nov 10, 2008
+ */
+class SecurityActions
+{   
+   static String getProperty(final String key, final String defaultValue)
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<String>()
+      {
+         public String run()
+         {
+            return System.getProperty(key, defaultValue);
+         }
+      }); 
+   } 
+}

Modified: projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java	2008-11-11 07:37:53 UTC (rev 80789)
@@ -25,7 +25,6 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.security.CodeSource;
-import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.Policy;
 import java.security.ProtectionDomain;
@@ -110,12 +109,9 @@
    @SuppressWarnings("unchecked")
    private Map<String, VirtualFileInfo> vfsCache = Collections.synchronizedMap(new SoftValueHashMap());
    
-   /** A generator that is capable of providing Java Security Manager friendly CodeSource */
-   private CodeSourceGenerator codeSourceGenerator = DefaultCodeSourceGenerator.INSTANCE;
+   /** JBCL-64: CodeSource should use read vfs url **/
+   private boolean useRealURL = false;
 
-   /** Code source permission */
-   private static final Permission csgPermission = new RuntimePermission(VFSClassLoaderPolicy.class.getName() + ".setCodeSourceGenerator");
-
    /**
     * Determine a name from the roots
     * 
@@ -257,6 +253,8 @@
       this.name = name;
       this.roots = roots;
       this.excludedRoots = excludedRoots;
+      
+      this.useRealURL = Boolean.valueOf(SecurityActions.getProperty("vfs.codesource.useRealURL", "true"));
    }
 
    @Override
@@ -493,8 +491,18 @@
          }
       }
       return null;
+   } 
+
+   public boolean isUseRealURL()
+   {
+      return useRealURL;
    }
 
+   public void setUseRealURL(boolean useRealURL)
+   {
+      this.useRealURL = useRealURL;
+   }
+
    @Override
    public void getResources(String name, Set<URL> urls) throws IOException
    {
@@ -514,24 +522,7 @@
             log.debug("Error getting resources for " + root, e);
          }
       }
-   }
-
-   /**
-    * Set a CodeSource Generator.
-    *
-    * @param csg the code soruce generator
-    */
-   public void setCodeSourceGenerator(final CodeSourceGenerator csg)
-   {
-      if (csg == null)
-         throw new IllegalArgumentException("Null code source generator.");
-
-      SecurityManager sm = System.getSecurityManager();
-      if(sm != null)
-         sm.checkPermission(csgPermission);
-      
-      codeSourceGenerator = csg; 
-   }
+   } 
    
    /**
     * Find a child from a path
@@ -647,10 +638,15 @@
       try
       {
          VirtualFile root = findRoot(path);
-         URL codeSourceURL = root.toURL();  
+         URL codeSourceURL = root.toURL(); 
          
-         Certificate[] certs = null; // TODO JBCL-67 determine certificates
-         CodeSource cs = codeSourceGenerator.getCodeSource(codeSourceURL, certs);
+         log.trace("getProtectionDomain:className="+ className + 
+               " path="+ path + " codeSourceURL=" + codeSourceURL);
+         
+         Certificate[] certs = null; // TODO JBCL-67 determine certificates 
+         if(this.useRealURL)
+            codeSourceURL = VFSUtils.getRealURL(codeSourceURL);
+         CodeSource cs = new CodeSource(codeSourceURL, certs);
          PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
          return new ProtectionDomain(cs, permissions);
       }

Modified: projects/jboss-cl/trunk/pom.xml
===================================================================
--- projects/jboss-cl/trunk/pom.xml	2008-11-11 07:24:30 UTC (rev 80788)
+++ projects/jboss-cl/trunk/pom.xml	2008-11-11 07:37:53 UTC (rev 80789)
@@ -33,7 +33,7 @@
     <version.jboss.common.core>2.2.9.GA</version.jboss.common.core>
     <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
     <version.jboss.classloading.spi>5.0.0.CR2</version.jboss.classloading.spi>
-    <version.jboss.vfs>2.0.0.CR2</version.jboss.vfs>
+    <version.jboss.vfs>2.2.0-SNAPSHOT</version.jboss.vfs>
     <version.jbossxb>2.0.0.GA</version.jbossxb>
     <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
     <version.junit>4.4</version.junit>




More information about the jboss-cvs-commits mailing list