[jboss-cvs] JBossAS SVN: r69127 - in projects/aop/trunk/aop: src/main/org/jboss/aop and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 18 12:54:11 EST 2008


Author: kabir.khan at jboss.com
Date: 2008-01-18 12:54:11 -0500 (Fri, 18 Jan 2008)
New Revision: 69127

Added:
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixin.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface2.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyCacheKeyTestCase.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyInVmTestCase.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyOutOfVmTestCase.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyTest.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect.java
Modified:
   projects/aop/trunk/aop/
   projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInterceptors.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/Delegate.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
   projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxySerializer.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializablePOJO.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SomeInterface.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestInterceptor.java
Log:
[JBAOP-467] Initial support for serializing container proxies out of the vm


Property changes on: projects/aop/trunk/aop
___________________________________________________________________
Name: svn:ignore
   - output
build.log
TEST-org.jboss.test.aop.*.txt
junit*.properties
comments.txt
jbossAgent.dll
jboss-aop-dist.zip
local.properties
org
*.class
aopc.tmpdir
target
com
eclipse-classes
snapshot_classes.mem
snapshot_objects.mem
snapshot_references.mem

   + output
build.log
TEST-org.jboss.test.aop.*.txt
junit*.properties
comments.txt
jbossAgent.dll
jboss-aop-dist.zip
local.properties
org
*.class
aopc.tmpdir
target
com
eclipse-classes
snapshot_classes.mem
snapshot_objects.mem
snapshot_references.mem
test-output


Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/JoinPointInfo.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -53,8 +53,8 @@
    
    protected JoinPointInfo(Advisor advisor, Class clazz)
    {
+      this.clazz = new WeakReference<Class>(clazz); 
       setAdvisor(advisor);
-      this.clazz = new WeakReference<Class>(clazz); 
    }
    
    /*
@@ -95,6 +95,10 @@
    public void setAdvisor(Advisor advisor) 
    {
       this.advisor = new WeakReference<Advisor>(advisor);
+      if (getClazz() == null && advisor != null)
+      {
+         this.clazz = new WeakReference<Class>(advisor.getClazz());
+      }
    }
 
    public boolean hasAdvices()

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInterceptors.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInterceptors.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/MethodInterceptors.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -28,7 +28,7 @@
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision$
  */
-class MethodInterceptors
+public class MethodInterceptors
 {
    Advisor advisor;
    TLongObjectHashMap infos = new TLongObjectHashMap();

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AOPProxyFactoryMixin.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -21,13 +21,15 @@
 */ 
 package org.jboss.aop.proxy.container;
 
+import java.io.IOException;
+import java.io.Serializable;
 import java.lang.ref.WeakReference;
 
-public class AOPProxyFactoryMixin
+public class AOPProxyFactoryMixin implements Serializable
 {
    private String construction;
-   private WeakReference mixinClassRef;
-   private WeakReference[] interfaceClassRefs;
+   private WeakReference<Class> mixinClassRef;
+   private WeakReference<Class>[] interfaceClassRefs;
    private int hashcode;
 
    public AOPProxyFactoryMixin(Class mixin, Class[] interfaces)
@@ -69,7 +71,7 @@
          Class[] interfaces = new Class[interfaceClassRefs.length];
          for (int i = 0 ; i < interfaces.length ; i++)
          {
-            interfaces[i] = (Class)interfaceClassRefs[i].get();
+            interfaces[i] = interfaceClassRefs[i].get();
          }
          return interfaces;
       }
@@ -165,4 +167,26 @@
       }
       return true;
    }
+   
+   private void writeObject(java.io.ObjectOutputStream out) throws IOException
+   {
+      out.writeObject(construction);
+      out.writeObject(mixinClassRef.get());
+      out.writeObject(getInterfaces());
+      out.writeInt(hashCode());
+   }
+   
+   private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+   {
+      construction = (String)in.readObject();
+      mixinClassRef = new WeakReference<Class>((Class)in.readObject());
+      Class[] ifs = (Class[])in.readObject();
+      interfaceClassRefs = new WeakReference[ifs.length];
+      for (int i = 0 ; i < ifs.length ; i++)
+      {
+         interfaceClassRefs[i] = new WeakReference<Class>(ifs[i]);
+      }
+      hashcode = in.readInt();
+   }
+   
 }
\ No newline at end of file

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/AspectManaged.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -24,6 +24,7 @@
 import org.jboss.aop.Advisor;
 import org.jboss.aop.InstanceAdvisor;
 import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.util.id.GUID;
 
 /**
  * comment
@@ -32,6 +33,7 @@
  */
 public interface AspectManaged
 {
+   GUID GUID = new GUID();
    public Advisor getAdvisor();
    public void setAdvisor(Advisor advisor);
    public InstanceAdvisor getInstanceAdvisor();

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ClassProxyContainer.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -21,6 +21,8 @@
   */
 package org.jboss.aop.proxy.container;
 
+import gnu.trove.TLongObjectHashMap;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -32,6 +34,7 @@
 import org.jboss.aop.ClassContainer;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassAdvisor;
+import org.jboss.aop.MethodInfo;
 import org.jboss.aop.advice.AspectDefinition;
 import org.jboss.aop.introduction.InterfaceIntroduction;
 import org.jboss.aop.util.ConstructorComparator;
@@ -214,4 +217,16 @@
    {
       return true;
    }
+
+   public MethodInfo[] getMethodInfos()
+   {
+      long[] keys = methodInfos.keys();
+      MethodInfo[] minfos = new MethodInfo[keys.length];
+      for (int i = 0 ; i < keys.length ; i++)
+      {
+         minfos[i] = methodInfos.getMethodInfo(keys[i]);
+         
+      }
+      return minfos;
+   }
 }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCache.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -41,7 +41,7 @@
 {
    private static volatile int counter;
    public static final Object mapLock = new Object();
-   private static WeakHashMap containerCache = new WeakHashMap();
+   private static WeakHashMap<Class, HashMap<String, ClassProxyContainer>> containerCache = new WeakHashMap<Class, HashMap<String, ClassProxyContainer>>();
 
    private AspectManager manager;
    private ContainerProxyCacheKey key;
@@ -161,12 +161,22 @@
       }
    }
 
+   public static ClassProxyContainer getCachedContainer(ContainerProxyCacheKey key)
+   {
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
+      if (managerContainers != null)
+      {
+         return managerContainers.get(key.getManagerFQN());
+      }
+      return null;
+   }
+   
    private ClassProxyContainer getCachedContainer(AspectManager manager)
    {
-      HashMap managerContainers = (HashMap)containerCache.get(key.getClazz());
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
       if (managerContainers != null)
       {
-         return (ClassProxyContainer)managerContainers.get(manager.getManagerFQN());
+         return managerContainers.get(manager.getManagerFQN());
       }
       return null;
    }
