[jboss-cvs] JBossAS SVN: r107586 - in projects/aop/branches/Branch_2_1: asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5 and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 13 06:27:11 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-08-13 06:27:11 -0400 (Fri, 13 Aug 2010)
New Revision: 107586
Modified:
projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AspectDeployer.java
projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java
projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithHierarchicalParentLoaderSanityTestCase.java
projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithHierarchicalParentLoaderTestCase.java
projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java
projects/aop/branches/Branch_2_1/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java
projects/aop/branches/Branch_2_1/pom.xml
Log:
[JBAOP-799] 2.1 branch should use VFS 2
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AspectDeployer.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AspectDeployer.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AspectDeployer.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -36,14 +36,14 @@
import org.jboss.aop.Domain;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
import org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.util.FilterVirtualFileVisitor;
-import org.jboss.vfs.util.SuffixesExcludeFilter;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
import org.w3c.dom.Document;
/**
@@ -61,9 +61,6 @@
/** The aspect manager */
private AspectManager aspectManager;
- /** Filter JAR files **/
- private SuffixesExcludeFilter jarExcludeFilter;
-
/**
* Create a new AspectDeployer.
*/
@@ -91,30 +88,8 @@
{
this.aspectManager = aspectManager;
}
-
- /**
- * Get the jar exclude filter.
- *
- * @return the JAR exclude filter
- */
- public SuffixesExcludeFilter getJarExcludeFilter()
- {
- if(jarExcludeFilter == null)
- jarExcludeFilter = new SuffixesExcludeFilter(JARStructure.DEFAULT_JAR_SUFFIXES);
- return jarExcludeFilter;
- }
/**
- * Set the jar exclude filter
- *
- * @param noJarFilter the JAR exclude filter
- */
- public void setJarExcludeFilter(SuffixesExcludeFilter jarExcludeFilter)
- {
- this.jarExcludeFilter = jarExcludeFilter;
- }
-
- /**
* Validate the configuration
*/
public void create()
@@ -334,7 +309,8 @@
VisitorAttributes va = new VisitorAttributes();
va.setLeavesOnly(true);
ClassFileFilter filter = new ClassFileFilter();
- va.setRecurseFilter(getJarExcludeFilter());
+ SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
+ va.setRecurseFilter(noJars);
FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
for (VirtualFile vf : unit.getClassPath())
@@ -388,7 +364,14 @@
{
public boolean accepts(VirtualFile file)
{
- return file.isFile() && file.getName().endsWith(".class");
+ try
+ {
+ return file.isLeaf() && file.getName().endsWith(".class");
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error visiting file: " + file.getName(), e);
+ }
}
}
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -31,9 +31,7 @@
import org.jboss.classloading.spi.RealClassLoader;
import org.jboss.logging.Logger;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VFSUtils;
-import org.jboss.vfs.VirtualFile;
+import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
/**
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
@@ -79,8 +77,8 @@
out.close();
byte[] classBytes = byteout.toByteArray();
- VirtualFile classFile = VFS.getChild(outputURL);
- VFSUtils.writeFile(classFile, classBytes);
+ MemoryContextFactory factory = MemoryContextFactory.getInstance();
+ factory.putFile(outputURL, classBytes);
if (myloader instanceof RealClassLoader)
{
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -21,17 +21,13 @@
*/
package org.jboss.test.aop.classpool.jbosscl.support;
-import java.io.Closeable;
import java.net.URL;
-import java.util.concurrent.Executors;
import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
import org.jboss.util.id.GUID;
-import org.jboss.vfs.TempFileProvider;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VFSUtils;
-import org.jboss.vfs.VirtualFile;
+import org.jboss.virtual.MemoryFileFactory;
+import org.jboss.virtual.VirtualFile;
/**
*
@@ -45,7 +41,6 @@
/** In AS we need a URL to create the temporary files */
URL dynamicClassRoot;
VirtualFile classes;
- Closeable tempDirectoryHandle;
public TestVFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
{
@@ -84,9 +79,8 @@
{
try
{
- classes = VFS.getChild("/" + GUID.asString());
- tempDirectoryHandle = VFS.mountTemp(classes, TempFileProvider.create("classes", Executors.newScheduledThreadPool(2)));
- dynamicClassRoot = classes.toURL();
+ dynamicClassRoot = new URL("vfsmemory", GUID.asString(), "");
+ classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
}
catch (Exception e)
{
@@ -95,13 +89,4 @@
}
}
}
-
- @Override
- public void reset()
- {
- super.reset();
- VFSUtils.safeClose(tempDirectoryHandle);
- }
-
-
}
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithHierarchicalParentLoaderSanityTestCase.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithHierarchicalParentLoaderSanityTestCase.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithHierarchicalParentLoaderSanityTestCase.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -23,9 +23,9 @@
import java.net.URL;
-import org.jboss.classloader.plugins.filter.NothingClassFilter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.test.aop.classpool.jbosscl.support.NoMatchClassFilter;
import junit.framework.Test;
@@ -74,7 +74,7 @@
public void testHierarchyFiltered() throws Exception
{
NoMatchClassFilter filter = new NoMatchClassFilter(CLASS_A);
- runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, NothingClassFilter.INSTANCE), false);
+ runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, ClassFilter.NOTHING), false);
assertTrue("Should have been filtered", filter.filtered);
}
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithHierarchicalParentLoaderTestCase.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithHierarchicalParentLoaderTestCase.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithHierarchicalParentLoaderTestCase.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -25,9 +25,9 @@
import javassist.ClassPool;
-import org.jboss.classloader.plugins.filter.NothingClassFilter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.test.aop.classpool.jbosscl.support.NoMatchClassFilter;
import junit.framework.Test;
@@ -76,7 +76,7 @@
public void testHierarchyFiltered() throws Exception
{
NoMatchClassFilter filter = new NoMatchClassFilter(CLASS_A);
- runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, NothingClassFilter.INSTANCE), false);
+ runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, ClassFilter.NOTHING), false);
assertTrue("Should have been filtered", filter.filtered);
}
Modified: projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java
===================================================================
--- projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -21,21 +21,15 @@
*/
package org.jboss.test.aop.classpool.jbosscl.test;
-import java.io.Closeable;
-import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
-import java.util.concurrent.Executors;
import javassist.ClassPool;
import javassist.CtClass;
@@ -47,7 +41,6 @@
import org.jboss.aop.classpool.jbosscl.JBossClDelegatingClassPoolFactory;
import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
import org.jboss.classloader.plugins.filter.CombiningClassFilter;
-import org.jboss.classloader.plugins.filter.NothingClassFilter;
import org.jboss.classloader.plugins.filter.PatternClassFilter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderSystem;
@@ -66,10 +59,7 @@
import org.jboss.test.aop.classpool.jbosscl.support.TestVFSClassLoaderFactory;
import org.jboss.test.aop.classpool.jbosscl.support.TestVFSClassLoaderFactoryFactory;
import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.vfs.TempFileProvider;
-import org.jboss.vfs.VFS;
-import org.jboss.vfs.VFSUtils;
-import org.jboss.vfs.VirtualFile;
+import org.jboss.virtual.VFS;
/**
* Base class for testing the new JBoss classloaders
@@ -102,8 +92,6 @@
private LoaderNameDeploymentRegistry loaderNameDeploymentRegistry = new LoaderNameDeploymentRegistry();
- private final List<Closeable> mountHandles = new LinkedList<Closeable>();
-
/** The classloader helper */
protected static final ClassLoaderSystem system = ClassLoaderSystem.getInstance();
private static boolean initialisedDefaultDomain;
@@ -136,6 +124,7 @@
domainRegistry = new VFSClassLoaderDomainRegistry();
AspectManager.setClassPoolFactory(new JBossClDelegatingClassPoolFactory(domainRegistry, new RegisterModuleCallback()));
+ VFS.init();
}
@@ -150,7 +139,7 @@
PackageClassFilter filter = new PackageClassFilter(parentPkgs);
filter.setIncludeJava(true);
CombiningClassFilter beforeFilter = CombiningClassFilter.create(filter, aopFilter);
- ParentPolicy parentPolicy = new ParentPolicy(beforeFilter, NothingClassFilter.INSTANCE);
+ ParentPolicy parentPolicy = new ParentPolicy(beforeFilter, ClassFilter.NOTHING);
defaultDomain.setParentPolicy(parentPolicy);
}
@@ -205,24 +194,12 @@
// enableTrace("org.jboss.aop.classpool");
// enableTrace("org.jboss.aop.classpool.jbosscl");
deploy("/org/jboss/test/aop/classpool/jbosscl/Common.xml");
-
- mountJars(JAR_A_1, JAR_A_2, JAR_B_1, JAR_B_2, JAR_C_1, JAR_C_2);
}
- protected void mountJars(URL... jarUrls) throws IOException, URISyntaxException
- {
- TempFileProvider tempFileProvider = TempFileProvider.create("test", Executors.newScheduledThreadPool(2));
- for(URL jarUrl : jarUrls)
- {
- VirtualFile jarFile = VFS.getChild(jarUrl);
- mountHandles.add(VFS.mountZip(jarFile, jarFile, tempFileProvider));
- }
- }
@Override
protected void tearDown() throws Exception
{
- VFSUtils.safeClose(mountHandles);
undeploy("/org/jboss/test/aop/classpool/jbosscl/Common.xml");
super.tearDown();
}
Modified: projects/aop/branches/Branch_2_1/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java
===================================================================
--- projects/aop/branches/Branch_2_1/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java 2010-08-13 10:27:11 UTC (rev 107586)
@@ -26,7 +26,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import javassist.bytecode.ClassFile;
@@ -41,11 +40,12 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.jboss.vfs.VisitorAttributes;
-import org.jboss.vfs.util.FilterVirtualFileVisitor;
-import org.jboss.vfs.util.SuffixesExcludeFilter;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
/**
* Reads the annotations and converts them into AOP metadata to be deployed properly
@@ -160,7 +160,7 @@
VisitorAttributes va = new VisitorAttributes();
va.setLeavesOnly(true);
ClassFileFilter filter = new ClassFileFilter();
- SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(Arrays.asList(".zip", ".ear", ".jar", ".rar", ".war", ".sar",".har", ".aop")); // TODO: Where should these come from?
+ SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
va.setRecurseFilter(noJars);
FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
@@ -183,7 +183,14 @@
{
public boolean accepts(VirtualFile file)
{
- return file.isFile() && file.getName().endsWith(".class");
+ try
+ {
+ return file.isLeaf() && file.getName().endsWith(".class");
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error visiting file: " + file.getName(), e);
+ }
}
}
}
Modified: projects/aop/branches/Branch_2_1/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_1/pom.xml 2010-08-13 10:12:43 UTC (rev 107585)
+++ projects/aop/branches/Branch_2_1/pom.xml 2010-08-13 10:27:11 UTC (rev 107586)
@@ -22,16 +22,16 @@
<properties>
<version.javassist.javassist>3.12.0.GA</version.javassist.javassist>
<version.org.jboss.jbossas>5.1.0.GA</version.org.jboss.jbossas>
- <version.org.jboss.jboss-common-core>2.2.17.GA</version.org.jboss.jboss-common-core>
- <version.org.jboss.cl>2.2.0.Alpha3</version.org.jboss.cl>
- <version.org.jboss.deployers>2.2.0.Alpha2</version.org.jboss.deployers>
+ <version.org.jboss.jboss-common-core>2.2.15.GA</version.org.jboss.jboss-common-core>
+ <version.org.jboss.cl>2.0.6.SP1</version.org.jboss.cl>
+ <version.org.jboss.deployers>2.0.8.GA</version.org.jboss.deployers>
<version.org.jboss.integration>5.1.0.SP1</version.org.jboss.integration>
<version.org.jboss.jboss-reflect>2.0.2.GA</version.org.jboss.jboss-reflect>
- <version.org.jboss.jboss-vfs>3.0.0.CR1</version.org.jboss.jboss-vfs>
+ <version.org.jboss.jboss-vfs>2.1.3.SP1</version.org.jboss.jboss-vfs>
<version.org.jboss.microcontainer.jboss-kernel>2.0.9.GA</version.org.jboss.microcontainer.jboss-kernel>
<version.org.jboss.logging>2.2.0.CR1</version.org.jboss.logging>
<version.org.jboss.man>2.1.1.GA</version.org.jboss.man>
- <version.org.jboss.mdr>2.2.0.Alpha1</version.org.jboss.mdr>
+ <version.org.jboss.mdr>2.0.2.GA</version.org.jboss.mdr>
<version.xdoclet>1.2.3</version.xdoclet>
<version.jarjar>1.0</version.jarjar>
</properties>
More information about the jboss-cvs-commits
mailing list