[jboss-cvs] JBossAS SVN: r60190 - projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 2 04:32:27 EST 2007


Author: scott.stark at jboss.org
Date: 2007-02-02 04:32:27 -0500 (Fri, 02 Feb 2007)
New Revision: 60190

Modified:
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
Log:
Workaround aop issue with proxy for now

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2007-02-02 09:21:25 UTC (rev 60189)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2007-02-02 09:32:27 UTC (rev 60190)
@@ -29,6 +29,8 @@
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.jboss.aop.proxy.container.AOPProxyFactoryParameters;
+import org.jboss.aop.proxy.container.GeneratedAOPProxyFactory;
 import org.jboss.deployers.plugins.attachments.AttachmentsImpl;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.attachments.Attachments;
@@ -109,8 +111,9 @@
    private transient Attachments transientAttachments = new AttachmentsImpl();
    
    /** The managed objects */
-   private transient Attachments transientManagedObjects = new AttachmentsImpl();
-   
+   private transient Attachments transientManagedObjects =
+      createProxy(new AttachmentsImpl(), Attachments.class);
+
    /** Throwable */
    private Throwable problem;
    
@@ -725,4 +728,28 @@
       buffer.append('{').append(name).append('}');
       return buffer.toString();
    }
+
+   /**
+    * Create a proxy 
+    * 
+    * @param <T> the expected type
+    * @param target the target
+    * @param interfaceClass the interface class
+    * @return the proxy
+    */
+   private <T> T createProxy(T target, Class<T> interfaceClass)
+   {
+      if (target == null)
+         return null;
+
+      GeneratedAOPProxyFactory proxyFactory = new GeneratedAOPProxyFactory();
+      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
+      params.setInterfaces(new Class[] { interfaceClass });
+      params.setObjectAsSuperClass(true);
+      params.setTarget(target);
+      Object proxy = proxyFactory.createAdvisedProxy(params);
+      if( log.isTraceEnabled() )
+         log.trace("Created proxy: "+proxy.getClass()+"@"+System.identityHashCode(proxy)+" target: "+target.getClass());
+      return interfaceClass.cast(proxy);
+   }
 }




More information about the jboss-cvs-commits mailing list