@@ -192,10 +202,10 @@
 
    private void cacheContainer(ContainerProxyCacheKey key, ClassProxyContainer container)
    {
-      HashMap managerContainers = (HashMap)containerCache.get(key.getClazz());
+      HashMap<String, ClassProxyContainer> managerContainers = containerCache.get(key.getClazz());
       if (managerContainers == null)
       {
-         managerContainers = new HashMap();
+         managerContainers = new HashMap<String, ClassProxyContainer>();
          containerCache.put(key.getClazz(), managerContainers);
       }
       managerContainers.put(key.getManagerFQN(), container);

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerCacheUtil.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -37,28 +37,28 @@
     * Takes a Class[] containing interface classes, and returns an array of weak references to thos class
     * objects, sorted alphabetically by name.
     */
-   public static WeakReference[] getSortedWeakReferenceForInterfaces(Class[] ifaces)
+   public static WeakReference<Class>[] getSortedWeakReferenceForInterfaces(Class[] ifaces)
    {
       if (ifaces == null)
       {
          return null;
       }
       
-      WeakReference[] interfaces = new WeakReference[ifaces.length];
+      WeakReference<Class>[] interfaces = new WeakReference[ifaces.length];
       
       for (int i = 0 ; i < ifaces.length ; i++)
       {
-         interfaces[i] = new WeakReference(ifaces[i]);
+         interfaces[i] = new WeakReference<Class>(ifaces[i]);
       }
       
       Arrays.sort(interfaces, Alphabetical.singleton);
       return interfaces;
    }
 
-   public static boolean compareClassRefs(WeakReference my, WeakReference other)
+   public static boolean compareClassRefs(WeakReference<Class> my, WeakReference<Class> other)
    {
-      Class myClass = (Class)my.get();
-      Class otherClass = (Class)other.get(); 
+      Class myClass = my.get();
+      Class otherClass = other.get(); 
       
       if (myClass == null || otherClass == null)
       {
@@ -72,7 +72,7 @@
       return true;
    }
    
-   public static boolean compareInterfaceRefs(WeakReference[] my, WeakReference[] other)
+   public static boolean compareInterfaceRefs(WeakReference<Class>[] my, WeakReference<Class>[] other)
    {
       if ((my == null && other != null) ||
             (my == null && other != null))
@@ -89,8 +89,8 @@
          
          for (int i = 0 ; i < my.length ; i++)
          {
-            Class myIf = (Class)my[i].get();
-            Class otherIf = (Class)other[i].get();
+            Class myIf = my[i].get();
+            Class otherIf = other[i].get();
             
             if (!myIf.equals(otherIf))
             {
@@ -108,8 +108,8 @@
       
       public int compare(Object o1, Object o2)
       {
-         String name1 = ((Class)((WeakReference)o1).get()).getName();
-         String name2 = ((Class)((WeakReference)o2).get()).getName();
+         String name1 = ((WeakReference<Class>)o1).get().getName();
+         String name2 = ((WeakReference<Class>)o2).get().getName();
          return (name1).compareTo(name2);
       }
    }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyCacheKey.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -21,6 +21,7 @@
 */ 
 package org.jboss.aop.proxy.container;
 
+import java.io.IOException;
 import java.io.Serializable;
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
@@ -36,12 +37,12 @@
 public class ContainerProxyCacheKey implements Serializable
 {
    private static final long serialVersionUID = 8758283842273747310L;
-   private static final WeakReference[] EMTPY_WR_ARRAY = new WeakReference[0];
+   private static final WeakReference<Class>[] EMTPY_WR_ARRAY = new WeakReference[0];
    private static final AOPProxyFactoryMixin[] EMPTY_MIXIN_ARRAY = new AOPProxyFactoryMixin[0];
    
    private String managerFqn;
-   private WeakReference clazzRef;
-   private WeakReference[] addedInterfaces = EMTPY_WR_ARRAY;
+   private WeakReference<Class> clazzRef;
+   private WeakReference<Class>[] addedInterfaces = EMTPY_WR_ARRAY;
    
    private MetaData metaData;
    
@@ -50,7 +51,7 @@
    
    public ContainerProxyCacheKey(String managerFqn, Class clazz)
    {
-      this.clazzRef = new WeakReference(clazz);
+      this.clazzRef = new WeakReference<Class>(clazz);
       this.managerFqn = managerFqn;
    }
    
@@ -79,8 +80,7 @@
 
    public Class getClazz()
    {
-      Class clazz = (Class)clazzRef.get();
-      return clazz; 
+      return clazzRef.get();
    }
    
    public String getManagerFQN()
@@ -240,6 +240,36 @@
       return true;
    }
    
+    private void writeObject(java.io.ObjectOutputStream out) throws IOException
+    {
+       out.writeUTF(managerFqn);
+       out.writeObject(clazzRef.get());
+       Class[] ifs = new Class[addedInterfaces.length];
+       for (int i = 0 ; i < addedInterfaces.length ; i++)
+       {
+          ifs[i] = addedInterfaces[i].get();
+       }
+       out.writeObject(ifs);
+       out.writeObject(metaData);
+       out.writeObject(addedMixins);
+       out.writeInt(hashCode());
+    }
+    
+    private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+    {
+       managerFqn = in.readUTF();
+       clazzRef = new WeakReference<Class>((Class)in.readObject());
+       Class[] ifs = (Class[])in.readObject();
+       addedInterfaces = new WeakReference[ifs.length];
+       for (int i = 0 ; i < ifs.length ; i++)
+       {
+          addedInterfaces[i] = new WeakReference<Class>(ifs[i]);
+       }
+       metaData = (MetaData)in.readObject();
+       addedMixins = (AOPProxyFactoryMixin[])in.readObject();
+       hashcode = in.readInt();
+    }
+   
    static class MixinAlphabetical implements Comparator
    {
       static MixinAlphabetical singleton = new MixinAlphabetical();

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -21,9 +21,12 @@
   */
 package org.jboss.aop.proxy.container;
 
+import java.io.Externalizable;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -92,12 +95,11 @@
    /** The class pool for the proxy (i.e for the class we are proxying */
    private ClassPool pool;
    
-   /** The interface introductions and mixins that should be used for this proxy*/
-   private ArrayList mixins;
-   
    /** True if we are proxying a class already woven by jboss aop, false otherwise */
    private boolean isAdvised;
    
+   ProxyStrategy proxyStrategy;
+   
    private CtConstructor defaultCtor;
    
    public static Class getProxyClass(Class clazz, AspectManager manager) throws Exception
@@ -110,6 +112,12 @@
    public static Class getProxyClass(boolean objectAsSuper, ContainerProxyCacheKey key, Advisor advisor)
            throws Exception
    {
+      return getProxyClass(objectAsSuper, key, advisor, null);
+   }
+   
+   public static Class getProxyClass(boolean objectAsSuper, ContainerProxyCacheKey key, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
+   throws Exception
+   {   
       Class clazz = key.getClazz();
       // Don't make a proxy of a proxy !
       if (Delegate.class.isAssignableFrom(clazz)) clazz = clazz.getSuperclass();
@@ -130,17 +138,17 @@
          
          if (proxyClass == null)
          {
-            proxyClass = generateProxy(objectAsSuper, clazz, advisor);
+            proxyClass = generateProxy(objectAsSuper, clazz, advisor, outOfVmProxy);
             map.put(key, proxyClass);
          }
       }
       return proxyClass;
    }
 
-   private static Class generateProxy(boolean objectAsSuper, Class clazz, Advisor advisor) throws Exception
+   private static Class generateProxy(boolean objectAsSuper, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy) throws Exception
    {
       ArrayList introductions = advisor.getInterfaceIntroductions();
-      CtClass proxy = createProxyCtClass(objectAsSuper, introductions, clazz, advisor);
+      CtClass proxy = createProxyCtClass(objectAsSuper, introductions, clazz, advisor, outOfVmProxy);
       ProtectionDomain pd = clazz.getProtectionDomain();
       Class proxyClass = TransformerCommon.toClass(proxy, pd);
       return proxyClass;
@@ -164,21 +172,35 @@
       return container;
    }
    
-   public static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   private static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   throws Exception
+   {
+      return createProxyCtClass(objectAsSuper, mixins, clazz, advisor, null);
+   }
+   
+   private static CtClass createProxyCtClass(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
            throws Exception
    {
-      ContainerProxyFactory factory = new ContainerProxyFactory(objectAsSuper, mixins, clazz, advisor);
+      ContainerProxyFactory factory = new ContainerProxyFactory(objectAsSuper, mixins, clazz, advisor, outOfVmProxy);
       return factory.createProxyCtClass();
    }
 
    
-   private ContainerProxyFactory(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor)
+   private ContainerProxyFactory(boolean objectAsSuper, ArrayList mixins, Class clazz, Advisor advisor, MarshalledContainerProxy outOfVmProxy)
    {
       this.objectAsSuper = objectAsSuper;
-      this.mixins = mixins;
       this.clazz = clazz;
       this.advisor = advisor;
       isAdvised = Advised.class.isAssignableFrom(clazz);
+      
+      if (outOfVmProxy == null)
+      {
+         proxyStrategy = new OriginalProxyStrategy(mixins);
+      }
+      else
+      {
+         proxyStrategy = new UnmarshalledInRemoteJVMProxyStrategy(outOfVmProxy);
+      }
    }
   
    
@@ -226,6 +248,10 @@
       addMethodFromTemplate(template, "getDelegate", "{ return delegate; }");
       setDelegateMethod = addMethodFromTemplate(template, "setDelegate", "{ this.delegate = (" + proxySuper.getName() + ")$1; }");
 
+      addFieldFromTemplate(template, "key");
+      addMethodFromTemplate(template, "setContainerProxyCacheKey", "{this.key=$1;}");
+      
+      
       //Add methods/fields needed for AspectManaged interface 
       proxy.addInterface(pool.get("org.jboss.aop.proxy.container.AspectManaged"));
 
@@ -241,8 +267,9 @@
       addMethodFromTemplate(template, "setInstanceAdvisor", instanceAdvisorSetterBody());
       addMethodFromTemplate(template, "getInstanceAdvisor", instanceAdvisorGetterBody());
       
-      addMethodFromTemplate(template, "writeObject", writeObjectBody());
-      addMethodFromTemplate(template, "readObject", readObjectBody(superclass));
+      addMethodFromTemplate(template, "writeReplace", writeReplaceObjectBody());
+      addMethodFromTemplate(template, "localUnmarshal", localUnmarshalObjectBody(superclass));
+      addMethodFromTemplate(template, "remoteUnmarshal", remoteUnmarshalObjectBody(superclass));
       
       if (objectAsSuper)
       {
@@ -294,33 +321,56 @@
          "}";
    }
 
-   private String writeObjectBody()
+   private String writeReplaceObjectBody()
    {
       return 
          "{" +
-         "   $1.writeObject(delegate);" +
-         "   $1.writeObject(mixins);" +
-         "   $1.writeObject(metadata);"+
-         "   $1.writeObject(classAdvisor.getClazz());" +
+         "   return new " + MarshalledContainerProxy.class.getName() + "(" +
+         "      this.getClass()," +
+         "      this.key," +
+         "      this.mixins," +
+         "      this.delegate," +
+         "      this.classAdvisor.getClazz()," +
+         "      this.currentAdvisor," +
+         "      this.metadata);" +
          "}";
-//       TODO add support for the instance advisors
    }
    
-   private String readObjectBody(CtClass superclass)
+   private String localUnmarshalObjectBody(CtClass superclass)
    {
       return 
          "{" +
-         "   delegate = (" + superclass.getName() + ")$1.readObject();" +
-         "   mixins = (Object[])$1.readObject();" +
-         "   metadata = (org.jboss.aop.metadata.SimpleMetaData)$1.readObject();" +
-         "   java.lang.Class clazz = (java.lang.Class)$1.readObject();" + 
-         "   org.jboss.aop.AspectManager manager = org.jboss.aop.AspectManager.getTopLevelAspectManager();" +
-         "   classAdvisor = manager.findAdvisor(clazz);" +
-         "   currentAdvisor = classAdvisor;" +
+         "   this.delegate = (" + superclass.getName() + ")$1.getDelegate();" +
+         "   this.mixins = $1.getMixins();" +
+         "   this.metadata = $1.getMetadata();" +
+         "   this.key = $1.getKey();" +
+         "   java.lang.Class clazz = $1.getClazz();" +
+         "   this.classAdvisor = org.jboss.aop.proxy.container.ContainerCache.getCachedContainer(this.key);" +
+         "   this.currentAdvisor = classAdvisor;" +
+         "   if ($1.getInstanceAdvisorDomainName() != null)" +
+         "   {" +
+         "      org.jboss.aop.proxy.container.ProxyAdvisorDomain domain = (org.jboss.aop.proxy.container.ProxyAdvisorDomain)org.jboss.aop.AspectManager.getTopLevelAspectManager().findManagerByName($1.getInstanceAdvisorDomainName());" +
+         "      this.currentAdvisor = domain.getAdvisor();" +
+         "      this.instanceAdvisor = this.currentAdvisor;" +
+             "}" +
          "}";
-       //TODO add support for instance advisors
    }
    
+   private String remoteUnmarshalObjectBody(CtClass superclass)
+   {
+      return 
+         "{" +
+         "   this.delegate = (" + superclass.getName() + ")$1.getDelegate();" +
+         "   this.mixins = $1.getMixins();" +
+         "   this.metadata = $1.getMetadata();" +
+         "   this.key = $1.getKey();" +
+         "   java.lang.Class clazz = $1.getClazz();" +
+         "   this.classAdvisor = $2;" +
+         "   this.currentAdvisor = $2;" +
+         "   this.instanceAdvisor = $2;" +
+         "}";
+   }
+   
    private String equalsBody()
    {
       return 
@@ -362,7 +412,7 @@
    {
       return addFieldFromTemplate(template, name, null);
    }
-
+   
    private CtField addFieldFromTemplate(CtClass template, String name, CtClass type) throws Exception
    {
       CtField templateField = template.getField(name);
@@ -464,41 +514,22 @@
    
    private void addMethodsAndMixins()throws Exception
    {
-      HashSet addedMethods = new HashSet();
+      HashSet<Long> addedMethods = new HashSet<Long>();
       createMixinsAndIntroductions(addedMethods);
       createProxyMethods(addedMethods);
    }
 
-   private void createMixinsAndIntroductions(HashSet addedMethods) throws Exception
+   private void createMixinsAndIntroductions(HashSet<Long> addedMethods) throws Exception
    {
-      HashSet addedInterfaces = new HashSet();
-      Set implementedInterfaces = interfacesAsSet();
+      HashSet<String> addedInterfaces = new HashSet<String>();
+      Set<String> implementedInterfaces = interfacesAsSet();
       
-      if (mixins != null)
+      if (proxyStrategy.hasIntroductions())
       {
-         HashMap intfs = new HashMap();
-         HashMap mixinIntfs = new HashMap();
-         ArrayList mixes = new ArrayList();
-         for (int i = 0; i < mixins.size(); i++)
-         {
-            InterfaceIntroduction introduction = (InterfaceIntroduction) mixins.get(i);
-            getIntroductionInterfaces(introduction, intfs, mixinIntfs, mixes, i);
-         }
-         if (mixes.size() > 0)
-         {
-            defaultCtor.insertAfter("mixins = new Object[" + mixes.size() + "];");
-            for (int i = 0; i < mixes.size(); i++)
-            {
-               //If using a constructor and passing "this" as the parameters, the proxy gets used. The delegate (instance wrapped by proxy) is not 
-               //set in the proxy until later, and if the mixin implements Delegate it will get set with the "real" instance at this point.
-               InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) mixes.get(i);
-               String initializer = (mixin.getConstruction() == null) ? ("new " + mixin.getClassName() + "()") : mixin.getConstruction();
-               String code = "mixins[" + i + "] = " + initializer + ";";
-               defaultCtor.insertAfter(code);
-               setDelegateMethod.insertAfter("{if (org.jboss.aop.proxy.container.Delegate.class.isAssignableFrom(mixins[" + i + "].getClass())) " +
-                     "((org.jboss.aop.proxy.container.Delegate)mixins[" + i + "]).setDelegate($1);}");
-            }
-         }
+         HashMap<String, Integer> intfs = new HashMap<String, Integer>();
+         HashMap<String, Integer> mixinIntfs = new HashMap<String, Integer>();
+         ArrayList<MixinInfo> mixes = new ArrayList<MixinInfo>();
+         proxyStrategy.getMixins(intfs, mixinIntfs, mixes);
          
          //Now that we have added the mixins, add all the proxies methods to the added methods set
          HashMap allMethods = JavassistMethodHashing.getDeclaredMethodMap(proxy);
@@ -509,57 +540,13 @@
       }
    }
    
-   /**
-    * Split the interface introduction into something we can work with
-    * 
-    * @param intro The InterfaceIntroduction
-    * @param intfs receives the interfaces from plain interface introductions
-    * @param mixins receives the interfaces from mixins
-    * @param mixes receives the actual InterfaceIntroduction.Mixin objects
-    * @@param the index interface introduction this data comes from 
-    */
-   private void getIntroductionInterfaces(InterfaceIntroduction intro, HashMap intfs, HashMap mixins, ArrayList mixes, int idx)
+   
+   
+   private void createMixins(HashSet<Long> addedMethods, ArrayList<MixinInfo> mixes, HashSet<String> addedInterfaces, Set<String> implementedInterfaces) throws Exception
    {
-      Iterator it = intro.getMixins().iterator();
-      while (it.hasNext())
-      {
-         InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) it.next();
-         mixes.add(mixin);
-         for (int i = 0; i < mixin.getInterfaces().length; i++)
-         {
-            if (intfs.containsKey(mixin.getInterfaces()[i]))
-            {
-               intfs.remove(mixin.getInterfaces()[i]);
-               
-            }
-            if (mixins.containsKey(mixin.getInterfaces()[i]))
-            {
-               throw new RuntimeException("cannot have an IntroductionInterface that introduces several mixins with the same interfaces " + mixin.getInterfaces()[i]);
-            }
-            mixins.put(mixin.getInterfaces()[i], new Integer(idx));
-         }
-      }
-      if (intro.getInterfaces() != null)
-      {
-         for (int i = 0; i < intro.getInterfaces().length; i++)
-         {
-            if (intfs.containsKey(intro.getInterfaces()[i]) || mixins.containsKey(intro.getInterfaces()[i])) 
-            {
-               //Do nothing
-            }
-            else
-            {
-               intfs.put(intro.getInterfaces()[i], new Integer(idx));
-            }
-         }
-      }
-   }
-
-   private void createMixins(HashSet addedMethods, ArrayList mixes, HashSet addedInterfaces, Set implementedInterfaces) throws Exception
-   {
       for (int mixinId = 0 ; mixinId < mixes.size() ; mixinId++)
       {
-         InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin)mixes.get(mixinId);
+         MixinInfo mixin = mixes.get(mixinId);
          
          String[] intfs = mixin.getInterfaces();
          
@@ -614,7 +601,7 @@
       }
    }
 
-   private void createProxyMethods(HashSet addedMethods) throws Exception
+   private void createProxyMethods(HashSet<Long> addedMethods) throws Exception
    {
       HashMap allMethods = JavassistMethodHashing.getMethodMap(proxy.getSuperclass());
 
@@ -678,7 +665,7 @@
       }
    }
    
-   private void createIntroductions(HashSet addedMethods, HashMap intfs, HashSet addedInterfaces, Set implementedInterfaces) throws Exception
+   private void createIntroductions(HashSet<Long> addedMethods, HashMap<String, Integer> intfs, HashSet<String> addedInterfaces, Set<String> implementedInterfaces) throws Exception
    {
       Iterator it = intfs.keySet().iterator();
       while (it.hasNext())
@@ -733,9 +720,9 @@
       }
    }
 
-   private Set interfacesAsSet() throws NotFoundException
+   private Set<String> interfacesAsSet() throws NotFoundException
    {
-      HashSet set = new HashSet();
+      HashSet<String> set = new HashSet<String>();
       CtClass[] interfaces = proxy.getInterfaces();
       
       for (int i = 0 ; i < interfaces.length ; i++)
@@ -893,4 +880,208 @@
          destFile.addAttribute(sig.copy(destFile.getConstPool(), new HashMap()));
       }
    }
+   
+   private interface ProxyStrategy
+   {
+      /**
+       * Whether the proxy has introductions and/or mixins
+       * @return true if we have introductions and/or mixins
+       */
+      boolean hasIntroductions();
+      
+      /**
+       * @param intfs receives the interfaces from plain interface introductions
+       * @param mixinInterfaces receives the interfaces from mixins
+       * @param mixes receives the actual InterfaceIntroduction.Mixin objects
+       */
+      void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixins, ArrayList<MixinInfo> mixes) throws Exception;
+   }
+   
+   private class OriginalProxyStrategy implements ProxyStrategy
+   {
+      ArrayList<InterfaceIntroduction> mixins;
+      
+      OriginalProxyStrategy(ArrayList<InterfaceIntroduction> mixins)
+      {
+         this.mixins = mixins;
+      }
+      
+      public boolean hasIntroductions()
+      {
+         if (mixins == null)
+         {
+            return false;
+         }
+         return mixins.size() > 0;
+      }
+
+      public void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixinInterfaces, ArrayList<MixinInfo> mixes) throws Exception
+      {
+         if (mixins != null)
+         {
+            HashMap mixinIntfs = new HashMap();
+            for (int i = 0; i < mixins.size(); i++)
+            {
+               InterfaceIntroduction introduction = mixins.get(i);
+               getIntroductionInterfaces(introduction, intfs, mixinIntfs, mixes, i);
+            }
+            if (mixes.size() > 0)
+            {
+               defaultCtor.insertAfter("mixins = new Object[" + mixes.size() + "];");
+               for (int i = 0; i < mixes.size(); i++)
+               {
+                  //If using a constructor and passing "this" as the parameters, the proxy gets used. The delegate (instance wrapped by proxy) is not 
+                  //set in the proxy until later, and if the mixin implements Delegate it will get set with the "real" instance at this point.
+                  MixinInfo mixin = mixes.get(i);
+                  String initializer = (mixin.getConstruction() == null) ? ("new " + mixin.getClassName() + "()") : mixin.getConstruction();
+                  String code = "mixins[" + i + "] = " + initializer + ";";
+                  defaultCtor.insertAfter(code);
+                  setDelegateMethod.insertAfter("{if (org.jboss.aop.proxy.container.Delegate.class.isAssignableFrom(mixins[" + i + "].getClass())) " +
+                        "((org.jboss.aop.proxy.container.Delegate)mixins[" + i + "]).setDelegate($1);}");
+               }
+            }
+         }
+      }
+      
+      /**
+       * Split the interface introduction into something we can work with
+       * 
+       * @param intro The InterfaceIntroduction
+       * @param intfs receives the interfaces from plain interface introductions
+       * @param mixinInterfaces receives the interfaces from mixins
+       * @param mixes receives the actual InterfaceIntroduction.Mixin objects
+       * @@param the index interface introduction this data comes from 
+       */
+      private void getIntroductionInterfaces(InterfaceIntroduction intro, 
+            HashMap<String, Integer> intfs, 
+            HashMap<String, Integer> mixinInterfaces, 
+            ArrayList<MixinInfo> mixes, 
+            int idx)
+      {
+         Iterator it = intro.getMixins().iterator();
+         while (it.hasNext())
+         {
+            InterfaceIntroduction.Mixin mixin = (InterfaceIntroduction.Mixin) it.next();
+            mixes.add(new MixinInfo(mixin));
+            for (int i = 0; i < mixin.getInterfaces().length; i++)
+            {
+               if (intfs.containsKey(mixin.getInterfaces()[i]))
+               {
+                  intfs.remove(mixin.getInterfaces()[i]);
+                  
+               }
+               if (mixinInterfaces.containsKey(mixin.getInterfaces()[i]))
+               {
+                  throw new RuntimeException("cannot have an IntroductionInterface that introduces several mixins with the same interfaces " + mixin.getInterfaces()[i]);
+               }
+               mixinInterfaces.put(mixin.getInterfaces()[i], new Integer(idx));
+            }
+         }
+         if (intro.getInterfaces() != null)
+         {
+            for (int i = 0; i < intro.getInterfaces().length; i++)
+            {
+               if (intfs.containsKey(intro.getInterfaces()[i]) || mixinInterfaces.containsKey(intro.getInterfaces()[i])) 
+               {
+                  //Do nothing
+               }
+               else
+               {
+                  intfs.put(intro.getInterfaces()[i], new Integer(idx));
+               }
+            }
+         }
+      }
+   }
+   
+   private class UnmarshalledInRemoteJVMProxyStrategy implements ProxyStrategy
+   {
+      MarshalledContainerProxy outOfVmProxy;
+      
+      UnmarshalledInRemoteJVMProxyStrategy(MarshalledContainerProxy outOfVmProxy)
+      {
+         this.outOfVmProxy = outOfVmProxy;
+      }
+      
+      public boolean hasIntroductions()
+      {
+         if (outOfVmProxy == null)
+         {
+            return false;
+         }
+         return outOfVmProxy.getIntroducedInterfaces().length > 0;
+      }
+      
+      public void getMixins(HashMap<String, Integer>  intfs, HashMap<String, Integer>  mixinInterfaces, ArrayList<MixinInfo> mixes) throws Exception
+      {
+         HashSet<String> allInterfaces = new HashSet<String>();
+         String[] introducedInterfaces = outOfVmProxy.getIntroducedInterfaces();
+         allInterfaces.addAll(Arrays.asList(introducedInterfaces));
+         
+         Set<String> targetInterfaces = outOfVmProxy.getTargetInterfaces();
+         Object[] mixins = outOfVmProxy.getMixins();
+         int i = 0;
+         for ( ; i < mixins.length ; i++)
+         {
+            Class clazz = mixins[i].getClass();
+            Class[] ifs = clazz.getInterfaces(); 
+            ArrayList<String> interfaces = new ArrayList<String>(ifs.length);
+            for (Class iface : ifs)
+            {
+               String name = iface.getName();
+               if (name.equals(Serializable.class.getName()) || 
+                     name.equals(Externalizable.class.getName()) || 
+                     targetInterfaces.contains(name))
+               {
+                  continue;
+               }
+               interfaces.add(name);
+               allInterfaces.remove(name);
+               mixinInterfaces.put(name, i);
+            }
+            MixinInfo info = new MixinInfo(clazz.getName(), interfaces);
+            mixes.add(info);
+         }
+         
+         for (String iface : allInterfaces)
+         {
+            intfs.put(iface, ++i);
+         }
+      }
+   }
+   
+   private static class MixinInfo
+   {
+      String[] interfaces;
+      String className;
+      String construction;
+      
+      MixinInfo(InterfaceIntroduction.Mixin mixin)
+      {
+         this.interfaces = mixin.getInterfaces();
+         this.className = mixin.getClassName();
+         this.construction = mixin.getConstruction();
+      }
+      
+      MixinInfo(String className, ArrayList<String> interfaces)
+      {
+         this.className = className;
+         this.interfaces = interfaces.toArray(new String[interfaces.size()]);
+      }
+      
+      protected String[] getInterfaces()
+      {
+         return interfaces;
+      }
+
+      protected String getClassName()
+      {
+         return className;
+      }
+
+      protected String getConstruction()
+      {
+         return construction;
+      }
+   }
 }   

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/Delegate.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/Delegate.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/Delegate.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -28,6 +28,9 @@
  */
 public interface Delegate
 {
-   public Object getDelegate();
-   public void setDelegate(Object delegate);
+   Object getDelegate();
+   void setDelegate(Object delegate);
+   void setContainerProxyCacheKey(ContainerProxyCacheKey key);
+   void localUnmarshal(MarshalledContainerProxy proxy);
+   void remoteUnmarshal(MarshalledContainerProxy proxy, MarshalledProxyAdvisor advisor);
 }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/GeneratedAOPProxyFactory.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -132,7 +132,6 @@
       return proxyClass;
    }
 
