[jboss-cvs] JBossAS SVN: r95647 - in projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool: domain and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 27 23:00:41 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-10-27 23:00:41 -0400 (Tue, 27 Oct 2009)
New Revision: 95647
Modified:
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/AbstractParentDelegationStrategy.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/DefaultClassPoolToClassPoolDomainAdaptorFactory.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdapter.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdaptorFactory.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolDomain.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdapter.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdaptorFactory.java
projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClParentDelegationStrategy.java
Log:
[JBREFLECT-65] Added infra-structure to support classpool parent delegation on classpool domains.
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/AbstractParentDelegationStrategy.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/AbstractParentDelegationStrategy.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/AbstractParentDelegationStrategy.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -21,6 +21,7 @@
*/
package org.jboss.classpool.base;
+import javassist.ClassPool;
import javassist.CtClass;
import org.jboss.classpool.domain.AbstractClassPoolDomain;
@@ -32,6 +33,7 @@
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
public abstract class AbstractParentDelegationStrategy implements ParentDelegationStrategy
@@ -65,6 +67,11 @@
}
}
+ protected AbstractParentDelegationStrategy(ClassPool parent, ClassPoolToClassPoolDomainAdaptorFactory adaptorFactory)
+ {
+ this.parent = adaptorFactory.createAdaptor(parent);
+ }
+
protected boolean hasParent()
{
if (logger.isTraceEnabled()) logger.trace(this + " " + getDomain() + " hasParent " + parent != null);
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/DefaultClassPoolToClassPoolDomainAdaptorFactory.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/DefaultClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/base/DefaultClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -21,12 +21,15 @@
*/
package org.jboss.classpool.base;
+import javassist.ClassPool;
+
import org.jboss.classpool.domain.ClassPoolToClassPoolDomainAdapter;
import org.jboss.classpool.domain.ClassPoolToClassPoolDomainAdaptorFactory;
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
class DefaultClassPoolToClassPoolDomainAdaptorFactory implements ClassPoolToClassPoolDomainAdaptorFactory
@@ -47,5 +50,10 @@
{
return new ClassPoolToClassPoolDomainAdapter();
}
+
+ public ClassPoolToClassPoolDomainAdapter createAdaptor(ClassPool classPool)
+ {
+ return new ClassPoolToClassPoolDomainAdapter(classPool);
+ }
}
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdapter.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdapter.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdapter.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -60,6 +60,7 @@
}
}
+ // TODO JBREFLECT-65 FIXME this shouldn't be return the default classpool always
public ClassPool initialiseParentClassLoader()
{
return ClassPool.getDefault();
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdaptorFactory.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/domain/ClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -21,12 +21,16 @@
*/
package org.jboss.classpool.domain;
+import javassist.ClassPool;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
public interface ClassPoolToClassPoolDomainAdaptorFactory
{
ClassPoolToClassPoolDomainAdapter createAdaptor();
+ ClassPoolToClassPoolDomainAdapter createAdaptor(ClassPool classPool);
}
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolDomain.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolDomain.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolDomain.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -49,6 +49,7 @@
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
class JBossClClassPoolDomain extends BaseClassPoolDomain
@@ -68,6 +69,17 @@
);
this.registry = registry;
}
+
+ public JBossClClassPoolDomain(String domainName, ClassPool parent, ParentPolicy parentPolicy, DomainRegistry registry)
+ {
+ super(domainName,
+ new JBossClParentDelegationStrategy(
+ parent,
+ parentPolicy,
+ JBossClClassPoolToClassPoolDomainAdaptorFactory.getInstance())
+ );
+ this.registry = registry;
+ }
synchronized void setupPoolsByPackage(DelegatingClassPool pool)
{
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdapter.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdapter.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdapter.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -30,10 +30,22 @@
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
class JBossClClassPoolToClassPoolDomainAdapter extends ClassPoolToClassPoolDomainAdapter
{
+ public JBossClClassPoolToClassPoolDomainAdapter()
+ {
+ super();
+ }
+
+ public JBossClClassPoolToClassPoolDomainAdapter(ClassPool classPool)
+ {
+ super(classPool);
+ }
+
+ // TODO JBREFLECT-65 FIXME this methd shouldn't be returning always the app classloader
@Override
public ClassPool initialiseParentClassLoader()
{
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdaptorFactory.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClClassPoolToClassPoolDomainAdaptorFactory.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -21,12 +21,15 @@
*/
package org.jboss.classpool.plugins.as5.jbosscl;
+import javassist.ClassPool;
+
import org.jboss.classpool.domain.ClassPoolToClassPoolDomainAdapter;
import org.jboss.classpool.domain.ClassPoolToClassPoolDomainAdaptorFactory;
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
class JBossClClassPoolToClassPoolDomainAdaptorFactory implements ClassPoolToClassPoolDomainAdaptorFactory
@@ -47,5 +50,10 @@
{
return new JBossClClassPoolToClassPoolDomainAdapter();
}
+
+ public ClassPoolToClassPoolDomainAdapter createAdaptor(ClassPool classPool)
+ {
+ return new JBossClClassPoolToClassPoolDomainAdapter(classPool);
+ }
}
Modified: projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClParentDelegationStrategy.java
===================================================================
--- projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClParentDelegationStrategy.java 2009-10-28 02:58:41 UTC (rev 95646)
+++ projects/jboss-classpool/trunk/src/main/java/org/jboss/classpool/plugins/as5/jbosscl/JBossClParentDelegationStrategy.java 2009-10-28 03:00:41 UTC (rev 95647)
@@ -21,6 +21,8 @@
*/
package org.jboss.classpool.plugins.as5.jbosscl;
+import javassist.ClassPool;
+
import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classpool.base.AbstractParentDelegationStrategy;
@@ -31,6 +33,7 @@
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
* @version $Revision$
*/
class JBossClParentDelegationStrategy extends AbstractParentDelegationStrategy
@@ -46,6 +49,16 @@
}
this.parentPolicy = parentPolicy;
}
+
+ JBossClParentDelegationStrategy(ClassPool parent, ParentPolicy parentPolicy, ClassPoolToClassPoolDomainAdaptorFactory adaptorFactory)
+ {
+ super(parent, adaptorFactory);
+ if (parentPolicy == null)
+ {
+ throw new IllegalStateException("Null parent policy");
+ }
+ this.parentPolicy = parentPolicy;
+ }
public boolean isParentAfter(String classname)
{
More information about the jboss-cvs-commits
mailing list