[jboss-cvs] JBossAS SVN: r57923 - projects/aop/trunk/aop/src/main/org/jboss/aop

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 30 11:45:42 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-10-30 11:45:41 -0500 (Mon, 30 Oct 2006)
New Revision: 57923

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java
Log:
[JBAOP-293] Get scoped AOP working with AspectAnnotationLoader

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java	2006-10-30 16:13:59 UTC (rev 57922)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/AspectAnnotationLoader.java	2006-10-30 16:45:41 UTC (rev 57923)
@@ -36,6 +36,7 @@
 import org.jboss.aop.advice.AspectDefinition;
 import org.jboss.aop.advice.AspectFactory;
 import org.jboss.aop.advice.AspectFactoryDelegator;
+import org.jboss.aop.advice.AspectFactoryWithClassLoader;
 import org.jboss.aop.advice.DynamicCFlowDefinition;
 import org.jboss.aop.advice.GenericAspectFactory;
 import org.jboss.aop.advice.Interceptor;
@@ -78,12 +79,27 @@
    //TODO: We need something to undeploy everything...
 
    protected AspectManager manager;
+   private ClassLoader cl; 
 
    public AspectAnnotationLoader(AspectManager manager)
    {
       this.manager = manager;
    }
 
+   public void setClassLoader(ClassLoader cl)
+   {
+      this.cl = cl;
+   }
+   
+   public ClassLoader getClassLoader()
+   {
+      if (cl == null)
+      {
+         return Thread.currentThread().getContextClassLoader();
+      }
+      return cl;
+   }
+
    public void deployInputStreamIterator(Iterator it) throws Exception
    {
       while (it.hasNext())
@@ -208,10 +224,12 @@
          if (isFactory)
          {
             factory = new AspectFactoryDelegator(cf.getName(), null);
+            ((AspectFactoryWithClassLoader)factory).setClassLoader(cl);
          }
          else
          {
             factory = new GenericAspectFactory(cf.getName(), null);
+            ((AspectFactoryWithClassLoader)factory).setClassLoader(cl);
          }
          AspectDefinition def = new AspectDefinition(cf.getName(), scope, factory);
          manager.addAspectDefinition(def);
@@ -267,10 +285,12 @@
          if (isFactory)
          {
             aspectFactory = new AspectFactoryDelegator(cf.getName(), null);
+            ((AspectFactoryWithClassLoader)aspectFactory).setClassLoader(cl);
          }
          else
          {
             aspectFactory = new GenericAspectFactory(cf.getName(), null);
+            ((AspectFactoryWithClassLoader)aspectFactory).setClassLoader(cl);
          }
 
          AspectDefinition def = new AspectDefinition(cf.getName(), scope, aspectFactory);




More information about the jboss-cvs-commits mailing list