-//   private Object instantiateAndConfigureProxy(Class proxyClass, ContainerCache cache, SimpleMetaData metadata, Object target, Constructor ctor, Object[] ctorArguments) throws Exception
    private Object instantiateAndConfigureProxy(Class proxyClass, AOPProxyFactoryParameters params) throws Exception
    {
       AspectManaged proxy;
@@ -166,6 +165,7 @@
       {
          ((Delegate)proxy).setDelegate(new Object());
       }
+      ((Delegate)proxy).setContainerProxyCacheKey(params.getContainerCache().getKey());
 
       return proxy;
    }

Added: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,369 @@
+/*
+* 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.proxy.container;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.instrument.Untransformable;
+import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.util.id.GUID;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MarshalledContainerProxy implements Serializable
+{
+   private static final long serialVersionUID = 1L;
+
+   //Fields to check if we are unmarshalling in the same JVM
+   private final static GUID GUID = new GUID();
+   private GUID guid = GUID;
+   
+   //Fields from the proxy, used when unmarshalling in the same JVM
+   private String proxyClassName;
+   private ContainerProxyCacheKey key;
+   private Object mixins[];
+   private Object delegate;
+   private Class clazz;
+   private String instanceAdvisorDomainName;
+   private SimpleMetaData metadata;
+   
+   //Interfaces resulting from a mixin or interface introduction
+   private String[] introducedInterfaces;
+   
+   //Interfaces implemented by mixins that are already implemented by the target class
+   private Set<String> targetInterfaces = new HashSet<String>();
+   
+   //The interceptor chains for each method used when unmarshalling in a different JVM
+   MarshalledInterceptors marshalledInterceptors;
+   
+   public MarshalledContainerProxy(Class proxyClass, ContainerProxyCacheKey key, Object[] mixins, Object delegate, Class clazz, Advisor currentAdvisor, SimpleMetaData metadata)
+   {
+      this.proxyClassName = proxyClass.getName();
+      this.key = key;
+      this.mixins = mixins;
+      this.delegate = delegate;
+      this.clazz = clazz;
+      
+      if (currentAdvisor instanceof InstanceProxyContainer)
+      {
+         AspectManager manager = currentAdvisor.getManager();
+         instanceAdvisorDomainName = manager.getManagerFQN();
+      }
+      this.metadata = metadata;
+
+      marshalledInterceptors = new MarshalledInterceptors(currentAdvisor, mixins);
+      
+      Class[] proxyInterfaces = proxyClass.getInterfaces();
+      ArrayList<String> ifs = new ArrayList<String>();
+      for (int i = 0 ; i < proxyInterfaces.length ; i++)
+      {
+         String name = proxyInterfaces[i].getName();
+         if (name.equals(Untransformable.class.getName()) || 
+               name.equals(Delegate.class.getName()) ||
+               name.equals(AspectManaged.class.getName()))
+         {
+            continue;
+         }
+         if (proxyInterfaces[i].isAssignableFrom(clazz))
+         {
+            targetInterfaces.add(clazz.getName());
+            continue;
+         }
+         ifs.add(proxyInterfaces[i].getName());
+      }
+      introducedInterfaces = ifs.toArray(new String[ifs.size()]);
+   }
+   
+   public Object readResolve() throws ObjectStreamException
+   {
+      try
+      {
+         if (isLocal())
+         {
+            return localReadResolve();
+         }
+         return remoteReadResolve();
+      }
+      catch (Exception e)
+      {
+         InvalidObjectException ex = new InvalidObjectException(e.getMessage());
+         ex.setStackTrace(e.getStackTrace());
+         ex.initCause(e);
+         throw ex;
+      }
+   }   
+   
+   private Object localReadResolve() throws Exception
+   {
+      ClassLoader tcl = SecurityActions.getContextClassLoader();
+      Class proxyClass = tcl.loadClass(proxyClassName);
+      Object proxy = proxyClass.newInstance();
+      Delegate delegate = (Delegate)proxy;
+      delegate.localUnmarshal(this);
+      return proxy;
+   }
+   
+   private Object remoteReadResolve() throws Exception
+   {
+      if (marshalledInterceptors.getException() != null)
+      {
+         throw new Exception(marshalledInterceptors.getException());
+      }
+      
+      MarshalledProxyAdvisor advisor = marshalledInterceptors.getMarshalledAdvisor();
+
+      //TODO Make this take into consideration, the super class
+      boolean objectAsSuper = false;
+      Class proxyClass = ContainerProxyFactory.getProxyClass(objectAsSuper, key, advisor, this);
+   
+      Delegate proxy = (Delegate)proxyClass.newInstance();
+      proxy.remoteUnmarshal(this, advisor);
+      return proxy;
+   }
+   
+   private boolean isLocal()
+   {
+      return guid.equals(GUID);
+   }
+
+   public ContainerProxyCacheKey getKey()
+   {
+      return key;
+   }
+   
+   public Object[] getMixins()
+   {
+      return mixins;
+   }
+
+   public Object getDelegate()
+   {
+      return delegate;
+   }
+
+   public Class getClazz()
+   {
+      return clazz;
+   }
+
+   public SimpleMetaData getMetadata()
+   {
+      return metadata;
+   }
+
+   protected String getInstanceAdvisorDomainName()
+   {
+      return instanceAdvisorDomainName;
+   }
+
+   protected String[] getIntroducedInterfaces()
+   {
+      return introducedInterfaces;
+   }
+
+   protected Set<String> getTargetInterfaces()
+   {
+      return targetInterfaces;
+   }
+   
+   private static class MarshalledInterceptors implements Serializable
+   {
+      private static final long serialVersionUID = 1L;
+      transient Advisor currentAdvisor;
+      Object[] mixins;
+      private Exception exception;
+
+      public MarshalledInterceptors(Advisor currentAdvisor, Object[] mixins)
+      {
+         this.currentAdvisor = currentAdvisor;
+         this.mixins = mixins;
+      }
+      
+      public Exception getException()
+      {
+         return exception;
+      }
+      
+      public MarshalledProxyAdvisor getMarshalledAdvisor()
+      {
+         return (MarshalledProxyAdvisor)currentAdvisor;
+      }
+      
+      private void writeObject(ObjectOutputStream out) throws IOException
+      {
+         ObjectOutputStream test = new ObjectOutputStream(new ByteArrayOutputStream());
+         try
+         {
+            MethodInfo[] methodInfos = ((ClassProxyContainer)currentAdvisor).getMethodInfos();
+            MarshalledMethodInfo[] marshalledInfos = new MarshalledMethodInfo[methodInfos.length];
+
+            for (int i = 0 ; i < methodInfos.length ; i++)
+            {
+               MarshalledMethodInfo info = new MarshalledMethodInfo(methodInfos[i]);
+
+               marshalledInfos[i] = info;
+               try
+               {
+                  test.writeObject(info);
+                  continue;
+               }
+               catch (Exception e)
+               {
+                  IOException ex = new IOException("An error happened serializing the info for " + getExceptionExpression(methodInfos[i]));
+                  ex.initCause(e);
+                  out.writeObject(ex);
+                  return;
+               }
+            }
+            out.writeObject(marshalledInfos);
+         }
+         finally
+         {
+            try
+            {
+               test.close();
+            }
+            catch (Exception e)
+            {
+            }
+         }
+      }
+      
+      private String getExceptionExpression(MethodInfo info)
+      {
+         Method m = info.getAdvisedMethod();
+         StringBuilder expr = new StringBuilder();
+         if (m == null)
+         {
+            expr.append("a method");
+         }
+         else
+         {
+            expr.append(m.getDeclaringClass().getName());
+            expr.append(".");
+            expr.append(m.getName());
+            expr.append("(");
+            boolean first = true;
+            for (Class c : m.getParameterTypes())
+            {
+               if (first)
+               {
+                  first = false;
+               }
+               else
+               {
+                  expr.append(", ");
+               }
+               expr.append(c.getName());
+            }
+            expr.append(")");
+         }
+         return expr.toString();
+      }
+      
+      private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+      {
+          Object o = in.readObject();
+          if (o instanceof IOException)
+          {
+             exception = (IOException)o;
+             return;
+          }
+          
+          MarshalledProxyAdvisor advisor = new MarshalledProxyAdvisor("Unmarshalled", AspectManager.getTopLevelAspectManager());
+          MarshalledMethodInfo[] marshalledInfos = (MarshalledMethodInfo[])o;
+          MethodInfo[] methodInfos = new MethodInfo[marshalledInfos.length];
+          for (int i = 0 ; i < marshalledInfos.length ; i++)
+          {
+             methodInfos[i] = marshalledInfos[i].getMethodInfo(advisor);
+             advisor.addMethodInfo(methodInfos[i]);
+          }
+          currentAdvisor = advisor;
+      }
+   }
+      
+      
+   private static class MarshalledMethodInfo implements Serializable
+   {
+      long advisedHash;
+      long unadvisedHash;
+      Interceptor[] interceptors;
+      Class clazz;
+      
+      public MarshalledMethodInfo(MethodInfo info) throws IOException
+      {
+         try
+         {
+            this.advisedHash = MethodHashing.methodHash(info.getAdvisedMethod());
+            this.unadvisedHash = MethodHashing.methodHash(info.getUnadvisedMethod());
+         }
+         catch (Exception e)
+         {
+            throw new MethodHashingException(e);
+         }
+         interceptors = info.getInterceptors();
+         clazz = info.getClazz();
+      }
+      
+      public MethodInfo getMethodInfo(Advisor advisor)
+      {
+         MethodInfo info = new MethodInfo(clazz, advisedHash, unadvisedHash, advisor);
+         info.setInterceptors(interceptors);
+         return info;
+      }
+      
+      public String toString()
+      {
+         return advisedHash + " " + ((interceptors == null) ? "null" : Arrays.asList(interceptors));
+      }
+   }
+      
+   private static class MethodHashingException extends IOException
+   {
+      private static final long serialVersionUID = 1L;
+
+      MethodHashingException(Exception e)
+      {
+         super("Error hashing method");
+         super.initCause(e);
+      }
+   }   
+}
\ No newline at end of file

Added: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledProxyAdvisor.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,172 @@
+/*
+* 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.proxy.container;
+
+import gnu.trove.TLongObjectHashMap;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.Domain;
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.AspectDefinition;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Joinpoint;
+import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.SimpleMetaData;
+
+/**
+ * The advisor used by a container proxy that is unmarshalled in a remote jvm
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+class MarshalledProxyAdvisor extends Advisor implements InstanceAdvisor
+{
+   TLongObjectHashMap methodInfos = new TLongObjectHashMap();
+   Object instance;
+   
+   public MarshalledProxyAdvisor(String name, AspectManager manager)
+   {
+      super(name, manager);
+   }
+
+   public void addMethodInfo(MethodInfo info)
+   {
+      methodInfos.put(info.getHash(), info);
+   }
+   
+   public void setInstance(Object instance)
+   {
+      this.instance = instance;
+   }
+   
+   @Override
+   public void addClassMetaData(ClassMetaDataBinding data)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   @Override
+   protected void rebuildInterceptors()
+   {
+      //Noop, all interceptors are added via addMethodInfo
+   }
+
+   @Override
+   public void removeClassMetaData(ClassMetaDataBinding data)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+   
+   @Override
+   public MethodInfo getMethodInfo(long hash)
+   {
+      MethodInfo info = (MethodInfo)methodInfos.get(hash);
+      return info;
+   }
+
+   public void appendInterceptor(Interceptor interceptor)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void appendInterceptor(int index, Interceptor interceptor) throws IndexOutOfBoundsException
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void appendInterceptorStack(String stackName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Domain getDomain()
+   {
+      return null;
+   }
+
+   public Object getInstance()
+   {
+      return instance;
+   }
+
+   public Interceptor[] getInterceptors()
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Interceptor[] getInterceptors(Interceptor[] baseChain)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public SimpleMetaData getMetaData()
+   {
+      return null;
+   }
+
+   public Object getPerInstanceAspect(String aspectName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Object getPerInstanceAspect(AspectDefinition def)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public Object getPerInstanceJoinpointAspect(Joinpoint joinpoint, AspectDefinition def)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public boolean hasInterceptors()
+   {
+      return false;
+   }
+
+   public void insertInterceptor(Interceptor interceptor)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void insertInterceptor(int index, Interceptor interceptor) throws IndexOutOfBoundsException
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void insertInterceptorStack(String stackName)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void removeInterceptor(String name)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+
+   public void removeInterceptorStack(String name)
+   {
+      throw new RuntimeException("Not yet implemented");
+   }
+}

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -22,11 +22,13 @@
 package org.jboss.aop.proxy.container;
 
 import java.io.IOException;
+import java.io.ObjectStreamException;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.InstanceAdvisor;
 import org.jboss.aop.metadata.SimpleMetaData;
+import org.jboss.util.id.GUID;
 
 /**
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
@@ -46,8 +48,8 @@
    private Object delegate;
    private Object[] mixins; // Do not remove this
    private SimpleMetaData metadata;
+   private ContainerProxyCacheKey key;
 
-
    public Object getDelegate()
    {
       return delegate;
@@ -58,6 +60,11 @@
       this.delegate = delegate;
    }
 
+   public void setContainerProxyCacheKey(ContainerProxyCacheKey key)
+   {
+      this.key = key;
+   }
+   
    public Advisor getAdvisor()
    {
       return currentAdvisor;
@@ -134,34 +141,45 @@
          return super.toString() + "(empty proxy of " + this.getClass().getSuperclass().getName() + ")";
    }
    
-//   "{" +
-//   "   if (delegate != null)" +
-//   "      return delegate.toString() + \" (proxied by \" + this.getClass().getName() + \"@\" + java.lang.Integer.toHexString(java.lang.System.identityHashCode(this)) + \")\";" +
-//   "   else" +
-//   "      return super.toString() + \" (empty proxy of \" + this.getClass().getSuperclass().getName() + \")\";" +
-//   "}";
-
+   private Object writeReplace() throws ObjectStreamException
+   {
+      return new MarshalledContainerProxy(
+            this.getClass(), 
+            this.key,
+            this.mixins, 
+            this.delegate, 
+            this.classAdvisor.getClazz(),
+            this.currentAdvisor,
+            this.metadata);
+   }
    
-   private void writeObject(java.io.ObjectOutputStream out) throws IOException
+   public void localUnmarshal(MarshalledContainerProxy proxy) 
    {
-      out.writeObject(delegate);
-      out.writeObject(mixins);
-      out.writeObject(metadata);
-      out.writeObject(classAdvisor.getClazz());
-      //TODO add support for the instance advisors
+      this.delegate = proxy.getDelegate();
+      this.mixins = proxy.getMixins();
+      this.metadata = proxy.getMetadata();
+      this.key = proxy.getKey();
+
+      Class clazz = proxy.getClazz();
+      this.classAdvisor = ContainerCache.getCachedContainer(this.key);
+      this.currentAdvisor = classAdvisor;
+      
+      if (proxy.getInstanceAdvisorDomainName() != null)
+      {
+         ProxyAdvisorDomain domain = (ProxyAdvisorDomain)AspectManager.getTopLevelAspectManager().findManagerByName(proxy.getInstanceAdvisorDomainName());
+         this.currentAdvisor = domain.getAdvisor();
+      }
    }
    
-   private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+   public void remoteUnmarshal(MarshalledContainerProxy proxy, MarshalledProxyAdvisor advisor)
    {
-      delegate = in.readObject();
-      mixins = (Object[])in.readObject();
-      metadata = (SimpleMetaData)in.readObject();
+      this.delegate = proxy.getDelegate();
+      this.mixins = proxy.getMixins();
+      this.metadata = proxy.getMetadata();
+      this.key = proxy.getKey();
       
-      Class clazz = (Class)in.readObject();
-      AspectManager manager = AspectManager.getTopLevelAspectManager();
-      classAdvisor = manager.findAdvisor(clazz);
-      currentAdvisor = classAdvisor;
-      //TODO add support for instance advisors
-      
+      this.classAdvisor = advisor;
+      this.currentAdvisor = advisor;
+      this.instanceAdvisor = advisor;
    }
 }

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/SecurityActions.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -33,7 +33,7 @@
 class SecurityActions
 {
    
-   public static class GetContextClassLoaderAction implements PrivilegedAction<ClassLoader>
+   static class GetContextClassLoaderAction implements PrivilegedAction<ClassLoader>
    {
       public static GetContextClassLoaderAction INSTANCE = new GetContextClassLoaderAction();
       

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixin.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixin.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixin.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,47 @@
+/*
+* 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.proxy;
+
+import java.io.Serializable;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class OtherMixin implements OtherMixinInterface, OtherMixinInterface2, Serializable
+{
+   int i;
+   public OtherMixin(int i)
+   {
+      this.i = i;
+   }
+   
+   public void other()
+   {
+   }
+   
+   public int other2()
+   {
+      return i;
+   }
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,32 @@
+/*
+* 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.proxy;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface OtherMixinInterface
+{
+   void other();
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface2.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface2.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OtherMixinInterface2.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,32 @@
+/*
+* 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.proxy;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface OtherMixinInterface2
+{
+   int other2();
+}

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxySerializer.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxySerializer.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxySerializer.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -35,8 +35,10 @@
 import org.jboss.aop.advice.GenericAspectFactory;
 import org.jboss.aop.advice.InterceptorFactory;
 import org.jboss.aop.advice.Scope;
+import org.jboss.aop.advice.ScopedInterceptorFactory;
 import org.jboss.aop.pointcut.PointcutExpression;
 import org.jboss.aop.proxy.container.AOPProxyFactory;
+import org.jboss.aop.proxy.container.AOPProxyFactoryMixin;
 import org.jboss.aop.proxy.container.AOPProxyFactoryParameters;
 import org.jboss.aop.proxy.container.GeneratedAOPProxyFactory;
 
@@ -66,103 +68,7 @@
       
       try
       {
-         
-//         InstanceDomain domain = new InstanceDomain(AspectManager.instance(), "blah", false);
-//
-//         
-//         InterfaceIntroduction intro = new InterfaceIntroduction("intro", "*", null);
-//         String[] intfs = {MixinInterface.class.getName()};
-//         InterfaceIntroduction.Mixin mixin = new InterfaceIntroduction.Mixin(Mixin.class.getName(), intfs, null, false);
-//         intro.getMixins().add(mixin);
-//         domain.addInterfaceIntroduction(intro);
-//
-//         
-//         AspectDefinition def = new AspectDefinition("aspect", Scope.PER_VM, new GenericAspectFactory(EchoInterceptor.class.getName(), null));
-//         domain.addAspectDefinition(def);
-//         AdviceFactory advice = new AdviceFactory(def, "invoke");
-//         domain.addInterceptorFactory(advice.getName(), advice);
-//         {
-//         PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(java.lang.String " + POJO.class.getName() + "->helloWorld(..))");
-//         domain.addPointcut(pointcut);
-//         InterceptorFactory[] interceptors = {advice};
-//         AdviceBinding binding = new AdviceBinding("pojo-binding", pointcut, null, null, interceptors);
-//         domain.addBinding(binding);
-//         }
-//
-//         {
-//         PointcutExpression pointcut = new PointcutExpression("mixin-pointcut", "execution(java.lang.String $instanceof{" + MixinInterface.class.getName() + "}->intercepted(..))");
-//         domain.addPointcut(pointcut);
-//         InterceptorFactory[] interceptors = {advice};
-//         AdviceBinding binding = new AdviceBinding("mixin-binding", pointcut, null, null, interceptors);
-//         domain.addBinding(binding);
-//         }
-//
-//         
-//         AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
-//         AOPProxyFactory factory = new GeneratedAOPProxyFactory();
-//         params.set
-//         factory.createAdvisedProxy(params);
-//         
-//         Class proxyClass = ContainerProxyFactory.getProxyClass(POJO.class, domain);
-//         ClassProxyContainer container = new ClassProxyContainer("test", domain);
-//         domain.setAdvisor(container);
-//         container.setClass(proxyClass);
-//         container.initializeClassContainer();
-//         POJO proxy = (POJO) proxyClass.newInstance();
-//         AspectManaged cp = (AspectManaged)proxy;
-//         cp.setAdvisor(container);
-//         Delegate delegate = (Delegate)cp;
-//         delegate.setDelegate(new POJO());
-//
-//         MixinInterface mi = (MixinInterface) proxy;
-//         System.out.println("--- mixin");
-//         assertEquals(mi.hello("mixin"), "mixin");
-//         System.out.println("--- hw");
-//         assertEquals("echoed", proxy.helloWorld());
-//         System.out.println("--- icptd");
-//         assertEquals("echoed", mi.intercepted("error"));
-//         
-         
-         AspectManager manager = AspectManager.instance();
-//         AspectDefinition def = new AspectDefinition("perinstanceaspect", Scope.PER_INSTANCE, new GenericAspectFactory(TestInterceptor.class.getName(), null));
-         AspectDefinition def = new AspectDefinition("perinstanceaspect", Scope.PER_VM, new GenericAspectFactory(TestInterceptor.class.getName(), null));
-         AdviceFactory advice = new AdviceFactory(def, "invoke");
-         PointcutExpression pointcut = new PointcutExpression("perinstancepointcut", "execution(* $instanceof{" + SomeInterface.class.getName() + "}->*(..))");
-         InterceptorFactory[] interceptors = {advice};
-         AdviceBinding binding = new AdviceBinding("perinstancebinding", pointcut, null, null, interceptors);
-
-         manager.addAspectDefinition(def);
-         manager.addInterceptorFactory(advice.getName(), advice);
-         manager.addPointcut(pointcut);
-         manager.addBinding(binding);
-            
-         AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
-         params.setInterfaces(new Class[] {SomeInterface.class});
-         params.setTarget(new SerializablePOJO());
-         
-         AOPProxyFactory factory = new GeneratedAOPProxyFactory();
-         SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
-         
-         si.helloWorld();
-         
-         assertTrue(TestInterceptor.invoked);
-         
-         ObjectOutputStream out = null;
-         try
-         {
-            out = new ObjectOutputStream(new FileOutputStream(file));
-            out.writeObject(si);
-         }
-         finally
-         {
-            try
-            {
-               out.close();
-            }
-            catch(Exception e)
-            {
-            }
-         }
+         createAndSerializeProxy(file);
       }
       catch (Throwable t)
       {
@@ -188,4 +94,71 @@
          System.exit(GENERAL_ERROR);
       }
    }
+   
+   public static void createAndSerializeProxy(File file) throws Exception
+   {
+      AspectManager manager = AspectManager.instance();
+      AspectDefinition def = new AspectDefinition("icptr", Scope.PER_VM, new GenericAspectFactory(TestInterceptor.class.getName(), null));
+      InterceptorFactory advice = new ScopedInterceptorFactory(def);
+      PointcutExpression pointcut = new PointcutExpression("pc1", "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+      InterceptorFactory[] interceptors = {advice};
+      AdviceBinding binding = new AdviceBinding("binding1", pointcut, null, null, interceptors);
+
+      manager.addAspectDefinition(def);
+      manager.addInterceptorFactory(advice.getName(), advice);
+      manager.addPointcut(pointcut);
+      manager.addBinding(binding);
+
+      System.out.println("===>  ENABLE ADDITION OF ASPECTS IN OUTOFPROCESSPROXYSERIALIZER");
+//      AspectDefinition def2 = new AspectDefinition("aspect", Scope.PER_VM, new GenericAspectFactory(TestAspect.class.getName(), null));
+//      AdviceFactory advice2 = new AdviceFactory(def2, "advice");
+//      PointcutExpression pointcut2 = new PointcutExpression("pc2", "execution(* $instanceof{" + SomeInterface.class.getName() + "}->otherWorld(..))");
+//      InterceptorFactory[] interceptors2 = {advice2};
+//      AdviceBinding binding2 = new AdviceBinding("binding2", pointcut2, null, null, interceptors2);
+//
+//      manager.addAspectDefinition(def2);
+//      manager.addInterceptorFactory(advice2.getName(), advice2);
+//      manager.addPointcut(pointcut2);
+//      manager.addBinding(binding2);
+         
+      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
+      params.setInterfaces(new Class[] {SomeInterface.class});
+      params.setMixins(new AOPProxyFactoryMixin[] {
+            new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class, OtherMixinInterface2.class}, "20")
+      });
+      
+      params.setTarget(new SerializablePOJO());
+      AOPProxyFactory factory = new GeneratedAOPProxyFactory();
+      SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
+      
+      TestInterceptor.invoked = false;
+      TestAspect.invoked = false;
+      si.helloWorld();
+      assertTrue(TestInterceptor.invoked);
+      assertFalse(TestAspect.invoked);
+      
+      System.out.println("===> ENABLE CHECKS OF ASPECTS IN OUTOFPROCESSPROXYSERIALIZER");
+//      TestInterceptor.invoked = false;
+//      TestAspect.invoked = false;
+//      si.otherWorld();
+//      assertFalse(TestInterceptor.invoked);
+//      assertTrue(TestAspect.invoked);
+      
+      ObjectOutputStream out = null;
+      try
+      {
+         out = new ObjectOutputStream(new FileOutputStream(file));
+         out.writeObject(si);
+      }
+      finally
+      {
+         try
+         {
+            out.close();
+         }
+         catch(Exception e)
+         {
+         }
+      }
+   }
 }

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializablePOJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializablePOJO.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializablePOJO.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -34,4 +34,9 @@
    {
       return "error";
    }
+   
+   public String otherWorld()
+   {
+      return "otherWorld";
+   }
 }

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyCacheKeyTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyCacheKeyTestCase.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyCacheKeyTestCase.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,93 @@
+/*
+* 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.proxy;
+
+import java.io.Externalizable;
+import java.rmi.MarshalledObject;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.aop.proxy.container.AOPProxyFactoryMixin;
+import org.jboss.aop.proxy.container.ContainerProxyCacheKey;
+import org.jboss.test.aop.AOPTestWithSetup;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SerializeContainerProxyCacheKeyTestCase extends AOPTestWithSetup
+{
+
+   public SerializeContainerProxyCacheKeyTestCase(String arg0)
+   {
+      // FIXME SerialixzeContainerProxyCacheKeyTestCase constructor
+      super(arg0);
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("SerializeContainerProxyCacheKeyTestCase");
+      suite.addTestSuite(SerializeContainerProxyCacheKeyTestCase.class);
+      return suite;
+   }
+
+   
+   public void testSerializeKey() throws Exception
+   {
+      ContainerProxyCacheKey original1 = new ContainerProxyCacheKey(
+            "/", 
+            SerializeContainerProxyCacheKeyTestCase.class, 
+            new Class[] {Externalizable.class, SomeInterface.class}, 
+            getMixins(),
+            null);
+
+      ContainerProxyCacheKey original2 = new ContainerProxyCacheKey(
+            "/", 
+            SerializeContainerProxyCacheKeyTestCase.class, 
+            new Class[] {Externalizable.class}, 
+            getMixins(),
+            null);
+      
+      assertNotSame(original1, original2);
+      
+      MarshalledObject mo1 = new MarshalledObject(original1);
+      MarshalledObject mo2 = new MarshalledObject(original2);
+      
+      ContainerProxyCacheKey deserialized1 = (ContainerProxyCacheKey)mo1.get();
+      ContainerProxyCacheKey deserialized2 = (ContainerProxyCacheKey)mo2.get();
+      
+      assertEquals(original1, deserialized1);
+      assertEquals(original2, deserialized2);
+      
+   }
+
+   private AOPProxyFactoryMixin[] getMixins()
+   {
+      AOPProxyFactoryMixin[] mixins = new AOPProxyFactoryMixin[2];
+      mixins[0] = new AOPProxyFactoryMixin(Mixin.class, new Class[] {MixinInterface.class}, "abc");
+      mixins[1] = new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class});
+      return mixins;
+   }
+   
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyInVmTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyInVmTestCase.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyInVmTestCase.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,63 @@
+/*
+  * 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.proxy;
+
+import java.io.File;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public class SerializeContainerProxyInVmTestCase extends SerializeContainerProxyTest
+{
+
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("SerializeContainerProxyInVmTestCase");
+      suite.addTestSuite(SerializeContainerProxyInVmTestCase.class);
+      return suite;
+   }
+
+   public SerializeContainerProxyInVmTestCase(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected File createProxyFile() throws Exception
+   {
+      File proxyFile = File.createTempFile("proxy", "err");
+      proxyFile.deleteOnExit();
+      OutOfProcessProxySerializer.createAndSerializeProxy(proxyFile);
+      return proxyFile;
+   }
+   
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyOutOfVmTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyOutOfVmTestCase.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyOutOfVmTestCase.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,208 @@
+/*
+  * 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.proxy;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public class SerializeContainerProxyOutOfVmTestCase extends SerializeContainerProxyTest
+{
+
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("SerializeContainerProxyOutOfVmTestCase");
+      suite.addTestSuite(SerializeContainerProxyOutOfVmTestCase.class);
+      return suite;
+   }
+
+   public SerializeContainerProxyOutOfVmTestCase(String name)
+   {
+      super(name);
+   }
+
+   @Override
+   protected File createProxyFile() throws Exception
+   {
+      return runExternalProcess();
+   }
+
+   private File runExternalProcess() throws Exception
+   {
+      Properties props = System.getProperties();
+      
+      String classPath = props.getProperty("java.class.path");      
+      String libraryPath = props.getProperty("sun.boot.library.path") + File.separator + "java";
+      String java = findJava(libraryPath);
+   
+      File proxyFile = File.createTempFile("proxy", "err");
+      proxyFile.deleteOnExit();
+      
+//      System.out.println(classPath);
+      boolean debugFlag = System.getProperty("jboss.aop.debug.classes", "false").equals("true"); 
+      String debug = debugFlag ? "-Djboss.aop.debug.classes=true " : "";
+      
+      Process proc = Runtime.getRuntime().exec(
+            java + 
+            " -classpath " + classPath + " " + 
+            debug + 
+            OutOfProcessProxySerializer.class.getName() + " " + 
+            proxyFile.getAbsolutePath());
+      int result = proc.waitFor();
+      
+      switch (result)
+      {
+         case OutOfProcessProxySerializer.WRONG_ARGS:
+            throw new RuntimeException("Wrong number of args passed in");
+         case OutOfProcessProxySerializer.NO_SUCH_FILE:
+            throw new RuntimeException("No file found " + proxyFile);
+         case OutOfProcessProxySerializer.GENERAL_ERROR:
+            String externalException = getExternalException(proxyFile);
+            throw new RuntimeException(externalException);
+      }
+      
+      return proxyFile;
+   }
+   
+   private String getExternalException(File proxyFile)
+   {
+      Reader reader = null;
+      StringBuffer sb = new StringBuffer();
+      try
+      {
+         reader = new FileReader(proxyFile);
+         int r = reader.read();
+         while (r != -1)
+         {
+            sb.append((char)r);
+            r = reader.read();
+         }
+      }
+      catch(Exception e)
+      {
+      }
+      finally
+      {
+         try
+         {
+            reader.close();
+         }
+         catch(Exception e)
+         {
+         }
+      }
+      return sb.toString();
+   }
+   
+   private String findJava(String classPath)
+   {
+      String java = null;
+      StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
+      while (tok.hasMoreTokens())
+      {
+         String path = tok.nextToken();
+         if (path.endsWith(".jar"))
+         {
+            continue;
+         }
+         java = getJavaPath(path);
+         if (java != null)
+         {
+            return java;
+         }
+      }
+      return null;
+   }
+   
+   private String getJavaPath(String dirName)
+   {
+      if (File.separatorChar == '/')
+      {
+         //Probably on Linuxx
+         //AFAIK on linux we have no extension after java in the bin directory?
+         String file = getFile(dirName + File.separator + "java");
+         if (file != null)
+         {
+            return file;
+         }
+         file = getFile(dirName);
+         if (file != null)
+         {
+            return file;
+         }
+      }
+      else if (File.separatorChar == '\\')
+      {
+         //We're probably on windows
+         String file = getFile(dirName + File.separator + "java.exe");
+         if (file != null)
+         {
+            return file;
+         }
+         file = getFile(dirName);
+         if (file != null)
+         {
+            return file;
+         }
+         file = getFile(dirName + ".exe");
+         if (file != null)
+         {
+            return file;
+         }
+      }
+      else
+      {
+         throw new RuntimeException("Cannot figure out OS");
+      }
+      return null;
+   }
+   
+   private String getFile(String java)
+   {
+      if (java != null)
+      {
+         File file = new File(java);
+         
+         if (file.exists() && !file.isDirectory())
+         {
+            System.out.println("Using Java executable: " + java);
+            return file.getAbsolutePath();
+         }
+      }
+      return null;
+   }
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyTest.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyTest.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyTest.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,81 @@
+/*
+  * 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.proxy;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.ObjectInputStream;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public abstract class SerializeContainerProxyTest extends TestCase
+{
+
+   public SerializeContainerProxyTest(String name)
+   {
+      super(name);
+   }
+
+   public void testContainerProxy() throws Exception
+   {
+      try
+      {
+         File proxyFile = createProxyFile();
+         
+         ObjectInputStream in = new ObjectInputStream(new FileInputStream(proxyFile));
+         Object o = in.readObject();
+         assertNotNull(o);
+         SomeInterface si = (SomeInterface)o;
+
+         TestInterceptor.invoked = false;
+         TestAspect.invoked = false;
+         si.helloWorld();
+         assertTrue(TestInterceptor.invoked);
+         assertFalse(TestAspect.invoked);
+         
+         OtherMixinInterface omi = (OtherMixinInterface)o;
+         omi.other();
+         
+         OtherMixinInterface2 omi2 = (OtherMixinInterface2)o;
+         int i = omi2.other2();
+         assertEquals(20, i);
+         
+         System.out.println("--- ENABLE CHECKS OF ASPECTS IN SERIALIZECONTAINERPROXYTEST AND OUTOFPROCESSPROXYSERIALIZER");
+//         TestInterceptor.invoked = false;
+//         TestAspect.invoked = false;
+         si.otherWorld();
+//         assertFalse(TestInterceptor.invoked);
+//         assertTrue(TestAspect.invoked);
+      }
+      catch(Exception e)
+      {
+         e.printStackTrace();
+         throw e;
+      }
+   }
+
+   protected abstract File createProxyFile() throws Exception;
+}

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SomeInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SomeInterface.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SomeInterface.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -29,5 +29,7 @@
  */
 public interface SomeInterface
 {
-   public String helloWorld();
+   String helloWorld();
+   
+   String otherWorld();
 }

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -0,0 +1,40 @@
+/*
+* 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.proxy;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestAspect
+{
+   public static boolean invoked;
+   public Object advice(Invocation inv) throws Throwable
+   {
+      invoked = true;
+      return inv.invokeNext();
+   }
+
+}

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestInterceptor.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestInterceptor.java	2008-01-18 17:30:39 UTC (rev 69126)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestInterceptor.java	2008-01-18 17:54:11 UTC (rev 69127)
@@ -21,6 +21,8 @@
 */ 
 package org.jboss.test.aop.proxy;
 
+import java.io.Serializable;
+
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
 
@@ -29,8 +31,9 @@
  * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
  * @version $Revision: 1.1 $
  */
-public class TestInterceptor implements Interceptor
+public class TestInterceptor implements Interceptor, Serializable
 {
+   private static final long serialVersionUID = 1L;
    static boolean invoked;
    
    public String getName()




More information about the jboss-cvs-commits mailing list