[jboss-cvs] JBossAS SVN: r101087 - 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
Wed Feb 17 12:28:09 EST 2010
Author: kabir.khan at jboss.com
Date: 2010-02-17 12:28:07 -0500 (Wed, 17 Feb 2010)
New Revision: 101087
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-769] - Merge VFS3 changes into branch
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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AspectDeployer.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -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.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.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.w3c.dom.Document;
/**
@@ -61,6 +61,9 @@
/** The aspect manager */
private AspectManager aspectManager;
+ /** Filter JAR files **/
+ private SuffixesExcludeFilter jarExcludeFilter;
+
/**
* Create a new AspectDeployer.
*/
@@ -88,8 +91,30 @@
{
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()
@@ -309,8 +334,7 @@
VisitorAttributes va = new VisitorAttributes();
va.setLeavesOnly(true);
ClassFileFilter filter = new ClassFileFilter();
- SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
- va.setRecurseFilter(noJars);
+ va.setRecurseFilter(getJarExcludeFilter());
FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
for (VirtualFile vf : unit.getClassPath())
@@ -364,14 +388,7 @@
{
public boolean accepts(VirtualFile file)
{
- try
- {
- return file.isLeaf() && file.getName().endsWith(".class");
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error visiting file: " + file.getName(), e);
- }
+ return file.isFile() && file.getName().endsWith(".class");
}
}
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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -31,7 +31,9 @@
import org.jboss.classloading.spi.RealClassLoader;
import org.jboss.logging.Logger;
-import org.jboss.virtual.plugins.context.memory.MemoryContextFactory;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
/**
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
@@ -77,8 +79,8 @@
out.close();
byte[] classBytes = byteout.toByteArray();
- MemoryContextFactory factory = MemoryContextFactory.getInstance();
- factory.putFile(outputURL, classBytes);
+ VirtualFile classFile = VFS.getChild(outputURL);
+ VFSUtils.writeFile(classFile, 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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -21,13 +21,17 @@
*/
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.virtual.MemoryFileFactory;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.vfs.TempFileProvider;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
/**
*
@@ -41,6 +45,7 @@
/** In AS we need a URL to create the temporary files */
URL dynamicClassRoot;
VirtualFile classes;
+ Closeable tempDirectoryHandle;
public TestVFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
{
@@ -79,8 +84,9 @@
{
try
{
- dynamicClassRoot = new URL("vfsmemory", GUID.asString(), "");
- classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
+ classes = VFS.getChild("/" + GUID.asString());
+ tempDirectoryHandle = VFS.mountTemp(classes, TempFileProvider.create("classes", Executors.newScheduledThreadPool(2)));
+ dynamicClassRoot = classes.toURL();
}
catch (Exception e)
{
@@ -89,4 +95,13 @@
}
}
}
+
+ @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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithHierarchicalParentLoaderSanityTestCase.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -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, ClassFilter.NOTHING), false);
+ runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, NothingClassFilter.INSTANCE), 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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/ClassPoolWithHierarchicalParentLoaderTestCase.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -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, ClassFilter.NOTHING), false);
+ runTest(ParentPolicy.BEFORE_BUT_JAVA_ONLY, new ParentPolicy(filter, NothingClassFilter.INSTANCE), 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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -21,15 +21,21 @@
*/
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;
@@ -41,6 +47,7 @@
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;
@@ -59,7 +66,10 @@
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.virtual.VFS;
+import org.jboss.vfs.TempFileProvider;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
/**
* Base class for testing the new JBoss classloaders
@@ -92,6 +102,8 @@
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;
@@ -124,7 +136,6 @@
domainRegistry = new VFSClassLoaderDomainRegistry();
AspectManager.setClassPoolFactory(new JBossClDelegatingClassPoolFactory(domainRegistry, new RegisterModuleCallback()));
- VFS.init();
}
@@ -139,7 +150,7 @@
PackageClassFilter filter = new PackageClassFilter(parentPkgs);
filter.setIncludeJava(true);
CombiningClassFilter beforeFilter = CombiningClassFilter.create(filter, aopFilter);
- ParentPolicy parentPolicy = new ParentPolicy(beforeFilter, ClassFilter.NOTHING);
+ ParentPolicy parentPolicy = new ParentPolicy(beforeFilter, NothingClassFilter.INSTANCE);
defaultDomain.setParentPolicy(parentPolicy);
}
@@ -194,12 +205,24 @@
// 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-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AOPAnnotationMetaDataParserDeployer.java 2010-02-17 17:28:07 UTC (rev 101087)
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javassist.bytecode.ClassFile;
@@ -40,12 +41,11 @@
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.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.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;
/**
* 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(JarUtils.getSuffixes());
+ SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(Arrays.asList(".zip", ".ear", ".jar", ".rar", ".war", ".sar",".har", ".aop")); // TODO: Where should these come from?
va.setRecurseFilter(noJars);
FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
@@ -183,14 +183,7 @@
{
public boolean accepts(VirtualFile file)
{
- try
- {
- return file.isLeaf() && file.getName().endsWith(".class");
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error visiting file: " + file.getName(), e);
- }
+ return file.isFile() && file.getName().endsWith(".class");
}
}
}
Modified: projects/aop/branches/Branch_2_1/pom.xml
===================================================================
--- projects/aop/branches/Branch_2_1/pom.xml 2010-02-17 17:11:51 UTC (rev 101086)
+++ projects/aop/branches/Branch_2_1/pom.xml 2010-02-17 17:28:07 UTC (rev 101087)
@@ -22,16 +22,16 @@
<properties>
<version.javassist.javassist>3.10.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.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.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.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>2.1.3.SP1</version.org.jboss.jboss-vfs>
+ <version.org.jboss.jboss-vfs>3.0.0.CR1</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.0.2.GA</version.org.jboss.mdr>
+ <version.org.jboss.mdr>2.2.0.Alpha1</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