[jboss-cvs] JBossAS SVN: r102346 - in projects/aop/trunk: aop and 38 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 12 08:38:21 EST 2010
Author: flavia.rainone at jboss.com
Date: 2010-03-12 08:38:13 -0500 (Fri, 12 Mar 2010)
New Revision: 102346
Added:
projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPDomainRegistry.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPVFSClassLoaderDomainRegistry.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTest.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/BundleInfoBuilder.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/Result.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/SupportClasses.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactory.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactoryFactory.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderPolicyModule.java
projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/
projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/jbosscl/
projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/jbosscl/Common.xml
Removed:
projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractClassPoolDomain.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractIsLocalResourcePlugin.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossClassPoolFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossDelegatingClassPoolFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractParentDelegationStrategy.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPool.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPoolDomain.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomain.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomainRegistry.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdapter.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdaptorFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePlugin.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePluginFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassPoolToClassPoolDomainAdaptorFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultParentDelegationStrategy.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DelegatingClassPool.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePlugin.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactoryRegistry.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/NonDelegatingClassPool.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ParentDelegationStrategy.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/SecurityActions.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossClassPool.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossDelegatingClassPool.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePlugin.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePluginFactory.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePlugin.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePluginFactory.java
projects/aop/trunk/asintegration-core/src/test/java/org/jboss/test/aop/classpool/support/a/
projects/aop/trunk/asintegration-core/src/test/java/org/jboss/test/aop/classpool/support/b/
projects/aop/trunk/asintegration-core/src/test/java/org/jboss/test/aop/classpool/test/
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/classpool/ucl/
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/DomainRegistry.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/RegisterModuleCallback.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvokerPoolReference.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderDomainRegistry.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/classpool/jbosscl/
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/deployers/temp/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/AlwaysWritablePermissionCollectionTestPolicyPlugin.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/BundleInfoBuilder.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/CapabilityInfo.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/ModuleOrPackageInfo.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/NoMatchClassFilter.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/RequirementInfo.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/Result.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/a/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/b/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/c/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/Invoked.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/child/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/parent/
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/test/
Modified:
projects/aop/trunk/aop/.classpath
projects/aop/trunk/aop/pom.xml
projects/aop/trunk/aop/src/main/java/org/jboss/aop/AspectManager.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java
projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java
projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java
projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/JBossIntegration.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java
projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java
projects/aop/trunk/asintegration-jmx/pom.xml
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/RepositoryClassLoaderScopingPolicy.java
projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectDeployer.java
projects/aop/trunk/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java
projects/aop/trunk/asintegration-mc/pom.xml
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderInitializer.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderScopingPolicyWithRegistry.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java
projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/aop/integration/junit/AOPIntegrationTest.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java
projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/scopeddomain/test/ScopedVFSClassLoaderDomainTestCase.java
projects/aop/trunk/pom.xml
Log:
[JBAOP-772] Deleted classes that have been moved to jboss-classpool project, and ported JBAOP-742 changes to trunk.
Modified: projects/aop/trunk/aop/.classpath
===================================================================
--- projects/aop/trunk/aop/.classpath 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/.classpath 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,9 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
- <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
- <classpathentry kind="src" path="docs" including="jboss-aop_1_0.dtd|jboss-aop_2_0.xsd" excluding="**/*.java"/>
- <classpathentry kind="src" path="src/etc" including="jbossorg-eula.txt" excluding="**/*.java"/>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-</classpath>
\ No newline at end of file
+ <classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" including="jboss-aop_1_0.dtd|jboss-aop_2_0.xsd" kind="src" path="docs"/>
+ <classpathentry excluding="**/*.java" including="jbossorg-eula.txt" kind="src" path="src/etc"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="var" path="JROCKIT_HOME/lib/rt.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Modified: projects/aop/trunk/aop/pom.xml
===================================================================
--- projects/aop/trunk/aop/pom.xml 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/pom.xml 2010-03-12 13:38:13 UTC (rev 102346)
@@ -298,6 +298,16 @@
<artifactId>javassist</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-scoped</artifactId>
+ <version>${version.org.jboss.classpool}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-reflect</artifactId>
<exclusions>
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/AspectManager.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/AspectManager.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/AspectManager.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,30 +1,28 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
-import java.net.URL;
-import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
@@ -43,8 +41,6 @@
import javassist.ClassPool;
import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
import org.jboss.aop.advice.AdviceBinding;
import org.jboss.aop.advice.AdviceStack;
@@ -61,7 +57,7 @@
import org.jboss.aop.array.ArrayBinding;
import org.jboss.aop.array.ArrayReplacement;
import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
+import org.jboss.aop.classpool.ClassLoaderRepository;
import org.jboss.aop.instrument.GeneratedAdvisorInstrumentor;
import org.jboss.aop.instrument.Instrumentor;
import org.jboss.aop.instrument.InstrumentorFactory;
@@ -85,10 +81,14 @@
import org.jboss.aop.util.AOPLock;
import org.jboss.aop.util.ReflectUtils;
import org.jboss.aop.util.UnmodifiableEmptyCollections;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.logging.Logger;
import org.jboss.util.collection.WeakValueHashMap;
import org.jboss.util.loading.Translator;
+
/**
* This singleton class manages all pointcuts and metadata.
* Coders can access it via the AspectManager.instance() method.
@@ -280,7 +280,7 @@
String pruneit = System.getProperty("jboss.aop.prune", null);
if (pruneit != null)
{
- AOPClassPoolRepository.getInstance().setPrune((Boolean.valueOf(pruneit)).booleanValue());
+ ClassPoolRepository.getInstance().setPrune(Boolean.valueOf(pruneit));
}
manager = new AspectManager();
//Initialise frequently used fields needed by the top-level manager
@@ -291,11 +291,14 @@
manager.includeInvisibleAnnotations = new ArrayList<String>();
- AOPClassPoolRepository.getInstance().setAspectManager(manager);
+ ClassLoaderRepository classLoaderRepository = ClassLoaderRepository.getInstance();
+ ClassPoolRepository classPoolRepository = ClassPoolRepository.getInstance();
+ classLoaderRepository.setAspectManager(manager);
+ classPoolRepository.addClassPoolRepositoryCallback(classLoaderRepository);
if (!verbose)
{
- verbose = (Boolean.valueOf(System.getProperty("jboss.aop.verbose", "false"))).booleanValue();
+ verbose = (Boolean.valueOf(System.getProperty("jboss.aop.verbose", "false")));
}
String exclude = System.getProperty("jboss.aop.exclude", null);
if (exclude != null)
@@ -331,13 +334,13 @@
String debugClass = System.getProperty("jboss.aop.debug.classes", null);
if (debugClass != null)
{
- debugClasses = (Boolean.valueOf(debugClass)).booleanValue();
+ debugClasses = (Boolean.valueOf(debugClass));
}
String methodInterceptors = System.getProperty("jboss.aop.advisor.methodInterceptors", null);
if (methodInterceptors != null)
{
- maintainAdvisorMethodInterceptors = (Boolean.valueOf(methodInterceptors)).booleanValue();
+ maintainAdvisorMethodInterceptors = (Boolean.valueOf(methodInterceptors));
}
@@ -817,9 +820,9 @@
// Public -------------------------------------------------------
- public static Map<ClassLoader, ClassPool> getRegisteredCLs()
+ public static Map<ClassLoader, ScopedClassPool> getRegisteredCLs()
{
- return AOPClassPoolRepository.getInstance().getRegisteredCLs();
+ return ClassPoolRepository.getInstance().getRegisteredCLs();
}
/**
@@ -827,7 +830,7 @@
*/
public static void clearUnregisteredClassLoaders()
{
- AOPClassPoolRepository.getInstance().clearUnregisteredClassLoaders();
+ ClassPoolRepository.getInstance().clearUnregisteredClassLoaders();
}
/**
@@ -894,17 +897,17 @@
public ClassPool registerClassLoader(ClassLoader ucl)
{
- return AOPClassPoolRepository.getInstance().registerClassLoader(ucl);
+ return ClassPoolRepository.getInstance().registerClassLoader(ucl);
}
protected void registerClass(Class<?> clazz)
{
- AOPClassPoolRepository.getInstance().registerClass(clazz);
+ ClassLoaderRepository.getInstance().registerClass(clazz);
}
public void unregisterClassLoader(ClassLoader cl)
{
- AOPClassPoolRepository.getInstance().unregisterClassLoader(cl);
+ ClassPoolRepository.getInstance().unregisterClassLoader(cl);
}
@@ -1003,22 +1006,22 @@
public static boolean getPrune()
{
- return AOPClassPoolRepository.getInstance().isPrune();
+ return ClassPoolRepository.getInstance().isPrune();
}
public static void setPrune(boolean prune)
{
- AOPClassPoolRepository.getInstance().setPrune(prune);
+ ClassPoolRepository.getInstance().setPrune(prune);
}
public static void setClassPoolFactory(ScopedClassPoolFactory factory)
{
- AOPClassPoolRepository.getInstance().setClassPoolFactory(factory);
+ ClassPoolRepository.getInstance().setClassPoolFactory(factory);
}
public static ScopedClassPoolFactory getClassPoolFactory()
{
- return AOPClassPoolRepository.getInstance().getClassPoolFactory();
+ return ClassPoolRepository.getInstance().getClassPoolFactory();
}
public boolean isNonAdvisableClassName(String classname)
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/ClassicWeavingStrategy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,35 +1,36 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop;
-import org.jboss.aop.classpool.AOPClassPool;
+import javassist.ByteArrayClassPath;
+import javassist.CtClass;
+import javassist.NotFoundException;
+
import org.jboss.aop.instrument.Instrumentor;
import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.logging.Logger;
-import javassist.ByteArrayClassPath;
-import javassist.CtClass;
-import javassist.NotFoundException;
-
/**
* Classic weaving.
*
@@ -59,7 +60,7 @@
{
return null;
}
- AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
+ ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);
CtClass clazz = null;
try
{
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/SuperClassesFirstWeavingStrategy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,37 +1,40 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.instrument.Instrumentor;
-import org.jboss.aop.instrument.InstrumentorFactory;
-import org.jboss.logging.Logger;
-
import javassist.ByteArrayClassPath;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
+import org.jboss.aop.instrument.Instrumentor;
+import org.jboss.aop.instrument.InstrumentorFactory;
+import org.jboss.aop.instrument.WeavingRegistry;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.spi.AbstractClassPool;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.logging.Logger;
+
/**
* Generated advisors need to load all the superclasses
* before we load the actual class.
@@ -62,7 +65,7 @@
return null;
}
- AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
+ ScopedClassPool pool = (ScopedClassPool) ClassPoolRepository.getInstance().registerClassLoader(loader);
CtClass clazz = obtainCtClassInfo(pool, className, classfileBuffer);
@@ -101,7 +104,7 @@
}
}
- private CtClass obtainCtClassInfo(AOPClassPool pool, String className, byte[] classfileBuffer) throws NotFoundException
+ private CtClass obtainCtClassInfo(ScopedClassPool pool, String className, byte[] classfileBuffer) throws NotFoundException
{
try
{
@@ -121,9 +124,9 @@
}
}
- private CtClass instrumentClass(AspectManager manager, AOPClassPool pool, CtClass clazz, boolean isLoadedClass) throws NotFoundException, Exception
+ private CtClass instrumentClass(AspectManager manager, ScopedClassPool pool, CtClass clazz, boolean isLoadedClass) throws NotFoundException, Exception
{
- if (pool.isClassLoadedButNotWoven(clazz.getName()))
+ if (WeavingRegistry.isClassLoadedButNotWoven(pool, clazz.getName()))
{
return null;
}
@@ -133,7 +136,7 @@
if (superClass != null && !Instrumentor.implementsAdvised(clazz))
{
ClassPool superPool = superClass.getClassPool();
- if (superPool instanceof AOPClassPool)
+ if (superPool != null && superPool instanceof AbstractClassPool)
{
AspectManager aspectManager = manager;
if (manager instanceof Domain && superPool != pool)
@@ -141,7 +144,7 @@
//We are in a scoped classloader and the superclass is not
aspectManager = AspectManager.instance(superPool.getClassLoader());
}
- instrumentClass(aspectManager, (AOPClassPool)superPool, superClass, false);
+ instrumentClass(aspectManager, (ScopedClassPool) superPool, superClass, false);
}
}
@@ -201,7 +204,7 @@
if (isLoadedClass)
{
- pool.setClassLoadedButNotWoven(clazz.getName());
+ WeavingRegistry.setClassLoadedButNotWoven(pool, clazz.getName());
}
return null;
Deleted: projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,415 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.aop.classpool;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.util.ClassLoaderUtils;
-import org.jboss.logging.Logger;
-
-/**
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- */
-public class AOPClassPool extends ScopedClassPool
-{
- protected final Logger logger = Logger.getLogger(this.getClass());
-
- /** Classnames of classes that will be created - we do not want to look for these in other pools.
- * The main use for this is when a class is created in a parent pool, and we then want to
- * create a class with the same name in a parent-last child pool. As part of the create process
- * javassist.ClassPool will check if that class is frozen (which in turn will call getCached()
- * and get0()). If the classname exists in this map, get0() and getCached() should return null;
- */
- protected final ConcurrentHashMap<String, String> generatedClasses = new ConcurrentHashMap<String, String>();
-
- protected final ConcurrentHashMap<String, Boolean> localResources = new ConcurrentHashMap<String, Boolean>();
-
- /** Classnames of classes that have been loaded, but were not woven */
- protected final ConcurrentHashMap<String, Boolean> loadedButNotWovenClasses = new ConcurrentHashMap<String, Boolean>();
-
- /** Causes the AOPClassPool.getCached() method to search all ClassPools registered in the repository */
- public static final Class<SearchAllRegisteredLoadersSearchStrategy> SEARCH_ALL_STRATEGY = SearchAllRegisteredLoadersSearchStrategy.class;
-
- /** Causes the AOPClassPool.getCached() method to search only itself */
- public static final Class<SearchLocalLoaderLoaderSearchStrategy> SEARCH_LOCAL_ONLY_STRATEGY = SearchLocalLoaderLoaderSearchStrategy.class;
-
- private final AOPCLassPoolSearchStrategy searchStrategy;
-
- private final Map<AOPClassPool, Boolean> children = new WeakHashMap<AOPClassPool, Boolean>();
-
- static
- {
- ClassPool.doPruning = false;
- ClassPool.releaseUnmodifiedClassFile = false;
- }
-
- public AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- this(cl, src, repository, false);
- }
-
- protected AOPClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- this(null, src, repository, true);
- }
-
- private AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean isTemp)
- {
- this(cl, src, repository, SEARCH_ALL_STRATEGY, isTemp);
- }
-
- public AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy)
- {
- this(cl, src, repository, searchStrategy, false);
- }
-
- public AOPClassPool(ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy)
- {
- this(null, src, repository, searchStrategy, true);
- }
-
- private AOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy, boolean isTemp)
- {
- super(cl, src, repository, isTemp);
- if (searchStrategy == SEARCH_ALL_STRATEGY)
- {
- this.searchStrategy = new SearchAllRegisteredLoadersSearchStrategy();
- }
- else if (searchStrategy == SEARCH_LOCAL_ONLY_STRATEGY)
- {
- this.searchStrategy = new SearchLocalLoaderLoaderSearchStrategy();
- }
- else
- {
- try
- {
- this.searchStrategy = searchStrategy.newInstance();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error instantiating search strategy class " + searchStrategy, e);
- }
- }
- if (logger.isTraceEnabled()) logger.trace(this + " creating pool for loader " + cl + " searchStrategy:" + this.searchStrategy + " isTemp:" + isTemp);
-
- registerWithParent();
- }
-
- private void registerWithParent()
- {
- if (parent != null && parent instanceof AOPClassPool)
- {
- ((AOPClassPool)parent).children.put(this, Boolean.TRUE);
- }
- }
-
- private void unregisterWithParent()
- {
- if (parent != null && parent instanceof AOPClassPool)
- {
- ((AOPClassPool)parent).children.remove(this);
- }
- }
-
- public void registerGeneratedClass(String className)
- {
- generatedClasses.put(className, className);
- }
-
- public boolean isGeneratedClass(String className)
- {
- return generatedClasses.containsKey(className);
- }
-
- public void doneGeneratingClass(String className)
- {
- generatedClasses.remove(className);
- }
-
- public void close()
- {
- super.close();
- unregisterWithParent();
- AOPClassPoolRepository.getInstance().perfomUnregisterClassLoader(getClassLoader());
- for (Iterator<AOPClassPool> it = children.keySet().iterator() ; it.hasNext() ; )
- {
- AOPClassPool child = it.next();
- it.remove();
- ClassLoader loader = child.getClassLoader();
- if (loader != null)
- {
- AspectManager.instance().unregisterClassLoader(loader);
- }
- }
- }
-
- public CtClass getCached(String classname)
- {
- return searchStrategy.getCached(classname);
- }
-
- /**
- * Make createCtClass public so that we can override it
- */
- @Override
- public CtClass createCtClass(String classname, boolean useCache)
- {
- boolean trace = logger.isTraceEnabled();
-
- if (trace) logger.trace(this + " attempting to create CtClass " + classname);
- CtClass clazz = super.createCtClass(classname, useCache);
- if (trace) logger.trace(this + " created CtClass " + getClassPoolLogStringForClass(clazz));
-
- return clazz;
- }
-
- @Override
- public void cacheCtClass(String classname, CtClass c, boolean dynamic)
- {
- boolean trace = logger.isTraceEnabled();
- if (trace) logger.trace(this + " caching " + classname);
- super.cacheCtClass(classname, c, dynamic);
- if (dynamic)
- {
- if (trace) logger.trace(this + " registering dynamic class " + classname);
- doneGeneratingClass(classname);
- String resourcename = getResourceName(classname);
- localResources.put(resourcename, Boolean.TRUE);
- }
- }
-
- protected boolean includeInGlobalSearch()
- {
- return true;
- }
-
- protected String getResourceName(String classname)
- {
- return ClassLoaderUtils.getResourceName(classname);
- }
-
- protected final boolean isLocalResource(String resourceName, boolean trace)
- {
- String classResourceName = resourceName;
- Boolean isLocal = localResources.get(classResourceName);
- if (isLocal != null)
- {
- if (trace) logger.trace(this + " " + resourceName + " is local " + isLocal);
-
- return isLocal.booleanValue();
- }
- boolean localResource = isLocalClassLoaderResource(classResourceName);
- localResources.put(classResourceName, localResource ? Boolean.TRUE : Boolean.FALSE);
-
- if (trace) logger.trace(this + " " + resourceName + " is local " + localResource);
-
- return localResource;
- }
-
- protected boolean isLocalClassLoaderResource(String classResourceName)
- {
- return getClassLoader().getResource(classResourceName) != null;
- }
-
- @Override
- public synchronized CtClass getLocally(String classname)
- throws NotFoundException
- {
- boolean trace = logger.isTraceEnabled();
- if (trace) logger.trace(this + " attempting local get for " + classname);
- softcache.remove(classname);
- CtClass clazz = (CtClass) classes.get(classname);
- if (trace && clazz != null)
- {
- logger.trace(this + " found " + classname + " in cache");
- }
- if (clazz == null)
- {
- clazz = createCtClass(classname, true);
- if (clazz == null) throw new NotFoundException(classname);
- lockInCache(clazz);//Avoid use of the softclasscache
- }
-
- return clazz;
- }
-
- @Override
- protected CtClass getCachedLocally(String classname)
- {
- if (logger.isTraceEnabled()) logger.trace(this + " checking local cache for " + classname);
- return super.getCachedLocally(classname);
- }
-
- @Override
- public void lockInCache(CtClass c)
- {
- if (logger.isTraceEnabled()) logger.trace(this + " locking in cache " + c.getName());
- super.lockInCache(c);
- }
-
- public void setClassLoadedButNotWoven(String classname)
- {
- loadedButNotWovenClasses.put(classname, Boolean.TRUE);
- }
-
- public boolean isClassLoadedButNotWoven(String classname)
- {
- return loadedButNotWovenClasses.get(classname) == Boolean.TRUE;
- }
-
- public static AOPClassPool createAOPClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- return (AOPClassPool)AspectManager.getClassPoolFactory().create(cl, src, repository);
- }
-
- public static AOPClassPool createAOPClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- return (AOPClassPool)AspectManager.getClassPoolFactory().create(src, repository);
- }
-
- public String toString()
- {
- ClassLoader cl = null;
- try
- {
- cl = getClassLoader();
- }
- catch(IllegalStateException ignore)
- {
- }
- return this.getClass().getName() + "@" + System.identityHashCode(this) + " " + super.toString() + " - dcl:" + cl;
- }
-
- public CtClass internalGet0(String classname, boolean useCache) throws NotFoundException
- {
- return super.get0(classname, useCache);
- }
-
- protected String getClassPoolLogStringForClass(CtClass clazz)
- {
- if (clazz == null)
- {
- return null;
- }
- if (clazz.getClassPool() == null)
- {
- return null;
- }
- return clazz.getClassPool().toString();
- }
-
- /**
- * Contains the original AOPClassPool.getCached()
- *
- */
- private class SearchAllRegisteredLoadersSearchStrategy implements AOPCLassPoolSearchStrategy
- {
- Logger logger = Logger.getLogger(this.getClass());
- public CtClass getCached(String classname)
- {
- boolean trace = logger.isTraceEnabled();
-
- if (trace) logger.trace(this + " " + AOPClassPool.this + " searching all pools for " + classname);
-
- CtClass clazz = getCachedLocally(classname);
- if (clazz == null)
- {
- //TODO is this check really necessary
- boolean isLocal = false;
-
- ClassLoader cl = getClassLoader0();
-
- if (cl != null)
- {
- isLocal = isLocalResource(getResourceName(classname), trace);
- }
-
- if (!isLocal)
- {
- Object o = generatedClasses.get(classname);
- if (o == null)
- {
- Map<ClassLoader, ClassPool> registeredCLs = AspectManager.getRegisteredCLs();
- synchronized (registeredCLs)
- {
- for(ClassPool pl : AspectManager.getRegisteredCLs().values())
- {
- AOPClassPool pool = (AOPClassPool) pl;
- if (pool.isUnloadedClassLoader())
- {
- if (trace) logger.trace(this + " pool is unloaded " + pool);
- AspectManager.instance().unregisterClassLoader(pool.getClassLoader());
- continue;
- }
-
- //Do not check classpools for scoped classloaders
- if (!pool.includeInGlobalSearch())
- {
- if (trace) logger.trace(this + " pool is scoped " + pool);
- continue;
- }
-
- if (trace) logger.trace(this + " " + AOPClassPool.this + " searching for " + classname + " in " + pool);
- clazz = pool.getCachedLocally(classname);
- if (clazz != null)
- {
- break;
- }
- }
- }
- }
- }
- }
- if (trace) logger.trace(this + " " + AOPClassPool.this + " found " + classname + " in pool" + getClassPoolLogStringForClass(clazz));
- return clazz;
- }
- }
-
- /**
- * Checks only the AOPClassPool's cache
- */
- private class SearchLocalLoaderLoaderSearchStrategy implements AOPCLassPoolSearchStrategy
- {
- Logger logger = Logger.getLogger(this.getClass());
-
- public CtClass getCached(String classname)
- {
- boolean trace = logger.isTraceEnabled();
-
- if (trace) logger.trace(this + " " + AOPClassPool.this + " searching just this pool for " + classname);
- CtClass clazz = getCachedLocally(classname);
- if (trace) logger.trace(this + " " + AOPClassPool.this + " found " + classname + " in pool" + getClassPoolLogStringForClass(clazz));
- return clazz;
- }
- }
-}
Deleted: projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision$
- *
- **/
-public class AOPClassPoolFactory implements ScopedClassPoolFactory
-{
- public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- return new AOPClassPool(cl, src, repository);
- }
-
- public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
- {
- return new AOPClassPool(src, repository);
- }
-}
Deleted: projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,264 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.classpool;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-import javassist.scopedpool.ScopedClassPoolRepositoryImpl;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.advice.SecurityActions;
-import org.jboss.aop.instrument.Instrumentor;
-import org.jboss.logging.Logger;
-
-/**
- * Singleton classpool repository used by aop
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public class AOPClassPoolRepository implements ScopedClassPoolRepository
-{
- private static final Logger logger = Logger.getLogger(AOPClassPoolRepository.class);
-
- private final static AOPClassPoolRepository instance = new AOPClassPoolRepository();
-
- /** The classes per classppol */
- protected final HashMap<ClassLoader, HashSet<Class<?>>> ucl2classes = new HashMap<ClassLoader, HashSet<Class<?>>>();
-
- /** The top-level AspectManager this pool belongs to */
- AspectManager manager;
-
- ScopedClassPoolRepository delegate;
-
- public static AOPClassPoolRepository getInstance()
- {
- return instance;
- }
-
- private AOPClassPoolRepository()
- {
- this.delegate = ScopedClassPoolRepositoryImpl.getInstance();
- //This was needed when jboss-aop.jar was deployed in the jboss/lib directory since the AspectManager bean had no chance to initialise it
- delegate.setClassPoolFactory(new AOPClassPoolFactory());
-// if (!setJBossSpecificStartupVariables())
-// {
-// delegate.setClassPoolFactory(new AOPClassPoolFactory());
-// }
- }
-
-// private boolean setJBossSpecificStartupVariables()
-// {
-// //We are running within JBoss 5, let's default to the JBossClassPoolFactory and set the ScopedClassPoolHelper
-// //so that we get correct behaviour before the AspectManager service has been deployed
-// try
-// {
-// Class jbcpf = Class.forName("org.jboss.aop.deployment.JBossClassPoolFactory");
-// ScopedClassPoolFactory factory = (ScopedClassPoolFactory)jbcpf.newInstance();
-//
-// Class hlpr = Class.forName("org.jboss.aop.deployment.JBossScopedClassLoaderHelper");
-// AOPScopedClassLoaderHelper helper = (AOPScopedClassLoaderHelper)hlpr.newInstance();
-// delegate.setClassPoolFactory(factory);
-// AspectManager.scopedCLHelper = helper;
-// return true;
-// }
-// catch (Exception e)
-// {
-// }
-// return false;//Not running in JBoss probably
-// }
-
- public void setClassPoolFactory(ScopedClassPoolFactory factory)
- {
- delegate.setClassPoolFactory(factory);
- }
-
- public ScopedClassPoolFactory getClassPoolFactory()
- {
- return delegate.getClassPoolFactory();
- }
-
- public boolean isPrune()
- {
- return delegate.isPrune();
- }
-
- public void setPrune(boolean prune)
- {
- delegate.setPrune(prune);
- }
-
- public ScopedClassPool createScopedClassPool(ClassLoader cl, ClassPool src)
- {
- return delegate.createScopedClassPool(cl, src);
- }
-
- public ClassPool findClassPool(ClassLoader cl)
- {
- return delegate.findClassPool(cl);
- }
-
- public void setAspectManager(AspectManager manager)
- {
- this.manager = manager;
- }
-
- /**
- * Get the registered classloaders
- *
- * @return the registered classloaders
- */
- public Map<ClassLoader, ClassPool> getRegisteredCLs()
- {
- return delegate.getRegisteredCLs();
- }
-
- /**
- * This method will check to see if a register classloader has been undeployed (as in JBoss)
- */
- public void clearUnregisteredClassLoaders()
- {
- delegate.clearUnregisteredClassLoaders();
- }
-
- public ClassPool registerClassLoader(ClassLoader ucl)
- {
- return delegate.registerClassLoader(ucl);
- }
-
- public void unregisterClassLoader(ClassLoader cl)
- {
- delegate.unregisterClassLoader(cl);
- }
-
- public void registerClass(Class<?> clazz)
- {
- ClassLoader classLoader = SecurityActions.getClassLoader(clazz);
- HashSet<Class<?>> classes = ucl2classes.get(classLoader);
- if (classes == null)
- {
- classes = new HashSet<Class<?>>();
- ucl2classes.put(classLoader, classes);
- }
- classes.add(clazz);
- }
-
- public void perfomUnregisterClassLoader(ClassLoader cl)
- {
- if (System.getSecurityManager() == null)
- {
- UnregisterClassLoaderAction.NON_PRIVILEGED.unregister(this, cl);
- }
- else
- {
- UnregisterClassLoaderAction.PRIVILEGED.unregister(this, cl);
- }
- }
-
- private void doUnregisterClassLoader(ClassLoader cl)
- {
- synchronized (delegate.getRegisteredCLs())
- {
- HashSet<Class<?>> classes = ucl2classes.remove(cl);
- if (classes != null)
- {
- for (Class<?> clazz : classes)
- {
- manager.cleanAdvisor(clazz);
- Class<?> advisedClass = clazz;
- try
- {
- //The static advisor field should be the only remaining hard reference to the advisor
- Field f = advisedClass.getDeclaredField(Instrumentor.HELPER_FIELD_NAME);
- f.setAccessible(true);
- f.set(null, null);
- }
- catch(NoSuchFieldException e)
- {
- logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
- }
- catch(IllegalAccessException e)
- {
- logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
- }
- catch(NoClassDefFoundError e)
- {
- logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
- }
- }
- }
-
- manager.cleanProxyAdvisorDomains(cl);
- }
- }
-
-
- interface UnregisterClassLoaderAction
- {
- void unregister(AOPClassPoolRepository repository, ClassLoader loader);
-
- UnregisterClassLoaderAction PRIVILEGED = new UnregisterClassLoaderAction()
- {
- public void unregister(final AOPClassPoolRepository repository, final ClassLoader loader)
- {
- try
- {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
- {
- public Object run()
- {
- repository.doUnregisterClassLoader(loader);
- return null;
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- Exception ex = e.getException();
- if (ex instanceof RuntimeException)
- {
- throw (RuntimeException)ex;
- }
- throw new RuntimeException(ex);
- }
- }
- };
-
- UnregisterClassLoaderAction NON_PRIVILEGED = new UnregisterClassLoaderAction()
- {
- public void unregister(AOPClassPoolRepository repository, ClassLoader loader)
- {
- repository.doUnregisterClassLoader(loader);
- }
- };
- }
-}
Copied: projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java (from rev 102302, projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/AOPClassPoolRepository.java)
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java (rev 0)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/classpool/ClassLoaderRepository.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.classpool;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.SecurityActions;
+import org.jboss.aop.instrument.Instrumentor;
+import org.jboss.classpool.spi.ClassPoolRepositoryCallback;
+import org.jboss.logging.Logger;
+
+/**
+ * Singleton classpool repository used by aop
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @version $Revision$
+ */
+public class ClassLoaderRepository implements ClassPoolRepositoryCallback
+{
+ private static final Logger logger = Logger.getLogger(ClassLoaderRepository.class);
+
+ private final static ClassLoaderRepository instance = new ClassLoaderRepository();
+
+ /** The classes per classppol */
+ protected final HashMap<ClassLoader, HashSet<Class<?>>> ucl2classes = new HashMap<ClassLoader, HashSet<Class<?>>>();
+
+ /** The top-level AspectManager this pool belongs to */
+ AspectManager manager;
+
+ public static ClassLoaderRepository getInstance()
+ {
+ return instance;
+ }
+
+ private ClassLoaderRepository() {}
+
+ public void setAspectManager(AspectManager manager)
+ {
+ this.manager = manager;
+ }
+
+
+ public void registerClass(Class<?> clazz)
+ {
+ ClassLoader classLoader = SecurityActions.getClassLoader(clazz);
+ HashSet<Class<?>> classes = ucl2classes.get(classLoader);
+ if (classes == null)
+ {
+ classes = new HashSet<Class<?>>();
+ ucl2classes.put(classLoader, classes);
+ }
+ classes.add(clazz);
+ }
+
+ public void classLoaderRegistered(ClassLoader classLoader)
+ {
+ // do nothing
+ }
+
+ public void classLoaderUnregistered(ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ UnregisterClassLoaderAction.NON_PRIVILEGED.unregister(this, classLoader);
+ }
+ else
+ {
+ UnregisterClassLoaderAction.PRIVILEGED.unregister(this, classLoader);
+ }
+ }
+
+ private void doUnregisterClassLoader(ClassLoader cl)
+ {
+ synchronized (this)
+ {
+ HashSet<Class<?>> classes = ucl2classes.remove(cl);
+ if (classes != null)
+ {
+ for (Class<?> clazz : classes)
+ {
+ manager.cleanAdvisor(clazz);
+ Class<?> advisedClass = clazz;
+ try
+ {
+ //The static advisor field should be the only remaining hard reference to the advisor
+ Field f = advisedClass.getDeclaredField(Instrumentor.HELPER_FIELD_NAME);
+ f.setAccessible(true);
+ f.set(null, null);
+ }
+ catch(NoSuchFieldException e)
+ {
+ logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
+ }
+ catch(IllegalAccessException e)
+ {
+ logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
+ }
+ catch(NoClassDefFoundError e)
+ {
+ logger.warn("Error unsetting advisor for " + advisedClass.getName() + " " + e);
+ }
+ }
+ }
+ manager.cleanProxyAdvisorDomains(cl);
+ }
+ }
+
+
+ interface UnregisterClassLoaderAction
+ {
+ void unregister(ClassLoaderRepository repository, ClassLoader loader);
+
+ UnregisterClassLoaderAction PRIVILEGED = new UnregisterClassLoaderAction()
+ {
+ public void unregister(final ClassLoaderRepository repository, final ClassLoader loader)
+ {
+ try
+ {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run()
+ {
+ repository.doUnregisterClassLoader(loader);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ Exception ex = e.getException();
+ if (ex instanceof RuntimeException)
+ {
+ throw (RuntimeException)ex;
+ }
+ throw new RuntimeException(ex);
+ }
+ }
+ };
+
+ UnregisterClassLoaderAction NON_PRIVILEGED = new UnregisterClassLoaderAction()
+ {
+ public void unregister(ClassLoaderRepository repository, ClassLoader loader)
+ {
+ repository.doUnregisterClassLoader(loader);
+ }
+ };
+ }
+}
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/contrib/IDEClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.contrib;
import java.io.IOException;
@@ -32,11 +32,11 @@
import javassist.ClassPool;
import javassist.CtClass;
import javassist.LoaderClassPath;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-import org.jboss.aop.classpool.AOPClassPool;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPool;
/**
* @author Marshall
@@ -77,7 +77,7 @@
}
}
- private class SimpleClassPool extends AOPClassPool
+ private class SimpleClassPool extends AbstractClassPool
{
private Loader loader;
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/eclipsesupport/Agent.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,33 +1,32 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.eclipsesupport;
+import java.lang.instrument.Instrumentation;
+
import org.jboss.aop.AspectManager;
import org.jboss.aop.standalone.StandaloneClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
-import java.lang.instrument.Instrumentation;
-
-import javassist.scopedpool.ScopedClassPoolRepositoryImpl;
-
/**
* An Agent for installing the appropriate hooks into eclipse to make the handling of tests easier
*
@@ -43,7 +42,7 @@
AspectManager.setClassPoolFactory(factory);
// necessary for configuration
AspectManager.instance();
- ScopedClassPoolRepositoryImpl.getInstance().setPrune(false);
+ ClassPoolRepository.getInstance().setPrune(false);
inst.addTransformer(new EclipseTestTransformer());
}
}
\ No newline at end of file
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/ClassicInstrumentor.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,27 +1,28 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtField;
import javassist.CtMethod;
@@ -31,7 +32,6 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
/**
* Comment
@@ -47,7 +47,7 @@
public static final String HELPER_CLASS_NAME =
Instrumentor.AOP_PACKAGE + ".ClassAdvisor";
- public ClassicInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+ public ClassicInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
{
super(pool,
manager,
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/FieldAccessTransformer.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.util.Collection;
@@ -26,6 +26,7 @@
import java.util.List;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CodeConverter;
import javassist.CtClass;
import javassist.CtField;
@@ -40,7 +41,6 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.aop.util.Advisable;
/**
@@ -60,7 +60,7 @@
// Static --------------------------------------------------------
// there are two transformations types available to a field: get and set
- static final String[] transformations = new String[] {"get", "set"};
+ protected static final String[] transformations = new String[] {"get", "set"};
protected static final int GET_INDEX = 0;
protected static final int SET_INDEX = 1;
protected static final WrapperTransformer wrapper = new WrapperTransformer(transformations);
@@ -507,7 +507,7 @@
protected CtMethod buildReadWrapperPlaceHolder(CtClass clazz, CtField field, String wrapperName, int mod)
throws NotFoundException, CannotCompileException
{
- AOPClassPool classPool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool classPool = instrumentor.getClassPool();
CtClass ftype = field.getType();
CtClass[] readParam = new CtClass[]{classPool.get("java.lang.Object")};
@@ -574,7 +574,7 @@
protected CtMethod buildWriteWrapperPlaceHolder(CtClass clazz, CtField field, String wrapperName, int mod)
throws NotFoundException, CannotCompileException
{
- AOPClassPool classPool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool classPool = instrumentor.getClassPool();
CtClass ftype = field.getType();
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/GeneratedAdvisorInstrumentor.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,27 +1,28 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtField;
@@ -41,7 +42,6 @@
import org.jboss.aop.MethodByConInfo;
import org.jboss.aop.MethodByMethodInfo;
import org.jboss.aop.MethodInfo;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.logging.Logger;
/**
@@ -88,7 +88,7 @@
CtClass genadvisor;
CtClass genInstanceAdvisor;
- public GeneratedAdvisorInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+ public GeneratedAdvisorInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
{
super(pool, manager, joinpointClassifier, observer);
}
@@ -716,7 +716,7 @@
// 3) a new child class is loaded and since the SuperClassesWeavingStrategy will attempt to
// weave not modified superclasses, the CtClass will contain the right baseclass stuff, although
// the already loaded class does not.
- if (classPool.isClassLoadedButNotWoven(supa.getName()))
+ if (WeavingRegistry.isClassLoadedButNotWoven(classPool, supa.getName()))
{
return true;
}
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/Instrumentor.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.util.ArrayList;
@@ -54,14 +54,13 @@
import org.jboss.aop.annotation.compiler.AnnotationInfoCreator;
import org.jboss.aop.array.ArrayAdvisor;
import org.jboss.aop.array.ArrayReplacement;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
import org.jboss.aop.introduction.AnnotationIntroduction;
import org.jboss.aop.introduction.InterfaceIntroduction;
import org.jboss.aop.util.Advisable;
import org.jboss.aop.util.CtConstructorComparator;
import org.jboss.aop.util.CtFieldComparator;
import org.jboss.aop.util.JavassistMethodHashing;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.logging.Logger;
/**
@@ -80,6 +79,7 @@
* @author <a href="mailto:gte863h at prism.gatech.edu">Austin Chau</a>
* @author <a href="mailto:crazybob at crazybob.org">Bob Lee</a>
* @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
public abstract class Instrumentor
@@ -103,7 +103,7 @@
*/
public static final String HELPER_FIELD_NAME = "aop$classAdvisor" + ClassAdvisor.NOT_TRANSFORMABLE_SUFFIX;
- protected AOPClassPool classPool;
+ protected ClassPool classPool;
protected boolean basicsSet = false;
@@ -126,7 +126,7 @@
* @param observer need be notified of every joinpoint wrapping caused only
* by pointcuts dynamicaly added.
*/
- protected Instrumentor(AOPClassPool pool,
+ protected Instrumentor(ClassPool pool,
AspectManager manager,
JoinpointClassifier joinpointClassifier,
DynamicTransformationObserver observer)
@@ -692,7 +692,7 @@
String ref = null;
try
{
- AOPClassPool pool = AOPClassPool.createAOPClassPool(clazz.getClassPool(), AOPClassPoolRepository.getInstance());
+ ClassPool pool = ClassPoolRepository.getInstance().getClassPoolFactory().create(clazz.getClassPool(), ClassPoolRepository.getInstance());
//Class.getRefClasses() only gets classes explicitly referenced in the class. We need to check the super classes and do some extra handling
for (ReferenceClassIterator it = new ReferenceClassIterator(clazz.getRefClasses()) ; it.hasNext() ; )
@@ -1098,7 +1098,7 @@
// registers the classes bytecodes to be hot swapped
for (CtClass clazz : classes)
{
- AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+ ClassPool classPool = clazz.getClassPool();
clazz.defrost();
hotSwapper.registerChange(classPool.getClassLoader().loadClass(clazz.getName()),
clazz.toBytecode());
@@ -1191,7 +1191,7 @@
public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
Collection<CtField> fieldReads, Collection<CtField> fieldWrites, boolean constructor)
{
- AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+ ClassPool classPool = clazz.getClassPool();
CodeConverter codeConverter = new CodeConverter();
for (CtField field : fieldReads)
{
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/InstrumentorFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,30 +1,31 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.lang.reflect.Constructor;
+import javassist.ClassPool;
+
import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.logging.Logger;
/**
@@ -41,7 +42,7 @@
static Constructor<?> otherInstrumentorConstructor;
- private static final Class<?>[] CONSTRUCTOR_SIG = new Class[] {AOPClassPool.class, AspectManager.class, JoinpointClassifier.class, DynamicTransformationObserver.class};
+ private static final Class<?>[] CONSTRUCTOR_SIG = new Class[] {ClassPool.class, AspectManager.class, JoinpointClassifier.class, DynamicTransformationObserver.class};
public static void initialise(String property)
{
@@ -95,7 +96,7 @@
return instrumentor;
}
- public static Instrumentor getInstrumentor(AOPClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
+ public static Instrumentor getInstrumentor(ClassPool pool, AspectManager manager, JoinpointClassifier joinpointClassifier, DynamicTransformationObserver observer)
{
if (instrumentor == InstrumentorEnum.CLASSIC)
{
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/MethodExecutionTransformer.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.lang.reflect.Method;
@@ -38,9 +38,9 @@
import javassist.bytecode.annotation.Annotation;
import org.jboss.aop.ClassAdvisor;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.aop.util.Advisable;
import org.jboss.aop.util.JavassistMethodHashing;
+import org.jboss.classpool.spi.AbstractClassPool;
/**
* Comment
@@ -166,7 +166,7 @@
for (org.jboss.aop.MethodInfo methodInfo : methodInfos)
{
Method method = methodInfo.getMethod();
- AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+ AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool();
Class<?>[] parameterTypes = method.getParameterTypes();
CtClass[] javassistParameterTypes = new CtClass[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++)
@@ -212,7 +212,7 @@
for (org.jboss.aop.MethodInfo methodInfo : methodInfos)
{
Method method = methodInfo.getMethod();
- AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
+ AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool();
Class<?>[] parameterTypes = method.getParameterTypes();
CtClass[] javassistParameterTypes = new CtClass[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++)
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedCallerInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,28 +1,29 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtField;
@@ -31,7 +32,6 @@
import javassist.Modifier;
import javassist.NotFoundException;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.logging.Logger;
/**
@@ -105,7 +105,7 @@
CtMethod method, String invocationClassName, String callerDescription)
throws NotFoundException, CannotCompileException
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass methodInvocation = pool.get(invocationClassName);
////////////////
@@ -156,7 +156,7 @@
CtConstructor con, String invocationClassName, String callerDescription)
throws NotFoundException, CannotCompileException
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass conInvocation = pool.get(invocationClassName);
////////////////
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructionInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,35 +1,34 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtMethod;
import javassist.CtNewConstructor;
import javassist.CtNewMethod;
-import org.jboss.aop.classpool.AOPClassPool;
-
/**
* Comment
*
@@ -54,7 +53,7 @@
Instrumentor instrumentor, CtClass clazz, CtConstructor con, int index)
throws Exception
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass conInvocation = pool.get("org.jboss.aop.joinpoint.ConstructionInvocation");
////////////////
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedConstructorInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,27 +1,28 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtMethod;
@@ -29,8 +30,6 @@
import javassist.CtNewMethod;
import javassist.NotFoundException;
-import org.jboss.aop.classpool.AOPClassPool;
-
/**
* Comment
*
@@ -55,7 +54,7 @@
CtClass clazz, CtConstructor con, int index)
throws NotFoundException, CannotCompileException
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass conInvocation = pool.get("org.jboss.aop.joinpoint.ConstructorInvocation");
////////////////
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedFieldInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,29 +1,26 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.util.JavassistToReflect;
-
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
@@ -33,6 +30,8 @@
import javassist.Modifier;
import javassist.NotFoundException;
+import org.jboss.aop.util.JavassistToReflect;
+
/**
* Comment
*
@@ -108,7 +107,7 @@
protected static String createOptimizedInvocationClass(Instrumentor instrumentor, CtClass clazz, CtField field, boolean get) throws Exception
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass fieldInvocation =
get
? pool.get("org.jboss.aop.joinpoint.FieldReadInvocation")
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,35 +1,34 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
import javassist.CtNewConstructor;
import javassist.NotFoundException;
-import org.jboss.aop.classpool.AOPClassPool;
-
/**
* Comment
*
@@ -38,15 +37,20 @@
*/
public abstract class OptimizedInvocations
{
- public static void defrostClassIfExists(AOPClassPool pool, String className)
+ public static void defrostClassIfExists(ClassPool pool, String className)
{
//In some cases we get a class frozen exception. I guess if the invocation class
//existed, method was unwrapped and the wrapped again
- CtClass existing = pool.getCached(className);
- if (existing != null)
+ // TODO I replaced getCached by get
+ try
{
+ CtClass existing = pool.getCtClass(className);
existing.defrost();
}
+ catch (NotFoundException e)
+ {
+ // ignore; class does not exist
+ }
}
/**
@@ -58,7 +62,7 @@
* @param superInvocation The super class of this invocation
* @return The created invocation class
*/
- public static CtClass makeInvocationClass(AOPClassPool pool,
+ public static CtClass makeInvocationClass(ClassPool pool,
boolean makeInnerClass,
CtClass outerClass,
String className,
@@ -81,7 +85,7 @@
return invocation;
}
- public static CtClass makeInvocationClassNoCtors(AOPClassPool pool,
+ public static CtClass makeInvocationClassNoCtors(ClassPool pool,
boolean makeInnerClass,
CtClass outerClass,
String className,
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/OptimizedMethodInvocations.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,29 +1,30 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.lang.reflect.Method;
import javassist.CannotCompileException;
+import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtField;
import javassist.CtMethod;
@@ -31,8 +32,6 @@
import javassist.Modifier;
import javassist.NotFoundException;
-import org.jboss.aop.classpool.AOPClassPool;
-
/**
* Comment
*
@@ -67,7 +66,7 @@
CtClass clazz, CtMethod method, CtMethod notAdvisedMethod)
throws NotFoundException, CannotCompileException
{
- AOPClassPool pool = (AOPClassPool) instrumentor.getClassPool();
+ ClassPool pool = instrumentor.getClassPool();
CtClass methodInvocation = pool.get("org.jboss.aop.joinpoint.MethodInvocation");
////////////////
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/instrument/TransformerCommon.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.instrument;
import java.io.File;
@@ -40,8 +40,8 @@
import javassist.NotFoundException;
import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.aop.standalone.Compiler;
+import org.jboss.classpool.spi.AbstractClassPool;
/**
* A few handy methods and common things used by the other Transformers
@@ -266,27 +266,27 @@
private static void registerGeneratedClass(ClassPool pool, String name)
{
- AOPClassPool aopPool = getAOPClassPool(pool);
- if (aopPool != null)
+ AbstractClassPool classPool = getAbstractClassPool(pool);
+ if (classPool != null)
{
- aopPool.registerGeneratedClass(name);
+ classPool.registerGeneratedClass(name);
}
}
private static void unregisterGeneratedClass(ClassPool pool, String name)
{
- AOPClassPool aopPool = getAOPClassPool(pool);
- if (aopPool != null)
+ AbstractClassPool classPool = getAbstractClassPool(pool);
+ if (classPool != null)
{
- aopPool.doneGeneratingClass(name);
+ classPool.doneGeneratingClass(name);
}
}
- private static AOPClassPool getAOPClassPool(ClassPool pool)
+ private static AbstractClassPool getAbstractClassPool(ClassPool pool)
{
- if (pool instanceof AOPClassPool)
+ if (pool instanceof AbstractClassPool)
{
- return (AOPClassPool)pool;
+ return (AbstractClassPool)pool;
}
return null;
}
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,33 +1,33 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.standalone;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-import org.jboss.aop.classpool.AOPClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPool;
/**
* Comment
@@ -36,7 +36,7 @@
* @version $Revision: 46253 $
* @deprecated Will be removed when Javassist is upgraded past 3.0 beta2
*/
-public class StandaloneClassPool extends AOPClassPool
+public class StandaloneClassPool extends AbstractClassPool
{
public StandaloneClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
{
Modified: projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/main/java/org/jboss/aop/standalone/StandaloneClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,46 +1,45 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.standalone;
-import org.jboss.aop.classpool.AOPClassPoolFactory;
-
import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPoolFactory;
+
/**
* Comment
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
* @version $Revision: 46253 $
*/
-public class StandaloneClassPoolFactory extends AOPClassPoolFactory
+public class StandaloneClassPoolFactory extends AbstractClassPoolFactory
{
- public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
+ public StandaloneClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
{
return new StandaloneClassPool(cl, src, repository);
}
- public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
+ public StandaloneClassPool create(ClassPool src, ScopedClassPoolRepository repository)
{
return new StandaloneClassPool(src, repository);
}
Modified: projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java
===================================================================
--- projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/jdk15/dynamic/common/scenario/ScenarioRunner.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,30 +1,29 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.
- */
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.aop.jdk15.dynamic.common.scenario;
import java.util.Map;
-import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtField;
import javassist.CtMethod;
@@ -34,8 +33,8 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.ClassAdvisor;
import org.jboss.aop.advice.AdviceBinding;
-import org.jboss.aop.classpool.AOPClassPool;
import org.jboss.aop.pointcut.ast.ParseException;
+import org.jboss.classpool.scoped.ScopedClassPool;
import org.jboss.test.aop.jdk15.dynamic.common.BindingInterceptor;
import org.jboss.test.aop.jdk15.dynamic.common.InstanceInterceptor;
import org.jboss.test.aop.jdk15.dynamic.common.POJOWrappingInfo;
@@ -325,8 +324,8 @@
*/
private static void loadPOJOData()
{
- Map<ClassLoader, ClassPool> cls = AspectManager.getRegisteredCLs();
- AOPClassPool classPool = (AOPClassPool) cls.get(POJO.class.getClassLoader());
+ Map<ClassLoader, ScopedClassPool> cls = AspectManager.getRegisteredCLs();
+ ScopedClassPool classPool = cls.get(POJO.class.getClassLoader());
try
{
POJO_CLASS = classPool.getLocally(POJO.class.getName());
Modified: projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java
===================================================================
--- projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/stress/weavetest/GenerateClassesScenario.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.aop.stress.weavetest;
import java.io.File;
@@ -34,7 +34,7 @@
import javassist.CtNewMethod;
import javassist.Modifier;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.test.aop.stress.AbstractScenario;
import org.jboss.test.aop.stress.SkipWarmup;
@@ -132,7 +132,7 @@
{
initDirectory();
- pool = AOPClassPoolRepository.getInstance().registerClassLoader(this.getClass().getClassLoader());
+ pool = ClassPoolRepository.getInstance().registerClassLoader(this.getClass().getClassLoader());
packageName = this.getClass().getPackage().getName();
CtClass clazz = pool.get("org.jboss.test.aop.stress.weavetest.TemplatePOJO");
if (clazz == null)
Modified: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/JBossIntegration.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/JBossIntegration.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/JBossIntegration.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,32 +1,31 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.asintegration;
import java.io.File;
-import javassist.scopedpool.ScopedClassPoolFactory;
-
import org.jboss.aop.ClassLoaderValidation;
import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
/**
* AOPIntegration.<p>
Modified: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/asintegration/core/AspectManagerServiceDelegate.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.core;
import java.io.BufferedInputStream;
@@ -33,9 +33,6 @@
import java.util.Map;
import java.util.StringTokenizer;
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-
import javax.xml.parsers.ParserConfigurationException;
import org.jboss.aop.AspectManager;
@@ -56,6 +53,8 @@
import org.jboss.aop.instrument.TransformerCommon;
import org.jboss.aop.introduction.InterfaceIntroduction;
import org.jboss.aop.pointcut.Pointcut;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
import org.jboss.logging.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -728,7 +727,7 @@
public String registeredClassLoaders()
{
- Map<ClassLoader, ClassPool> loaders = AspectManager.getRegisteredCLs();
+ Map<ClassLoader, ScopedClassPool> loaders = AspectManager.getRegisteredCLs();
StringBuffer buffer = new StringBuffer("");
for (ClassLoader loader : loaders.keySet())
{
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractClassPoolDomain.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractClassPoolDomain.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractClassPoolDomain.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,124 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import org.jboss.logging.Logger;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-
-
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractClassPoolDomain implements ClassPoolDomain
-{
- protected final Logger logger = Logger.getLogger(this.getClass());
-
- abstract CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, boolean create);
-
- abstract CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace);
-
- abstract CtClass getCachedOrCreateFromParent(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace);
-
- abstract void addClassPool(DelegatingClassPool pool);
-
- abstract void removeClassPool(DelegatingClassPool pool);
-
-
- protected CtClass getCachedOrCreateFromPoolParent(BaseClassPool initiatingPool, String classname, boolean create, boolean trace)
- {
- if (initiatingPool == null)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from pool parent - no initiating pool");
- return null;
- }
- ClassPool parentPool = initiatingPool.getParent();
- if (parentPool == null)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from pool parent - no parent pool");
- return null;
- }
-
- return getCachedOrCreateFromPool(parentPool, classname, create, trace);
- }
-
-
- protected CtClass getCachedOrCreateFromPool(ClassPool pool, String classname, boolean create, boolean trace)
- {
- if (pool instanceof BaseClassPool)
- {
- return getCachedOrCreateFromPool((BaseClassPool)pool, classname, create, trace);
- }
- try
- {
- //This will check the parents
- if (trace) logger.trace(this + " get cached or create " + classname + " from non-BaseClassPool pool " + pool);
- CtClass clazz = pool.get(classname);
- if (trace) logger.trace(this + " got cached or create " + classname + " from non-BaseClassPool pool " + clazz.getClassPool());
- return clazz;
- }
- catch(NotFoundException e)
- {
- return null;
- }
- }
-
- protected CtClass getCachedOrCreateFromPool(BaseClassPool pool, String classname, boolean create, boolean trace)
- {
- if (pool == null)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - no pool");
- return null;
- }
-
- CtClass clazz = null;
- if (!pool.childFirstLookup)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - checking parent (parentFirst)");
- clazz = getCachedOrCreateFromPoolParent(pool, classname, create, trace);
- }
-
- if (clazz == null)
- {
- //We can use the exposed methods directly to avoid the overhead of NotFoundException
- if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - checking cache");
- clazz = pool.getCached(classname);
- if (clazz == null && create)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - creating");
- clazz = pool.createCtClass(classname, true);
- }
- }
-
- if (clazz == null && pool.childFirstLookup)
- {
- if (trace) logger.trace(this + " get cached or create " + classname + " from BaseClassPool - checking parent (parentLast)");
- clazz = getCachedOrCreateFromPoolParent(pool, classname, create, trace);
- }
- return clazz;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractIsLocalResourcePlugin.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractIsLocalResourcePlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractIsLocalResourcePlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,77 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.net.URL;
-
-import javassist.ClassPool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractIsLocalResourcePlugin implements IsLocalResourcePlugin
-{
- private final BaseClassPool pool;
-
- public AbstractIsLocalResourcePlugin(BaseClassPool pool)
- {
- this.pool = pool;
- initialise();
- }
-
- protected void initialise()
- {
-
- }
-
- protected AOPClassPool getPool()
- {
- return pool;
- }
-
- /**
- * Checks if the resource can be found in the parent classpool's loader
- * and returns true if it either does not exist in the parent or if
- * the parent has a different URL for the resource
- */
- protected boolean isSameInParent(String classResourceName, URL foundURL)
- {
- ClassPool parent = pool.getParent();
- if (parent != null)
- {
- ClassLoader parentLoader = parent.getClassLoader();
- URL parentURL = parentLoader.getResource(classResourceName);
- if (parentURL == null)
- {
- return false;
- }
- if (parentURL.equals(foundURL))
- {
- return true;
- }
- }
-
- return false;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossClassPoolFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,62 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import org.jboss.logging.Logger;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractJBossClassPoolFactory implements ScopedClassPoolFactory
-{
- protected final Logger log = Logger.getLogger(this.getClass().getName());
-
- protected ClassPool getCreateParentClassPools(final ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- //Make sure that we get classpools for all the parent classloaders
- if (cl == null)
- {
- return ClassPool.getDefault();
- }
- ClassLoader parent = SecurityActions.getParent(cl);
-
- if (parent != null)
- {
- return repository.registerClassLoader(parent);
- }
- return src;
- }
-
- public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
- {
- return new TempJBossClassPool(src, repository);
- }
-
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossDelegatingClassPoolFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossDelegatingClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractJBossDelegatingClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,39 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractJBossDelegatingClassPoolFactory extends AbstractJBossClassPoolFactory
-{
- public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository)
- {
- return new TempJBossDelegatingClassPool(src, repository);
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractParentDelegationStrategy.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractParentDelegationStrategy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/AbstractParentDelegationStrategy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,92 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.CtClass;
-
-import org.jboss.logging.Logger;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractParentDelegationStrategy implements ParentDelegationStrategy
-{
- protected final Logger logger = Logger.getLogger(this.getClass().getName());
- private AbstractClassPoolDomain domain;
- private AbstractClassPoolDomain parent;
-
- protected AbstractParentDelegationStrategy(ClassPoolDomain parent, ClassPoolToClassPoolDomainAdaptorFactory adaptorFactory)
- {
- if (parent == null)
- {
- if (adaptorFactory == null)
- {
- throw new IllegalStateException("Null parent and null adaptorFactory");
- }
- this.parent = adaptorFactory.createAdaptor();
- }
- else
- {
- if (parent instanceof AbstractClassPoolDomain == false)
- {
- throw new IllegalArgumentException("Parent must implement AbstractClassPoolDomain");
- }
- this.parent = (AbstractClassPoolDomain)parent;
- }
-
- if (this.parent == null)
- {
- throw new IllegalStateException("Parent was not set");
- }
- }
-
- protected boolean hasParent()
- {
- if (logger.isTraceEnabled()) logger.trace(this + " " + getDomain() + " hasParent " + parent != null);
- return parent != null;
- }
-
- protected AbstractClassPoolDomain getDomain()
- {
- return domain;
- }
-
- public CtClass getCachedOrCreateFromParent(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace)
- {
- return parent.getCachedOrCreate(initiatingPool, classname, resourceName, create, trace);
- }
-
- public void setDomain(AbstractClassPoolDomain domain)
- {
- if (domain == null)
- {
- throw new IllegalArgumentException("Null domain");
- }
- if (this.domain != null)
- {
- throw new IllegalArgumentException("Cannot change domain");
- }
- this.domain = domain;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,144 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * Intermediate class containing commonly needed functionality for the new classpools. I don't want to
- * modify AOPClassPool too much
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class BaseClassPool extends AOPClassPool
-{
- private IsLocalResourcePlugin isLocalResourcePlugin;
-
- public BaseClassPool(ClassLoader cl, ClassPool parent, ScopedClassPoolRepository repository)
- {
- super(cl, parent, repository);
- isLocalResourcePlugin = IsLocalResourcePluginFactoryRegistry.getPluginFactory(cl).create(this);
- if (logger.isTraceEnabled()) logger.trace(this + " isLocalResourcePlugin:" + isLocalResourcePlugin);
- }
-
- public BaseClassPool(ClassLoader cl, ClassPool parent, ScopedClassPoolRepository repository, Class<? extends AOPCLassPoolSearchStrategy> searchStrategy)
- {
- super(cl, parent, repository, searchStrategy);
- isLocalResourcePlugin = IsLocalResourcePluginFactoryRegistry.getPluginFactory(cl).create(this);
- if (logger.isTraceEnabled()) logger.trace(this + " isLocalResourcePlugin:" + isLocalResourcePlugin);
- }
-
- @Override
- public CtClass createCtClass(String classname, boolean useCache)
- {
- CtClass clazz = super.createCtClass(classname, useCache);
- if (clazz != null)
- {
- lockInCache(clazz);
- }
- return clazz;
- }
-
- protected CtClass createParentCtClass(String classname, boolean useCache, boolean trace)
- {
- if (parent == null)
- {
- return null;
- }
-
- //Make parent create class
- if (parent instanceof BaseClassPool)
- {
- return ((AOPClassPool)parent).createCtClass(classname, useCache);
- }
- else
- {
- return plainParentGet(classname);
- }
- }
-
- private CtClass plainParentGet(String classname)
- {
- try
- {
- return parent.get(classname);
- }
- catch (NotFoundException e)
- {
- }
- return null;
- }
-
- public ClassPool getParent()
- {
- return parent;
- }
-
- @Override
- protected boolean isLocalClassLoaderResource(String classResourceName)
- {
- return isLocalResourcePlugin.isMyResource(classResourceName);
- }
-
- @Override
- public final CtClass get(String classname) throws NotFoundException
- {
- boolean trace = logger.isTraceEnabled();
- if (trace) logger.trace(this + " initiating get of " + classname);
-
- try
- {
- CtClass clazz = super.get(classname);
- if (trace)
- {
- logger.trace(this + " completed get of " + classname + " " + getClassPoolLogStringForClass(clazz));
- }
- return clazz;
- }
- catch (NotFoundException e)
- {
- // AutoGenerated
- NotFoundException wrapped = new NotFoundException(e.getMessage() + " could not be found from " + this);
- wrapped.setStackTrace(e.getStackTrace());
- throw wrapped;
- }
- }
-
- @Override
- public CtClass get0(String classname, boolean useCache) throws NotFoundException
- {
- return super.get0(classname, useCache);
- }
-
- @Override
- public void close()
- {
- super.close();
-
- if (logger.isTraceEnabled()) logger.trace(this + " closing");
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPoolDomain.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPoolDomain.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/BaseClassPoolDomain.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,154 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javassist.CtClass;
-
-import org.jboss.aop.util.ClassLoaderUtils;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class BaseClassPoolDomain extends AbstractClassPoolDomain
-{
- private String domainName;
-
- private List<DelegatingClassPool> delegatingPools = new ArrayList<DelegatingClassPool>();
-
- private ParentDelegationStrategy parentDelegationStrategy;
-
- public BaseClassPoolDomain(String domainName, ClassPoolDomain parent, boolean parentFirst)
- {
- this(domainName,
- new DefaultParentDelegationStrategy(
- parent,
- parentFirst,
- DefaultClassPoolToClassPoolDomainAdaptorFactory.getInstance())
- );
- }
-
- protected BaseClassPoolDomain(String domainName, ParentDelegationStrategy parentDelegationStrategy)
- {
- this.domainName = domainName;
- this.parentDelegationStrategy = parentDelegationStrategy;
- parentDelegationStrategy.setDomain(this);
- if (logger.isTraceEnabled()) logger.trace("Created " + this + " parentDelegationStrategy:" + parentDelegationStrategy);
- }
-
- @Override
- synchronized void addClassPool(DelegatingClassPool pool)
- {
- if (!delegatingPools.contains(pool))
- {
- if (logger.isTraceEnabled()) logger.trace(this + " adding pool " + pool);
- delegatingPools.add(pool);
- }
- }
-
- @Override
- protected synchronized void removeClassPool(DelegatingClassPool pool)
- {
- if (logger.isTraceEnabled()) logger.trace(this + " removing pool " + pool);
- delegatingPools.remove(pool);
- }
-
- @Override
- synchronized CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, boolean create)
- {
- boolean trace = logger.isTraceEnabled();
- String resourceName = ClassLoaderUtils.getResourceName(classname);
-
- CtClass clazz = getCachedOrCreate(initiatingPool, classname, resourceName, create, trace);
-
- if (clazz == null)
- {
- clazz = getCachedOrCreateFromPoolParent(initiatingPool, classname, create, trace);
- }
- return clazz;
- }
-
- @Override
- protected CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace)
- {
- if (trace) logger.trace(this + " looking for " + classname);
-
- CtClass clazz = null;
- if (isParentBefore(classname))
- {
- if (trace) logger.trace(this + " checking parent first for " + classname);
- clazz = getCachedOrCreateFromParent(initiatingPool, classname, resourceName, create, trace);
- }
- if (clazz == null)
- {
- List<DelegatingClassPool> pools = getPoolsForClassName(classname);
- if (pools.size() > 0)
- {
- for (DelegatingClassPool pool : pools)
- {
- clazz = pool.loadLocally(classname, resourceName, create);
- if (clazz != null)
- {
- break;
- }
- }
- }
- }
- if (clazz == null && isParentAfter(classname))
- {
- if (trace) logger.trace(this + " checking parent last for " + classname);
- clazz = getCachedOrCreateFromParent(initiatingPool, classname, resourceName, create, trace);
- }
- if (trace) logger.trace(this + " found " + classname + " in " + (clazz == null ? "null" : clazz.getClassPool()));
- return clazz;
- }
-
- @Override
- protected CtClass getCachedOrCreateFromParent(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace)
- {
- return parentDelegationStrategy.getCachedOrCreateFromParent(initiatingPool, classname, resourceName, create, trace);
- }
-
- public String toString()
- {
- return "[" + super.toString() + " name:" + domainName + "]";
- }
-
- protected boolean isParentBefore(String classname)
- {
- return parentDelegationStrategy.isParentBefore(classname);
- }
-
- protected boolean isParentAfter(String classname)
- {
- return parentDelegationStrategy.isParentAfter(classname);
- }
-
- protected List<DelegatingClassPool> getPoolsForClassName(String classname)
- {
- return delegatingPools;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomain.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomain.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomain.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,31 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ClassPoolDomain
-{
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomainRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomainRegistry.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolDomainRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.lang.ref.WeakReference;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ClassPoolDomainRegistry
-{
- final static ClassPoolDomainRegistry INSTANCE = new ClassPoolDomainRegistry();
-
- final Map<Object, WeakReference<ClassPoolDomain>> domains = new WeakHashMap<Object, WeakReference<ClassPoolDomain>>();
-
- public static ClassPoolDomainRegistry getInstance()
- {
- return INSTANCE;
- }
-
- public synchronized ClassPoolDomain getDomain(Object key)
- {
- WeakReference<ClassPoolDomain> ref = domains.get(key);
- if (ref == null)
- {
- return null;
- }
- return ref.get();
- }
-
- public synchronized void addClassPoolDomain(Object key, ClassPoolDomain domain)
- {
- domains.put(key, new WeakReference<ClassPoolDomain>(domain));
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdapter.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdapter.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdapter.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,96 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ClassPoolToClassPoolDomainAdapter extends AbstractClassPoolDomain
-{
- protected ClassPool pool;
-
- public ClassPoolToClassPoolDomainAdapter()
- {
- this.pool = initialiseParentClassLoader();
- if (logger.isTraceEnabled()) logger.trace("Created " + this);
- validate();
- }
-
- public ClassPoolToClassPoolDomainAdapter(ClassPool pool)
- {
- this.pool = pool;
- if (logger.isTraceEnabled()) logger.trace("Created " + this);
- validate();
- }
-
- private void validate()
- {
- if (pool == null)
- {
- throw new IllegalStateException("Null parent classpool");
- }
- }
-
- public ClassPool initialiseParentClassLoader()
- {
- return ClassPool.getDefault();
- }
-
- public void addClassPool(DelegatingClassPool pool)
- {
- throw new IllegalStateException("Cannot add pools to the domain adaptor");
- }
-
-
- synchronized CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace)
- {
- return getCachedOrCreateFromPool(pool, classname, create, trace);
- }
-
- @Override
- CtClass getCachedOrCreateFromParent(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace)
- {
- return null;
- }
-
- void removeClassPool(DelegatingClassPool pool)
- {
- throw new IllegalStateException("Cannot remove pools from the domain adaptor");
- }
-
- public String toString()
- {
- return "ClassPoolToDomainAdapter[" + System.identityHashCode(this) + " " + pool.toString() + "]";
- }
-
- @Override
- CtClass getCachedOrCreate(DelegatingClassPool initiatingPool, String classname, boolean create)
- {
- throw new IllegalStateException("Should never be called");
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdaptorFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdaptorFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ClassPoolToClassPoolDomainAdaptorFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ClassPoolToClassPoolDomainAdaptorFactory
-{
- ClassPoolToClassPoolDomainAdapter createAdaptor();
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePlugin.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class DefaultClassLoaderIsLocalResourcePlugin extends AbstractIsLocalResourcePlugin implements IsLocalResourcePlugin
-{
- public DefaultClassLoaderIsLocalResourcePlugin(BaseClassPool pool)
- {
- super(pool);
- }
-
- public boolean isMyResource(String resourceName)
- {
- return getPool().getClassLoader().getResource(resourceName) != null;
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePluginFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,37 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class DefaultClassLoaderIsLocalResourcePluginFactory implements IsLocalResourcePluginFactory
-{
-
- public IsLocalResourcePlugin create(BaseClassPool pool)
- {
- return new DefaultClassLoaderIsLocalResourcePlugin(pool);
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassPoolToClassPoolDomainAdaptorFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassPoolToClassPoolDomainAdaptorFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultClassPoolToClassPoolDomainAdaptorFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,48 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class DefaultClassPoolToClassPoolDomainAdaptorFactory implements ClassPoolToClassPoolDomainAdaptorFactory
-{
- private static final DefaultClassPoolToClassPoolDomainAdaptorFactory INSTANCE = new DefaultClassPoolToClassPoolDomainAdaptorFactory();
-
- private DefaultClassPoolToClassPoolDomainAdaptorFactory()
- {
-
- }
-
- public static ClassPoolToClassPoolDomainAdaptorFactory getInstance()
- {
- return INSTANCE;
- }
-
- public ClassPoolToClassPoolDomainAdapter createAdaptor()
- {
- return new ClassPoolToClassPoolDomainAdapter();
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultParentDelegationStrategy.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultParentDelegationStrategy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DefaultParentDelegationStrategy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-class DefaultParentDelegationStrategy extends AbstractParentDelegationStrategy
-{
- boolean parentFirst;
- DefaultParentDelegationStrategy(ClassPoolDomain parent, boolean parentFirst, ClassPoolToClassPoolDomainAdaptorFactory adaptorFactory)
- {
- super(parent, adaptorFactory);
- this.parentFirst = parentFirst;
- }
-
- public boolean isParentBefore(String classname)
- {
- boolean isParentBefore = hasParent() && parentFirst == true;
- if (logger.isTraceEnabled()) logger.trace(this + " " + getDomain() + " isParentBefore " + isParentBefore);
- return isParentBefore;
- }
-
- public boolean isParentAfter(String classname)
- {
- boolean isParentAfter = hasParent() && parentFirst == false;
- if (logger.isTraceEnabled()) logger.trace(this + " " + getDomain() + " isParentAfter " + isParentAfter);
- return isParentAfter;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DelegatingClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DelegatingClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/DelegatingClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,136 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import org.jboss.aop.util.ClassLoaderUtils;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * Base class for classpools backed by a domain
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class DelegatingClassPool extends BaseClassPool
-{
- private final AbstractClassPoolDomain domain;
-
- private boolean closed;
-
- public DelegatingClassPool(ClassPoolDomain domain, ClassLoader cl, ClassPool parent, ScopedClassPoolRepository repository)
- {
- super(cl, parent, repository);
- if (domain == null)
- {
- throw new IllegalArgumentException("Domain was null");
- }
- if (domain instanceof AbstractClassPoolDomain == false)
- {
- throw new IllegalArgumentException("Domain must implement AbstractClassPoolDomain");
- }
- this.domain = (AbstractClassPoolDomain)domain;
- if (logger.isTraceEnabled()) logger.trace(this + " domain:" + this);
- this.domain.addClassPool(this);
- }
-
- public CtClass loadLocally(String classname, String resourceName, boolean create)
- {
- boolean trace = logger.isTraceEnabled();
- if (trace) logger.trace(this + " attempt to load locally " + classname);
-
- CtClass clazz = null;
- if (isLocalResource(resourceName, trace))
- {
- clazz = getCachedLocally(classname);
- if (clazz == null && create)
- {
- clazz = createCtClass(classname, true);
- }
- }
- if (trace) logger.trace(this + " loaded locally " + classname + " " + getClassPoolLogStringForClass(clazz));
- return clazz;
- }
-
- /**
- * Overrides ClassPool.get0() so that we can look up classes without caching them in the initiating pool.
- * The DelgatingClassPool + DomainClassPool handle the caching in the correct pool + handles the
- * parentFirst functionality
- */
- @Override
- public synchronized CtClass get0(String classname, boolean useCache) throws NotFoundException
- {
- if (isGeneratedClass(classname))
- {
- return null;
- }
- CtClass clazz = domain.getCachedOrCreate(this, classname, true);
- if (clazz == null)
- {
- //It is probably a generated proxy. The package name can be different (for example if it is
- //a proxy for a java system class) than the package names exported by the loaders.
- //TODO It should be possible to remove this once these have been done:
- //https://jira.jboss.org/jira/browse/JBCL-25
- //https://jira.jboss.org/jira/browse/JBCL-92
- clazz = loadLocally(classname, ClassLoaderUtils.getResourceName(classname), true);
- }
- return clazz;
- }
-
- @Override
- public boolean isUnloadedClassLoader()
- {
- return closed;
- }
-
- @Override
- public void close()
- {
- closed = true;
- super.close();
- domain.removeClassPool(this);
- }
-
- @Override
- public CtClass getCached(String classname)
- {
- //TODO Not 100 sure this is correct, but it seems to do the job where repeated calls to get() on a pool in a hierarchy returns a different instance of the class
- CtClass clazz = super.getCachedLocally(classname);
- if (clazz != null)
- return clazz;
-
- if (isGeneratedClass(classname))
- {
- return null;
- }
- return domain.getCachedOrCreate(this, classname, false);
- }
-
- @Override
- public String toString()
- {
- return "[" + super.toString() + " domain: " + domain + "]";
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePlugin.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface IsLocalResourcePlugin
-{
- boolean isMyResource(String resourceName);
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,32 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface IsLocalResourcePluginFactory
-{
- IsLocalResourcePlugin create(BaseClassPool pool);
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactoryRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactoryRegistry.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/IsLocalResourcePluginFactoryRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,90 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.net.URLClassLoader;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.jboss.util.loading.Translatable;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class IsLocalResourcePluginFactoryRegistry
-{
- private static Map<Class<?>, IsLocalResourcePluginFactory> plugins = new WeakHashMap<Class<?>, IsLocalResourcePluginFactory>();
-
- static
- {
- addPluginFactory(ClassLoader.class, new DefaultClassLoaderIsLocalResourcePluginFactory());
- addPluginFactory(URLClassLoader.class, new URLClassLoaderIsLocalResourcePluginFactory());
- addPluginFactory(Translatable.class, new TranslatableClassLoaderIsLocalResourcePluginFactory());
- }
-
- public static synchronized void addPluginFactory(Class<?> classLoaderClass, IsLocalResourcePluginFactory plugin)
- {
- plugins.put(classLoaderClass, plugin);
- }
-
- public static synchronized void removePluginFactory(Class<?> classLoaderClass, IsLocalResourcePluginFactory plugin)
- {
- plugins.remove(classLoaderClass);
- }
-
- public static synchronized IsLocalResourcePluginFactory getPluginFactory(ClassLoader classLoader)
- {
- if (classLoader != null)
- {
- return getPluginFactory(classLoader.getClass());
- }
- return getPluginFactory(ClassLoader.class);
- }
-
- public static synchronized IsLocalResourcePluginFactory getPluginFactory(Class<?> classLoaderClass)
- {
- IsLocalResourcePluginFactory plugin = plugins.get(classLoaderClass);
- if (plugin == null)
- {
- Class<?>[] interfaces = classLoaderClass.getInterfaces();
- if (interfaces.length > 0)
- {
- for (Class<?> iface : interfaces)
- {
- plugin = getPluginFactory(iface);
- if (plugin != null)
- {
- return plugin;
- }
- }
- }
- Class<?> superClass = classLoaderClass.getSuperclass();
- if (superClass != null && superClass != Object.class)
- {
- return getPluginFactory(superClass);
- }
- }
- return plugin;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/NonDelegatingClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/NonDelegatingClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/NonDelegatingClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,65 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * ClassPool for class loaders not backed by a repository/classloading domain
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class NonDelegatingClassPool extends BaseClassPool
-{
- public NonDelegatingClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, boolean parentFirst)
- {
- super(cl, src, repository, AOPClassPool.SEARCH_LOCAL_ONLY_STRATEGY);
- super.childFirstLookup = !parentFirst;
- }
-
- @Override
- public CtClass createCtClass(String classname, boolean useCache)
- {
- boolean trace = logger.isTraceEnabled();
- CtClass clazz = null;
- if (!childFirstLookup)
- {
- if (trace)logger.trace(this + " attempting to create " + classname + " in parent pool (parentFirst)");
- clazz = createParentCtClass(classname, useCache, trace);
- }
- if (clazz == null && isLocalResource(getResourceName(classname), trace))
- {
- clazz = super.createCtClass(classname, useCache);
- }
- if (childFirstLookup && clazz == null)
- {
- if (trace)logger.trace(this + " attempting to create " + classname + " in parent pool (parentLast)");
- clazz = createParentCtClass(classname, useCache, trace);
- }
-
- if (trace)logger.trace(this + " created " + classname + " " + getClassPoolLogStringForClass(clazz));
- return clazz;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ParentDelegationStrategy.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ParentDelegationStrategy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/ParentDelegationStrategy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,40 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.CtClass;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ParentDelegationStrategy
-{
- void setDomain(AbstractClassPoolDomain domain);
-
- CtClass getCachedOrCreateFromParent(DelegatingClassPool initiatingPool, String classname, String resourceName, boolean create, boolean trace);
-
- boolean isParentBefore(String classname);
-
- boolean isParentAfter(String classname);
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/SecurityActions.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/SecurityActions.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/SecurityActions.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,80 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-class SecurityActions
-{
- interface GetParentAction
- {
- ClassLoader getParent(ClassLoader loader);
-
- GetParentAction NON_PRIVILEGED = new GetParentAction()
- {
- public ClassLoader getParent(ClassLoader loader)
- {
- return loader.getParent();
- }
- };
-
- GetParentAction PRIVILEGED = new GetParentAction()
- {
- public ClassLoader getParent(final ClassLoader loader)
- {
- try
- {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
- {
- public ClassLoader run() throws Exception
- {
- return loader.getParent();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw new RuntimeException(e.getException());
- }
- }
- };
- }
-
- public static ClassLoader getParent(ClassLoader loader)
- {
- if (System.getSecurityManager() == null)
- {
- return GetParentAction.NON_PRIVILEGED.getParent(loader);
- }
- else
- {
- return GetParentAction.PRIVILEGED.getParent(loader);
- }
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,70 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import org.jboss.aop.classpool.AOPClassPool;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * The temporary classpool used by the instrumentor. It's main job is to delegate to the parent classpool
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TempJBossClassPool extends AOPClassPool
-{
- boolean isParentPoolAOP;
- public TempJBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- super(cl, src, repository);
- if (src instanceof AOPClassPool)
- {
- isParentPoolAOP = true;
- }
- }
-
- public TempJBossClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- super(src, repository);
- if (src instanceof AOPClassPool)
- {
- isParentPoolAOP = true;
- }
- }
-
- public CtClass getCached(String classname)
- {
- CtClass clazz = null;
- if (isParentPoolAOP)
- {
- clazz = ((AOPClassPool)parent).getCached(classname);
- }
- if (clazz == null)
- {
- clazz = super.getCached(classname);
- }
- return clazz;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossDelegatingClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossDelegatingClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TempJBossDelegatingClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,68 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TempJBossDelegatingClassPool extends AOPClassPool
-{
- boolean isParentPoolDelegating;
- public TempJBossDelegatingClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- super(cl, src, repository);
- if (src instanceof BaseClassPool)
- {
- isParentPoolDelegating = true;
- }
- }
-
- public TempJBossDelegatingClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- super(src, repository);
- if (src instanceof BaseClassPool)
- {
- isParentPoolDelegating = true;
- }
- }
- @Override
- public CtClass get0(String classname, boolean useCache) throws NotFoundException
- {
- CtClass clazz = null;
- if (isParentPoolDelegating)
- {
- clazz = ((BaseClassPool)parent).get0(classname, useCache);
- }
- if (clazz == null)
- {
- clazz = super.get0(classname, useCache);
- }
- return clazz;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePlugin.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.net.URL;
-
-import org.jboss.util.loading.Translatable;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TranslatableClassLoaderIsLocalResourcePlugin extends AbstractIsLocalResourcePlugin
-{
- public TranslatableClassLoaderIsLocalResourcePlugin(BaseClassPool pool)
- {
- super(pool);
- }
-
- public boolean isMyResource(String resourceName)
- {
- ClassLoader loader = getPool().getClassLoader();
- if (loader instanceof Translatable == false)
- {
- throw new IllegalStateException("ClassLoader is not instance of Translatable " + loader);
- }
- URL url = ((Translatable)getPool().getClassLoader()).getResourceLocally(resourceName);
- if (url == null)
- {
- return false;
- }
- if (isSameInParent(resourceName, url))
- {
- return false;
- }
- return true;
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePluginFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/TranslatableClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,36 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TranslatableClassLoaderIsLocalResourcePluginFactory implements IsLocalResourcePluginFactory
-{
- public IsLocalResourcePlugin create(BaseClassPool pool)
- {
- return new TranslatableClassLoaderIsLocalResourcePlugin(pool);
- }
-
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePlugin.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,54 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-import java.net.URL;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class URLClassLoaderIsLocalResourcePlugin extends AbstractIsLocalResourcePlugin
-{
- public URLClassLoaderIsLocalResourcePlugin(BaseClassPool pool)
- {
- super(pool);
- }
-
- public boolean isMyResource(String classResourceName)
- {
- //TODO This should be moved into URLClassLoaderIsLocalResourcePlugin, and the -core tests should be updated to
- //not use the same urls
- ClassLoader myLoader = getPool().getClassLoader();
- URL myURL = myLoader.getResource(classResourceName);
- if (myURL == null)
- {
- return false;
- }
- if (isSameInParent(classResourceName, myURL))
- {
- return false;
- }
- return true;
- }
-}
Deleted: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePluginFactory.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/classpool/URLClassLoaderIsLocalResourcePluginFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,37 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.classpool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class URLClassLoaderIsLocalResourcePluginFactory implements IsLocalResourcePluginFactory
-{
-
- public IsLocalResourcePlugin create(BaseClassPool pool)
- {
- return new URLClassLoaderIsLocalResourcePlugin(pool);
- }
-
-}
Modified: projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java
===================================================================
--- projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-core/src/main/java/org/jboss/aop/deployment/AbstractAspectManagerService.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,35 +1,34 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.deployment;
import java.io.File;
-import javassist.scopedpool.ScopedClassPoolFactory;
-
import org.jboss.aop.AspectManager;
import org.jboss.aop.AspectNotificationHandler;
import org.jboss.aop.ClassLoaderValidation;
import org.jboss.aop.asintegration.JBossIntegration;
import org.jboss.aop.asintegration.core.AspectManagerServiceDelegate;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
import org.jboss.logging.Logger;
/**
Modified: projects/aop/trunk/asintegration-jmx/pom.xml
===================================================================
--- projects/aop/trunk/asintegration-jmx/pom.xml 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/pom.xml 2010-03-12 13:38:13 UTC (rev 102346)
@@ -113,6 +113,10 @@
<artifactId>javassist</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-ucl</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.aop</groupId>
<artifactId>jboss-aop</artifactId>
</dependency>
Modified: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBoss4Integration.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,33 +1,30 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
import java.io.File;
import java.lang.reflect.Constructor;
import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
@@ -41,8 +38,18 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.asintegration.JBossIntegration;
import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.classpool.ucl.JBossUclDelegatingClassPoolFactory;
import org.jboss.aop.domain.ScopedRepositoryClassLoaderDomain;
+import org.jboss.classpool.plugins.ucl.JBossClassPool;
+import org.jboss.classpool.plugins.ucl.JBossClassPoolFactory;
+import org.jboss.classpool.plugins.ucl.LoaderRepositoryUrlUtil;
+import org.jboss.classpool.plugins.ucl.ScopedJBossClassPool;
+import org.jboss.classpool.plugins.ucl.ScopedRepositoryClassLoaderHelper;
+import org.jboss.classpool.plugins.ucl.UclDelegatingClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.logging.Logger;
import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
import org.jboss.mx.loading.RepositoryClassLoader;
@@ -124,13 +131,14 @@
public ScopedClassPoolFactory createScopedClassPoolFactory(File tmpDir) throws Exception
{
String classname = getClassPoolFactoryClassName();
+ AbstractClassPoolFactory abstractClassPoolFactory = null;
if (classname.equals(JBossClassPoolFactory.class.getName()))
{
- delegateClassPoolFactory = new JBossClassPoolFactory(tmpDir);
+ abstractClassPoolFactory = new JBossClassPoolFactory(tmpDir);
}
- else if (classname.equals(JBossUclDelegatingClassPoolFactory.class.getName()))
+ else if (classname.equals(UclDelegatingClassPoolFactory.class.getName()))
{
- delegateClassPoolFactory = new JBossUclDelegatingClassPoolFactory(tmpDir);
+ abstractClassPoolFactory = new UclDelegatingClassPoolFactory(tmpDir);
}
else
{
@@ -139,16 +147,18 @@
{
Class<?> clazz = Class.forName(classname);
Constructor<?> ctor = clazz.getConstructor(File.class);
- delegateClassPoolFactory = (ScopedClassPoolFactory)ctor.newInstance(tmpDir);
+ abstractClassPoolFactory = (AbstractClassPoolFactory)ctor.newInstance(tmpDir);
}
catch(Exception e)
{
logger.warn("Error instantiating " + classname + " defaulting to " + JBossClassPoolFactory.class.getName());
classPoolFactoryClassName = classname;
createScopedClassPoolFactory(tmpDir);
+ return this;
}
}
-
+ ClassPoolRepository.getInstance().setClassPoolFactory(abstractClassPoolFactory);
+ delegateClassPoolFactory = abstractClassPoolFactory;
return this;
}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
-
-import java.io.File;
-import java.net.URL;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision$
- */
-public class JBossClassPool extends AOPClassPool implements ToClassInvokerPoolReference
-{
- ToClassInvoker toClassInvoker = null;
-
- protected JBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
- {
- super(cl, src, repository);
- toClassInvoker = new ToClassInvoker(tmp);
- }
-
- protected JBossClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- super(src, repository);
- }
-
- public boolean isUnloadedClassLoader()
- {
- if (getClassLoader() instanceof RepositoryClassLoader)
- {
- RepositoryClassLoader rcl = (RepositoryClassLoader) getClassLoader();
- return rcl.getLoaderRepository() == null;
- }
- return false;
- }
-
- public Class<?> toClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
- {
- return toClassInvoker.toClass(this, cc, getResourceName(cc.getName()), loader, domain);
- }
-
- public Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
- {
- return super.toClass(cc, loader, domain);
- }
-
- @Override
- public void lockInCache(CtClass clazz)
- {
- super.lockInCache(clazz);
- localResources.put(getResourceName(clazz.getName()), Boolean.TRUE);
- }
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/JBossClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,129 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AbstractJBossClassPoolFactory;
-import org.jboss.mx.loading.RepositoryClassLoader;
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision$
- **/
-public class JBossClassPoolFactory extends AbstractJBossClassPoolFactory implements ScopedClassPoolFactory
-{
- protected File tmpClassesDir;
-
- public JBossClassPoolFactory(File tmpClassesDir) throws IOException
- {
- this.tmpClassesDir = tmpClassesDir;
-
- }
- public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- ClassPool parent = getCreateParentClassPools(cl, src, repository);
- if (cl instanceof RepositoryClassLoader)
- {
- File tempdir = getTempDirectory(cl);
- URL tmpCP;
- try
- {
- tmpCP = createURLAndAddToLoader(cl, tempdir);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- if (ScopedRepositoryClassLoaderHelper.isScopedClassLoader(cl))
- {
- //It is scoped
- return new ScopedJBossClassPool(cl, parent, repository, tempdir, tmpCP);
- }
- return new JBossClassPool(cl, parent, repository, tempdir, tmpCP);
- }
- return new AOPClassPool(cl, parent, repository);
- }
-
- protected File getTempDirectory(ClassLoader cl)
- {
- File tempdir = null;
- int attempts = 0;
- IOException ex = null;
- while (tempdir == null && attempts < 5)
- {
- //Workaround for JBAOP-254, retry a few times
- try
- {
- tempdir = createTempDir(cl);
- }
- catch (IOException e)
- {
- ex = e;
- }
- }
-
- if (tempdir == null)
- {
- throw new RuntimeException("", ex);
- }
-
- return tempdir;
- }
-
- public File createTempDir(ClassLoader cl) throws IOException
- {
- File tempdir = File.createTempFile("ucl", "", tmpClassesDir);
- tempdir.delete();
- tempdir.mkdir();
- tempdir.deleteOnExit();
-
- return tempdir;
- }
-
- private URL createURLAndAddToLoader(ClassLoader cl, File tempdir) throws IOException
- {
- URL tmpURL = tempdir.toURL();
- URL tmpCP = new URL(tmpURL, "?dynamic=true");
-
- RepositoryClassLoader ucl = (RepositoryClassLoader) cl;
-
- // We may be undeploying.
- if (ucl.getLoaderRepository() != null)
- {
- ucl.addURL(tmpCP);
- }
-
- return tmpCP;
- }
-
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/LoaderRepositoryUrlUtil.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,173 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
-
-import java.net.URL;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.util.MBeanServerLocator;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class LoaderRepositoryUrlUtil implements NotificationListener
-{
- final static MBeanServer SERVER;
- final static ObjectName MAIN_LOADER_REPOSITORY_OBJECT_NAME;
- final static LoaderRepository MAIN_LOADER_REPOSITORY;
- static
- {
- SERVER = MBeanServerLocator.locateJBoss();
- try
- {
- MAIN_LOADER_REPOSITORY_OBJECT_NAME = new ObjectName("JMImplementation:name=Default,service=LoaderRepository");
- MAIN_LOADER_REPOSITORY = (LoaderRepository)SERVER.invoke(MAIN_LOADER_REPOSITORY_OBJECT_NAME, "getInstance", new Object[0], new String[0]);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- long currentSequenceNumber;
- long lastSequenceNumber = -1;
- URL[] urls;
-
- public LoaderRepositoryUrlUtil()
- {
- try
- {
- SERVER.addNotificationListener(MAIN_LOADER_REPOSITORY_OBJECT_NAME, this, null, null);
- }
- catch (InstanceNotFoundException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public synchronized void handleNotification(Notification notification, Object handback)
- {
- if (notification.getType().equals(LoaderRepository.CLASSLOADER_ADDED))
- {
- currentSequenceNumber = notification.getSequenceNumber();
- }
- else if (notification.getType().equals(LoaderRepository.CLASSLOADER_REMOVED))
- {
- currentSequenceNumber = notification.getSequenceNumber();
- }
- }
-
- public synchronized UrlInfo getURLInfo(HeirarchicalLoaderRepository3 scopedLoader, UrlInfo urlInfo)
- {
- boolean changed = false;
- if (lastSequenceNumber != currentSequenceNumber)
- {
- urls = MAIN_LOADER_REPOSITORY.getURLs();
- lastSequenceNumber = currentSequenceNumber;
- changed = true;
- }
- if (!changed)
- {
- changed = urlInfo != null && (urlInfo.getSequenceNumber() != lastSequenceNumber);
- }
- if (urlInfo == null || changed)
- {
- URL[] localUrls = getLocalUrls(scopedLoader, urls);
- urlInfo = new UrlInfo(urls, localUrls, lastSequenceNumber);
- }
- return urlInfo;
- }
-
- public long getCurrentSequenceNumber()
- {
- return currentSequenceNumber;
- }
-
- private URL[] getLocalUrls(HeirarchicalLoaderRepository3 scopedRepository, URL[] globalUrls)
- {
- URL[] scopedRepositoryUrls = scopedRepository.getURLs();
-
- //This is a bit of a hack, since this relies on the order of the urls returned by HeirarchicalLoaderRepository3
- //My urls, followed by parent urls.
- int scopedLength = 0;
- for (int i = 0 ; i < scopedRepositoryUrls.length ; i++)
- {
- for (int j = 0 ; j < globalUrls.length ; j ++)
- {
- if (scopedRepositoryUrls[i].equals(globalUrls[j]))
- {
- scopedLength = i;
- break;
- }
- }
- if (scopedLength > 0)
- {
- break;
- }
- }
-
- URL[] localUrls = new URL[scopedLength];
- System.arraycopy(scopedRepositoryUrls, 0, localUrls, 0, scopedLength);
- return localUrls;
- }
-
- public class UrlInfo
- {
-
- URL[] globalUrls;
- URL[] localUrls;
- long sequenceNumber;
-
- public UrlInfo(URL[] globalUrls, URL[] localUrls, long sequenceNumber)
- {
- super();
- this.globalUrls = globalUrls;
- this.localUrls = localUrls;
- this.sequenceNumber = sequenceNumber;
- }
-
- public URL[] getGlobalUrls()
- {
- return globalUrls;
- }
-
- public URL[] getLocalUrls()
- {
- return localUrls;
- }
-
- public long getSequenceNumber()
- {
- return sequenceNumber;
- }
- }
-
-}
Modified: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/RepositoryClassLoaderScopingPolicy.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/RepositoryClassLoaderScopingPolicy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/RepositoryClassLoaderScopingPolicy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss4;
import java.util.Map;
@@ -27,8 +27,9 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.Domain;
import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
import org.jboss.aop.domain.ScopedRepositoryClassLoaderDomain;
+import org.jboss.classpool.plugins.ucl.ScopedRepositoryClassLoaderHelper;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.logging.Logger;
import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
import org.jboss.mx.loading.RepositoryClassLoader;
@@ -51,7 +52,7 @@
if (scopedClassLoader != null)
{
Domain scopedManager = null;
- synchronized (AOPClassPoolRepository.getInstance().getRegisteredCLs())
+ synchronized (ClassPoolRepository.getInstance().getRegisteredCLs())
{
Object loaderRepository = getLoaderRepository(classLoader);
scopedManager = scopedClassLoaderDomains.get(loaderRepository);
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedJBossClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,273 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
-import org.jboss.aop.asintegration.jboss4.LoaderRepositoryUrlUtil.UrlInfo;
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * A classpool in JBoss backed by a scoped (HierarchicalLoaderRepository) loader repository
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ScopedJBossClassPool extends JBossClassPool
-{
- final static LoaderRepositoryUrlUtil LOADER_REPOSITORY_UTIL = new LoaderRepositoryUrlUtil();
-
- private UrlInfo urlInfo;
- private ThreadLocal<ClassPool> lastPool = new ThreadLocal<ClassPool>();
-
- public ScopedJBossClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, File tmp, URL tmpURL)
- {
- super(cl, src, repository, tmp, tmpURL);
-
- boolean parentFirst = false;
- LoaderRepository loaderRepository = null;
- ClassLoader prnt = cl;
- while (prnt != null)
- {
- if (prnt instanceof RepositoryClassLoader)
- {
- loaderRepository = ((RepositoryClassLoader)prnt).getLoaderRepository();
- if (loaderRepository instanceof HeirarchicalLoaderRepository3)
- {
- parentFirst = ((HeirarchicalLoaderRepository3)loaderRepository).getUseParentFirst();
- }
- break;
- }
- prnt = SecurityActions.getParent(cl);
- }
-
- super.childFirstLookup = !parentFirst;
- }
-
-
- private HeirarchicalLoaderRepository3 getRepository()
- {
- ClassLoader cl = getClassLoader0();
- if (cl != null)
- {
- return (HeirarchicalLoaderRepository3)((RepositoryClassLoader)cl).getLoaderRepository();
- }
- return null;
- }
-
- private URL getResourceUrlForClass(String resourcename)
- {
- HeirarchicalLoaderRepository3 repo = getRepository();
- return repo.getResource(resourcename, super.getClassLoader());
- }
-
- private boolean isMine(URL url)
- {
- HeirarchicalLoaderRepository3 repo = getRepository();
- if (repo != null)
- {
- //The URL of the class loaded with my scoped classloader
- if (url != null)
- {
- urlInfo = LOADER_REPOSITORY_UTIL.getURLInfo(getRepository(), urlInfo);
-
- URL[] myUrls = urlInfo.getLocalUrls();
- String resource = url.toString();
- for (int i = 0 ; i < myUrls.length ; i++)
- {
- if (resource.indexOf(myUrls[i].toString()) >= 0)
- {
- return true;
- }
- }
- return false;
- }
- }
- return true;
- }
-
- public CtClass getCached(String classname)
- {
- if (classname == null)
- {
- return null;
- }
- if (isUnloadedClassLoader())
- {
- return null;
- }
-
- if (generatedClasses.get(classname) != null)
- {
- //It is a new class, and this callback is probably coming from the frozen check when creating a new nested class
- return super.getCached(classname);
- }
-
- //Is this from the scoped classloader itself of from the parent?
- String resourcename = getResourceName(classname);
- URL url = getResourceUrlForClass(resourcename);
- boolean isMine = isMine(url);
-
- if (isMine)
- {
- if (super.childFirstLookup)
- {
- //Parent delegation is false, attempt to get this class out of ourselves
- CtClass clazz = super.getCachedLocally(classname);
- if (clazz == null)
- {
- clazz = createCtClass(classname, false);
- if (clazz != null)
- {
- lockInCache(clazz);
- }
- }
- if (clazz != null)
- {
- return clazz;
- }
- }
- return super.getCached(classname);
- }
-
-
- try
- {
- ClassPool pool = getCorrectPoolForResource(classname, url);
- if (pool != lastPool.get())
- {
- lastPool.set(pool);
- return pool.get(classname);
- }
- }
- catch (NotFoundException e)
- {
- }
- catch(StackOverflowError e)
- {
- throw e;
- }
- finally
- {
- lastPool.set(null);
- }
-
- return null;
- }
-
- @Override
- protected boolean includeInGlobalSearch()
- {
- return false;
- }
-
- private ClassPool getCorrectPoolForResource(String classname, URL url)
- {
- synchronized(AspectManager.getRegisteredCLs())
- {
- //JBoss 5 has an extra NoAnnotationURLCLassLoader that is not on the default path, make sure that that is checked at the end
- //FIXME This needs revisiting/removing once the
- ArrayList<AOPClassPool> noAnnotationURLClassLoaderPools = null;
- String resource = url.toString();
- for(ClassPool pool : AspectManager.getRegisteredCLs().values())
- {
- AOPClassPool candidate = (AOPClassPool)pool;
- if (candidate.isUnloadedClassLoader())
- {
- AspectManager.instance().unregisterClassLoader(candidate.getClassLoader());
- continue;
- }
-
- if (candidate.getClassLoader() instanceof RepositoryClassLoader)
- {
- //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
- RepositoryClassLoader rcl = (RepositoryClassLoader)candidate.getClassLoader();
- URL[] urls = rcl.getClasspath();
-
- for (int i = 0 ; i < urls.length ; i++)
- {
- if (resource.indexOf(urls[i].getFile()) >= 0)
- {
- return candidate;
- }
- }
- }
- //FIXME Remove once we have the JBoss 5 version of pool
- else if (isInstanceOfNoAnnotationURLClassLoader(candidate.getClassLoader()))
- {
- if (noAnnotationURLClassLoaderPools == null)
- {
- noAnnotationURLClassLoaderPools = new ArrayList<AOPClassPool>();
- }
- noAnnotationURLClassLoaderPools.add(candidate);
- }
- }
-
- //FIXME Remove once we have the JBoss 5 version of pool
- if (noAnnotationURLClassLoaderPools != null)
- {
- for (AOPClassPool pool : noAnnotationURLClassLoaderPools)
- {
- try
- {
- pool.get(classname);
- return pool;
- }
- catch(NotFoundException ignoreTryNext)
- {
- }
- }
- }
- }
-
- return AOPClassPool.createAOPClassPool(ClassPool.getDefault(), AOPClassPoolRepository.getInstance());
- }
-
- /**
- * NoAnnotationURLCLassLoader lives in different packages in JBoss 4 and 5
- */
- private boolean isInstanceOfNoAnnotationURLClassLoader(ClassLoader loader)
- {
- Class<?> parent = loader.getClass();
- while (parent != null)
- {
- if ("NoAnnotationURLClassLoader".equals(parent.getSimpleName()))
- {
- return true;
- }
- parent = parent.getSuperclass();
- }
- return false;
- }
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ScopedRepositoryClassLoaderHelper.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss4;
-
-import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
-import org.jboss.mx.loading.LoaderRepository;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @autor adrian at jboss.org
- * @version $Revision$
- */
-public class ScopedRepositoryClassLoaderHelper
-{
- public static boolean isScopedClassLoader(ClassLoader loader)
- {
- boolean scoped = false;
- if (loader instanceof RepositoryClassLoader)
- {
- LoaderRepository repository = ((RepositoryClassLoader)loader).getLoaderRepository();
- if (repository instanceof HeirarchicalLoaderRepository3)
- {
- scoped = true;
- //HeirarchicalLoaderRepository3 hlr = (HeirarchicalLoaderRepository3)repository;
- //boolean parentFirst = hlr.getUseParentFirst();
- }
- }
- return scoped;
- }
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/SecurityActions.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,84 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss4;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-class SecurityActions
-{
- interface GetParentAction
- {
- ClassLoader getParent(ClassLoader loader);
-
- GetParentAction NON_PRIVILEGED = new GetParentAction()
- {
- public ClassLoader getParent(ClassLoader loader)
- {
- return loader.getParent();
- }
- };
-
- GetParentAction PRIVILEGED = new GetParentAction()
- {
- public ClassLoader getParent(final ClassLoader loader)
- {
- try
- {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>()
- {
- public ClassLoader run() throws Exception
- {
- return loader.getParent();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw new RuntimeException(e.getException());
- }
- }
- };
- }
-
- public static ClassLoader getParent(ClassLoader loader)
- {
- if (loader == null)
- {
- return null;
- }
- if (System.getSecurityManager() == null)
- {
- return GetParentAction.NON_PRIVILEGED.getParent(loader);
- }
- else
- {
- return GetParentAction.PRIVILEGED.getParent(loader);
- }
- }
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvoker.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,103 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss4;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-import org.jboss.logging.Logger;
-import org.jboss.mx.loading.RepositoryClassLoader;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ToClassInvoker
-{
- Logger logger = Logger.getLogger(this.getClass());
-
- public File tmpDir;
-
- public Object tmplock = new Object();
-
- public ToClassInvoker(File tmpDir)
- {
- this.tmpDir = tmpDir;
- }
-
- public Class<?> toClass(ToClassInvokerPoolReference pool, CtClass cc, String classFileName, ClassLoader loader, ProtectionDomain domain)
- throws CannotCompileException
- {
- boolean trace = logger.isTraceEnabled();
- pool.lockInCache(cc);
- final ClassLoader myloader = pool.getClassLoader();
- if (myloader == null || tmpDir == null)
- {
- if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " tmpDir:" + tmpDir + " default to superPool.toClass for " + cc.getName());
- Class<?> clazz = pool.superPoolToClass(cc, loader, domain);
- if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + clazz);
- return clazz;
- }
- Class<?> dynClass = null;
- try
- {
- File classFile = null;
- // Write the clas file to the tmpdir
- synchronized (tmplock)
- {
- classFile = new File(tmpDir, classFileName);
- if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " writing bytes to " + classFile);
- File pkgDirs = classFile.getParentFile();
- pkgDirs.mkdirs();
- FileOutputStream stream = new FileOutputStream(classFile);
- stream.write(cc.toBytecode());
- stream.flush();
- stream.close();
- classFile.deleteOnExit();
- }
- // We have to clear Blacklist caches or the class will never
- // be found
- //((UnifiedClassLoader)dcl).clearBlacklists();
- // To be backward compatible
- RepositoryClassLoader rcl = (RepositoryClassLoader)myloader;
- rcl.clearClassBlackList();
- rcl.clearResourceBlackList();
-
- // Now load the class through the cl
- dynClass = myloader.loadClass(cc.getName());
- if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + dynClass);
- return dynClass;
- }
- catch (Exception ex)
- {
- ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName());
- cfe.initCause(ex);
- throw cfe;
- }
- }
-
-}
Deleted: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/asintegration/jboss4/ToClassInvokerPoolReference.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,39 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss4;
-
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ToClassInvokerPoolReference
-{
- Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException;
- ClassLoader getClassLoader();
- void lockInCache(CtClass clazz);
-}
Modified: projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectDeployer.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectDeployer.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/main/java/org/jboss/aop/deployment/AspectDeployer.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.deployment;
import java.io.File;
@@ -35,7 +35,7 @@
import org.jboss.aop.AspectAnnotationLoader;
import org.jboss.aop.AspectManager;
import org.jboss.aop.AspectXmlLoader;
-import org.jboss.aop.asintegration.jboss4.ScopedRepositoryClassLoaderHelper;
+import org.jboss.classpool.plugins.ucl.ScopedRepositoryClassLoaderHelper;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.DeploymentState;
Modified: projects/aop/trunk/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java
===================================================================
--- projects/aop/trunk/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-jmx/src/test/java/org/jboss/test/aop/classpool/ucl/test/UclClassPoolTest.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.aop.classpool.ucl.test;
import java.io.File;
@@ -36,7 +36,8 @@
import javax.management.ObjectName;
import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.ucl.JBossUclDelegatingClassPoolFactory;
+import org.jboss.classpool.plugins.ucl.UclDelegatingClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
import org.jboss.mx.loading.HeirarchicalLoaderRepository3;
import org.jboss.mx.loading.LoaderRepository;
import org.jboss.mx.loading.RepositoryClassLoader;
@@ -80,7 +81,7 @@
try
{
MAIN_LOADER_REPOSITORY_OBJECT_NAME = new ObjectName("JMImplementation:name=Default,service=LoaderRepository");
- AspectManager.setClassPoolFactory(new JBossUclDelegatingClassPoolFactory(new File(".")));
+ ClassPoolRepository.getInstance().setClassPoolFactory(new UclDelegatingClassPoolFactory(new File(".")));
}
catch (Exception e)
{
Modified: projects/aop/trunk/asintegration-mc/pom.xml
===================================================================
--- projects/aop/trunk/asintegration-mc/pom.xml 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/pom.xml 2010-03-12 13:38:13 UTC (rev 102346)
@@ -146,6 +146,10 @@
<artifactId>javassist</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-jbosscl</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.aop</groupId>
<artifactId>jboss-aop</artifactId>
</dependency>
Modified: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderInitializer.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderInitializer.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderInitializer.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
import org.jboss.aop.AspectManager;
@@ -47,17 +47,17 @@
public static void unregisterLoaders(AspectManager manager, DeploymentUnit unit)
{
AOPClassLoaderScopingPolicyWithRegistry policy = (AOPClassLoaderScopingPolicyWithRegistry)AspectManager.getClassLoaderScopingPolicy();
- DomainRegistry registry = policy.getRegistry();
+ AOPDomainRegistry registry = policy.getRegistry();
if (unit.isTopLevel() || unit.getParent().getClassLoader() != unit.getClassLoader())
{
- registry.cleanupLoader(unit.getClassLoader());
+ registry.cleanupModule(registry.getModule(unit.getClassLoader()));
manager.unregisterClassLoader(unit.getClassLoader());
}
}
private static void registerLoaders(AOPClassLoaderScopingPolicyWithRegistry policy, DeploymentUnit unit)
{
- DomainRegistry registry = policy.getRegistry();
+ AOPDomainRegistry registry = policy.getRegistry();
if (!unit.isTopLevel())
{
registerLoaders(policy, unit.getParent());
@@ -80,9 +80,7 @@
domain = createDomain(registry, unit.getClassLoader(), module, unit);
}
- ClassLoader parentUnitLoader = unit.isTopLevel() ? null : unit.getParent().getClassLoader();
- registry.initMapsForLoader(unit.getClassLoader(), module, domain, parentUnitLoader);
-
+ registry.setDomain(domain);
policy.registerClassLoader(module, unit.getClassLoader());
}
}
@@ -105,12 +103,12 @@
}
- private static ScopedVFSClassLoaderDomain getDomain(DomainRegistry registry, DeploymentUnit unit)
+ private static ScopedVFSClassLoaderDomain getDomain(AOPDomainRegistry registry, DeploymentUnit unit)
{
return (ScopedVFSClassLoaderDomain)registry.getRegisteredDomain(unit.getClassLoader());
}
- private static ScopedVFSClassLoaderDomain createDomain(DomainRegistry registry, ClassLoader loader, Module module, DeploymentUnit unit)
+ private static ScopedVFSClassLoaderDomain createDomain(AOPDomainRegistry registry, ClassLoader loader, Module module, DeploymentUnit unit)
{
if (!module.getDeterminedDomainName().equals(ClassLoaderSystem.DEFAULT_DOMAIN_NAME))
{
Modified: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderScopingPolicyWithRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderScopingPolicyWithRegistry.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPClassLoaderScopingPolicyWithRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
import org.jboss.aop.classpool.AOPClassLoaderScopingPolicy;
@@ -31,7 +31,7 @@
*/
public interface AOPClassLoaderScopingPolicyWithRegistry extends AOPClassLoaderScopingPolicy
{
- DomainRegistry getRegistry();
+ AOPDomainRegistry getRegistry();
void registerClassLoader(Module module, ClassLoader loader);
Added: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPDomainRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPDomainRegistry.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPDomainRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
+
+import java.util.List;
+import java.util.concurrent.locks.ReadWriteLock;
+
+import org.jboss.aop.Domain;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classpool.plugins.jbosscl.DomainRegistry;
+
+/**
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public interface AOPDomainRegistry extends DomainRegistry
+{
+ void setDomain(ScopedVFSClassLoaderDomain domain);
+
+ Domain getRegisteredDomain(ClassLoader cl);
+
+ List<ScopedVFSClassLoaderDomain> getAOPDomainsForClassLoaderDomain(ClassLoaderDomain domain);
+
+ ReadWriteLock getAOPDomainsLockForClassLoaderDomain(ClassLoaderDomain domain);
+}
\ No newline at end of file
Property changes on: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPDomainRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPVFSClassLoaderDomainRegistry.java (from rev 102302, projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderDomainRegistry.java)
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPVFSClassLoaderDomainRegistry.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/AOPVFSClassLoaderDomainRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.jboss.aop.Domain;
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classpool.plugins.jbosscl.VFSClassLoaderDomainRegistry;
+
+/**
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @version $Revision: 1.1 $
+ */
+public class AOPVFSClassLoaderDomainRegistry extends VFSClassLoaderDomainRegistry implements AOPDomainRegistry
+{
+ /** aopDomains by classloader */
+ private Map<ClassLoader, ScopedVFSClassLoaderDomain> aopDomainsByClassLoader = new WeakHashMap<ClassLoader, ScopedVFSClassLoaderDomain>();
+
+ /** aopDomains by classloader domain */
+ private Map<ClassLoaderDomain, List<ScopedVFSClassLoaderDomain>> aopDomainsByClassLoaderDomain = new WeakHashMap<ClassLoaderDomain, List<ScopedVFSClassLoaderDomain>>();
+
+ private Map<ClassLoaderDomain, ReadWriteLock> aopDomainsLocksByClassLoaderDomain = new WeakHashMap<ClassLoaderDomain, ReadWriteLock>();
+
+ private ScopedVFSClassLoaderDomain initDomain = null;
+
+ public List<ScopedVFSClassLoaderDomain> getAOPDomainsForClassLoaderDomain(ClassLoaderDomain domain)
+ {
+ List<ScopedVFSClassLoaderDomain> domains = aopDomainsByClassLoaderDomain.get(domain);
+ if (domains != null)
+ {
+ return domains;
+ }
+ return Collections.emptyList();
+ }
+
+ public ReadWriteLock getAOPDomainsLockForClassLoaderDomain(ClassLoaderDomain domain)
+ {
+ return aopDomainsLocksByClassLoaderDomain.get(domain);
+ }
+
+ public synchronized Domain getRegisteredDomain(ClassLoader cl)
+ {
+ return aopDomainsByClassLoader.get(cl);
+ }
+
+
+ public synchronized void setDomain(ScopedVFSClassLoaderDomain domain)
+ {
+ this.initDomain = domain;
+ }
+
+ @Override
+ protected void validateInitMaps(ClassLoader loader, ClassLoaderDomain loaderDomain, Module module, ClassLoader parentUnitLoader)
+ {
+ if (loaderDomain == null && initDomain != null)
+ {
+ throw new IllegalStateException("Have " + domain + " but no classloader domain");
+ }
+ }
+
+ @Override
+ protected void initMapsDone(ClassLoader loader, ClassLoaderDomain loaderDomain, Module module, ClassLoader parentUnitLoader)
+ {
+ if (initDomain != null)
+ {
+ aopDomainsByClassLoader.put(loader, initDomain);
+
+ ReadWriteLock lock = aopDomainsLocksByClassLoaderDomain.get(loaderDomain);
+ if (lock == null)
+ {
+ lock = new ReentrantReadWriteLock();
+ aopDomainsLocksByClassLoaderDomain.put(loaderDomain, lock);
+ }
+
+ lock.writeLock().lock();
+ try
+ {
+ List<ScopedVFSClassLoaderDomain> aopDomains = aopDomainsByClassLoaderDomain.get(loaderDomain);
+ if (aopDomains == null)
+ {
+ synchronized (aopDomainsByClassLoaderDomain)
+ {
+ aopDomains = new CopyOnWriteArrayList<ScopedVFSClassLoaderDomain>();
+ if (!aopDomains.contains(loaderDomain))
+ {
+ aopDomainsByClassLoaderDomain.put(loaderDomain, aopDomains);
+ }
+ }
+ }
+ aopDomains.add(initDomain);
+ }
+ finally
+ {
+ lock.writeLock().unlock();
+ }
+ }
+ }
+
+ @Override
+ public synchronized void cleanupLoaderDone(ClassLoader loader, ClassLoaderDomain loaderDomain, int domainReferences)
+ {
+ if (loaderDomain != null)
+ {
+ if (domainReferences == 0)
+ {
+ //aopDomainsByClassLoaderDomain.remove(loaderDomain);
+ }
+ ScopedVFSClassLoaderDomain aopDomain = aopDomainsByClassLoader.remove(loader);
+ List<ScopedVFSClassLoaderDomain> aopDomains = aopDomainsByClassLoaderDomain.get(loaderDomain);
+ if (aopDomains != null)
+ {
+ aopDomains.remove(aopDomain);
+ }
+ if (aopDomain != null)
+ {
+ aopDomain.getParent().unsubscribeSubDomain(aopDomain);
+ }
+ }
+ aopDomainsByClassLoader.remove(loader);
+ }
+}
\ No newline at end of file
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/DomainRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/DomainRegistry.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/DomainRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,60 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.util.List;
-import java.util.concurrent.locks.ReadWriteLock;
-
-import org.jboss.aop.Domain;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.dependency.Module;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface DomainRegistry
-{
- ClassLoaderSystem getSystem();
-
- ClassLoaderDomain getDefaultDomain();
-
- boolean initMapsForLoader(ClassLoader loader, Module module, ScopedVFSClassLoaderDomain domain, ClassLoader parentUnitLoader);
-
- void cleanupLoader(ClassLoader loader);
-
- Domain getRegisteredDomain(ClassLoader cl);
-
- ClassLoaderDomain getClassLoaderDomainForLoader(ClassLoader cl);
-
- ClassLoader getParentUnitLoader(ClassLoader loader);
-
- Module getModule(ClassLoader loader);
-
- ClassLoader getClassLoader(Module module);
-
- List<ScopedVFSClassLoaderDomain> getAOPDomainsForClassLoaderDomain(ClassLoaderDomain domain);
-
- ReadWriteLock getAOPDomainsLockForClassLoaderDomain(ClassLoaderDomain domain);
-}
\ No newline at end of file
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,76 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.net.URL;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.classpool.AOPClassPool;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class JBoss5ClassPool extends AOPClassPool implements ToClassInvokerPoolReference
-{
- protected ToClassInvoker toClassInvoker = null;
-
- boolean closed;
-
- protected JBoss5ClassPool(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository, URL tmpURL)
- {
- super(cl, src, repository);
- toClassInvoker = new ToClassInvoker(tmpURL);
- }
-
- protected JBoss5ClassPool(ClassPool src, ScopedClassPoolRepository repository)
- {
- super(src, repository);
- }
-
- public boolean isUnloadedClassLoader()
- {
- return closed;
- }
-
- public void close()
- {
- closed = true;
- super.close();
- }
-
- public Class<?> toClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
- {
- return toClassInvoker.toClass(this, cc, getResourceName(cc.getName()), loader, domain);
- }
-
- public Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
- {
- return super.toClass(cc, loader, domain);
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5ClassPoolFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,102 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss5;
-
-import java.net.URL;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AbstractJBossClassPoolFactory;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.RealClassLoader;
-import org.jboss.classloading.spi.dependency.Module;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @author adrian at jboss.org
- * @version $Revision: 64815 $
- **/
-public class JBoss5ClassPoolFactory extends AbstractJBossClassPoolFactory implements ScopedClassPoolFactory
-{
- private DomainRegistry registry;
-
- public JBoss5ClassPoolFactory(DomainRegistry registry)
- {
- this.registry = registry;
- }
-
- public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
- {
- ClassPool parent = getCreateParentClassPools(cl, src, repository);
-
- ScopedClassPool pool = null;
-
- if (cl instanceof RealClassLoader)
- {
- Module module = registry.getModule(cl);
- if (module != null && module.getDeterminedParentDomainName() != null)
- {
- //It is scoped
- ClassLoaderSystem sys = registry.getSystem();
- ClassLoaderDomain domain = sys.getDomain(module.getDeterminedDomainName());
- boolean parentFirst = module.isJ2seClassLoadingCompliance();
- ClassPool parentDomainPool = getParentUnitClassPool(cl);
- pool = new ScopedJBoss5ClassPool(cl, parent, parentDomainPool, repository, getTempURL(module), parentFirst, domain);
- }
- else
- {
- pool = new JBoss5ClassPool(cl, parent, repository, getTempURL(module));
- }
- }
-
- if (pool == null)
- {
- pool = new AOPClassPool(cl, parent, repository);
- }
- log.debug("Created pool " + pool + " for loader " + cl);
-
- return pool;
- }
-
- private ClassPool getParentUnitClassPool(ClassLoader cl)
- {
- ClassLoader parent = registry.getParentUnitLoader(cl);
- return AspectManager.instance().registerClassLoader(parent);
- }
-
-
- private URL getTempURL(Module module)
- {
- if (module == null)
- return null;
-
- return module.getDynamicClassRoot();
- }
-}
Modified: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/JBoss5Integration.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
import java.io.File;
@@ -29,14 +29,17 @@
import java.util.Set;
import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPool;
-import javassist.scopedpool.ScopedClassPoolFactory;
-import javassist.scopedpool.ScopedClassPoolRepository;
import org.jboss.aop.AspectManager;
import org.jboss.aop.asintegration.JBossIntegration;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloading.spi.RealClassLoader;
+import org.jboss.classpool.plugins.jbosscl.JBoss5ClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPool;
+import org.jboss.classpool.scoped.ScopedClassPoolFactory;
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.classpool.spi.AbstractClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
/**
*
@@ -120,14 +123,24 @@
return policy;
}
- public DomainRegistry getDomainRegistry()
+ public AOPDomainRegistry getDomainRegistry()
{
return policy.getRegistry();
}
public void setClassPoolFactory(ScopedClassPoolFactory factory)
{
- this.delegateClassPoolFactory = factory;
+ if (factory instanceof AbstractClassPoolFactory)
+ {
+ ClassPoolRepository.getInstance().setClassPoolFactory((AbstractClassPoolFactory) factory);
+ //AOPClassPoolFactory.setDelegateClassPoolFactory();
+ this.delegateClassPoolFactory = factory;//new AOPClassPoolFactory();
+ }
+ else
+ {
+ this.delegateClassPoolFactory = factory;
+ }
+ ClassPoolRepository.getInstance().setClassPoolFactory(delegateClassPoolFactory);
}
public synchronized ScopedClassPoolFactory createScopedClassPoolFactory(File tmpDir) throws Exception
@@ -135,6 +148,7 @@
if (delegateClassPoolFactory == null)
{
delegateClassPoolFactory = new JBoss5ClassPoolFactory(getDomainRegistry());
+ ClassPoolRepository.getInstance().setClassPoolFactory(delegateClassPoolFactory);
}
return this;
}
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/RegisterModuleCallback.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/RegisterModuleCallback.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/RegisterModuleCallback.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,68 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.logging.Logger;
-
-/**
- * Use with org.jboss.aop.classpool.jbosscl.JBossClDelegatingClassPoolFactory
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class RegisterModuleCallback
-{
- Logger logger = Logger.getLogger(this.getClass());
-
- private Set<Module> registeredModules = new HashSet<Module>();
- private Set<Module> unregisteredModules = new HashSet<Module>();
-
- public synchronized void addModule(Module module)
- {
- logger.debug("Adding module " + module);
- unregisteredModules.add(module);
- }
-
- public synchronized void removeModule(Module module)
- {
- logger.debug("Removing module " + module);
- registeredModules.remove(module);
- unregisteredModules.remove(module);
- }
-
- public synchronized Set<Module> getUnregisteredModules()
- {
- return Collections.unmodifiableSet(new HashSet<Module>(unregisteredModules));
- }
-
- public synchronized void registerModule(Module module)
- {
- logger.debug("Registering module " + module);
- registeredModules.add(module);
- unregisteredModules.remove(module);
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedJBoss5ClassPool.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,401 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.lang.ref.WeakReference;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.NotFoundException;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
-import org.jboss.aop.classpool.AOPClassPoolRepository;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.Loader;
-import org.jboss.classloading.spi.RealClassLoader;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ScopedJBoss5ClassPool extends JBoss5ClassPool
-{
- ThreadLocal<ClassPool> lastPool = new ThreadLocal<ClassPool>();
- WeakReference<ClassLoaderDomain> domainRef;
- /** The classpool representing the parent domain of this one */
- ClassPool parentDomainPool;
-
- public ScopedJBoss5ClassPool(ClassLoader cl, ClassPool src, ClassPool parentDomainPool, ScopedClassPoolRepository repository,
- URL tmpURL, boolean parentFirst, ClassLoaderDomain domain)
- {
- super(cl, src, repository, tmpURL);
- super.childFirstLookup = !parentFirst;
- this.parentDomainPool = parentDomainPool;
- this.domainRef = new WeakReference<ClassLoaderDomain>(domain);
-
- logger.debug("Created new ScopedJBoss5ClasPool for " + cl + ", with parent: " + src + ", parentDomain: " + parentDomainPool + ", parentFirst: " + parentFirst);
- }
-
- private URL getResourceUrlForClass(String resourcename)
- {
- ClassLoaderDomain domain = domainRef.get();
- return domain.getResource(resourcename);
- }
-
- private boolean isMine(URL myURL, String resourceName)
- {
- if (myURL == null)
- {
- return false;
- }
-
- ClassLoaderDomain domain = domainRef.get();
- Loader parent = domain.getParent();
- URL parentURL = parent.getResource(resourceName);
-
- if (parentURL == null)
- {
- return true;
- }
-
- if (!myURL.equals(parentURL))
- {
- return true;
- }
-
- return false;
- }
-
-
- @Override
- protected synchronized CtClass get0(String classname, boolean useCache) throws NotFoundException
- {
- CtClass clazz = null;
- if (useCache)
- {
- clazz = getCached(classname);
- if (clazz != null)
- return clazz;
- }
-
- if (!childFirstLookup)
- {
- if (parentDomainPool != null)
- {
- clazz = performGet(parentDomainPool, classname);
- if (clazz != null)
- {
- return clazz;
- }
- }
- if (parent != null)
- {
- clazz = performGet(parent, classname);
- if (clazz != null)
- {
- return clazz;
- }
- }
- }
-
- clazz = createCtClass(classname, useCache);
- if (clazz != null)
- {
- // clazz.getName() != classname if classname is "[L<name>;".
- if (useCache)
- cacheCtClass(clazz.getName(), clazz, false);
-
- return clazz;
- }
-
- if (childFirstLookup)
- {
- if (parent != null)
- {
- clazz = performGet(parent, classname);
- if (clazz != null)
- {
- return clazz;
- }
- }
- if (parentDomainPool != null)
- {
- clazz = performGet(parentDomainPool, classname);
- if (clazz != null)
- {
- return clazz;
- }
- }
- }
-
- return clazz;
- }
-
- private CtClass performGet(ClassPool pool, String classname)
- {
- try
- {
- //Want to avoid calling get() if possible since that creates NotFoundExceptions
- //on misses which is expensive
- if (pool instanceof AOPClassPool)
- {
- return ((AOPClassPool)pool).internalGet0(classname, true);
- }
- else
- {
- return pool.get(classname);
- }
- }
- catch (NotFoundException e)
- {
- return null;
- }
- }
-
-
- public CtClass getCached(String classname)
- {
- boolean trace = logger.isTraceEnabled();
-
- if (trace)
- {
- logger.trace("getCached() " + classname);
- }
-
- if (classname == null)
- {
- if (trace)
- {
- logger.trace("getCached() returning null (classname == null)");
- }
- return null;
- }
- if (isUnloadedClassLoader())
- {
- if (trace)
- {
- logger.trace("getCached() returning null (unloaded)");
- }
- return null;
- }
-
- if (generatedClasses.get(classname) != null)
- {
- //It is a new class, and this callback is probably coming from the frozen check when creating a new nested class
- if (trace)
- {
- logger.trace("getCached() In generated classes - check super");
- }
- return super.getCached(classname);
- }
-
- //Is this from the scoped classloader itself of from the parent?
- String resourcename = getResourceName(classname);
- URL url = getResourceUrlForClass(resourcename);
-
- if (isMine(url, resourcename))
- {
- if (super.childFirstLookup)
- {
- //Parent delegation is false, attempt to get this class out of ourselves
- CtClass clazz = super.getCachedLocally(classname);
- if (clazz == null)
- {
- if (trace)
- {
- logger.trace("getCached() Creating my class " + classname);
- }
- clazz = createCtClass(classname, false);
- if (clazz != null)
- {
- lockInCache(clazz);
- }
- }
- if (clazz != null)
- {
- if (trace)
- {
- logger.trace("getCached() Returning my class " + classname);
- }
- return clazz;
- }
- }
- if (trace)
- {
- logger.trace("getCached() Checking super for my class " + classname);
- }
- return super.getCached(classname);
- }
- else if (url == null)
- {
- if (trace)
- {
- logger.trace("getCached() Checking super for my class " + classname + " (no url)");
- }
- return super.getCached(classname);
- }
-
-
- try
- {
- ClassPool pool = getCorrectPoolForResource(classname, resourcename, url, trace);
- if (trace)
- {
- logger.trace("getCached() Found pool for class " + classname + " " + pool);
- }
- if (pool != lastPool.get())
- {
- lastPool.set(pool);
- CtClass found = pool.get(classname);
- if (trace)
- {
- logger.trace("getCached() Found clazz " + classname + " in " + pool + " : " + found);
- }
- return found;
- }
- }
- catch (NotFoundException e)
- {
- }
- catch(StackOverflowError e)
- {
- throw e;
- }
- finally
- {
- lastPool.set(null);
- }
-
- return null;
- }
-
- @Override
- protected boolean includeInGlobalSearch()
- {
- return false;
- }
-
- private ClassPool getCorrectPoolForResource(String classname, String resourceName, URL url, boolean trace)
- {
- synchronized(AspectManager.getRegisteredCLs())
- {
- //JBoss 5 has an extra NoAnnotationURLCLassLoader that is not on the default path, make sure that that is checked at the end
- //FIXME This needs revisiting/removing once the
- ArrayList<ClassPool> noAnnotationURLClassLoaderPools = null;
-
- for(Iterator<ClassPool> it = AspectManager.getRegisteredCLs().values().iterator() ; it.hasNext() ; )
- {
- AOPClassPool candidate = (AOPClassPool)it.next();
- if (candidate.isUnloadedClassLoader())
- {
- AspectManager.instance().unregisterClassLoader(candidate.getClassLoader());
- continue;
- }
-
- if (candidate.getClassLoader() instanceof RealClassLoader)
- {
- //Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
- RealClassLoader bcl = (RealClassLoader)candidate.getClassLoader();
- URL foundUrl = bcl.getResourceLocally(resourceName);
- if (foundUrl != null)
- {
- if (url.equals(foundUrl))
- {
- if (trace)
- {
- logger.trace("getCorrectPoolForResource() Candidate classloader " + bcl + " has local resource " + foundUrl);
- }
- return candidate;
- }
- }
- }
- //FIXME Remove once we have the JBoss 5 version of pool
- else if (isInstanceOfNoAnnotationURLClassLoader(candidate.getClassLoader()))
- {
- if (noAnnotationURLClassLoaderPools == null)
- {
- noAnnotationURLClassLoaderPools = new ArrayList<ClassPool>();
- }
- noAnnotationURLClassLoaderPools.add(candidate);
- }
- }
-
- //FIXME Remove once we have the JBoss 5 version of pool
- if (noAnnotationURLClassLoaderPools != null)
- {
- for (ClassPool pool : noAnnotationURLClassLoaderPools)
- {
- try
- {
- pool.get(classname);
- if (trace)
- {
- logger.trace("getCorrectPoolForResource(() Found " + classname + " (no url)");
- }
- return pool;
- }
- catch(NotFoundException ignoreTryNext)
- {
- }
- }
- }
- }
- return createTempPool();
- }
-
- private ClassPool createTempPool()
- {
- //Rememeber that the stuff in jboss5/lib goes in a child classloader of the default classloader. We need
- //to make this the parent of the temp classloader
- ClassLoader aopLoader = AspectManager.class.getClassLoader();
- ClassPool pool = AspectManager.instance().registerClassLoader(aopLoader);
- return AOPClassPool.createAOPClassPool(pool, AOPClassPoolRepository.getInstance());
- }
-
- /**
- * NoAnnotationURLCLassLoader lives in different packages in JBoss 4 and 5
- */
- private boolean isInstanceOfNoAnnotationURLClassLoader(ClassLoader loader)
- {
- if (loader == null)
- {
- return false;
- }
- Class<?> parent = loader.getClass();
- while (parent != null)
- {
- if ("NoAnnotationURLClassLoader".equals(parent.getSimpleName()))
- {
- return true;
- }
- parent = parent.getSuperclass();
- }
- return false;
- }
-
-}
Modified: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ScopedVFSClassLoaderDomain.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.aop.asintegration.jboss5;
@@ -70,10 +70,10 @@
public class ScopedVFSClassLoaderDomain extends ScopedClassLoaderDomain
{
WeakReference<ClassLoaderDomain> classLoaderDomainRef;
- DomainRegistry registry;
+ AOPDomainRegistry registry;
public ScopedVFSClassLoaderDomain(ClassLoader loader, String name, boolean parentDelegation, AspectManager manager, boolean parentFirst,
- ClassLoaderDomain classLoaderDomain, DomainRegistry registry)
+ ClassLoaderDomain classLoaderDomain, AOPDomainRegistry registry)
{
super(loader, name, parentDelegation, manager, parentFirst);
classLoaderDomainRef = new WeakReference<ClassLoaderDomain>(classLoaderDomain);
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvoker.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,102 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-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;
-
-/**
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ToClassInvoker
-{
- Logger logger = Logger.getLogger(this.getClass());
-
- public URL tempURL;
-
- public Object tmplock = new Object();
-
- public ToClassInvoker(URL tempURL)
- {
- this.tempURL = tempURL;
- }
-
- public Class<?> toClass(ToClassInvokerPoolReference pool, CtClass cc, String classFileName, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException
- {
- boolean trace = logger.isTraceEnabled();
- pool.lockInCache(cc);
- final ClassLoader myloader = pool.getClassLoader();
- if (myloader == null || tempURL == null)
- {
- if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " tempURL:" + tempURL + " default to superPool.toClass for " + cc.getName());
- Class<?> clazz = pool.superPoolToClass(cc, loader, domain);
- if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + clazz);
- return clazz;
- }
-
- try
- {
- URL outputURL = new URL(tempURL.toString() + "/" + classFileName);
- //Write the classfile to the temporary url
- synchronized (tmplock)
- {
- if (trace) logger.trace(this + " " + pool + ".toClass() myloader:" + myloader + " writing bytes to " + tempURL);
- ByteArrayOutputStream byteout = new ByteArrayOutputStream();
- BufferedOutputStream out = new BufferedOutputStream(byteout);
- out.write(cc.toBytecode());
- out.flush();
- out.close();
-
- byte[] classBytes = byteout.toByteArray();
- VirtualFile classFile = VFS.getChild(outputURL);
- VFSUtils.writeFile(classFile, classBytes);
-
- if (myloader instanceof RealClassLoader)
- {
- ((RealClassLoader)myloader).clearBlackList(classFileName);
- }
-
- Class<?> clazz = myloader.loadClass(cc.getName());
- if (trace) logger.trace(this + " " + pool + " myloader:" + myloader + " created class:" + clazz);
- return clazz;
- }
- }
- catch(Exception e)
- {
- ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName() + " on " + this + " loader:" + myloader);
- cfe.initCause(e);
- throw cfe;
- }
- }
-}
\ No newline at end of file
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvokerPoolReference.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvokerPoolReference.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/ToClassInvokerPoolReference.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,40 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.security.ProtectionDomain;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-
-/**
- * Exposes methods on ClassPool needed by JBoss5ClassPool
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface ToClassInvokerPoolReference
-{
- Class<?> superPoolToClass(CtClass cc, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException;
- ClassLoader getClassLoader();
- void lockInCache(CtClass clazz);
-}
Deleted: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderDomainRegistry.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderDomainRegistry.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderDomainRegistry.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,290 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.aop.asintegration.jboss5;
-
-import java.lang.ref.WeakReference;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.jboss.aop.Domain;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.dependency.Module;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class VFSClassLoaderDomainRegistry implements DomainRegistry
-{
- final static ClassLoaderDomain domain = new ClassLoaderDomain("NOT_USED_PLACEHOLDER");
-
- private ClassLoaderSystem system;
-
- private ClassLoaderDomain defaultDomain;
-
- /** classloader domains by their classloaders */
- private Map<ClassLoader, WeakReference<ClassLoaderDomain>> classLoaderDomainsByLoader = new WeakHashMap<ClassLoader, WeakReference<ClassLoaderDomain>>();
-
- /** aopDomains by classloader */
- private Map<ClassLoader, ScopedVFSClassLoaderDomain> aopDomainsByClassLoader = new WeakHashMap<ClassLoader, ScopedVFSClassLoaderDomain>();
-
- /** aopDomains by classloader domain */
- private Map<ClassLoaderDomain, List<ScopedVFSClassLoaderDomain>> aopDomainsByClassLoaderDomain = new WeakHashMap<ClassLoaderDomain, List<ScopedVFSClassLoaderDomain>>();
-
- private Map<ClassLoaderDomain, ReadWriteLock> aopDomainsLocksByClassLoaderDomain = new WeakHashMap<ClassLoaderDomain, ReadWriteLock>();
-
-
- /** parent deployment unit classloaders indexed by children */
- private Map<ClassLoader, WeakReference<ClassLoader>> classLoaderUnitParents = new WeakHashMap<ClassLoader, WeakReference<ClassLoader>>();
-
- /** Modules by classloader */
- private Map<ClassLoader, WeakReference<Module>> classLoaderModules = new WeakHashMap<ClassLoader, WeakReference<Module>>();
-
- /** classloaders by module */
- private Map<Module, WeakReference<ClassLoader>> moduleClassLoaders = new WeakHashMap<Module, WeakReference<ClassLoader>>();
-
- private Map<ClassLoaderDomain, Integer> classLoaderDomainReferenceCounts = new WeakHashMap<ClassLoaderDomain, Integer>();
-
- /**
- * Needed for the tests, not expected to be needed in production
- */
- public void setSystem(ClassLoaderSystem system)
- {
- this.system = system;
- }
-
- /**
- * Needed for the tests, not expected to be needed in production
- */
- public void setDefaultDomain(ClassLoaderDomain domain)
- {
- this.defaultDomain = domain;
- }
-
- public synchronized ClassLoaderSystem getSystem()
- {
- if (system == null)
- {
- system = ClassLoaderSystem.getInstance();
- }
- return system;
- }
-
- public synchronized ClassLoaderDomain getDefaultDomain()
- {
- if (defaultDomain == null)
- {
- defaultDomain = getSystem().getDefaultDomain();
- }
- return defaultDomain;
- }
-
- public synchronized boolean initMapsForLoader(ClassLoader loader, Module module, ScopedVFSClassLoaderDomain domain, ClassLoader parentUnitLoader)
- {
- if (loader == parentUnitLoader)
- {
- throw new IllegalArgumentException("initMapsForLoader() should only be called if parentUnitLoader is different from loader");
- }
- ClassLoaderSystem system = getSystem();
-
- String domainName = module.getDeterminedDomainName();
- ClassLoaderDomain clDomain = system.getDomain(domainName);
- if (clDomain == null && domain != null)
- {
- throw new IllegalStateException("Have " + domain + " but no classloader domain");
- }
-
- boolean ret = false;
- if (!classLoaderDomainsByLoader.containsKey(loader))
- {
- Integer count = classLoaderDomainReferenceCounts.get(clDomain);
- int cnt = count == null ? 0 : count.intValue();
- classLoaderDomainReferenceCounts.put(clDomain, cnt);
-
- classLoaderDomainsByLoader.put(loader, new WeakReference<ClassLoaderDomain>(clDomain));
- classLoaderUnitParents.put(loader, new WeakReference<ClassLoader>(parentUnitLoader));
- classLoaderModules.put(loader, new WeakReference<Module>(module));
- moduleClassLoaders.put(module, new WeakReference<ClassLoader>(loader));
- ret = true;
- if (domain != null)
- {
- aopDomainsByClassLoader.put(loader, domain);
-
- ReadWriteLock lock = aopDomainsLocksByClassLoaderDomain.get(clDomain);
- if (lock == null)
- {
- lock = new ReentrantReadWriteLock();
- aopDomainsLocksByClassLoaderDomain.put(clDomain, lock);
- }
-
- lock.writeLock().lock();
- try
- {
- List<ScopedVFSClassLoaderDomain> aopDomains = aopDomainsByClassLoaderDomain.get(clDomain);
- if (aopDomains == null)
- {
- synchronized (aopDomainsByClassLoaderDomain)
- {
- aopDomains = new CopyOnWriteArrayList<ScopedVFSClassLoaderDomain>();
- if (!aopDomains.contains(clDomain))
- {
- aopDomainsByClassLoaderDomain.put(clDomain, aopDomains);
- }
- }
- }
- aopDomains.add(domain);
- }
- finally
- {
- lock.writeLock().unlock();
- }
- }
- }
-
-
- return ret;
- }
-
- public synchronized void cleanupLoader(ClassLoader loader)
- {
- WeakReference<ClassLoaderDomain> clDomainRef = classLoaderDomainsByLoader.remove(loader);
- ClassLoaderDomain clDomain = clDomainRef == null ? null : clDomainRef.get();
- if (clDomain != null)
- {
- Integer count = classLoaderDomainReferenceCounts.get(clDomain);
- int cnt = count == null ? 0 : count.intValue();
- if (cnt > 0)
- {
- cnt--;
- }
- if (cnt == 0)
- {
- //aopDomainsByClassLoaderDomain.remove(clDomain);
- classLoaderDomainReferenceCounts.remove(clDomain);
- }
- else
- {
- classLoaderDomainReferenceCounts.put(clDomain, ++cnt);
- }
- ScopedVFSClassLoaderDomain aopDomain = aopDomainsByClassLoader.remove(loader);
- classLoaderUnitParents.remove(loader);
- WeakReference<Module> moduleRef = classLoaderModules.remove(loader);
- if (moduleRef != null)
- {
- Module module = moduleRef.get();
- if (module != null)
- {
- moduleClassLoaders.remove(module);
- }
- }
-
- List<ScopedVFSClassLoaderDomain> aopDomains = aopDomainsByClassLoaderDomain.get(clDomain);
- if (aopDomains != null)
- {
- aopDomains.remove(aopDomain);
- }
- if (aopDomain != null)
- {
- aopDomain.getParent().unsubscribeSubDomain(aopDomain);
- }
- }
- aopDomainsByClassLoader.remove(loader);
- }
-
- public synchronized Domain getRegisteredDomain(ClassLoader cl)
- {
- return aopDomainsByClassLoader.get(cl);
- }
-
- public synchronized ClassLoaderDomain getClassLoaderDomainForLoader(ClassLoader cl)
- {
- WeakReference<ClassLoaderDomain> clDomainRef = classLoaderDomainsByLoader.get(cl);
- if (clDomainRef != null)
- {
- return clDomainRef.get();
- }
-
- ClassLoader parent = SecurityActions.getParent(cl);
- if (parent != null)
- {
- ClassLoaderDomain domain = getClassLoaderDomainForLoader(parent);
- if (domain != null)
- {
- classLoaderDomainsByLoader.put(parent, new WeakReference<ClassLoaderDomain>(domain));
- return domain;
- }
- }
- return null;
- }
-
- public synchronized ClassLoader getParentUnitLoader(ClassLoader loader)
- {
- WeakReference<ClassLoader> parentRef = classLoaderUnitParents.get(loader);
- if (parentRef != null)
- {
- return parentRef.get();
- }
- return null;
- }
-
- public synchronized Module getModule(ClassLoader loader)
- {
- WeakReference<Module> moduleRef = classLoaderModules.get(loader);
- if (moduleRef != null)
- {
- return moduleRef.get();
- }
- return null;
- }
-
- public synchronized ClassLoader getClassLoader(Module module)
- {
- WeakReference<ClassLoader> loaderRef = moduleClassLoaders.get(module);
- if (loaderRef != null)
- {
- return loaderRef.get();
- }
- return null;
- }
-
- public List<ScopedVFSClassLoaderDomain> getAOPDomainsForClassLoaderDomain(ClassLoaderDomain domain)
- {
- List<ScopedVFSClassLoaderDomain> domains = aopDomainsByClassLoaderDomain.get(domain);
- if (domains != null)
- {
- return domains;
- }
- return Collections.emptyList();
- }
-
- public ReadWriteLock getAOPDomainsLockForClassLoaderDomain(ClassLoaderDomain domain)
- {
- return aopDomainsLocksByClassLoaderDomain.get(domain);
- }
-}
Modified: projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/main/java/org/jboss/aop/asintegration/jboss5/VFSClassLoaderScopingPolicy.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.aop.asintegration.jboss5;
import java.util.HashMap;
@@ -38,9 +38,9 @@
public class VFSClassLoaderScopingPolicy implements AOPClassLoaderScopingPolicyWithRegistry
{
static Logger log = Logger.getLogger(VFSClassLoaderScopingPolicy.class);
- DomainRegistry registry = new VFSClassLoaderDomainRegistry();
+ AOPDomainRegistry registry = new AOPVFSClassLoaderDomainRegistry();
- public DomainRegistry getRegistry()
+ public AOPDomainRegistry getRegistry()
{
return registry;
}
Modified: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/aop/integration/junit/AOPIntegrationTest.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/aop/integration/junit/AOPIntegrationTest.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/aop/integration/junit/AOPIntegrationTest.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -80,6 +80,12 @@
super.setUp();
configureLogging();
}
+
+ protected void configureLogging()
+ {
+ super.configureLogging();
+ enableTrace("org.jboss.classpool");
+ }
/**
* Get the delegate
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/AlwaysWritablePermissionCollectionTestPolicyPlugin.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/AlwaysWritablePermissionCollectionTestPolicyPlugin.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/AlwaysWritablePermissionCollectionTestPolicyPlugin.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,118 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.SecurityPermission;
-import java.util.Enumeration;
-import java.util.PropertyPermission;
-
-import org.jboss.test.security.TestsPolicyPlugin;
-
-/**
- * The original TestPolicyPlugin reuses the underlying PermissionCollection. This causes problems
- * for tests creating several ProtectionDomains, since the ProtectionDomain's constructor
- * marks the PolicyCollection as read-only so we get errors
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class AlwaysWritablePermissionCollectionTestPolicyPlugin extends TestsPolicyPlugin
-{
- public AlwaysWritablePermissionCollectionTestPolicyPlugin(Class<?> clazz)
- {
- super(clazz);
- }
-
- public synchronized PermissionCollection getPermissions(CodeSource codesource)
- {
- return new AlwaysWritablePermissionCollection(super.getPermissions(codesource));
- }
-
- public static void initialisePlugin()
- {
- System.setProperty("org.jboss.test.security.PolicyPlugin", AlwaysWritablePermissionCollectionTestPolicyPlugin.class.getName());
- }
-
- public static void cleanupPlugin()
- {
- System.clearProperty("org.jboss.test.security.PolicyPlugin");
- }
-
- private static class AlwaysWritablePermissionCollection extends PermissionCollection
- {
- private static final long serialVersionUID = 1L;
-
- volatile PermissionCollection lastDelegate;
- volatile PermissionCollection delegate;
-
- final static Permission GET_POLICY = new SecurityPermission("getPolicy");
- final static Permission PARENT_PKGS = new PropertyPermission("jboss.test.parent.pkgs", "read");
-
- private AlwaysWritablePermissionCollection(PermissionCollection delegate)
- {
- this.delegate = delegate;
- }
-
- public void add(Permission permission)
- {
- delegate.add(permission);
- }
-
- public Enumeration<Permission> elements()
- {
- return delegate.elements();
- }
-
- public boolean equals(Object obj)
- {
- return delegate.equals(obj);
- }
-
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
- public boolean implies(Permission permission)
- {
- return delegate.implies(permission);
- }
-
- public boolean isReadOnly()
- {
- return delegate.isReadOnly();
- }
-
- public void setReadOnly()
- {
- //ignore
- }
-
- public String toString()
- {
- return delegate.toString();
- }
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/BundleInfoBuilder.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/BundleInfoBuilder.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/BundleInfoBuilder.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,179 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.classloading.spi.metadata.Capability;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.classloading.spi.version.VersionRange;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class BundleInfoBuilder
-{
- static ClassLoadingMetaDataFactory clmdf = ClassLoadingMetaDataFactory.getInstance();
-
- List<Capability> capabilities = new ArrayList<Capability>();
- List<Requirement> requirements = new ArrayList<Requirement>();
-
- private BundleInfoBuilder()
- {
-
- }
-
- public static BundleInfoBuilder getBuilder()
- {
- return new BundleInfoBuilder();
- }
-
- public BundleInfoBuilder createModule(String name)
- {
- capabilities.add(clmdf.createModule(name));
- return this;
- }
-
- public BundleInfoBuilder createModule(String name, Object version)
- {
- capabilities.add(clmdf.createModule(name, version));
- return this;
- }
-
- public BundleInfoBuilder createRequireModule(String name)
- {
- requirements.add(clmdf.createRequireModule(name, null));
- return this;
- }
-
- public BundleInfoBuilder createRequireModule(String name, VersionRange versionRange)
- {
- requirements.add(clmdf.createRequireModule(name, versionRange));
- return this;
- }
-
- public BundleInfoBuilder createRequireModule(String name, VersionRange versionRange, boolean optional, boolean reExport, boolean dynamic)
- {
- requirements.add(clmdf.createRequireModule(name, versionRange, optional, reExport, dynamic));
- return this;
- }
-
- public BundleInfoBuilder createPackage(String name)
- {
- capabilities.add(clmdf.createPackage(name));
- return this;
- }
-
- public BundleInfoBuilder createPackage(String name, Object version)
- {
- capabilities.add(clmdf.createPackage(name, version));
- return this;
- }
-
- public BundleInfoBuilder createRequirePackage(String name)
- {
- requirements.add(clmdf.createRequirePackage(name));
- return this;
- }
-
- public BundleInfoBuilder createRequirePackage(String name, VersionRange versionRange)
- {
- requirements.add(clmdf.createRequirePackage(name, versionRange));
- return this;
- }
-
- public BundleInfoBuilder createRequirePackage(String name, VersionRange versionRange, boolean optional, boolean reExport, boolean dynamic)
- {
- requirements.add(clmdf.createRequirePackage(name, versionRange, optional, reExport, dynamic));
- return this;
- }
-
- public BundleInfoBuilder createReExportModule(String name)
- {
- requirements.add(clmdf.createReExportModule(name));
- return this;
- }
-
- public BundleInfoBuilder createReExportModule(String name, VersionRange versionRange)
- {
- requirements.add(clmdf.createReExportModule(name, versionRange));
- return this;
- }
-
- public BundleInfoBuilder createReExportModule(String name, VersionRange versionRange, boolean optional)
- {
- requirements.add(clmdf.createReExportModule(name, versionRange, optional));
- return this;
- }
-
- public BundleInfoBuilder createReExportPackage(String name)
- {
- requirements.add(clmdf.createReExportPackage(name));
- return this;
- }
-
- public BundleInfoBuilder createReExportPackage(String name, VersionRange versionRange)
- {
- requirements.add(clmdf.createReExportPackage(name, versionRange));
- return this;
- }
-
- public BundleInfoBuilder createReExportPackage(String name, VersionRange versionRange, boolean optional)
- {
- requirements.add(clmdf.createReExportPackage(name, versionRange, optional));
- return this;
- }
-
- public BundleInfoBuilder createUsesPackage(String name)
- {
- requirements.add(clmdf.createUsesPackage(name));
- return this;
- }
-
- public BundleInfoBuilder createUsesPackage(String name, VersionRange versionRange)
- {
- requirements.add(clmdf.createUsesPackage(name, versionRange));
- return this;
- }
-
- public BundleInfoBuilder createUsesPackage(String name, VersionRange versionRange, boolean reExport)
- {
- requirements.add(clmdf.createUsesPackage(name, versionRange, reExport));
- return this;
- }
-
-
-
- public List<Capability> getCapabilities()
- {
- return capabilities;
- }
-
- public List<Requirement> getRequirements()
- {
- return requirements;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/CapabilityInfo.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/CapabilityInfo.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/CapabilityInfo.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class CapabilityInfo extends ModuleOrPackageInfo
-{
- public CapabilityInfo(String name, Object version)
- {
- // FIXME ModuleCapabilityInfo constructor
- super(name, version);
- }
-
- public CapabilityInfo(String name)
- {
- // FIXME ModuleCapabilityInfo constructor
- super(name);
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/ModuleOrPackageInfo.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/ModuleOrPackageInfo.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/ModuleOrPackageInfo.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,55 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public abstract class ModuleOrPackageInfo
-{
- private String name;
-
- private Object version;
-
- public ModuleOrPackageInfo(String name, Object version)
- {
- this.name = name;
- this.version = version;
- }
-
- public ModuleOrPackageInfo(String name)
- {
- this(name, null);
- }
-
- public String getName()
- {
- return name;
- }
-
- public Object getVersion()
- {
- return version;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/NoMatchClassFilter.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/NoMatchClassFilter.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/NoMatchClassFilter.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, 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.test.aop.classpool.jbosscl.support;
-
-import org.jboss.classloader.plugins.ClassLoaderUtils;
-import org.jboss.classloader.spi.filter.ClassFilter;
-
-/**
- * NoMatchClassFilter.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class NoMatchClassFilter implements ClassFilter
-{
- String className;
-
- public boolean filtered = false;
-
- public NoMatchClassFilter(String classname)
- {
- this.className = classname;
- }
-
- public boolean matchesClassName(String className)
- {
- if (this.className.equals(className))
- {
- filtered = true;
- return false;
- }
- return true;
- }
-
- public boolean matchesResourcePath(String resourcePath)
- {
- if (ClassLoaderUtils.classNameToPath(this.className).equals(resourcePath))
- {
- filtered = true;
- return false;
- }
- return true;
- }
-
- public boolean matchesPackageName(String packageName)
- {
- if (ClassLoaderUtils.getClassPackageName(this.className).equals(packageName))
- return false;
- return true;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/RequirementInfo.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/RequirementInfo.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/RequirementInfo.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,75 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-import org.jboss.classloading.spi.version.VersionRange;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class RequirementInfo extends ModuleOrPackageInfo
-{
- boolean optional;
- boolean reExport;
- boolean dynamic;
-
- public RequirementInfo(String name, VersionRange range)
- {
- super(name, range);
- }
-
- public RequirementInfo(String name)
- {
- super(name);
- }
-
- public RequirementInfo(String name, VersionRange range, boolean optional, boolean reExport, boolean dynamic)
- {
- super(name, range);
- this.optional = optional;
- this.reExport = reExport;
- this.dynamic = dynamic;
- }
-
- @Override
- public VersionRange getVersion()
- {
- return (VersionRange)super.getVersion();
- }
-
- public boolean isOptional()
- {
- return optional;
- }
-
- public boolean isReExport()
- {
- return reExport;
- }
-
- public boolean isDynamic()
- {
- return dynamic;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/Result.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/Result.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/Result.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class Result
-{
- private TestVFSClassLoaderFactory factory;
-
- public TestVFSClassLoaderFactory getFactory()
- {
- return factory;
- }
-
- public void setFactory(TestVFSClassLoaderFactory factory)
- {
- this.factory = factory;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,104 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
-import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TestVFSClassLoaderFactory extends VFSClassLoaderFactory
-{
- private static final long serialVersionUID = 1L;
-
- private ClassLoader parent;
-
- @Override
- protected Class<? extends VFSClassLoaderPolicyModule> getModuleClass()
- {
- return TestVFSClassLoaderPolicyModule.class;
- }
-
- public void setParent(ClassLoader parent)
- {
- this.parent = parent;
- }
-
- @Override
- public List<BeanMetaData> getBeans()
- {
-
- List<BeanMetaData> result = super.getBeans();
- if (parent != null)
- {
- //We need to modify the Module factory method used to create the classloader to pass in the parent
- if (result.size() != 2)
- {
- throw new IllegalStateException("Expected size=2, was " + result.size());
- }
-
- BeanMetaData classLoader = null;
- BeanMetaData module = null;
- for (BeanMetaData bean : result)
- {
- if (bean.getBean().equals(ClassLoader.class.getName()))
- {
- classLoader = bean;
- }
- else
- {
- module = bean;
- }
- }
-
- if (module == null)
- {
- throw new IllegalStateException("Could not find module");
- }
- if (classLoader == null)
- {
- throw new IllegalStateException("Could not find module");
- }
-
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(classLoader.getName(), ClassLoader.class.getName());
- builder.setNoClassLoader();
- builder.setFactory(module.getName());
- builder.setFactoryMethod("registerClassLoaderPolicy");
- builder.addConstructorParameter(ClassLoaderSystem.class.getName(), builder.createInject(getClassLoaderSystemName()));
- builder.addConstructorParameter(ClassLoader.class.getName(), parent);
- classLoader = builder.getBeanMetaData();
-
- result = Arrays.asList(classLoader, module);
- }
-
- return result;
- }
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,135 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.ExportAll;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TestVFSClassLoaderFactoryFactory
-{
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, importAll, null, false, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, importAll, null, null, builder, false, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, String domainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, domainName, null, builder, parentFirst, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, false, domainName, parentDomainName, builder, false, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String moduleName, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, importAll, null, false, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, boolean parentFirst, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, importAll, domainName, null, parentFirst, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, boolean parentFirst, URL... urls) throws Exception
- {
- return createClassLoaderFactory(name, importAll, domainName, parentDomainName, null, parentFirst, urls);
- }
-
- public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
- {
- TestVFSClassLoaderFactory factory = new TestVFSClassLoaderFactory();
- factory.setName(name);
- factory.setImportAll(importAll);
- if (importAll)
- {
- factory.setExportAll(ExportAll.NON_EMPTY);
- }
- factory.setRoots(urlsToStringList(urls));
- addCapabilitiesAndRequirements(factory, builder);
- setupDomain(factory, domainName, parentDomainName, parentFirst);
- return factory;
- }
-
- private static void addCapabilitiesAndRequirements(ClassLoadingMetaData md, BundleInfoBuilder builder)
- {
- if (builder != null)
- {
- md.getCapabilities().setCapabilities(builder.getCapabilities());
- md.getRequirements().setRequirements(builder.getRequirements());
- }
- }
-
- private static void setupDomain(ClassLoadingMetaData md, String domainName, String parentDomainName, boolean parentFirst)
- {
- if (domainName != null)
- {
- md.setDomain(domainName);
- md.setJ2seClassLoadingCompliance(parentFirst);
- if (parentDomainName != null)
- {
- md.setParentDomain(parentDomainName);
- }
- else
- {
- md.setParentDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
- }
- }
- else
- {
- md.setDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
- }
- }
-
- private static List<String> urlsToStringList(URL... urls)
- {
- List<String> urlList = new ArrayList<String>(urls.length);
- if (urls.length > 0)
- {
- for (URL url : urls)
- {
- if (url != null)
- {
- urlList.add(url.toString());
- }
- }
- }
- return urlList;
- }
-
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,107 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.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;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class TestVFSClassLoaderPolicyModule extends VFSClassLoaderPolicyModule
-{
- private static final long serialVersionUID = 1;
-
- /** In AS we need a URL to create the temporary files */
- URL dynamicClassRoot;
- VirtualFile classes;
- Closeable tempDirectoryHandle;
-
- public TestVFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
- {
- // FIXME TesetMockClassLoaderPolicyModule constructor
- super(classLoadingMetaData, contextName);
- }
-
- /**
- * Get/Create the vfs memory file where we will create dynamic classes
- */
- @Override
- public URL getDynamicClassRoot()
- {
- initDynamicClassRoot();
- return dynamicClassRoot;
- }
-
- /**
- * Prepend the dynamic URL location to the classpath
- */
- @Override
- protected VirtualFile[] determineVFSRoots()
- {
- initDynamicClassRoot();
- VirtualFile[] roots = super.determineVFSRoots();
- VirtualFile[] newRoots = new VirtualFile[roots.length + 1];
- newRoots[0] = classes;
- System.arraycopy(roots, 0, newRoots, 1, roots.length);
-
- return newRoots;
- }
-
- private synchronized void initDynamicClassRoot()
- {
- if (dynamicClassRoot == null)
- {
- try
- {
- classes = VFS.getChild("/" + GUID.asString());
- tempDirectoryHandle = VFS.mountTemp(classes, TempFileProvider.create("classes", Executors.newScheduledThreadPool(2)));
- dynamicClassRoot = classes.toURL();
- }
- catch (Exception e)
- {
- // AutoGenerated
- throw new RuntimeException(e);
- }
- }
- }
-
- @Override
- public void reset()
- {
- super.reset();
- VFSUtils.safeClose(tempDirectoryHandle);
- }
-
-
-}
Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/Invoked.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/Invoked.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/support/excluded/replacereferences/Invoked.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,39 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.test.aop.classpool.jbosscl.support.excluded.replacereferences;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class Invoked
-{
- public static boolean invoked;
-
- public static boolean getAndReset()
- {
- boolean inv = invoked;
- invoked = false;
- return inv;
- }
-}
Modified: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.aop.classpool.jbosscl.weaving.test;
import java.lang.reflect.Method;
@@ -28,9 +28,9 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.AspectXmlLoader;
-import org.jboss.test.aop.classpool.jbosscl.support.BundleInfoBuilder;
-import org.jboss.test.aop.classpool.jbosscl.test.JBossClClassPoolTest;
import org.jboss.test.aop.classpool.jbosscl.weaving.support.TestTranslator;
+import org.jboss.test.classpool.jbosscl.test.JBossClClassPoolTest;
+import org.jboss.test.classpool.support.BundleInfoBuilder;
/**
*
Modified: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/scopeddomain/test/ScopedVFSClassLoaderDomainTestCase.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/scopeddomain/test/ScopedVFSClassLoaderDomainTestCase.java 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/scopeddomain/test/ScopedVFSClassLoaderDomainTestCase.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.aop.scopeddomain.test;
import java.net.URL;
@@ -45,6 +45,7 @@
import org.jboss.aop.advice.Scope;
import org.jboss.aop.advice.ScopedInterceptorFactory;
import org.jboss.aop.array.ArrayReplacement;
+import org.jboss.aop.asintegration.jboss5.AOPDomainRegistry;
import org.jboss.aop.asintegration.jboss5.ScopedVFSClassLoaderDomain;
import org.jboss.aop.introduction.AnnotationIntroduction;
import org.jboss.aop.introduction.InterfaceIntroduction;
@@ -58,7 +59,7 @@
import org.jboss.aop.pointcut.Typedef;
import org.jboss.aop.pointcut.TypedefExpression;
import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.test.aop.classpool.jbosscl.test.JBossClClassPoolTest;
+import org.jboss.test.classpool.jbosscl.test.JBossClClassPoolTest;
/**
*
@@ -1730,4 +1731,37 @@
unregisterDomain(middleDomain);
}
}
+
+ public class ScopedVFSClassLoaderDomainSetup
+ {
+ ScopedVFSClassLoaderDomain domain;
+
+ String name;
+ boolean parentDelegation;
+ AspectManager manager;
+ boolean parentFirst;
+ AOPDomainRegistry registry;
+
+ public ScopedVFSClassLoaderDomainSetup(String name, boolean parentDelegation, AspectManager manager, boolean parentFirst, AOPDomainRegistry registry)
+ {
+ this.name = name;
+ this.parentDelegation = parentDelegation;
+ this.manager = manager;
+ this.parentFirst = parentFirst;
+ this.registry = registry;
+ }
+
+ public ScopedVFSClassLoaderDomain getDomain()
+ {
+ return domain;
+ }
+
+ public void setClassLoaderAndDomain(ClassLoader loader, ClassLoaderDomain clDomain)
+ {
+ if (domain == null)
+ {
+ domain = new ScopedVFSClassLoaderDomain(loader, name, parentDelegation, manager, parentFirst, clDomain, registry);
+ }
+ }
+ }
}
\ No newline at end of file
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTest.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTest.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTest.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,1019 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.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;
+import junit.framework.Test;
+
+import org.jboss.aop.asintegration.jboss5.AOPVFSClassLoaderDomainRegistry;
+import org.jboss.aop.asintegration.jboss5.ScopedVFSClassLoaderDomain;
+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;
+import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.PackageClassFilter;
+import org.jboss.classloader.test.support.IsolatedClassLoaderTestHelper;
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.test.AbstractTestCaseWithSetup;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.aop.scopeddomain.test.ScopedVFSClassLoaderDomainTestCase.ScopedVFSClassLoaderDomainSetup;
+import org.jboss.test.classpool.support.BundleInfoBuilder;
+import org.jboss.test.classpool.support.Result;
+import org.jboss.test.classpool.support.SupportClasses;
+import org.jboss.test.classpool.support.TestVFSClassLoaderFactory;
+import org.jboss.test.classpool.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;
+
+/**
+ * Base class for testing the new JBoss classloaders
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class JBossClClassPoolTest extends MicrocontainerTest
+{
+ public final static URL JAR_A_1 = getURLRelativeToProjectRoot(SupportClasses.JAR_A_1);
+ public final static URL JAR_A_2 = getURLRelativeToProjectRoot(SupportClasses.JAR_A_2);
+ public final static URL JAR_B_1 = getURLRelativeToProjectRoot(SupportClasses.JAR_B_1);
+ public final static URL JAR_B_2 = getURLRelativeToProjectRoot(SupportClasses.JAR_B_2);
+ public final static URL JAR_C_1 = getURLRelativeToProjectRoot(SupportClasses.JAR_C_1);
+ public final static URL JAR_C_2 = getURLRelativeToProjectRoot(SupportClasses.JAR_C_2);
+
+ //Keep a strong reference to the URL classloaders so that they are not garbage collected
+ final static Set<URLClassLoader> registeredURLClassLoaders = new HashSet<URLClassLoader>();
+
+ private Map<ClassLoader, ClassLoaderDomain> scopedChildDomainsByLoader = new WeakHashMap<ClassLoader, ClassLoaderDomain>();
+
+ 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;
+ private static final ClassFilter aopFilter;
+ static
+ {
+ String[] classPatterns = new String[] {
+ "org\\.jboss\\.aop\\..+",
+ "org\\.jboss\\.classloading\\..+",
+ "org\\.jboss\\.classloader\\..+",
+ "org\\.jboss\\.virtual\\..+",
+ "org\\.jboss\\.test\\.classpool\\.jbosscl\\..+\\..+",
+ "org\\.jboss\\.metadata\\..+",
+ "org\\.test\\.classpool\\.proxy\\..+"};
+ String[] resourcePatterns = new String[] {
+ "org/jboss/aop/.+",
+ "org/jboss/classloading/.+",
+ "org/jboss/classloader/.+",
+ "org/jboss/virtual/.+",
+ "org/jboss/test/classpool/jbosscl/.+\\..+",
+ "org/jboss/metadata/.+",
+ "org/test/classpool/proxy/.+"};
+ aopFilter = new PatternClassFilter(classPatterns, resourcePatterns, null);
+ }
+
+ protected static final AOPVFSClassLoaderDomainRegistry domainRegistry = new AOPVFSClassLoaderDomainRegistry();
+
+ ClassLoading classLoading = new ClassLoading();
+
+ public static ClassLoaderSystem getSystem()
+ {
+ if (!initialisedDefaultDomain)
+ {
+ ClassLoaderDomain defaultDomain = system.getDefaultDomain();
+
+ Set<String> parentPackages = IsolatedClassLoaderTestHelper.getParentPackages();
+ String[] parentPkgs = parentPackages.toArray(new String[parentPackages.size()]);
+ PackageClassFilter filter = new PackageClassFilter(parentPkgs);
+ filter.setIncludeJava(true);
+ CombiningClassFilter beforeFilter = CombiningClassFilter.create(filter, aopFilter);
+ ParentPolicy parentPolicy = new ParentPolicy(beforeFilter, NothingClassFilter.INSTANCE);
+
+ defaultDomain.setParentPolicy(parentPolicy);
+ }
+ return system;
+ }
+
+ public static Test suite(Class<?> clazz)
+ {
+ return AbstractTestCaseWithSetup.suite(clazz);
+ }
+
+ public JBossClClassPoolTest(String name)
+ {
+ super(name);
+ }
+
+
+ public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ return new JBossClClassPoolTestDelegate(clazz);
+ }
+
+
+ protected static URL getURLRelativeToProjectRoot(String relativePath)
+ {
+ try
+ {
+ URL url = JBossClClassPoolTest.class.getProtectionDomain().getCodeSource().getLocation();
+ String location = url.toString();
+ int index = location.lastIndexOf("/target/") + "/target/".length();
+ location = location.substring(0, index);
+
+ location = location + relativePath;
+ return new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected ClassLoaderDomain getDefaultDomain()
+ {
+ return getSystem().getDefaultDomain();
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ //enableTrace("org.jboss.aop.classpool");
+ //enableTrace("org.jboss.classpool.jbosscl");
+ deploy("/org/jboss/test/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/classpool/jbosscl/Common.xml");
+ super.tearDown();
+ }
+
+ protected String array(String name)
+ {
+ return name + "[]";
+ }
+
+ protected ClassLoader createClassLoader(String name, boolean importAll, URL... urls) throws Exception
+ {
+ return createClassLoader(null, name, importAll, urls);
+ }
+
+ protected ClassLoader createClassLoader(Result result, String name, boolean importAll, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, urls);
+ return createClassLoader(result, factory);
+ }
+
+ protected ClassLoader createClassLoader(String name, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassLoader(null, name, builder, urls);
+ }
+
+ protected ClassLoader createClassLoader(Result result, String name, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassLoader(result, name, false, builder, urls);
+ }
+
+ protected ClassLoader createClassLoader(String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassLoader(null, name, importAll, builder, urls);
+ }
+
+ protected ClassLoader createClassLoader(Result result, String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, builder, urls);
+ return createClassLoader(result, factory);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader((Result)null, name, domainName, importAll, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(Result result, String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader(result, name, domainName, importAll, null, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader(null, name, domainName, importAll, parent, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(Result result, String name, String domainName, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, null, true, importAll, parent, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader(null, name, domainName, parentDomainName, importAll, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(Result result, String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, parentDomainName, true, importAll, null, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader((Result)null, name, domainName, importAll, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(Result result, String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader(result, name, domainName, importAll, null, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(String name, String domainName, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader(null, name, domainName, importAll, parent, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(Result result, String name, String domainName, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, null, false, importAll, parent, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader(null, name, domainName, parentDomainName, importAll, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(Result result, String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, parentDomainName, false, importAll, null, urls);
+ }
+
+ protected ClassLoader createChildDomainClassLoader(String name, String domainName, String parentDomainName, boolean parentFirst, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(null, name, domainName, parentDomainName, parentFirst, importAll, parent, urls);
+ }
+
+ protected ClassLoader createChildDomainClassLoader(Result result, String name, String domainName, String parentDomainName, boolean parentFirst, boolean importAll, ClassLoader parent, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, domainName, parentDomainName, parentFirst, urls);
+
+ ClassLoader classLoader = createClassLoader(result, factory, parent);
+
+ registerDomainAndLoader(classLoader, domainName);
+ return classLoader;
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader((Result)null, name, domainName, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(Result result, String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader(result, name, domainName, null, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassLoader(null, name, domainName, parentDomainName, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentFirstClassLoader(Result result, String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, parentDomainName, builder, true, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader((Result)null, name, domainName, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(Result result, String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader(result, name, domainName, null, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassLoader(null, name, domainName, parentDomainName, builder, urls);
+ }
+
+ protected ClassLoader createChildDomainParentLastClassLoader(Result result, String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(result, name, domainName, parentDomainName, builder, false, urls);
+ }
+
+ protected ClassLoader createChildDomainClassLoader(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createChildDomainClassLoader(null, name, domainName, parentDomainName, builder, parentFirst, urls);
+ }
+
+ protected ClassLoader createChildDomainClassLoader(Result result, String name, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, domainName, parentDomainName, builder, parentFirst, urls);
+
+ ClassLoader classLoader = createClassLoader(result, factory);
+
+ registerDomainAndLoader(classLoader, domainName);
+ return classLoader;
+ }
+
+ private void registerDomainAndLoader(ClassLoader classLoader, String domainName)
+ {
+ ClassLoaderDomain domain = getSystem().getDomain(domainName);
+ scopedChildDomainsByLoader.put(classLoader, domain);
+ }
+
+ protected ClassLoader createChildURLClassLoader(ClassLoader parent, URL url)
+ {
+ URLClassLoader cl = new URLClassLoader(new URL[] {url}, parent);
+ registeredURLClassLoaders.add(cl);
+ return cl;
+ }
+
+ private ClassLoader createClassLoader(Result result, TestVFSClassLoaderFactory factory) throws Exception
+ {
+ return createClassLoader(result, factory, null);
+ }
+
+ private ClassLoader createClassLoader(Result result, TestVFSClassLoaderFactory factory, ClassLoader parent) throws Exception
+ {
+ if (parent != null)
+ {
+ factory.setParent(parent);
+ }
+
+ KernelDeployment deployment = install(factory);
+ loaderNameDeploymentRegistry.registerDeployment(factory.getName(), deployment);
+ if (result != null)
+ {
+ result.setFactory(factory);
+ }
+ ClassLoader loader = assertClassLoader(factory, parent);
+
+ return loader;
+ }
+
+ /**
+ * Here since we cannot access this via the classloading api
+ */
+ protected ClassLoaderDomain getChildDomainForLoader(ClassLoader loader)
+ {
+ return scopedChildDomainsByLoader.get(loader);
+ }
+
+ protected ClassLoaderDomain getChildDomainForPool(ClassPool pool)
+ {
+ return getChildDomainForLoader(pool.getClassLoader());
+ }
+
+ protected void unregisterDomain(ClassLoaderDomain domain)
+ {
+ if (domain != null)
+ {
+ ClassLoaderDomain registeredDomain = getSystem().getDomain(domain.getName());
+ if (registeredDomain == null)
+ throw new IllegalStateException("Domain is not registered: " + domain.getName());
+ if (registeredDomain != domain)
+ throw new IllegalStateException(domain + " is not the same as " + registeredDomain);
+ getSystem().unregisterDomain(domain);
+ }
+ }
+
+ protected void unregisterDomain(ClassLoader loader)
+ {
+ if (loader != null)
+ {
+ ClassLoaderDomain domain = getChildDomainForLoader(loader);
+ unregisterDomain(domain);
+ }
+ }
+
+ protected void unregisterDomain(ClassPool pool)
+ {
+ if (pool != null)
+ {
+ ClassLoaderDomain domain = getChildDomainForPool(pool);
+ unregisterDomain(domain);
+ }
+ }
+
+ protected void assertCannotLoadClass(ClassLoader cl, String className)
+ {
+ try
+ {
+ cl.loadClass(className);
+ fail("Should not have been able to load " + className);
+ }
+ catch(Exception expected)
+ {
+ }
+ }
+
+ protected void assertCannotLoadClass(String className, ClassLoader cl)
+ {
+ assertCannotLoadClass(cl, className);
+ }
+
+ protected void assertCannotLoadCtClass(ClassPool pool, String className)
+ {
+ try
+ {
+ pool.get(className);
+ }
+ catch(Exception e)
+ {
+ }
+ }
+
+ protected void assertCannotLoadCtClass(String className, ClassPool pool)
+ {
+ assertCannotLoadCtClass(pool, className);
+ }
+
+ protected void assertCannotLoadClass(ClassLoaderDomain domain, String className)
+ {
+ try
+ {
+ Class<?> clazz = domain.loadClass(className);
+ if (clazz == null)
+ {
+ return;
+ }
+ fail("Should not have been able to load " + className);
+ }
+ catch(Exception expected)
+ {
+ }
+ }
+
+ protected ClassPool createClassPool(String name, boolean importAll, URL... urls) throws Exception
+ {
+ return createClassPool(null, name, importAll, urls);
+ }
+
+ protected ClassPool createClassPool(Result result, String name, boolean importAll, URL... urls) throws Exception
+ {
+ ClassLoader loader = createClassLoader(result, name, importAll, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createClassPool(String name, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassPool(null, name, builder, urls);
+ }
+
+ protected ClassPool createClassPool(Result result, String name, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassPool(result, name, false, builder, urls);
+ }
+
+ protected ClassPool createClassPool(String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassPool(null, name, importAll, builder, urls);
+ }
+
+ protected ClassPool createClassPool(Result result, String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, builder, urls);
+ ClassLoader loader = createClassLoader(result, factory);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassPool((Result)null, name, domainName, importAll, urls);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(Result result, String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentFirstClassLoader(result, name, domainName, importAll, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(String name, String domainName, boolean importAll, ClassPool parent, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassPool(null, name, domainName, importAll, parent, urls);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(Result result, String name, String domainName, boolean importAll, ClassPool parent, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentFirstClassLoader(result, name, domainName, importAll, parent.getClassLoader(), urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassPool(null, name, domainName, parentDomainName, importAll, urls);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(Result result, String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentFirstClassLoader(result, name, domainName, parentDomainName, importAll, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassPool((Result)null, name, domainName, importAll, urls);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(Result result, String name, String domainName, boolean importAll, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentLastClassLoader(result, name, domainName, importAll, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(String name, String domainName, boolean importAll, ClassPool parent, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassPool(null, name, domainName, importAll, parent, urls);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(Result result, String name, String domainName, boolean importAll, ClassPool parent, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentLastClassLoader(result, name, domainName, importAll, parent.getClassLoader(), urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassPool(null, name, domainName, parentDomainName, importAll, urls);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(Result result, String name, String domainName, String parentDomainName, boolean importAll, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentLastClassLoader(result, name, domainName, parentDomainName, importAll, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassPool(null, name, domainName, parentDomainName, builder, urls);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(Result result, String name, String domainName, String parentDomainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentFirstClassLoader(result, name, domainName, parentDomainName, builder, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentFirstClassPool((Result)null, name, domainName, builder, urls);
+ }
+
+ protected ClassPool createChildDomainParentFirstClassPool(Result result, String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentFirstClassLoader(result, name, domainName, builder, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createChildDomainParentLastClassPool(null, name, domainName, builder, urls);
+ }
+
+ protected ClassPool createChildDomainParentLastClassPool(Result result, String name, String domainName, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ ClassLoader loader = createChildDomainParentLastClassLoader(result, name, domainName, builder, urls);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected ClassPool createChildURLClassPool(ClassPool parent, URL url)
+ {
+ ClassLoader parentLoader = null;
+ if (parent != null)
+ {
+ parentLoader = parent.getClassLoader();
+ }
+ ClassLoader loader = createChildURLClassLoader(parentLoader, url);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected void registerModule(ClassLoader loader, Module module)
+ {
+ registerModule(loader, module, null);
+ }
+
+ protected void registerModule(ClassLoader loader, Module module, ClassLoader parent)
+ {
+ if (getSystem() != domainRegistry.getSystem())
+ {
+ domainRegistry.setSystem(getSystem());
+ }
+
+ //TODO I have just hacked the domain here so this might cause problems
+ //with the tests if we try to do weaving. However, it should be fine while just testing pools
+ //and loaders
+ ScopedVFSClassLoaderDomainSetup setup = peekClassLoaderDomainSetup();
+ ScopedVFSClassLoaderDomain domain = null;
+ if (setup != null)
+ {
+ ClassLoaderDomain clDomain = getSystem().getDomain(module.getDomainName());
+ setup.setClassLoaderAndDomain(loader, clDomain);
+ domain = setup.getDomain();
+ }
+ domainRegistry.setDomain(domain);
+ domainRegistry.initMapsForModule(module);
+ }
+
+ protected void unregisterModule(ClassLoader loader)
+ {
+ domainRegistry.cleanupModule(domainRegistry.getModule(loader));
+ }
+
+ protected void assertModule(ClassLoader loader)
+ {
+ ClassLoaderDomain domainForLoader = scopedChildDomainsByLoader.get(loader);
+ if (domainForLoader == null)
+ {
+ //domainForLoader = helper.getDomain();
+ domainForLoader = getSystem().getDefaultDomain();
+ }
+ assertNotNull(domainForLoader);
+
+ ClassLoaderDomain domainForModule = domainRegistry.getClassLoaderDomainForLoader(loader);
+ assertNotNull(domainForModule);
+ assertSame(domainForLoader, domainForModule);
+
+ Module module = domainRegistry.getModule(loader);
+ assertNotNull(module);
+ assertEquals(domainForModule.getName(), module.getDomainName());
+ assertEquals(domainForModule.getParentDomainName(), module.getParentDomainName());
+ }
+
+
+ protected void assertNoClassLoader(Result result) throws Exception
+ {
+ if (result == null)
+ {
+ throw new IllegalStateException("Null result");
+ }
+ assertNoClassLoader(getContextName(result.getFactory()));
+ }
+
+ protected void assertNoClassPool(Result result) throws Exception
+ {
+ if (result == null)
+ {
+ throw new IllegalStateException("Null result");
+ }
+ assertNoClassLoader(getContextName(result.getFactory()));
+ }
+
+ protected void assertNoClassLoader(String name) throws Exception
+ {
+ try
+ {
+ Object bean = getBean(name, null);
+ if (bean != null)
+ fail("Should not be here: " + bean);
+ }
+ catch (Throwable t)
+ {
+ checkThrowable(IllegalStateException.class, t);
+ }
+ }
+
+ protected void unregisterClassPool(ClassPool pool) throws Exception
+ {
+ if (pool != null)
+ {
+ ClassLoader loader = pool.getClassLoader();
+ ClassPoolRepository.getInstance().unregisterClassLoader(loader);
+ if (loader != null)
+ {
+ unregisterClassLoader(loader);
+ }
+ }
+ }
+
+ protected void unregisterClassLoader(ClassLoader classLoader) throws Exception
+ {
+ if (classLoader != null)
+ {
+ if (registeredURLClassLoaders.remove(classLoader) == false)
+ {
+ domainRegistry.cleanupModule(domainRegistry.getModule(classLoader));
+ KernelDeployment deployment = loaderNameDeploymentRegistry.unregisterDeployment(classLoader);
+ unregisterDeployment(deployment);
+ }
+ }
+ }
+
+ protected void unregisterClassLoader(String name) throws Exception
+ {
+ KernelDeployment deployment = loaderNameDeploymentRegistry.unregisterDeployment(name);
+ unregisterDeployment(deployment);
+ }
+
+ private void unregisterDeployment(KernelDeployment deployment)
+ {
+ if (deployment != null)
+ {
+ undeploy(deployment);
+ }
+ }
+
+ /**
+ * Unregister a domain
+ *
+ * @param name the domain name
+ */
+ protected void unregisterDomain(String name)
+ {
+ if (name != null)
+ {
+ ClassLoaderDomain registeredDomain = getSystem().getDomain(name);
+ unregisterDomain(registeredDomain);
+ }
+ }
+
+ protected KernelDeployment install(TestVFSClassLoaderFactory metaData) throws Exception
+ {
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setName(metaData.getName() + ":" + metaData.getVersion());
+ deployment.setBeanFactories(Collections.singletonList((BeanMetaDataFactory) metaData));
+ deploy(deployment);
+ return deployment;
+ }
+
+ protected String getContextName(TestVFSClassLoaderFactory factory)
+ {
+ String contextName = factory.getContextName();
+ if (contextName == null)
+ contextName = factory.getName() + ":" + factory.getVersion();
+ return contextName;
+ }
+
+ protected ClassLoader assertClassLoader(TestVFSClassLoaderFactory factory) throws Exception
+ {
+ return assertClassLoader(factory, null);
+ }
+
+ protected ClassLoader assertClassLoader(TestVFSClassLoaderFactory factory, ClassLoader parent) throws Exception
+ {
+ try
+ {
+ Object obj = getBean(getContextName(factory));
+ ClassLoader loader = assertInstanceOf(obj, ClassLoader.class);
+
+ Module module = assertModule(getContextName(factory));
+ registerModule(loader, module, parent);
+ loaderNameDeploymentRegistry.registerLoaderName(factory.getName(), loader);
+
+ return loader;
+ }
+ catch (IllegalStateException e)
+ {
+ throw new NoSuchClassLoaderException(e);
+ }
+ }
+
+ protected ClassPool assertClassPool(TestVFSClassLoaderFactory factory) throws Exception
+ {
+ ClassLoader loader = assertClassLoader(factory);
+ return ClassPoolRepository.getInstance().registerClassLoader(loader);
+ }
+
+ protected Class<?> assertLoadClass(String name, ClassLoader initiating) throws Exception
+ {
+ return assertLoadClass(name, initiating, initiating);
+ }
+
+ protected Class<?> assertLoadClass(String name, ClassLoader initiating, ClassLoader expected) throws Exception
+ {
+ Class<?> clazz = initiating.loadClass(name);
+ if (expected != null)
+ {
+ assertSame(expected, clazz.getClassLoader());
+ }
+ return clazz;
+ }
+
+ protected CtClass assertLoadCtClass(String name, ClassPool initiating) throws Exception
+ {
+ return assertLoadCtClass(name, initiating, initiating);
+ }
+
+ protected CtClass assertLoadCtClass(String name, ClassPool initiating, ClassPool expected) throws Exception
+ {
+ CtClass clazz = initiating.get(name);
+ if (expected != null)
+ {
+ assertSame(expected, clazz.getClassPool());
+ }
+
+ //Load twice to test both create and cache
+ clazz = initiating.get(name);
+ if (expected != null)
+ {
+ assertSame(expected, clazz.getClassPool());
+ }
+
+ assertLoadCtClassArray(name, clazz, initiating, expected);
+
+ return clazz;
+ }
+
+ private void assertLoadCtClassArray(String name, CtClass clazz, ClassPool initiating, ClassPool expected) throws Exception
+ {
+ assertLoadCtClassArray(name, clazz, 1, initiating, expected);
+ assertLoadCtClassArray(name, clazz, 2, initiating, expected);
+ }
+
+ private void assertLoadCtClassArray(String name, CtClass clazz, int dimensions, ClassPool initiating, ClassPool expected) throws Exception
+ {
+ String arrayName = name;
+ for (int i = 0 ; i < dimensions ; i++)
+ {
+ arrayName = array(arrayName);
+ }
+ CtClass array = initiating.get(arrayName);
+
+ if (expected != null)
+ {
+ assertSame(expected, array.getClassPool());
+ }
+
+ assertSame(clazz.getClassPool(), array.getClassPool());
+
+ CtClass type = array;
+ for (int i = 0 ; i < dimensions ; i++)
+ {
+ type = type.getComponentType();
+ }
+ assertSame(type, clazz);
+ }
+
+ protected Module assertModule(String contextName)
+ {
+ return assertBean(contextName + "$MODULE", Module.class);
+ }
+
+ /**
+ * The test classes should not be on the launcher classpath
+ */
+ public void testClassesNotOnClasspath()
+ {
+ assertCannotLoadClass(this.getClass().getClassLoader(), SupportClasses.CLASS_A);
+ assertCannotLoadClass(this.getClass().getClassLoader(), SupportClasses.CLASS_B);
+ assertCannotLoadClass(this.getClass().getClassLoader(), SupportClasses.CLASS_C);
+ }
+
+ static class NoSuchClassLoaderException extends Exception
+ {
+ private static final long serialVersionUID = 1L;
+
+ public NoSuchClassLoaderException(Exception e)
+ {
+ super(e);
+ }
+ }
+
+ private static class LoaderNameDeploymentRegistry
+ {
+ private Map<String, KernelDeployment> deploymentsByName = new HashMap<String, KernelDeployment>();
+
+ private Map<ClassLoader, String> namesByLoader = new HashMap<ClassLoader, String>();
+
+ private void registerDeployment(String name, KernelDeployment deployment)
+ {
+ if (!deploymentsByName.containsKey(name))
+ {
+ deploymentsByName.put(name, deployment);
+ }
+ }
+
+ private void registerLoaderName(String name, ClassLoader loader)
+ {
+ if (loader != null)
+ {
+ namesByLoader.put(loader, name);
+ }
+ }
+
+ private KernelDeployment unregisterDeployment(String name)
+ {
+ return deploymentsByName.remove(name);
+ }
+
+ private KernelDeployment unregisterDeployment(ClassLoader loader)
+ {
+ String name = namesByLoader.remove(loader);
+ return unregisterDeployment(name);
+ }
+ }
+
+ private static ScopedVFSClassLoaderDomainSetup classLoaderDomainSetup;
+
+ protected static void pushClassLoaderDomainSetup(ScopedVFSClassLoaderDomainSetup setup)
+ {
+ classLoaderDomainSetup = setup;
+ }
+
+ protected static ScopedVFSClassLoaderDomainSetup popClassLoaderDomainSetup()
+ {
+ ScopedVFSClassLoaderDomainSetup setup = classLoaderDomainSetup;
+ classLoaderDomainSetup = null;
+ return setup;
+ }
+
+ protected static ScopedVFSClassLoaderDomainSetup peekClassLoaderDomainSetup()
+ {
+ return classLoaderDomainSetup;
+ }
+
+ /*public class ScopedVFSClassLoaderDomainSetup
+ {
+ ScopedVFSClassLoaderDomain domain;
+
+ String name;
+ boolean parentDelegation;
+ boolean parentFirst;
+ DomainRegistry registry;
+
+ public ScopedVFSClassLoaderDomainSetup(String name, boolean parentDelegation, boolean parentFirst, DomainRegistry registry)
+ {
+ this.name = name;
+ this.parentDelegation = parentDelegation;
+ this.parentFirst = parentFirst;
+ this.registry = registry;
+ }
+
+ public ScopedVFSClassLoaderDomain getDomain()
+ {
+ return domain;
+ }
+
+ public void setClassLoaderAndDomain(ClassLoader loader, ClassLoaderDomain clDomain)
+ {
+ if (domain == null)
+ {
+ domain = new ScopedVFSClassLoaderDomain(loader, name, parentDelegation, parentFirst, clDomain, registry);
+ }
+ }
+ }*/
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTest.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.classpool.jbosscl.test;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.classpool.plugins.jbosscl.JBossClDelegatingClassPoolFactory;
+import org.jboss.classpool.plugins.jbosscl.RegisterModuleCallback;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class JBossClClassPoolTestDelegate extends MicrocontainerTestDelegate
+{
+ static
+ {
+
+ // TODO remove this later; currently, AspectManager sets the classpoolfactory
+ // at ScopedClassPoolRepositoryImpl, overwriting the setClassPoolFactory command below
+ // Notice that AspectManager.instance() is invoked by AOPDependencyBuilder, so
+ // we have no way of avoiding AspectManager creation
+ AspectManager.instance();
+ ClassPoolRepository.getInstance().setClassPoolFactory(new JBossClDelegatingClassPoolFactory(JBossClClassPoolTest.domainRegistry, new RegisterModuleCallback(JBossClClassPoolTest.domainRegistry)));
+ //ClassPoolRepository.getInstance().setClassPoolFactory(new AOPClassPoolFactory());
+ //AOPClassPoolFactory.setDelegateClassPoolFactory(new JBossClDelegatingClassPoolFactory(domainRegistry, new RegisterModuleCallback(domainRegistry)));
+ }
+ public JBossClClassPoolTestDelegate(Class<?> clazz) throws Exception
+ {
+ super(clazz);
+// String property = System.getProperty("jboss.aop.secure", "true");
+// boolean enableSecurity = Boolean.valueOf(property).booleanValue();
+// this.enableSecurity = enableSecurity;
+ }
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/BundleInfoBuilder.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/BundleInfoBuilder.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/BundleInfoBuilder.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.classpool.support;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.version.VersionRange;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class BundleInfoBuilder
+{
+ static ClassLoadingMetaDataFactory clmdf = ClassLoadingMetaDataFactory.getInstance();
+
+ List<Capability> capabilities = new ArrayList<Capability>();
+ List<Requirement> requirements = new ArrayList<Requirement>();
+
+ private BundleInfoBuilder()
+ {
+
+ }
+
+ public static BundleInfoBuilder getBuilder()
+ {
+ return new BundleInfoBuilder();
+ }
+
+ public BundleInfoBuilder createModule(String name)
+ {
+ capabilities.add(clmdf.createModule(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createModule(String name, Object version)
+ {
+ capabilities.add(clmdf.createModule(name, version));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequireModule(String name)
+ {
+ requirements.add(clmdf.createRequireModule(name, null));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequireModule(String name, VersionRange versionRange)
+ {
+ requirements.add(clmdf.createRequireModule(name, versionRange));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequireModule(String name, VersionRange versionRange, boolean optional, boolean reExport, boolean dynamic)
+ {
+ requirements.add(clmdf.createRequireModule(name, versionRange, optional, reExport, dynamic));
+ return this;
+ }
+
+ public BundleInfoBuilder createPackage(String name)
+ {
+ capabilities.add(clmdf.createPackage(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createPackage(String name, Object version)
+ {
+ capabilities.add(clmdf.createPackage(name, version));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequirePackage(String name)
+ {
+ requirements.add(clmdf.createRequirePackage(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequirePackage(String name, VersionRange versionRange)
+ {
+ requirements.add(clmdf.createRequirePackage(name, versionRange));
+ return this;
+ }
+
+ public BundleInfoBuilder createRequirePackage(String name, VersionRange versionRange, boolean optional, boolean reExport, boolean dynamic)
+ {
+ requirements.add(clmdf.createRequirePackage(name, versionRange, optional, reExport, dynamic));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportModule(String name)
+ {
+ requirements.add(clmdf.createReExportModule(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportModule(String name, VersionRange versionRange)
+ {
+ requirements.add(clmdf.createReExportModule(name, versionRange));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportModule(String name, VersionRange versionRange, boolean optional)
+ {
+ requirements.add(clmdf.createReExportModule(name, versionRange, optional));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportPackage(String name)
+ {
+ requirements.add(clmdf.createReExportPackage(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportPackage(String name, VersionRange versionRange)
+ {
+ requirements.add(clmdf.createReExportPackage(name, versionRange));
+ return this;
+ }
+
+ public BundleInfoBuilder createReExportPackage(String name, VersionRange versionRange, boolean optional)
+ {
+ requirements.add(clmdf.createReExportPackage(name, versionRange, optional));
+ return this;
+ }
+
+ public BundleInfoBuilder createUsesPackage(String name)
+ {
+ requirements.add(clmdf.createUsesPackage(name));
+ return this;
+ }
+
+ public BundleInfoBuilder createUsesPackage(String name, VersionRange versionRange)
+ {
+ requirements.add(clmdf.createUsesPackage(name, versionRange));
+ return this;
+ }
+
+ public BundleInfoBuilder createUsesPackage(String name, VersionRange versionRange, boolean reExport)
+ {
+ requirements.add(clmdf.createUsesPackage(name, versionRange, reExport));
+ return this;
+ }
+
+
+
+ public List<Capability> getCapabilities()
+ {
+ return capabilities;
+ }
+
+ public List<Requirement> getRequirements()
+ {
+ return requirements;
+ }
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/BundleInfoBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/Result.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/Result.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/Result.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * JBoss, Home of Professional Open Source.
+ * 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.test.classpool.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class Result
+{
+ private TestVFSClassLoaderFactory factory;
+
+ public TestVFSClassLoaderFactory getFactory()
+ {
+ return factory;
+ }
+
+ public void setFactory(TestVFSClassLoaderFactory factory)
+ {
+ this.factory = factory;
+ }
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/Result.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/SupportClasses.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/SupportClasses.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/SupportClasses.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.classpool.support;
+
+import java.net.URL;
+
+/**
+ *
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @version $Revision$
+ */
+public class SupportClasses
+{
+ public final static String JAR_A_1 = "a1.jar";
+ public final static String JAR_A_2 = "a2.jar";
+ public final static String JAR_B_1 = "b1.jar";
+ public final static String JAR_B_2 = "b2.jar";
+ public final static String JAR_C_1 = "c1.jar";
+ public final static String JAR_C_2 = "c2.jar";
+
+ public static final String PACKAGE_ROOT = SupportClasses.class.getPackage().getName() + ".excluded";
+ public final static String PACKAGE_A = PACKAGE_ROOT + ".a";
+ public final static String PACKAGE_B = PACKAGE_ROOT + ".b";
+ public final static String PACKAGE_C = PACKAGE_ROOT + ".c";
+
+ public final static String CLASS_A = PACKAGE_A + ".A";
+ public final static String CLASS_B = PACKAGE_B + ".B";
+ public final static String CLASS_C = PACKAGE_C + ".C";
+}
\ No newline at end of file
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/SupportClasses.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactory.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * JBoss, Home of Professional Open Source.
+ * 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.test.classpool.support;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class TestVFSClassLoaderFactory extends VFSClassLoaderFactory
+{
+ private static final long serialVersionUID = 1L;
+
+ private ClassLoader parent;
+
+ @Override
+ protected Class<? extends VFSClassLoaderPolicyModule> getModuleClass()
+ {
+ return TestVFSClassLoaderPolicyModule.class;
+ }
+
+ public void setParent(ClassLoader parent)
+ {
+ this.parent = parent;
+ }
+
+ @Override
+ public List<BeanMetaData> getBeans()
+ {
+
+ List<BeanMetaData> result = super.getBeans();
+ if (parent != null)
+ {
+ //We need to modify the Module factory method used to create the classloader to pass in the parent
+ if (result.size() != 2)
+ {
+ throw new IllegalStateException("Expected size=2, was " + result.size());
+ }
+
+ BeanMetaData classLoader = null;
+ BeanMetaData module = null;
+ for (BeanMetaData bean : result)
+ {
+ if (bean.getBean().equals(ClassLoader.class.getName()))
+ {
+ classLoader = bean;
+ }
+ else
+ {
+ module = bean;
+ }
+ }
+
+ if (module == null)
+ {
+ throw new IllegalStateException("Could not find module");
+ }
+ if (classLoader == null)
+ {
+ throw new IllegalStateException("Could not find module");
+ }
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(classLoader.getName(), ClassLoader.class.getName());
+ builder.setNoClassLoader();
+ builder.setFactory(module.getName());
+ builder.setFactoryMethod("registerClassLoaderPolicy");
+ builder.addConstructorParameter(ClassLoaderSystem.class.getName(), builder.createInject(getClassLoaderSystemName()));
+ builder.addConstructorParameter(ClassLoader.class.getName(), parent);
+ classLoader = builder.getBeanMetaData();
+
+ result = Arrays.asList(classLoader, module);
+ }
+
+ return result;
+ }
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactoryFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactoryFactory.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactoryFactory.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * JBoss, Home of Professional Open Source.
+ * 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.test.classpool.support;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class TestVFSClassLoaderFactoryFactory
+{
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, null, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, null, null, builder, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, String domainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, domainName, null, builder, parentFirst, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, false, domainName, parentDomainName, builder, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String moduleName, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, null, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, domainName, null, parentFirst, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, domainName, parentDomainName, null, parentFirst, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = new TestVFSClassLoaderFactory();
+ factory.setName(name);
+ factory.setImportAll(importAll);
+ if (importAll)
+ {
+ factory.setExportAll(ExportAll.NON_EMPTY);
+ }
+ factory.setRoots(urlsToStringList(urls));
+ addCapabilitiesAndRequirements(factory, builder);
+ setupDomain(factory, domainName, parentDomainName, parentFirst);
+ return factory;
+ }
+
+ private static void addCapabilitiesAndRequirements(ClassLoadingMetaData md, BundleInfoBuilder builder)
+ {
+ if (builder != null)
+ {
+ md.getCapabilities().setCapabilities(builder.getCapabilities());
+ md.getRequirements().setRequirements(builder.getRequirements());
+ }
+ }
+
+ private static void setupDomain(ClassLoadingMetaData md, String domainName, String parentDomainName, boolean parentFirst)
+ {
+ if (domainName != null)
+ {
+ md.setDomain(domainName);
+ md.setJ2seClassLoadingCompliance(parentFirst);
+ if (parentDomainName != null)
+ {
+ md.setParentDomain(parentDomainName);
+ }
+ else
+ {
+ md.setParentDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
+ }
+ }
+ else
+ {
+ md.setDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
+ }
+ }
+
+ private static List<String> urlsToStringList(URL... urls)
+ {
+ List<String> urlList = new ArrayList<String>(urls.length);
+ if (urls.length > 0)
+ {
+ for (URL url : urls)
+ {
+ if (url != null)
+ {
+ urlList.add(url.toString());
+ }
+ }
+ }
+ return urlList;
+ }
+
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderFactoryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderPolicyModule.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderPolicyModule.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderPolicyModule.java 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * JBoss, Home of Professional Open Source.
+ * 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.test.classpool.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;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+public class TestVFSClassLoaderPolicyModule extends VFSClassLoaderPolicyModule
+{
+ private static final long serialVersionUID = 1;
+
+ /** In AS we need a URL to create the temporary files */
+ URL dynamicClassRoot;
+ VirtualFile classes;
+ Closeable tempDirectoryHandle;
+
+ public TestVFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
+ {
+ // FIXME TesetMockClassLoaderPolicyModule constructor
+ super(classLoadingMetaData, contextName);
+ }
+
+ /**
+ * Get/Create the vfs memory file where we will create dynamic classes
+ */
+ @Override
+ public URL getDynamicClassRoot()
+ {
+ initDynamicClassRoot();
+ return dynamicClassRoot;
+ }
+
+ /**
+ * Prepend the dynamic URL location to the classpath
+ */
+ @Override
+ protected VirtualFile[] determineVFSRoots()
+ {
+ initDynamicClassRoot();
+ VirtualFile[] roots = super.determineVFSRoots();
+ VirtualFile[] newRoots = new VirtualFile[roots.length + 1];
+ newRoots[0] = classes;
+ System.arraycopy(roots, 0, newRoots, 1, roots.length);
+
+ return newRoots;
+ }
+
+ private synchronized void initDynamicClassRoot()
+ {
+ if (dynamicClassRoot == null)
+ {
+ try
+ {
+ classes = VFS.getChild("/" + GUID.asString());
+ tempDirectoryHandle = VFS.mountTemp(classes, TempFileProvider.create("classes", Executors.newScheduledThreadPool(2)));
+ dynamicClassRoot = classes.toURL();
+ }
+ catch (Exception e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ @Override
+ public void reset()
+ {
+ super.reset();
+ VFSUtils.safeClose(tempDirectoryHandle);
+ }
+}
Property changes on: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/classpool/support/TestVFSClassLoaderPolicyModule.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/jbosscl/Common.xml
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/jbosscl/Common.xml (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/resources/org/jboss/test/classpool/jbosscl/Common.xml 2010-03-12 13:38:13 UTC (rev 102346)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+ <constructor factoryClass="org.jboss.test.classpool.jbosscl.test.JBossClClassPoolTest" factoryMethod="getSystem"/>
+ </bean>
+
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured"/>
+ <uncallback method="removeModule" state="Configured"/>
+ </bean>
+
+</deployment>
Modified: projects/aop/trunk/pom.xml
===================================================================
--- projects/aop/trunk/pom.xml 2010-03-12 13:14:11 UTC (rev 102345)
+++ projects/aop/trunk/pom.xml 2010-03-12 13:38:13 UTC (rev 102346)
@@ -20,7 +20,7 @@
<properties>
<version.javassist.javassist>3.11.0.GA</version.javassist.javassist>
- <version.jboss.jbossas.core-libs>4.0.4.GA</version.jboss.jbossas.core-libs>
+ <version.org.jboss.classpool>1.0.0.Alpha4</version.org.jboss.classpool>
<version.org.jboss.jbossas>6.0.0.20100216-M2</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>
@@ -56,7 +56,7 @@
</requireMavenVersion>
<requireJavaVersion>
<version>1.5</version>
- </requireJavaVersion>
+ </requireJavaVersion>
</rules>
</configuration>
</execution>
@@ -146,6 +146,26 @@
<version>${version.javassist.javassist}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-scoped</artifactId>
+ <version>${version.org.jboss.classpool}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool</artifactId>
+ <version>${version.org.jboss.classpool}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-jbosscl</artifactId>
+ <version>${version.org.jboss.classpool}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.classpool</groupId>
+ <artifactId>jboss-classpool-ucl</artifactId>
+ <version>${version.org.jboss.classpool}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-reflect</artifactId>
<version>${version.org.jboss.jboss-reflect}</version>
More information about the jboss-cvs-commits
mailing list