[jboss-cvs] JBossAS SVN: r94959 - in projects/jboss-cl/branches/vfs3-int: classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 15 12:46:22 EDT 2009
Author: david.lloyd at jboss.com
Date: 2009-10-15 12:46:21 -0400 (Thu, 15 Oct 2009)
New Revision: 94959
Modified:
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/PackageVisitor.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceVisitor.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/ExportAllUnitTestCase.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/VFSCLPolicySignedCertsUnitTestCase.java
projects/jboss-cl/branches/vfs3-int/pom.xml
Log:
Initial port over to VFS3 API
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/PackageVisitor.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/PackageVisitor.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/PackageVisitor.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -28,10 +28,10 @@
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloading.spi.metadata.ExportAll;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileFilterWithAttributes;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileVisitor;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.AbstractVirtualFileFilterWithAttributes;
/**
* Visits a virtual file system recursively
@@ -185,58 +185,51 @@
public void visit(VirtualFile file)
{
- try
+ // We only want only directories
+ if (file.isDirectory() && accepts(file))
{
- // We only want only directories
- if (file.isLeaf() == false && accepts(file))
+ boolean empty = true;
+ // Include empty directories?
+ if (exportAll == ExportAll.ALL)
+ empty = false;
+ else
{
- boolean empty = true;
- // Include empty directories?
- if (exportAll == ExportAll.ALL)
- empty = false;
- else
+ // Determine whether there is anything there
+ List<VirtualFile> children = file.getChildren();
+ if (children != null && children.isEmpty() == false)
{
- // Determine whether there is anything there
- List<VirtualFile> children = file.getChildren();
- if (children != null && children.isEmpty() == false)
+ for (VirtualFile child : children)
{
- for (VirtualFile child : children)
+ // We must have a leaf to be non-empty
+ if (! child.isDirectory())
{
- // We must have a leaf to be non-empty
- if (child.isLeaf())
- {
- empty = false;
- break;
- }
+ empty = false;
+ break;
}
}
}
- // This looks interesting
- if (empty == false)
- {
- String path = file.getPathName();
- if (path.equals(rootPath))
- path = "";
- else if (path.startsWith(rootPathWithSlash))
- path = path.substring(rootPathWithSlash.length());
- String pkg = path.replace('/', '.');
-
- // Check for inclusions/exclusions
- if (included != null && included.matchesPackageName(pkg) == false)
- return;
- if (excluded != null && excluded.matchesPackageName(pkg))
- return;
- if (excludedExport != null && excludedExport.matchesPackageName(pkg))
- return;
-
- // Ok this is a package for export
- packages.add(pkg);
- }
}
+ // This looks interesting
+ if (empty == false)
+ {
+ String path = file.getPathName();
+ if (path.equals(rootPath))
+ path = "";
+ else if (path.startsWith(rootPathWithSlash))
+ path = path.substring(rootPathWithSlash.length());
+ String pkg = path.replace('/', '.');
+
+ // Check for inclusions/exclusions
+ if (included != null && included.matchesPackageName(pkg) == false)
+ return;
+ if (excluded != null && excluded.matchesPackageName(pkg))
+ return;
+ if (excludedExport != null && excludedExport.matchesPackageName(pkg))
+ return;
+
+ // Ok this is a package for export
+ packages.add(pkg);
+ }
}
- catch (IOException e)
- {
- throw new Error("Error visiting " + file, e);
- }
}
}
\ No newline at end of file
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceContext.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -26,7 +26,7 @@
import java.io.IOException;
import org.jboss.classloading.plugins.visitor.AbstractResourceContext;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VirtualFile;
/**
* VFS resource context.
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceVisitor.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceVisitor.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/plugins/vfs/VFSResourceVisitor.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -27,10 +27,10 @@
import org.jboss.classloading.spi.visitor.ResourceContext;
import org.jboss.classloading.spi.visitor.ResourceFilter;
import org.jboss.classloading.spi.visitor.ResourceVisitor;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.vfs.helpers.AbstractVirtualFileFilterWithAttributes;
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileVisitor;
+import org.jboss.vfs.VisitorAttributes;
+import org.jboss.vfs.util.AbstractVirtualFileFilterWithAttributes;
/**
* Visits a virtual file system recursively
@@ -245,7 +245,7 @@
try
{
// We don't want directories
- if (file.isLeaf() == false)
+ if (file.isDirectory())
return;
// Determine the resource name
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/dependency/VFSClassLoaderPolicyModule.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -23,6 +23,7 @@
import java.net.URI;
import java.net.URL;
+import java.net.URISyntaxException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -40,8 +41,8 @@
import org.jboss.classloading.spi.visitor.ResourceVisitor;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
/**
* VFSClassLoaderPolicyModule.
@@ -60,6 +61,8 @@
/** Our cached vfs roots */
private VirtualFile[] vfsRoots;
+ private static final VirtualFile[] NO_VIRTUAL_FILES = new VirtualFile[0];
+
/**
* Create a new VFSClassLoaderPolicyModule.
*
@@ -156,7 +159,7 @@
if (roots == null)
{
- vfsRoots = new VirtualFile[0];
+ vfsRoots = NO_VIRTUAL_FILES;
}
else
{
@@ -167,14 +170,10 @@
try
{
URI uri = new URI(root);
- vfsRoots[i] = getVirtualFile(uri);
+ vfsRoots[i] = VFS.getChild(uri);
}
- catch (RuntimeException e)
+ catch (URISyntaxException e)
{
- throw e;
- }
- catch (Exception e)
- {
throw new RuntimeException("Error creating VFS file for " + root, e);
}
}
@@ -183,21 +182,6 @@
return vfsRoots;
}
- /**
- * Get virtual file for uri.
- *
- * @param uri the uri
- * @return virtual file for uri
- * @throws Exception for any error
- */
- protected VirtualFile getVirtualFile(URI uri) throws Exception
- {
- if (isCacheable())
- return VFS.getRoot(uri);
- else
- return VFS.createNewRoot(uri);
- }
-
@Override
public VFSClassLoaderPolicy getPolicy()
{
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/main/java/org/jboss/classloading/spi/vfs/policy/VFSClassLoaderPolicy.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -28,7 +28,7 @@
import java.security.PermissionCollection;
import java.security.Policy;
import java.security.ProtectionDomain;
-import java.security.cert.Certificate;
+import java.security.CodeSigner;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -47,8 +47,8 @@
import org.jboss.classloading.spi.metadata.ExportAll;
import org.jboss.logging.Logger;
import org.jboss.util.collection.SoftValueHashMap;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
/**
* VFSClassLoaderPolicy.
@@ -649,14 +649,14 @@
try
{
VirtualFile root = findRoot(path);
- URL codeSourceURL = isUseRealURL() ? VFSUtils.getRealURL(root) : root.toURL();
+ URL codeSourceURL = isUseRealURL() ? VFSUtils.getPhysicalURL(root) : root.toURL();
if (log.isTraceEnabled())
log.trace("getProtectionDomain:className="+ className + " path="+ path + " codeSourceURL=" + codeSourceURL);
- Certificate[] certs = clazz.getCertificates();
- CodeSource cs = new CodeSource(codeSourceURL, certs);
- PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
+ final CodeSigner[] signers = clazz.getCodeSigners();
+ final CodeSource cs = new CodeSource(codeSourceURL, signers);
+ final PermissionCollection permissions = Policy.getPolicy().getPermissions(cs);
return new ProtectionDomain(cs, permissions);
}
catch (Exception e)
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/metadata/test/GeneratedClassesUnitTestCase.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -38,9 +38,9 @@
import org.jboss.test.classloading.vfs.metadata.support.a.A;
import org.jboss.test.classloading.vfs.metadata.support.b.B;
import org.jboss.util.id.GUID;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
+import org.jboss.vfs.MemoryFileFactory;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.plugins.context.memory.MemoryContextFactory;
/**
* DomainUnitTestCase.
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/ExportAllUnitTestCase.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/ExportAllUnitTestCase.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/ExportAllUnitTestCase.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -39,8 +39,8 @@
import org.jboss.classloading.spi.metadata.ExportAll;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
/**
* ExportAllUnitTestCase.
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/PackageInfoUnitTestCase.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -30,8 +30,8 @@
import org.jboss.classloading.spi.metadata.ExportAll;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
/**
* Package related tests of VFSClassLoaderPolicy
Modified: projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/VFSCLPolicySignedCertsUnitTestCase.java
===================================================================
--- projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/VFSCLPolicySignedCertsUnitTestCase.java 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/classloading-vfs/src/test/java/org/jboss/test/classloading/vfs/policy/test/VFSCLPolicySignedCertsUnitTestCase.java 2009-10-15 16:46:21 UTC (rev 94959)
@@ -31,8 +31,8 @@
import org.jboss.classloading.spi.metadata.ExportAll;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
import org.jboss.test.BaseTestCase;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
/**
* Unit test JBCL-67
Modified: projects/jboss-cl/branches/vfs3-int/pom.xml
===================================================================
--- projects/jboss-cl/branches/vfs3-int/pom.xml 2009-10-15 16:45:56 UTC (rev 94958)
+++ projects/jboss-cl/branches/vfs3-int/pom.xml 2009-10-15 16:46:21 UTC (rev 94959)
@@ -30,7 +30,7 @@
</modules>
<properties>
- <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
+ <version.jboss.vfs>3.0.0.CR1-SNAPSHOT</version.jboss.vfs>
<version.jboss.man>2.1.1.CR1</version.jboss.man>
<version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
<version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
More information about the jboss-cvs-commits
mailing list