[jboss-cvs] JBossAS SVN: r76876 - in projects/ejb3/trunk/core: src/main/java/org/jboss/ejb3 and 21 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Aug 10 22:46:56 EDT 2008


Author: ALRubinger
Date: 2008-08-10 22:46:56 -0400 (Sun, 10 Aug 2008)
New Revision: 76876

Added:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java
Modified:
   projects/ejb3/trunk/core/pom.xml
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
   projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml
   projects/ejb3/trunk/core/src/test/resources/log4j.xml
Log:
[EJBTHREE-1385] Integrate EJB3 Proxy w/ EJB3 Core

Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/pom.xml	2008-08-11 02:46:56 UTC (rev 76876)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.jboss.ejb3</groupId>
     <artifactId>jboss-ejb3-build</artifactId>
-    <version>0.13.10</version>
+    <version>0.13.12-SNAPSHOT</version>
     <relativePath>../build/pom.xml</relativePath>
   </parent>
 
@@ -177,7 +177,7 @@
           <groupId>org.jboss.javaee</groupId>
           <artifactId>jboss-javaee</artifactId>
         </exclusion>
-      </exclusions>      
+      </exclusions>
     </dependency>
     
     <dependency>
@@ -264,7 +264,6 @@
     <dependency>
       <groupId>org.jboss.aspects</groupId>
       <artifactId>jboss-remoting-aspects</artifactId>
-      <version>1.0.1.CR2</version>
     </dependency>
     
     <dependency>
@@ -365,8 +364,14 @@
     
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-proxy</artifactId>
+      <version>0.1.0-SNAPSHOT</version>
+    </dependency>
+   
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-test</artifactId>
-      <version>0.1.2</version>
+      <version>0.1.3-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
 
@@ -375,7 +380,7 @@
       <artifactId>jboss-ejb3-transactions</artifactId>
       <version>0.13.3</version>
     </dependency>
-    
+
     <dependency>
       <groupId>org.jboss.embedded</groupId>
       <artifactId>jboss-embedded</artifactId>

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Container.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -56,6 +56,8 @@
    Class getBeanClass();
 
    String getEjbName();
+   
+   String getName();
 
    ObjectName getObjectName();
 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -84,6 +84,7 @@
 import org.jboss.ejb3.pool.Pool;
 import org.jboss.ejb3.pool.PoolFactory;
 import org.jboss.ejb3.pool.PoolFactoryRegistry;
+import org.jboss.ejb3.proxy.container.InvokableContext;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
 import org.jboss.ejb3.security.SecurityDomainManager;
 import org.jboss.ejb3.statistics.InvocationStatistics;
@@ -173,8 +174,6 @@
 
    private String jaccContextId;
 
-   protected HashMap invokedMethod = new HashMap();
-
    protected InvocationStatistics invokeStats = new InvocationStatistics();
    
    private String partitionName;
@@ -225,7 +224,7 @@
       // we must have set beanContainer first and then do the advisor. 
       try
       {
-         beanContainer.initialize(ejbName, domain, beanClass, beanMetaData, cl); 
+         beanContainer.initialize(ejbName, domain, beanClass, beanMetaData, cl);
       }
       catch(Exception e)
       {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/Ejb3Deployment.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -47,6 +47,7 @@
 import org.jboss.ejb3.cache.CacheFactoryRegistry;
 import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
 import org.jboss.ejb3.common.lang.ClassHelper;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.enc.EjbModulePersistenceUnitResolver;
 import org.jboss.ejb3.enc.MessageDestinationResolver;
 import org.jboss.ejb3.entity.PersistenceUnitDeployment;

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/LocalProxyInvocationHandler.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -28,7 +28,7 @@
 import java.lang.reflect.InvocationHandler;
 
 import org.jboss.ejb3.proxy.handler.BaseProxyInvocationHandler;
-import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated;
 import org.jboss.logging.Logger;
 
 /**
@@ -37,7 +37,7 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandler
+public abstract class LocalProxyInvocationHandler extends BaseProxyInvocationHandler implements InvocationHandler, Externalizable, ProxyInvocationHandlerDeprecated
 {
    private static Logger log = Logger.getLogger(LocalProxyInvocationHandler.class);
 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/metadata/JBossSessionGenericWrapper.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -109,10 +109,6 @@
    {
       return delegate.determineInvokerBindings();
    }
-   public String determineLocalJndiName()
-   {
-      return delegate.determineLocalJndiName();
-   }
    public boolean equals(Object obj)
    {
       return delegate.equals(obj);

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/ProxyUtils.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -36,7 +36,7 @@
 import org.jboss.aspects.asynch.AsynchProxyInterceptor;
 import org.jboss.aspects.asynch.FutureHolder;
 import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
-import org.jboss.ejb3.proxy.handler.ProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerDeprecated;
 
 /**
  * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
@@ -133,13 +133,13 @@
       }
    }
 
-   public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
+   public static Object handleCallLocally(Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args)
    {
       long hash = MethodHashing.calculateHash(m);
       return handleCallLocally(hash, jbproxy, ih, m, args);
    }
 
-   public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandler ih, Method m, Object[] args)
+   public static Object handleCallLocally(long hash, Object jbproxy, ProxyInvocationHandlerDeprecated ih, Method m, Object[] args)
    {
       if (hash == ProxyUtils.GET_ASYNCHRONOUS)
       {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/BaseSessionProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -510,10 +510,22 @@
     */
    protected abstract Class<?> getHomeType();
    
-   protected final String getJndiName()
+   protected String getJndiName()
    {
-      return this.jndiName;
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String jndiName = md.determineResolvedJndiName(null);
+      return jndiName;
    }
+
+   protected String getHomeJndiName()
+   {
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String home = md.getHome();
+      String jndiName = md.determineResolvedJndiName(home);
+      return jndiName;
+   }
    
    public final String getJndiNameProxyFactory()
    {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/SessionProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -31,7 +31,9 @@
  * 
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  * @version $Revision: $
+ * @deprecated In favor of EJB3 Proxy
  */
+ at Deprecated
 public interface SessionProxyFactory extends ProxyFactory
 {
    /**

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/BaseStatefulProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -25,6 +25,7 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
+import javax.naming.Context;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.StringRefAddr;
@@ -86,6 +87,11 @@
       //Name name = ctx.getNameParser("").parse(jndiName);
       //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
       //String atom = name.get(name.size() - 1);
+      Context ctx = getContainer().getInitialContext();
+      String jndiName = this.getJndiName();
+//      Name name = ctx.getNameParser("").parse(jndiName);
+      //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
+      //String atom = name.get(name.size() - 1);
       RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
       Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
 //      try
@@ -102,10 +108,12 @@
 //      }
       
       this.bindProxy(ref);
+
    }
 
    public void stop() throws Exception
    {
+      String jndiName = this.getJndiName();
       Util.unbind(getContainer().getInitialContext(), jndiName);
    }
 
@@ -124,13 +132,11 @@
          log.error(e.getMessage(), e);
          throw new IOException(e.getMessage());
       }
-      this.jndiName = in.readUTF();
    }
    
    @Override
    public void writeExternal(ObjectOutput out) throws IOException
    {
       super.writeExternal(out);
-      out.writeUTF(jndiName);
    }
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulClusterProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -216,6 +216,7 @@
       ClusteredPojiProxy proxy = new ClusteredPojiProxy(targetId, locator, interceptors, wrapper, 
                                                         factoryLBP, partitionName, null);
       Object factoryProxy =  Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, proxy);
+      String jndiName = this.getJndiName();
       try
       {
          Util.rebind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME, factoryProxy);
@@ -268,6 +269,7 @@
       hatarget.destroy();
       drm.unregisterListener(proxyFamilyName, this);
       this.getContainer().getClusterFamilies().remove(proxyFamilyName);
+      String jndiName = this.getJndiName();
       Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
       super.stop();
    }
@@ -277,6 +279,7 @@
     */
    protected String getTargetId()
    {
+      String jndiName = this.getJndiName();
       assert jndiName != null : "jndiName is null";      
       String partition = ((SessionContainer) getContainer()).getPartitionName();
       return jndiName + PROXY_FACTORY_NAME + "@" + partition;

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateful/StatefulRemoteProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -72,6 +72,7 @@
       String targetId = getTargetId();
       String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(this.getBinding());
       Object factoryProxy = createPojiProxy(targetId, interfaces, clientBindUrl);
+      String jndiName = this.getJndiName();
       log.debug("Binding proxy factory for " + getContainer().getEjbName() + " in JNDI at " + jndiName + PROXY_FACTORY_NAME + " with client bind url " + clientBindUrl);
       try
       {
@@ -100,6 +101,7 @@
    @Override
    public void stop() throws Exception
    {
+      String jndiName = this.getJndiName();
       Util.unbind(getContainer().getInitialContext(), jndiName + PROXY_FACTORY_NAME);
       Dispatcher.singleton.unregisterTarget(getTargetId());
       
@@ -167,6 +169,7 @@
     */
    protected String getTargetId()
    {  
+      String jndiName = this.getJndiName();
       assert jndiName != null : "jndiName is null"; 
       return jndiName + PROXY_FACTORY_NAME;
    }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/BaseStatelessProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -129,7 +129,7 @@
 
    public void stop() throws Exception
    {
-      Util.unbind(getContainer().getInitialContext(), jndiName);
+      Util.unbind(getContainer().getInitialContext(), this.getJndiName());
    }
    
    protected abstract void validateEjb21Views();

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/factory/stateless/StatelessLocalProxyFactory.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -33,6 +33,7 @@
 import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.ejb3.stateless.StatelessHandleRemoteImpl;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.util.naming.Util;
 
 
@@ -172,4 +173,13 @@
       // defined for local proxy factories
       return null;
    }
+   
+   @Override
+   protected String getJndiName()
+   {
+      SessionSpecContainer container = this.getContainer();
+      JBossSessionBeanMetaData md = container.getMetaData();
+      String jndiName = md.determineLocalJndiName();
+      return jndiName;
+   }
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/BaseProxyInvocationHandler.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -32,7 +32,7 @@
  * @deprecated Has moved to EJB3 Proxy Component as ProxyInvocationHandlerBase
  */
 @Deprecated
-public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandler
+public abstract class BaseProxyInvocationHandler implements ProxyInvocationHandlerDeprecated
 {
    // ------------------------------------------------------------------------------||
    // Instance Members -------------------------------------------------------------||

Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerDeprecated.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ejb3.proxy.handler;
+
+/**
+ * ProxyInvocationHandler
+ * 
+ * Defines 
+ * 
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: 73407 $
+ * @deprecated Has moved to EJB3 Proxy Component
+ */
+ at Deprecated
+public interface ProxyInvocationHandlerDeprecated
+{
+   /**
+    * For use in hashCode, toString() and equals() *
+    */
+   String toString();
+
+   Object getAsynchronousProxy(Object proxy);
+
+   String getBusinessInterfaceType();
+}
\ No newline at end of file

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/proxy/handler/RemoteProxyInvocationHandler.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -29,7 +29,7 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public interface RemoteProxyInvocationHandler extends ProxyInvocationHandler
+public interface RemoteProxyInvocationHandler extends ProxyInvocationHandlerDeprecated
 {
    SimpleMetaData getMetaData();
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/IsLocalInterceptor.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -26,9 +26,12 @@
 
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.util.PayloadKey;
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.logging.Logger;
 import org.jboss.serial.io.MarshalledObjectForLocalCalls;
 
@@ -76,8 +79,29 @@
    protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
    {
       Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
-      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE);
-      org.jboss.aop.joinpoint.InvocationResponse response = ((SessionContainer) container).dynamicInvoke(null, copy);
+      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
+      org.jboss.aop.joinpoint.InvocationResponse response = null;
+
+      /*
+       * EJBTHREE-1385
+       * 
+       * Integration of EJB3 Proxy changed the invocation model,
+       * so SessionSpecContainers now are supported via
+       * dynamicInvoke(Invocation), where all other
+       * SessionContainers use the @deprecated
+       * dynamicInvoke(Object,Invocation)
+       */ 
+      if (container instanceof SessionSpecContainer)
+      {
+         SessionSpecContainer ssc = (SessionSpecContainer) container;
+         response = ssc.dynamicInvoke(copy);
+      }
+      else
+      {
+         response = ((SessionContainer) container).dynamicInvoke(null, copy);
+      }
+      
+      
       Map contextInfo = response.getContextInfo();
       if (contextInfo != null)
       {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,6 +21,7 @@
  */
 package org.jboss.ejb3.service;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.Hashtable;
 import java.util.List;
@@ -58,16 +59,15 @@
 import org.jboss.ejb3.asynchronous.AsynchronousInterceptor;
 import org.jboss.ejb3.proxy.ProxyFactory;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
 import org.jboss.ejb3.proxy.factory.service.ServiceLocalProxyFactory;
 import org.jboss.ejb3.proxy.factory.service.ServiceRemoteProxyFactory;
 import org.jboss.ejb3.session.SessionContainer;
+import org.jboss.ejb3.stateful.StatefulContainerInvocation;
 import org.jboss.ejb3.timerservice.TimedObjectInvoker;
 import org.jboss.ejb3.timerservice.TimerServiceFactory;
 import org.jboss.injection.Injector;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
-import org.jboss.util.NotImplementedException;
 
 /**
  * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
@@ -139,11 +139,11 @@
       return new ServiceRemoteProxyFactory(this, binding);
    }
    
-   public Object createSession(Class initTypes[], Object initArgs[])
+   public Serializable createSession(Class<?> initTypes[], Object initArgs[])
    {
 //      if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
 //         throw new IllegalArgumentException("service bean create method must take no arguments");
-      throw new RuntimeException("NYI");
+      throw new UnsupportedOperationException("Service Containers have no Sessions");
    }
 
    public Object getMBean()
@@ -170,6 +170,12 @@
    }
 
    @Override
+   public void instantiated()
+   {
+      super.instantiated();
+   }
+
+   @Override
    protected List<Class<?>> resolveBusinessInterfaces()
    {
       List<Class<?>> interfaces = super.resolveBusinessInterfaces();
@@ -207,6 +213,7 @@
    protected void lockedStart() throws Exception
    {
       super.lockedStart();
+      proxyDeployer.start();
 
       try
       {
@@ -233,7 +240,7 @@
 
    @Override
    protected void lockedStop() throws Exception
-   {
+   {      
       invokeOptionalMethod("stop");
       
       if (timerService != null)
@@ -249,6 +256,15 @@
       beanContext = null;
       
       super.lockedStop();
+      
+      try
+      {
+         proxyDeployer.stop();
+      }
+      catch (Exception ignore)
+      {
+         log.debug("Proxy deployer stop failed", ignore);
+      }
    }
 
    public void destroy() throws Exception
@@ -366,7 +382,7 @@
          {
             throw new RuntimeException("Could not resolve beanClass method from proxy call: " + method.toString());
          }
-         EJBContainerInvocation nextInvocation = new EJBContainerInvocation(info);
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info,null);
          nextInvocation.setAdvisor(getAdvisor());
          nextInvocation.setArguments(args);
 
@@ -399,7 +415,7 @@
       long start = System.currentTimeMillis();
       
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
-      EJBContainerInvocation newSi = null;
+      StatefulContainerInvocation newSi = null;
       
       MethodInvocation si = (MethodInvocation) invocation;
       MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
@@ -414,7 +430,7 @@
          {
             throw new RuntimeException("Could not resolve beanClass method from proxy call");
          }
-         newSi = new EJBContainerInvocation(info);
+         newSi = new StatefulContainerInvocation(info,null);
          newSi.setArguments(si.getArguments());
          newSi.setMetaData(si.getMetaData());
          newSi.setAdvisor(getAdvisor());
@@ -470,7 +486,7 @@
    }
    
    @Override
-   protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
+   protected StatefulContainerInvocation populateInvocation(StatefulContainerInvocation invocation)
    {
       invocation.setTargetObject(singleton);
       invocation.setBeanContext(beanContext);
@@ -526,21 +542,6 @@
       return delegate.invoke(actionName, params, signature);
    }
 
-   @Override
-   protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object[] args) throws Exception
-   {
-      throw new RuntimeException("NYI");
-   }
-   
-
-   //TODO This shouldn't be required of @Service
-   @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception
-   {
-      throw new NotImplementedException("Invalid for " + ServiceContainer.class.getName());
-   }
-
    public MBeanInfo getMBeanInfo()
    {
       return delegate.getMBeanInfo();

Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/Ejb2xMethodNames.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.session;
+
+/**
+ * Ejb2xMethodNames
+ * 
+ * This interface contains immutable names of EJB2.x Methods for
+ * use in reflection
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface Ejb2xMethodNames
+{
+   // --------------------------------------------------------------------------------||
+   // Constants ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /*
+    * The following are used in EJB2.x Home Interfaces
+    */
+
+   String METHOD_NAME_HOME_CREATE = "create";
+
+   String METHOD_NAME_HOME_REMOVE = "remove";
+}

Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/InvokableContextClassProxyHack.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.session;
+
+import java.lang.reflect.Method;
+
+import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.proxy.ClassProxy;
+import org.jboss.aop.proxy.ProxyMixin;
+import org.jboss.aop.util.MethodHashing;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+
+/**
+ * Exposes InvokableContext.dynamicInvoke to Remoting
+ *
+ * org.jboss.aop.Dispatcher can handle only certain types.
+ * 
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class InvokableContextClassProxyHack implements ClassProxy
+{
+   private InvokableContext container;
+
+   InvokableContextClassProxyHack(InvokableContext container)
+   {
+      assert container != null : "container is null";
+
+      this.container = container;
+   }
+
+   public InvocationResponse _dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      return container.dynamicInvoke(invocation);
+   }
+
+   public void setMixins(ProxyMixin[] mixins)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public InstanceAdvisor _getInstanceAdvisor()
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void _setInstanceAdvisor(InstanceAdvisor newAdvisor)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+}

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/ProxyDeployer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -40,6 +40,7 @@
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
 
 /**
  * Delegatee of a SessionContainer for managing proxy factories.
@@ -191,10 +192,11 @@
          if (binding == null)
          {
             log.debug("no declared remote bindings for : " + container.getEjbName());
-            if (ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container).length > 0)
+            BusinessRemotesMetaData businessRemotes = container.getMetaData().getBusinessRemotes();
+            if (businessRemotes != null && businessRemotes.size() > 0)
             {
                log.debug("there is remote interfaces for " + container.getEjbName());
-               String jndiName = ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container);
+               String jndiName = container.getMetaData().determineResolvedJndiName(null);
                log.debug("default remote binding has jndiName of " + jndiName);
                String uri = ""; // use the default
                RemoteBinding[] list = {new RemoteBindingImpl(jndiName, "", uri, RemoteBindingDefaults.PROXY_FACTORY_DEFAULT)};

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,15 +21,17 @@
  */
 package org.jboss.ejb3.session;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
-import javax.ejb.EJBLocalObject;
 import javax.ejb.EJBObject;
 import javax.ejb.Handle;
 import javax.ejb.LocalHome;
@@ -43,15 +45,14 @@
 import org.jboss.aop.util.MethodHashing;
 import org.jboss.aspects.asynch.FutureHolder;
 import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.EJBContainerInvocation;
 import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.Ejb3Module;
-import org.jboss.ejb3.ThreadLocalStack;
 import org.jboss.ejb3.annotation.LocalBinding;
 import org.jboss.ejb3.annotation.RemoteBinding;
 import org.jboss.ejb3.annotation.RemoteBindings;
 import org.jboss.ejb3.proxy.ProxyFactory;
 import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
 import org.jboss.ejb3.proxy.factory.RemoteProxyFactory;
 import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
@@ -60,6 +61,8 @@
 import org.jboss.ha.framework.server.HATarget;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
 import org.jboss.serial.io.MarshalledObjectForLocalCalls;
 
 /**
@@ -75,18 +78,6 @@
 
    protected ProxyDeployer proxyDeployer;
    private Map<String, HATarget> clusterFamilies;
-
-   public class InvokedMethod
-   {
-      public InvokedMethod(boolean localInterface, Method method)
-      {
-         isLocalInterface = localInterface;
-         this.method = method;
-      }
-
-      public boolean isLocalInterface;
-      public Method method;
-   }
    
    /**
     * Returns a remote binding for this container
@@ -108,8 +99,6 @@
       return binding;
    }
 
-   protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
-
    public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
                            Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
    {
@@ -132,30 +121,8 @@
    protected abstract RemoteProxyFactory getProxyFactory(RemoteBinding binding);
    
    public abstract InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable;
-   
-   public Class<?> getInvokedBusinessInterface()
-   {
-      InvokedMethod method = invokedMethod.get();
-      if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
-      if (method.method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
-      if (method.isLocalInterface) return method.method.getDeclaringClass();
-      Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
-      for (Class<?> intf : remoteInterfaces)
-      {
-         try
-         {
-            intf.getMethod(method.method.getName(), method.method.getParameterTypes());
-            return intf;
-         }
-         catch (NoSuchMethodException ignored)
-         {
-            // continue
-         }
-      }
-      throw new IllegalStateException("Unable to find geInvokedBusinessInterface()");
-   }
 
-   protected JBossSessionBeanMetaData getMetaData()
+   public JBossSessionBeanMetaData getMetaData()
    {
       // TODO: resolve this cast using generics on EJBContainer
       return (JBossSessionBeanMetaData) getXml();
@@ -183,9 +150,19 @@
    protected void lockedStart() throws Exception
    {
       super.lockedStart();
+      this.registerWithAopDispatcher();
+      
+      //TODO Remove
+      //      proxyDeployer.start();
+   }
+   
+   /**
+    * Registers this Container with Remoting
+    */
+   protected void registerWithAopDispatcher()
+   {
       // So that Remoting layer can reference this container easily.
       Dispatcher.singleton.registerTarget(getObjectName().getCanonicalName(), new ClassProxyHack(this));
-      proxyDeployer.start();
    }
 
    /**
@@ -210,16 +187,17 @@
 
    protected void lockedStop() throws Exception
    {
+      //TODO Remove
+//      try
+//      {
+//         proxyDeployer.stop();
+//      }
+//      catch (Exception ignore)
+//      {
+//         log.debug("Proxy deployer stop failed", ignore);
+//      }
       try
       {
-         proxyDeployer.stop();
-      }
-      catch (Exception ignore)
-      {
-         log.debug("Proxy deployer stop failed", ignore);
-      }
-      try
-      {
          Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
       }
       catch (Exception ignore)
@@ -267,6 +245,152 @@
       return virtualMethods;
    }
    
+   
+//   /**
+//    * Obtains a List of all methods handled by the bean class
+//    * 
+//    * @return The methods handled by the bean class directly
+//    */
+//   @Override
+//   //FIXME: Should be adapted to use metadata view from metadata bridge
+//   // such that *-aop.xml annotations may be included
+//   public List<Method> getVirtualMethods()
+//   {
+//      // Initialize
+//      List<Method> virtualMethods = new ArrayList<Method>();
+//
+//      // Obtain Metadata
+//      JBossSessionBeanMetaData smd = this.getMetaData();
+//
+//      // Obtain CL
+//      ClassLoader cl = this.getClassloader();
+//
+//      /*
+//       * Business Remotes
+//       */
+//
+//      // Obtain all specified business remotes
+//      BusinessRemotesMetaData businessRemotes = smd.getBusinessRemotes();
+//      if (businessRemotes != null)
+//      {
+//         // For each business remote
+//         for (String businessRemote : businessRemotes)
+//         {
+//            // Load the Class
+//            Class<?> businessRemoteClass = null;
+//            try
+//            {
+//               businessRemoteClass = Class.forName(businessRemote, true, cl);
+//            }
+//            catch (ClassNotFoundException e)
+//            {
+//               throw new RuntimeException("Could not find specified business remote class: " + businessRemote, e);
+//            }
+//
+//            // Obtain all methods declared by the class
+//            Method[] declaredMethods = businessRemoteClass.getMethods();
+//
+//            // Add each method
+//            for (Method declaredMethod : declaredMethods)
+//            {
+//               virtualMethods.add(declaredMethod);
+//            }
+//         }
+//      }
+//
+//      /*
+//       * Business Locals
+//       */
+//
+//      // Obtain all specified business locals
+//      BusinessLocalsMetaData businessLocals = smd.getBusinessLocals();
+//      if (businessLocals != null)
+//      {
+//         // For each business local
+//         for (String businessLocal : businessLocals)
+//         {
+//            // Load the Class
+//            Class<?> businessLocalClass = null;
+//            try
+//            {
+//               businessLocalClass = Class.forName(businessLocal, true, cl);
+//            }
+//            catch (ClassNotFoundException e)
+//            {
+//               throw new RuntimeException("Could not find specified business local class: " + businessLocal, e);
+//            }
+//
+//            // Obtain all methods declared by the class
+//            Method[] declaredMethods = businessLocalClass.getMethods();
+//
+//            // Add each method
+//            for (Method declaredMethod : declaredMethods)
+//            {
+//               virtualMethods.add(declaredMethod);
+//            }
+//         }
+//      }
+//
+//      // Remote Home
+//      String remoteHomeClassName = smd.getHome();
+//      if (remoteHomeClassName != null)
+//      {
+//         Class<?> remoteHomeClass = null;
+//         try
+//         {
+//            remoteHomeClass = Class.forName(remoteHomeClassName, true, cl);
+//         }
+//         catch (ClassNotFoundException e)
+//         {
+//            throw new RuntimeException("Could not find specified Remote Home Class: " + remoteHomeClassName, e);
+//         }
+//         if (remoteHomeClass != null)
+//         {
+//            Method[] declaredMethods = remoteHomeClass.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//
+//            declaredMethods = javax.ejb.EJBObject.class.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//         }
+//      }
+//
+//      // Local Home
+//      String localHomeClassName = smd.getLocalHome();
+//      if (localHomeClassName != null)
+//      {
+//         Class<?> localHomeClass = null;
+//         try
+//         {
+//            localHomeClass = Class.forName(localHomeClassName, true, cl);
+//         }
+//         catch (ClassNotFoundException e)
+//         {
+//            throw new RuntimeException("Could not find specified Local Home Class: " + localHomeClass, e);
+//         }
+//         if (localHomeClass != null)
+//         {
+//            Method[] declaredMethods = localHomeClass.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//
+//            declaredMethods = javax.ejb.EJBLocalObject.class.getMethods();
+//            for (Method declaredMethod : declaredMethods)
+//               virtualMethods.add(declaredMethod);
+//         }
+//      }
+//      
+//      log.debug("Found virtual methods: ");
+//      for(Method m : virtualMethods)
+//      {
+//         log.debug("\t" + m + " - " + MethodHashing.calculateHash(m));
+//      }
+//      
+//
+//      return virtualMethods;
+//   }
+   
    /*
    protected void createMethodMap()
    {
@@ -316,32 +440,6 @@
    }
    */
 
-   protected boolean isHomeMethod(Method method)
-   {
-      if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
-      if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass())) return true;
-      return false;
-   }
-
-   protected boolean isEJBObjectMethod(Method method)
-   {
-      if (method.getDeclaringClass().getName().equals(EJBObject.class.getName()))
-         return true;
-
-      if (method.getDeclaringClass().getName().equals(EJBLocalObject.class.getName()))
-         return true;
-
-      return false;
-   }
-
-   protected boolean isHandleMethod(Method method)
-   {
-      if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
-         return true;
-
-      return false;
-   }
-
    public static InvocationResponse marshallException(Invocation invocation, Throwable exception, Map responseContext) throws Throwable
    {
       if (invocation.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) == null) throw exception;
@@ -382,7 +480,9 @@
     * @param method     the business or home method to invoke
     * @param args       the arguments for the method
     * @param provider   for asynchronous usage
+    * @deprecated Use "invoke" as defined by InvokableContext
     */
+   @Deprecated
    public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[], FutureHolder provider) throws Throwable
    {
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
@@ -398,19 +498,22 @@
                             + method.toString());
          }
 
-         Method unadvisedMethod = info.getUnadvisedMethod();
+         
+         // Handled now by SessionSpecContainer
+         //Method unadvisedMethod = info.getUnadvisedMethod();
+//         if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+//         {
+//            return invokeHomeMethod(factory, info, args);
+//         }
+//         else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+//         {
+//            return invokeEJBObjectMethod(factory, id, info, args);
+//         }
 
-         if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
-         {
-            return invokeHomeMethod(factory, info, args);
-         }
-         else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
-         {
-            return invokeEJBObjectMethod(factory, id, info, args);
-         }
-
          // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
-         EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+         //StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info,null);
+         //EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
          nextInvocation.setAdvisor(getAdvisor());
          nextInvocation.setArguments(args);
          
@@ -418,15 +521,7 @@
          nextInvocation = populateInvocation(nextInvocation);
 
          ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
-         try
-         {
-            invokedMethod.push(new InvokedMethod(true, method));
-            return nextInvocation.invokeNext();
-         }
-         finally
-         {
-            invokedMethod.pop();
-         }
+         return nextInvocation.invokeNext();
       }
       finally
       {
@@ -436,59 +531,19 @@
    }
    
    /**
-    * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
-    * TODO: Move this to SessionSpecContainer
-    */
-   //TODO
-   private Object invokeHomeMethod(SessionProxyFactory factory, MethodInfo info, Object args[]) throws Exception
-   {
-      Method unadvisedMethod = info.getUnadvisedMethod();
-      if (unadvisedMethod.getName().equals("create"))
-      {
-         return this.invokeHomeCreate(factory, unadvisedMethod, args);
-      }
-      else if (unadvisedMethod.getName().equals("remove"))
-      {
-         if(args[0] instanceof Handle)
-            removeHandle((Handle) args[0]);
-         else
-            destroySession(args[0]);
-
-         return null;
-      }
-      else
-      {
-         throw new IllegalArgumentException("illegal home method " + unadvisedMethod);
-      }
-   }
-   
-   /**
-    * Provides implementation for this bean's EJB 2.1 Home.create() method 
-    * 
-    * @param factory
-    * @param unadvisedMethod
-    * @param args
-    * @return
-    * @throws Exception
-    */
-   //TODO Move this to SessionSpecContainer
-   protected abstract Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
-         throws Exception;
-   
-   /**
     * Create session to an EJB bean.
     * 
     * @param initParameterTypes     the parameter types used by the home's create method
     * @param initParameterValues    the arguments for the home's create method
     * @return   the identifier of the session
     */
-   abstract public Object createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
+   abstract public Serializable createSession(Class<?> initParameterTypes[], Object initParameterValues[]);
    
    abstract public Object localInvoke(Object id, Method method, Object[] args, FutureHolder provider) throws Throwable;
    
    abstract public Object localHomeInvoke(Method method, Object[] args) throws Throwable;
    
-   public Object createSession()
+   public Serializable createSession()
    {
       return createSession(new Class<?>[]{}, new Object[]{});
    }
@@ -512,12 +567,12 @@
       return proxyDeployer.hasJNDIBinding(jndiName);
    }
    
-   protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
+   protected Object invokeEJBObjectMethod(Object id, MethodInfo info, Object args[]) throws Exception
    {
       Method unadvisedMethod = info.getUnadvisedMethod();
       if(unadvisedMethod.getName().equals("getEJBHome"))
       {
-         return factory.createHomeProxy();
+         return this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
       }
       if(unadvisedMethod.getName().equals("getPrimaryKey"))
       {
@@ -554,7 +609,8 @@
     * @param invocation
     * @return
     */
-   protected EJBContainerInvocation populateInvocation(EJBContainerInvocation invocation)
+   protected StatefulContainerInvocation populateInvocation(
+         StatefulContainerInvocation invocation)
    {
       return invocation;
    }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContextDelegateBase.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -36,7 +36,9 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public abstract class SessionContextDelegateBase<J extends SessionContainer> extends EJBContextImpl<J, SessionBeanContext<J>>
+public abstract class SessionContextDelegateBase<J extends SessionSpecContainer>
+      extends
+         EJBContextImpl<J, SessionBeanContext<J>>
       implements
          SessionContext
 {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -1,12 +1,44 @@
 package org.jboss.ejb3.session;
 
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
 
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+
+import org.jboss.aop.Advisor;
+import org.jboss.aop.Dispatcher;
 import org.jboss.aop.Domain;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.proxy.ClassProxy;
+import org.jboss.aop.util.MethodHashing;
 import org.jboss.ejb3.Ejb3Deployment;
+import org.jboss.ejb3.Ejb3Registry;
+import org.jboss.ejb3.ThreadLocalStack;
 import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.LocalHomeBinding;
 import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.common.registrar.spi.Ejb3Registrar;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.proxy.container.InvokableContext;
+import org.jboss.ejb3.proxy.handler.session.SessionProxyInvocationHandler;
+import org.jboss.ejb3.proxy.handler.session.stateful.StatefulProxyInvocationHandlerBase;
+import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
+import org.jboss.ejb3.stateful.StatefulContainerInvocation;
+import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.RemoteBindingMetaData;
 
 /**
  * SessionSpecContainer
@@ -17,18 +49,39 @@
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  * @version $Revision: $
  */
-public abstract class SessionSpecContainer extends SessionContainer
+public abstract class SessionSpecContainer extends SessionContainer implements InvokableContext
 {
+
+   // ------------------------------------------------------------------------------||
+   // Class Members ----------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(SessionSpecContainer.class);
    
-   // Constructor
-   
+   /**
+    * The method invoked upon by the client
+    */
+   //TODO: Remove when CurrentInvocation is completely sorted out
+   @Deprecated 
+   protected static ThreadLocalStack<SerializableMethod> invokedMethod = new ThreadLocalStack<SerializableMethod>();
+
+   // ------------------------------------------------------------------------------||
+   // Instance Members -------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   private JndiSessionRegistrarBase jndiRegistrar;
+
+   // ------------------------------------------------------------------------------||
+   // Constructor ------------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
    public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
          Hashtable ctxProperties, Ejb3Deployment deployment, JBossSessionBeanMetaData beanMetaData)
          throws ClassNotFoundException
    {
       super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
    }
-   
+
    /**
     * Create a remote proxy (EJBObject) for an enterprise bean identified by id
     * 
@@ -74,4 +127,524 @@
     * @throws Exception
     */
    public abstract Object createProxyLocalEjb21(LocalBinding binding, String businessInterfaceType) throws Exception;
+
+   /**
+    * Invokes the method described by the specified serializable method
+    * as called from the specified proxy, using the specified arguments
+    * 
+    * @param proxy The proxy making the invocation
+    * @param method The method to be invoked
+    * @param args The arguments to the invocation
+    * @throws Throwable A possible exception thrown by the invocation
+    * @return
+    */
+   public Object invoke(Object proxy, SerializableMethod method, Object[] args) throws Throwable
+   {
+      /*
+       * Replace the TCL with the CL for this Container
+       */
+      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+      
+      // Push the ENC onto the Stack
+      pushEnc();
+      
+      try
+      {
+         
+         /*
+          * Obtain the target method (advised)
+          */
+         Method unadvisedMethod = method.toMethod(this.getClassloader());
+         long hash = MethodHashing.calculateHash(unadvisedMethod);
+         MethodInfo info = getAdvisor().getMethodInfo(hash);
+         if (info == null)
+         {
+            throw new RuntimeException("Method invocation via Proxy could not be found handled for EJB "
+                  + this.getEjbName() + " : " + method.toString()
+                  + ", probable error in virtual method registration w/ Advisor for the Container");
+         }
+
+         // Obtain Invocation Handler
+         //TODO Ugly, use polymorphism and get Session ID for SFSB only
+         assert Proxy.isProxyClass(proxy.getClass());
+         SessionProxyInvocationHandler handler = (SessionProxyInvocationHandler)Proxy.getInvocationHandler(proxy);
+         Object sessionId = null;
+         if (handler instanceof StatefulProxyInvocationHandlerBase)
+         {
+            sessionId = ((StatefulProxyInvocationHandlerBase) handler).getSessionId();
+         }
+         
+         /*
+          * Invoke directly if this is an EJB2.x Method
+          */
+
+         if (unadvisedMethod != null && isHomeMethod(method))
+         {
+            return invokeHomeMethod(method, args);
+         }
+         else if (unadvisedMethod != null && this.isEjbObjectMethod(method))
+         {
+            return invokeEJBObjectMethod(sessionId, info, args);
+         }
+
+         // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
+         //TODO Use Polymorphism to have sessions only in StatefulContainer
+         
+//         Interceptor[] interceptors, long methodHash, Method advisedMethod,
+//         Method unadvisedMethod, SerializableMethod invokedMethod, Advisor advisor
+         
+//         StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info
+//               .getInterceptors(), hash, info.getAdvisedMethod(), info.getUnadvisedMethod(), method, getAdvisor());
+         
+         /*
+          * Build an invocation
+          */
+         
+         StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info,sessionId);
+         nextInvocation.setArguments(args);
+         
+         
+         //nextInvocation.setAdvisor(getAdvisor());
+         //nextInvocation.setSessionId(sessionId);
+//         EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, sessionId);
+//         nextInvocation.setAdvisor(getAdvisor());
+//         nextInvocation.setArguments(args);
+
+         // allow a container to supplement information into an invocation
+         //nextInvocation = populateInvocation(nextInvocation);
+
+         //TODO Support Async Invocation
+         //         ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
+        
+         
+         try
+         {
+            /*
+             * Invoke
+             */
+            
+            invokedMethod.push(method);
+            return nextInvocation.invokeNext();
+         }
+         finally
+         {
+            invokedMethod.pop();
+         }
+
+
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(oldLoader);
+         popEnc();
+      }
+   }
+
+   public Class<?> getInvokedBusinessInterface()
+   {
+      //TODO Should be getting from current invocation
+      SerializableMethod invokedMethod = SessionSpecContainer.invokedMethod.get();
+      assert invokedMethod!=null : "Invoked Method has not been set";
+      String interfaceName = invokedMethod.getActualClassName();
+      assert interfaceName !=null && interfaceName.trim().length()>0 : "Target Business Interface is not available on invoked method";
+      Class<?> invokedInterface = null;
+      
+      try
+      {
+         invokedInterface = Class.forName(interfaceName, false, this.getClassloader());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Invoked Business Interface on Proxy was set to " + interfaceName
+               + ", but this could not be loaded by the " + ClassLoader.class.getSimpleName() + " for " + this);
+      }
+//      if (method == null) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+//      if (method.getName() == null || method.getName().equals("")) throw new IllegalStateException("getInvokedBusinessInterface() being invoked outside of a business invocation");
+      
+//      String invokedBusinessInterfaceClassName = method.getActualClassName();
+//      Class<?> invokedBusinessInterface = null;
+//      try
+//      {
+//         invokedBusinessInterface = this.getClassloader().loadClass(invokedBusinessInterfaceClassName);
+//      }
+//      catch (ClassNotFoundException e)
+//      {
+//         throw new RuntimeException("Invoked Business Interface on Proxy was set to "
+//               + invokedBusinessInterfaceClassName + ", but this could not be loaded by the "
+//               + ClassLoader.class.getSimpleName() + " for " + this);
+//      }
+      
+      return invokedInterface;
+   }
+   
+   /**
+    * Provides implementation for this bean's EJB 2.1 Home.create() method 
+    * 
+    * @param method
+    * @param args
+    * @return
+    * @throws Exception
+    */
+   protected abstract Object invokeHomeCreate(SerializableMethod method, Object args[]) throws Exception;
+
+   /**
+    * TODO: work in progress (refactor both invokeHomeMethod's, localHomeInvoke)
+    */
+   //TODO
+   private Object invokeHomeMethod(SerializableMethod method, Object args[]) throws Exception
+   {
+      if (method.getName().equals(Ejb2xMethodNames.METHOD_NAME_HOME_CREATE))
+      {
+         return this.invokeHomeCreate(method, args);
+      }
+      else if (method.getName().equals(Ejb2xMethodNames.METHOD_NAME_HOME_REMOVE))
+      {
+         if (args[0] instanceof Handle)
+            removeHandle((Handle) args[0]);
+         else
+            destroySession(args[0]);
+
+         return null;
+      }
+      else
+      {
+         throw new IllegalArgumentException("illegal home method " + method);
+      }
+   }
+
+   /**
+    * @deprecated Use isHomeMethod(SerializableMethod method) in SessionSpecContainer
+    */
+   @Deprecated
+   protected boolean isHomeMethod(Method method)
+   {
+      if (javax.ejb.EJBHome.class.isAssignableFrom(method.getDeclaringClass()))
+         return true;
+      if (javax.ejb.EJBLocalHome.class.isAssignableFrom(method.getDeclaringClass()))
+         return true;
+      return false;
+   }
+
+   /**
+    * Determines whether the specified method is an EJB2.x Home Method
+    * 
+    * @param method
+    * @return
+    */
+   protected boolean isHomeMethod(SerializableMethod method)
+   {
+      // Get the Method
+      Method invokingMethod = method.toMethod(this.getClassloader());
+
+      // Use legacy
+      return this.isHomeMethod(invokingMethod);
+   }
+
+   /**
+    * @param method
+    * @return
+    * @deprecated Use isEjbObjectMethod(SerializableMethod method)
+    */
+   @Deprecated
+   protected boolean isEJBObjectMethod(Method method)
+   {
+      /*
+       * Initialize
+       */
+      
+      // Get the declaring class
+      Class<?> declaringClass = method.getDeclaringClass();
+      
+      /*
+       * Test if declared by EJBObject/EJBLocalObject
+       */
+      
+      if (declaringClass.getName().equals(EJBObject.class.getName()))
+         return true;
+
+      if (declaringClass.getName().equals(EJBLocalObject.class.getName()))
+         return true;
+
+      return false;
+   }
+
+   /**
+    * Determines whether the specified method is an EJB2.x Local 
+    * or Remote Method
+    * 
+    * @param method
+    * @return
+    */
+   protected boolean isEjbObjectMethod(SerializableMethod method)
+   {
+      
+      /*
+       * Initialize
+       */
+      
+      // Get the declaring class
+      Class<?> declaringClass = null;
+      String declaringClassName = method.getDeclaringClassName();
+      try
+      {
+         declaringClass = Class.forName(declaringClassName, false, this.getClassloader());
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Invoked Method specifies a declaring class that could not be loaded by the "
+               + ClassLoader.class.getSimpleName() + " for EJB " + this.getEjbName());
+      }
+      
+      /*
+       * Test if declared by EJBObject/EJBLocalObject
+       */
+      
+      if (declaringClass.getName().equals(EJBObject.class.getName()))
+         return true;
+
+      if (declaringClass.getName().equals(EJBLocalObject.class.getName()))
+         return true;
+
+      // If we've reached here, not EJBObject/EJBLocalObject
+      return false;
+   }
+
+   /**
+    * 
+    * @param method
+    * @return
+    * @deprecated Use isHandleMethod(SerializableMethod method)
+    */
+   @Deprecated
+   protected boolean isHandleMethod(Method method)
+   {
+      if (method.getDeclaringClass().getName().equals(Handle.class.getName()))
+         return true;
+
+      return false;
+   }
+
+   /**
+    * Determines if the specified Method is a Handle Method
+    * @param method
+    * @return
+    */
+   protected boolean isHandleMethod(SerializableMethod method)
+   {
+      // Get the Method
+      Method invokingMethod = method.toMethod(this.getClassloader());
+
+      // Use legacy
+      return this.isHandleMethod(invokingMethod);
+   }
+   
+   /**
+    * Registers this Container with Remoting / AOP Dispatcher
+    */
+   @Override
+   protected void registerWithAopDispatcher()
+   {
+      String registrationName = this.getObjectName().getCanonicalName();
+      ClassProxy classProxy = new InvokableContextClassProxyHack(this);
+      
+      // So that Remoting layer can reference this container easily.
+      Dispatcher.singleton.registerTarget(registrationName, classProxy);
+      
+      // Log
+      log.debug("Registered " + this + " with " + Dispatcher.class.getName() + " via "
+            + InvokableContextClassProxyHack.class.getSimpleName() + " at key " + registrationName);
+   }
+
+   // ------------------------------------------------------------------------------||
+   // Lifecycle Methods ------------------------------------------------------------||
+   // ------------------------------------------------------------------------------||
+
+   public static ClassLoader TMP_CL = null;
+   
+   /**
+    * Lifecycle Start
+    */
+   @Override
+   protected void lockedStart() throws Exception
+   {
+      log.info("Starting " + this);
+
+      super.lockedStart();
+
+      //TODO
+      /*
+       * Temporary Hack Alert
+       * 
+       * Populate JBoss-specific metadata until this is done by
+       * AnnotationMetaDataDeployer and MergedJBossMetaDataDeployer
+       * 
+       * http://jira.jboss.com/jira/browse/JBMETA-45
+       * http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157770
+       */
+      log.warn("Populating JBoss-specific annotation metadata manually until done by deployers: " + this);
+
+      // Obtain annotations 
+      RemoteBindings remoteBindings = this.getAnnotation(RemoteBindings.class);
+      RemoteBinding remoteBinding = this.getAnnotation(RemoteBinding.class);
+      RemoteHomeBinding remoteHomeBinding = this.getAnnotation(RemoteHomeBinding.class);
+      LocalHomeBinding localHomeBinding = this.getAnnotation(LocalHomeBinding.class);
+      //      LocalBinding localBinding = this.getAnnotation(LocalBinding.class); // < No LocalBindingMetaData?
+
+      // Create a Set to hold RemoteBindings
+      Set<RemoteBinding> remoteBindingsSet = new HashSet<RemoteBinding>();
+
+      // Populate Set with Remote Bindings
+      if (remoteBindings != null)
+      {
+         for (RemoteBinding binding : remoteBindings.value())
+         {
+            remoteBindingsSet.add(binding);
+         }
+      }
+      if (remoteBinding != null)
+      {
+         remoteBindingsSet.add(remoteBinding);
+      }
+
+      // Ensure remote bindings metadata is not null
+      List<RemoteBindingMetaData> rbmd = this.getMetaData().getRemoteBindings();
+      if (rbmd == null || rbmd.size() == 0)
+      {
+         rbmd = new ArrayList<RemoteBindingMetaData>();
+         this.getMetaData().setRemoteBindings(rbmd);
+      }
+
+      // For each remote binding, populate metadata
+      for (RemoteBinding binding : remoteBindingsSet)
+      {
+         RemoteBindingMetaData md = new RemoteBindingMetaData();
+         md.setClientBindUrl(binding.clientBindUrl());
+         md.setInterceptorStack(binding.interceptorStack());
+         md.setJndiName(binding.jndiBinding());
+         md.setProxyFactory(binding.factory());
+         //TODO binding.invokerName?
+         rbmd.add(md);
+      }
+
+      // Populate metadata for @RemoteHomeBinding
+      if (remoteHomeBinding != null)
+      {
+         this.getMetaData().setHomeJndiName(remoteHomeBinding.jndiBinding());
+      }
+
+      // Populate metadata for @LocalHomeBinding
+      if (localHomeBinding != null)
+      {
+         this.getMetaData().setLocalHomeJndiName(localHomeBinding.jndiBinding());
+      }
+
+      /*
+       * End Temporary Hack
+       */
+
+      // Obtain registrar
+      JndiSessionRegistrarBase registrar = this.getJndiRegistrar();
+
+      // Bind all appropriate references/factories to Global JNDI for Client access, if a JNDI Registrar is present
+      if (registrar != null)
+      {
+         String guid = Ejb3Registry.guid(this);
+         registrar.bindEjb(this.getInitialContext(), this.getMetaData(), this.getClassloader(), this.getObjectName()
+               .getCanonicalName(), guid, this.getAdvisor());
+      }
+      else
+      {
+         log.warn("No " + JndiSessionRegistrarBase.class.getSimpleName()
+               + " was found; byassing binding of Proxies to " + this.getName() + " in Global JNDI.");
+      }
+      
+      //TODO Remove
+      TMP_CL = this.getClassloader();
+   }
+
+   /**
+    * Lifecycle Stop
+    */
+   @Override
+   protected void lockedStop() throws Exception
+   {
+      log.info("Stopping " + this);
+
+      super.lockedStop();
+
+      // Deregister with Remoting
+      Dispatcher.singleton.unregisterTarget(this.getName());
+
+      // Unbind applicable JNDI Entries
+      JndiSessionRegistrarBase jndiRegistrar = this.getJndiRegistrar();
+      if (jndiRegistrar != null)
+      {
+         jndiRegistrar.unbindEjb(this.getInitialContext(), this.getMetaData());
+      }
+
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Contracts ----------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected abstract String getJndiRegistrarBindName();
+
+   // --------------------------------------------------------------------------------||
+   // Accessors / Mutators -----------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Obtains the JndiSessionRegistrarBase from MC, null if not found
+    * 
+    * @return
+    */
+   protected JndiSessionRegistrarBase getJndiRegistrar()
+   {
+      // If defined already, use it
+      if (this.jndiRegistrar != null)
+      {
+         return this.jndiRegistrar;
+      }
+
+      // Initialize
+      String jndiRegistrarBindName = this.getJndiRegistrarBindName();
+
+      // Obtain Registrar
+      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();
+
+      // Lookup
+      Object obj = null;
+      try
+      {
+         obj = registrar.lookup(jndiRegistrarBindName);
+         this.setJndiRegistrar(jndiRegistrar);
+      }
+      // If not installed, warn and return null
+      catch (NotBoundException e)
+      {
+         log.warn("No " + JndiSessionRegistrarBase.class.getName()
+               + " was found installed in the ObjectStore (Registry) at " + jndiRegistrarBindName);
+         return null;
+
+      }
+
+      // Cast
+      JndiSessionRegistrarBase jndiRegistrar = (JndiSessionRegistrarBase) obj;
+
+      // Return
+      return jndiRegistrar;
+   }
+
+   public void setJndiRegistrar(JndiSessionRegistrarBase jndiRegistrar)
+   {
+      this.jndiRegistrar = jndiRegistrar;
+   }
 }

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,13 +21,13 @@
  */
 package org.jboss.ejb3.stateful;
 
+import java.io.Serializable;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.rmi.NoSuchObjectException;
 import java.rmi.RemoteException;
-import java.util.Collection;
 import java.util.Hashtable;
 import java.util.Map;
 
@@ -43,10 +43,13 @@
 import javax.ejb.RemoveException;
 import javax.ejb.TimerService;
 
+import org.jboss.aop.Advisor;
 import org.jboss.aop.Domain;
 import org.jboss.aop.MethodInfo;
+import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.InvocationResponse;
+import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.aop.util.MethodHashing;
 import org.jboss.aspects.asynch.FutureHolder;
 import org.jboss.ejb3.BeanContext;
@@ -62,17 +65,24 @@
 import org.jboss.ejb3.cache.Ejb3CacheFactory;
 import org.jboss.ejb3.cache.StatefulCache;
 import org.jboss.ejb3.cache.StatefulObjectFactory;
+import org.jboss.ejb3.common.lang.SerializableMethod;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
+import org.jboss.ejb3.interceptors.container.StatefulSessionContainerMethodInvocation;
 import org.jboss.ejb3.proxy.ProxyFactory;
 import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.StatefulSessionInvokableContext;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
-import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
+import org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateful.BaseStatefulRemoteProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateful.StatefulClusterProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateful.StatefulLocalProxyFactory;
-import org.jboss.ejb3.proxy.factory.stateful.StatefulProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateful.StatefulRemoteProxyFactory;
 import org.jboss.ejb3.proxy.impl.EJBMetaDataImpl;
 import org.jboss.ejb3.proxy.impl.HomeHandleImpl;
+import org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
+import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.proxy.remoting.StatefulSessionRemotingMetadata;
 import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.injection.Injector;
@@ -86,7 +96,10 @@
  * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
  * @version $Revision$
  */
-public class StatefulContainer extends SessionSpecContainer implements StatefulObjectFactory<StatefulBeanContext>
+public class StatefulContainer extends SessionSpecContainer
+      implements
+         StatefulObjectFactory<StatefulBeanContext>,
+         StatefulSessionInvokableContext
 {
    private static final Logger log = Logger.getLogger(StatefulContainer.class);
 
@@ -328,6 +341,16 @@
    {
       return this.getDeployment().getCacheFactoryRegistry();
    }
+   
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected String getJndiRegistrarBindName()
+   {
+      return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SFSB;
+   }
 
    /**
     * Performs a synchronous local invocation
@@ -404,13 +427,17 @@
                return invokeEJBLocalObjectMethod(id, info, args);
             }
             
-            StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+            SerializableMethod invoked = new SerializableMethod(method, method.getClass());
+            
+            //StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
+            StatefulSessionContainerMethodInvocation nextInvocation = new StatefulSessionContainerMethodInvocation(info);
+            nextInvocation.setSessionId(id);
             nextInvocation.setAdvisor(getAdvisor());
             nextInvocation.setArguments(args);
             
             ProxyUtils.addLocalAsynchronousInfo(nextInvocation, provider);
             
-            invokedMethod.push(new InvokedMethod(true, method));
+            //invokedMethod.push(invoked);
             return nextInvocation.invokeNext();
          }
          finally
@@ -424,7 +451,7 @@
          
             invokeStats.callOut();
             
-            invokedMethod.pop();
+            //invokedMethod.pop();
          }
       }
       finally
@@ -439,7 +466,7 @@
     *
     * @return
     */
-   public Object createSession(Class<?>[] initTypes, Object[] initValues)
+   public Serializable createSession(Class<?>[] initTypes, Object[] initValues)
    {
       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
       pushEnc();
@@ -450,7 +477,9 @@
          StatefulBeanContext ctx = cache.create(initTypes, initValues);
          // Since we return the key here, the context is not in use.
          cache.release(ctx);
-         return ctx.getId();
+         Object id = ctx.getId();
+         assert id instanceof Serializable : "SFSB Session IDs must be " + Serializable.class.getSimpleName();
+         return (Serializable) id;
       }
       finally
       {
@@ -463,14 +492,223 @@
    {
       getCache().remove(id);
    }
+   
+   /**
+    * Remote Invocation entry point, as delegated from
+    * ClassProxyHack (Remoting Dispatcher)
+    */
+   //TODO
+   public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      /*
+       * Initialize
+       */
 
+      // Mark the start time
+      long start = System.currentTimeMillis();
+
+      // Create a pointer to a new Invocation
+      EJBContainerInvocation newSi = null;
+
+      // Create a pointer to the response we'll return
+      InvocationResponse response = null;
+
+      // Create a pointer to the Session ID
+      Serializable sessionId = null;
+
+      /*
+       * Setup Environment (Stack/Thread)
+       */
+
+      // Hold a reference to the existing TCL
+      ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
+
+      // Set the Container's CL as TCL, required to unmarshall methods from the bean impl class
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+
+      // Push the ENC onto the stack
+      pushEnc();
+
+      try
+      {
+
+         /*
+          * Obtain the target method (unmarshall from invocation)
+          */
+
+         // Cast
+         assert invocation instanceof StatefulRemoteInvocation : SessionContainer.class.getName()
+               + ".dynamicInoke supports only " + StatefulRemoteInvocation.class.getSimpleName()
+               + ", but has been passed: " + invocation;
+         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
+
+         // Get the method hash
+         long methodHash = si.getMethodHash();
+         log.debug("Received dynamic invocation for method with hash: " + methodHash);
+
+         // Get the Method via MethodInfo from the Advisor
+         Advisor advisor = this.getAdvisor();
+         MethodInfo info = advisor.getMethodInfo(methodHash);
+         Method unadvisedMethod = info.getMethod();
+         
+         // Get the invoked method from invocation metadata
+         Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
+         assert objInvokedMethod !=null : "Invoked Method must be set on invocation metadata";
+         assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type " + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
+         SerializableMethod invokedMethod = (SerializableMethod)objInvokedMethod;
+
+         try
+         {
+
+            // Increment invocation statistics
+            invokeStats.callIn();
+
+            /*
+             * Obtain Session ID
+             */
+
+            // Obtain the Session ID
+            Object objSessionId = si.getMetaData(StatefulSessionRemotingMetadata.TAG_SFSB_INVOCATION,
+                  StatefulSessionRemotingMetadata.KEY_SESSION_ID);
+            if (objSessionId != null)
+            {
+               assert objSessionId instanceof Serializable : "Session IDs must be "
+                     + Serializable.class.getSimpleName();
+               sessionId = (Serializable) objSessionId;
+            }
+
+            if (info != null && unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               response = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               response = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+               if (unadvisedMethod.isBridge())
+               {
+                  unadvisedMethod = this.getNonBridgeMethod(unadvisedMethod);
+                  info = super.getMethodInfo(unadvisedMethod);
+               }
+
+               if (sessionId == null)
+               {
+                  StatefulBeanContext ctx = getCache().create(null, null);
+                  Object objNewId = ctx.getId();
+                  assert objNewId instanceof Serializable : "Obtained new Session ID from cache, " + objNewId
+                        + ", which is not " + Serializable.class.getSimpleName();
+                  sessionId = (Serializable) objNewId;
+               }
+               
+               /*
+                * Set the invoked method
+                */
+               //TODO Remove when CurrentInvocation is ironed out
+               
+               // Set onto stack
+               SessionSpecContainer.invokedMethod.push(invokedMethod);
+               
+               /*
+                * Build a new Invocation
+                */
+
+               // Construct the invocation
+               newSi = new StatefulContainerInvocation(info, sessionId);
+               //newSi = new StatefulContainerInvocation(info.getInterceptors(), long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor, Object id);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+
+               // Create an object to hold the return value
+               Object returnValue = null;
+
+               /*
+                * Perform Invocation
+                */
+
+               // Invoke
+               returnValue = newSi.invokeNext();
+
+               // Marshall the response
+               response = marshallResponse(invocation, returnValue, newSi.getResponseContextInfo());
+               if (sessionId != null)
+               {
+                  response.addAttachment(StatefulConstants.NEW_ID, sessionId);
+               }
+               
+//               response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
+//               if (newId != null) response.addAttachment(StatefulConstants.NEW_ID, newId);
+               
+               // Create a Response
+//             response = new InvocationResponse(returnValue);
+//             Map<Object, Object> responseContext = newSi.getResponseContextInfo();
+//             response.setContextInfo(responseContext);
+            }
+         }
+         catch (Throwable t)
+         {
+            Throwable exception = t;
+//            if (sessionId != null)
+//            {
+//               exception = new ForwardId(t, sessionId);
+//            }
+            Map<Object, Object> responseContext = null;
+            if (newSi != null)
+            {
+               responseContext = newSi.getResponseContextInfo();
+            }
+            response = marshallException(invocation, exception, responseContext);
+            return response;
+         }
+         finally
+         {
+            /*
+             * Update Invocation Statistics
+             */
+            if (unadvisedMethod != null)
+            {
+               // Mark end time
+               long end = System.currentTimeMillis();
+
+               // Calculate elapsed time
+               long elapsed = end - start;
+
+               // Update statistics with elapsed time
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+
+            // Complete call to increment statistics
+            invokeStats.callOut();
+            
+            // Pop invoked method off the stack
+            //TODO Remove when CurrentInvocation handles this
+            SessionSpecContainer.invokedMethod.pop();
+         }
+
+         // Return
+         return response;
+      }
+      finally
+      {
+         // Reset the TCL to original
+         Thread.currentThread().setContextClassLoader(originalLoader);
+
+         // Pop the ENC off the stack
+         this.popEnc();
+      }
+   }
+   
    /**
     * This should be a remote invocation call
     *
     * @param invocation
     * @return
     * @throws Throwable
+    * @deprecated Use dynamicInvoke(Invocation invocation)
     */
+   @Deprecated
    public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
    {
       long start = System.currentTimeMillis();
@@ -481,15 +719,21 @@
       try
       {
          Thread.currentThread().setContextClassLoader(classloader);
-         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
-         MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
+         MethodInvocation mi = (MethodInvocation)invocation;
+         
+         MethodInfo info = getAdvisor().getMethodInfo(mi.getMethodHash());
          if (info == null)
          {
             throw new RuntimeException("Could not resolve beanClass method from proxy call " + invocation);
          }
+         Method unadvisedMethod = info.getUnadvisedMethod();
+         
+         
+         StatefulRemoteInvocation si = (StatefulRemoteInvocation) invocation;
+         
 
          InvocationResponse response = null;
-         Method unadvisedMethod = info.getUnadvisedMethod();
+         
          Object newId = null;
          
          try
@@ -528,7 +772,7 @@
    
                Object rtn = null;
                  
-               invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
+
                rtn = newSi.invokeNext();
 
                response = marshallResponse(invocation, rtn, newSi.getResponseContextInfo());
@@ -557,8 +801,6 @@
             }
             
             invokeStats.callOut();
-            
-            invokedMethod.pop();
          }
 
          return response;
@@ -858,7 +1100,7 @@
    }
 
    protected InvocationResponse invokeHomeMethod(MethodInfo info,
-                                                 StatefulRemoteInvocation statefulInvocation) throws Throwable
+         StatefulRemoteInvocation statefulInvocation) throws Throwable
    {
       Method unadvisedMethod = info.getUnadvisedMethod();
       if (unadvisedMethod.getName().startsWith("create"))
@@ -880,7 +1122,7 @@
          else
             binding = this.getAnnotation(RemoteBinding.class);
 
-         StatefulContainerInvocation newStatefulInvocation = buildNewInvocation(
+         StatefulSessionContainerMethodInvocation newStatefulInvocation = buildNewInvocation(
                  info, statefulInvocation, initParameterTypes,
                  initParameterValues);
 
@@ -889,15 +1131,15 @@
 
          Object proxy = null;
          String businessInterfaceType = unadvisedMethod.getReturnType().getName();
-         if (newStatefulInvocation.getId() != null)
-            proxy = factory.createProxyEjb21(newStatefulInvocation.getId(), businessInterfaceType);
+         if (newStatefulInvocation.getSessionId() != null)
+            proxy = factory.createProxyEjb21(newStatefulInvocation.getSessionId(), businessInterfaceType);
          else
             proxy = factory.createProxyEjb21(businessInterfaceType);
 
          InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
-         if (newStatefulInvocation.getId() != null)
+         if (newStatefulInvocation.getSessionId() != null)
             response.addAttachment(StatefulConstants.NEW_ID,
-                    newStatefulInvocation.getId());
+                    newStatefulInvocation.getSessionId());
          return response;
       }
       else if (unadvisedMethod.getName().equals("remove"))
@@ -963,43 +1205,26 @@
     * @throws Exception
     */
    @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+   protected Object invokeHomeCreate(SerializableMethod method, Object args[])
          throws Exception
-   {
+   {  
+      // Lookup
+      String proxyFactoryKey = this.getJndiRegistrar().getProxyFactoryRegistryKey(this.getMetaData(), false);
+      Object factory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey);
       
       // Cast
-      String errorMessage = "Specified factory " + factory.getClass().getName() + " is not of type "
-            + StatefulProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName();
-      assert factory instanceof StatefulProxyFactory : errorMessage;
-      StatefulProxyFactory statefulFactory = null;
-      try
-      {
-         statefulFactory = (StatefulProxyFactory) factory;
-      }
-      catch (ClassCastException cce)
-      {
-         throw new ClassCastException(errorMessage);
-      }
-      
-      Class<?>[] initParameterTypes =
-      {};
-      Object[] initParameterValues =
-      {};
-      if (unadvisedMethod.getParameterTypes().length > 0)
-      {
-         initParameterTypes = unadvisedMethod.getParameterTypes();
-         initParameterValues = args;
-      }
+      assert factory instanceof StatefulSessionProxyFactory : "Specified factory " + factory.getClass().getName() + " is not of type "
+      + StatefulSessionProxyFactory.class.getName() + " as required by " + StatefulContainer.class.getName() + ", but was instead " + factory;
+      StatefulSessionProxyFactory statefulFactory = null;
+      statefulFactory = StatefulSessionProxyFactory.class.cast(factory);
 
-      Object id = createSession(initParameterTypes, initParameterValues);
+      Object proxy = statefulFactory.createProxyEjb2x();
 
-      Object proxy = statefulFactory.createProxyBusiness(id, unadvisedMethod.getReturnType().getName());
-
       return proxy;
    }
 
    protected InvocationResponse invokeEJBObjectMethod(MethodInfo info,
-                                                      StatefulRemoteInvocation statefulInvocation) throws Throwable
+         StatefulRemoteInvocation statefulInvocation) throws Throwable
    {
       Method unadvisedMethod = info.getUnadvisedMethod();
       if (unadvisedMethod.getName().equals("getHandle"))
@@ -1068,11 +1293,11 @@
       }
    }
 
-   private StatefulContainerInvocation buildNewInvocation(MethodInfo info,
-                                                          StatefulRemoteInvocation statefulInvocation,
-                                                          Class[] initParameterTypes, Object[] initParameterValues)
+   private StatefulSessionContainerMethodInvocation buildNewInvocation(MethodInfo info,
+         StatefulRemoteInvocation statefulInvocation, Class<?>[] initParameterTypes,
+         Object[] initParameterValues)
    {
-      StatefulContainerInvocation newStatefulInvocation = null;
+      StatefulSessionContainerMethodInvocation newStatefulInvocation = null;
 
       StatefulBeanContext ctx = null;
       if (initParameterTypes.length > 0)
@@ -1081,7 +1306,8 @@
          ctx = getCache().create(null, null);
 
       Object newId = ctx.getId();
-      newStatefulInvocation = new StatefulContainerInvocation(info, newId);
+      newStatefulInvocation = new StatefulSessionContainerMethodInvocation(info);
+      newStatefulInvocation.setSessionId(newId);
 
       newStatefulInvocation.setArguments(statefulInvocation.getArguments());
       newStatefulInvocation.setMetaData(statefulInvocation.getMetaData());
@@ -1126,8 +1352,8 @@
       
       boolean isRemote = false;
       boolean found = false;
-      Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
-      for (Class intf : remoteInterfaces)
+      Class<?>[] remoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(this);
+      for (Class<?> intf : remoteInterfaces)
       {
          if (intf.getName().equals(businessInterface.getName()))
          {
@@ -1138,8 +1364,8 @@
       }
       if (found == false)
       {
-         Class[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
-         for (Class intf : localInterfaces)
+         Class<?>[] localInterfaces = ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(this);
+         for (Class<?> intf : localInterfaces)
          {
             if (intf.getName().equals(businessInterface.getName()))
             {
@@ -1149,20 +1375,38 @@
          }
       }
       if (found == false) throw new IllegalStateException(businessInterface.getName() + " is not a business interface for container " + this);
+      
+      // Obtain SFSB JNDI Registrar
+      String sfsbJndiRegistrarObjectStoreBindName = this.getJndiRegistrarBindName();
+      JndiStatefulSessionRegistrar sfsbJndiRegistrar = Ejb3RegistrarLocator
+            .locateRegistrar().lookup(sfsbJndiRegistrarObjectStoreBindName,JndiStatefulSessionRegistrar.class);
+      
+      // Find the Proxy Factory Key for this SFSB
+      String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(this.getMetaData(), !isRemote);
+      
+      // Lookup the Proxy Factory in the Object Store
+      StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
+            StatefulSessionProxyFactory.class);
+      
+      // Create a new business proxy
+      Object proxy = proxyFactory.createProxyBusiness((Serializable) ctx.getId(), businessInterface.getName());
+      
+      // Return the Proxy
+      return proxy;
 
-      Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
-      for (ProxyFactory factory : proxyFactories)
-      {
-         if (isRemote && factory instanceof StatefulRemoteProxyFactory)
-         {
-            return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
-         }
-         else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
-         {
-            return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
-         }
-      }
-      throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
+//      Collection<ProxyFactory> proxyFactories = this.proxyDeployer.getProxyFactories().values();
+//      for (ProxyFactory factory : proxyFactories)
+//      {
+//         if (isRemote && factory instanceof StatefulRemoteProxyFactory)
+//         {
+//            return ((StatefulRemoteProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
+//         }
+//         else if (!isRemote && factory instanceof StatefulLocalProxyFactory)
+//         {
+//            return ((StatefulLocalProxyFactory) factory).createProxyBusiness(ctx.getId(),null);
+//         }
+//      }
+//      throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
    }
 
    /**

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateless/StatelessContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -22,6 +22,19 @@
 package org.jboss.ejb3.stateless;
 
 
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.Handle;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.naming.NamingException;
+
+import org.jboss.aop.Advisor;
 import org.jboss.aop.Domain;
 import org.jboss.aop.MethodInfo;
 import org.jboss.aop.joinpoint.Invocation;
@@ -37,14 +50,20 @@
 import org.jboss.ejb3.annotation.Clustered;
 import org.jboss.ejb3.annotation.LocalBinding;
 import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.common.lang.SerializableMethod;
 import org.jboss.ejb3.proxy.ProxyUtils;
+import org.jboss.ejb3.proxy.container.InvokableContext;
 import org.jboss.ejb3.proxy.factory.ProxyFactoryHelper;
 import org.jboss.ejb3.proxy.factory.SessionProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateless.BaseStatelessRemoteProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateless.StatelessClusterProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateless.StatelessLocalProxyFactory;
 import org.jboss.ejb3.proxy.factory.stateless.StatelessRemoteProxyFactory;
+import org.jboss.ejb3.proxy.objectstore.ObjectStoreBindings;
+import org.jboss.ejb3.proxy.remoting.SessionSpecRemotingMetadata;
+import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.ejb3.session.SessionSpecContainer;
+import org.jboss.ejb3.stateful.StatefulRemoteInvocation;
 import org.jboss.ejb3.timerservice.TimedObjectInvoker;
 import org.jboss.ejb3.timerservice.TimerServiceFactory;
 import org.jboss.injection.WebServiceContextProxy;
@@ -53,6 +72,7 @@
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
 import org.jboss.proxy.ejb.handle.HomeHandleImpl;
+import org.jboss.util.NotImplementedException;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
 import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
@@ -61,13 +81,7 @@
 import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
 import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
 
-import javax.ejb.*;
-import javax.naming.NamingException;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Map;
 
-
 /**
  * Comment
  *
@@ -75,7 +89,7 @@
  * @version $Revision$
  */
 public class StatelessContainer extends SessionSpecContainer
-  implements TimedObjectInvoker, ServiceEndpointContainer
+  implements TimedObjectInvoker, ServiceEndpointContainer, InvokableContext
 {
    private static final Logger log = Logger.getLogger(StatelessContainer.class);
 
@@ -167,7 +181,7 @@
       return proxyFactory.createProxyEjb21(businessInterfaceType);
    }
    
-   public Object createSession(Class<?> initTypes[], Object initArgs[])
+   public Serializable createSession(Class<?> initTypes[], Object initArgs[])
    {
       if((initTypes != null && initTypes.length > 0) || (initArgs != null && initArgs.length > 0))
          throw new IllegalArgumentException("stateless bean create method must take no arguments (EJB3 4.5)");
@@ -312,7 +326,7 @@
          {
             invokeStats.callIn();
             
-            invokedMethod.push(new InvokedMethod(true, unadvisedMethod));
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
 
             if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
             {
@@ -338,7 +352,7 @@
             
             invokeStats.callOut();
             
-            invokedMethod.pop();
+            //invokedMethod.pop();
          }
       }
       finally
@@ -346,7 +360,140 @@
          Thread.currentThread().setContextClassLoader(oldLoader);
       }
    }
+   
+   /**
+    * Remote Invocation entry point, as delegated from
+    * ClassProxyHack (Remoting Dispatcher)
+    */
+   public InvocationResponse dynamicInvoke(Invocation invocation) throws Throwable
+   {
+      /*
+       * Initialize
+       */
 
+      // Mark the start time
+      long start = System.currentTimeMillis();
+
+      // Create a pointer to a new Invocation
+      EJBContainerInvocation newSi = null;
+
+      // Create a pointer to the response we'll return
+      InvocationResponse response = null;
+      
+
+      /*
+       * Setup Environment (Stack/Thread)
+       */
+
+      // Hold a reference to the existing TCL
+      ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
+
+      // Set the Container's CL as TCL, required to unmarshall methods from the bean impl class
+      Thread.currentThread().setContextClassLoader(this.getClassloader());
+
+      // Push the ENC onto the stack
+      pushEnc();
+      
+      try
+      {
+         
+         /*
+          * Obtain the target method (unmarshall from invocation)
+          */
+
+         // Cast
+         assert invocation instanceof StatefulRemoteInvocation : SessionContainer.class.getName()
+               + ".dynamicInoke supports only " + StatefulRemoteInvocation.class.getSimpleName()
+               + ", but has been passed: " + invocation;
+         MethodInvocation si = (MethodInvocation) invocation;
+
+         // Get the method hash
+         long methodHash = si.getMethodHash();
+         log.debug("Received dynamic invocation for method with hash: " + methodHash);
+
+         // Get the Method via MethodInfo from the Advisor
+         Advisor advisor = this.getAdvisor();
+         MethodInfo info = advisor.getMethodInfo(methodHash);
+         Method unadvisedMethod = info.getMethod();
+         
+         try
+         {
+            invokeStats.callIn();
+
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
+            Map responseContext = null;
+            Object rtn = null;
+            if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
+            {
+               rtn = invokeHomeMethod(info, si);
+            }
+            else if (info != null && unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
+            {
+               rtn = invokeEJBObjectMethod(info, si);
+            }
+            else
+            {
+
+               newSi = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+               newSi.setArguments(si.getArguments());
+               newSi.setMetaData(si.getMetaData());
+               newSi.setAdvisor(getAdvisor());
+               
+               /*
+                * Set the invoked method
+                */
+               //TODO Remove when CurrentInvocation is ironed out
+               
+               // Get the invoked method from invocation metadata
+               Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
+               assert objInvokedMethod !=null : "Invoked Method must be set on invocation metadata";
+               assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type " + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
+               SerializableMethod invokedMethod = (SerializableMethod)objInvokedMethod;
+               
+               // Set onto stack
+               SessionSpecContainer.invokedMethod.push(invokedMethod);
+               
+               
+               try
+               {
+                  rtn = newSi.invokeNext();
+                  responseContext = newSi.getResponseContextInfo();
+               }
+               catch (Throwable throwable)
+               {
+                  responseContext = newSi.getResponseContextInfo();
+                  return marshallException(invocation, throwable, responseContext);
+               }
+               finally
+               {
+                  SessionSpecContainer.invokedMethod.pop();
+               }
+            }
+
+            response = marshallResponse(invocation, rtn, responseContext);
+            return response;
+         }
+         finally
+         {
+            if (unadvisedMethod != null)
+            {
+               long end = System.currentTimeMillis();
+               long elapsed = end - start;
+               invokeStats.updateStats(unadvisedMethod, elapsed);
+            }
+
+            invokeStats.callOut();
+
+            //invokedMethod.pop();
+         }
+      }
+      finally
+      {
+         Thread.currentThread().setContextClassLoader(originalLoader);
+      }
+   }
+
+   @Deprecated
    public InvocationResponse dynamicInvoke(Object target, Invocation invocation) throws Throwable
    {
       long start = System.currentTimeMillis();
@@ -367,7 +514,7 @@
          {
             invokeStats.callIn();
             
-            invokedMethod.push(new InvokedMethod(false, unadvisedMethod));
+            //invokedMethod.push(new SerializableMethod(unadvisedMethod, unadvisedMethod.getClass()));
             Map responseContext = null;
             Object rtn = null;
             if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
@@ -413,7 +560,7 @@
             
             invokeStats.callOut();
             
-            invokedMethod.pop();
+            //invokedMethod.pop();
          }
       }
       finally
@@ -474,11 +621,14 @@
     * @throws Exception
     */
    @Override
-   protected Object invokeHomeCreate(SessionProxyFactory factory, Method unadvisedMethod, Object args[])
+   protected Object invokeHomeCreate(SerializableMethod unadvisedMethod, Object args[])
          throws Exception
    {   
+      // Lookup factory
+      Object factory = this.getInitialContext().lookup(this.getMetaData().getHomeJndiName());
+      SessionProxyFactory proxyFactory = SessionProxyFactory.class.cast(factory);
 
-      Object proxy = factory.createProxyBusiness(unadvisedMethod.getReturnType().getName());
+      Object proxy = proxyFactory.createProxyBusiness(unadvisedMethod.getReturnType());
 
       return proxy;
    }
@@ -590,6 +740,16 @@
       return name;
    }
    
+   /**
+    * Returns the name under which the JNDI Registrar for this container is bound
+    * 
+    * @return
+    */
+   protected String getJndiRegistrarBindName()
+   {
+      return ObjectStoreBindings.OBJECTSTORE_BEAN_NAME_JNDI_REGISTRAR_SLSB;
+   }
+   
    static class WSCallbackImpl implements BeanContextLifecycleCallback
    {
       private ExtensibleWebServiceContext jaxwsContext;

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/InjectionUtil.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,16 +21,6 @@
  */
 package org.jboss.injection;
 
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.injection.lang.reflect.BeanProperty;
-import org.jboss.injection.lang.reflect.BeanPropertyFactory;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.javaee.spec.RemoteEnvironment;
-import org.jboss.metadata.javaee.spec.ResourceInjectionMetaData;
-import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
-import org.jboss.metamodel.descriptor.InjectionTarget;
-import org.jboss.metamodel.descriptor.Ref;
-
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
@@ -43,6 +33,14 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.injection.lang.reflect.BeanPropertyFactory;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.javaee.spec.RemoteEnvironment;
+import org.jboss.metadata.javaee.spec.ResourceInjectionMetaData;
+import org.jboss.metadata.javaee.spec.ResourceInjectionTargetMetaData;
+
 /**
  * Comment
  *

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/JndiPropertyInjector.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,6 +21,7 @@
  */
 package org.jboss.injection;
 
+import java.lang.reflect.Proxy;
 import java.util.Arrays;
 
 import javax.naming.Context;
@@ -29,6 +30,7 @@
 
 import org.jboss.ejb3.BeanContext;
 import org.jboss.ejb3.JndiUtil;
+import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.injection.lang.reflect.BeanProperty;
 import org.jboss.logging.Logger;
 
@@ -89,7 +91,28 @@
 
    public void inject(Object instance)
    {
+      
+      
+      
+      
+      
       Object value = lookup(jndiName);
+      
+//      Class<?> valueClass = value.getClass();
+//      
+//      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+//      ClassLoader classcl = property.getType().getClassLoader();
+//      ClassLoader valueCl = valueClass.getClassLoader();
+//      ClassLoader proxyHandlerCl = null;
+//      if(Proxy.isProxyClass(value.getClass()))
+//      {
+//         Object proxyHandler = Proxy.getInvocationHandler(value);
+//         proxyHandlerCl = proxyHandler.getClass().getClassLoader();
+//         
+//      }
+//      ClassLoader containerCl = SessionSpecContainer.TMP_CL;
+//      boolean equalsCl = classcl.equals(valueCl);
+      
       log.trace("injecting " + value + " from " + jndiName + " into " + property + " of " + instance);
       try
       {

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface1.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.core.test.ejbthree1060;
+
+/**
+ * BusinessInterface1
+ * 
+ * A Simple Business interface extending from a 
+ * shared base
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface BusinessInterface1 extends CommonBusinessInterface
+{
+
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/BusinessInterface2.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.core.test.ejbthree1060;
+
+/**
+ * BusinessInterface1
+ * 
+ * A Simple Business interface extending from a 
+ * shared base
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface BusinessInterface2 extends CommonBusinessInterface
+{
+
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/CommonBusinessInterface.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.core.test.ejbthree1060;
+
+/**
+ * CommonBusinessInterface
+ * 
+ * A Common Business Interface to be used as a Base
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface CommonBusinessInterface
+{
+
+   /**
+    * Returns the business interface invoked upon
+    * 
+    * @return
+    */
+   Class<?> getInvokedBusinessInterface();
+
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/InvokedBusinessInterfaceBean.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.core.test.ejbthree1060;
+
+import javax.annotation.Resource;
+import javax.ejb.Local;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+
+import org.jboss.logging.Logger;
+
+/**
+ * InvokedBusinessInterfaceBean
+ * 
+ * A Simple EJB used for testing calls to obtain 
+ * the Invoked Business interface when a common base is
+ * in play
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Local(
+{BusinessInterface1.class, BusinessInterface2.class})
+public class InvokedBusinessInterfaceBean implements BusinessInterface1, BusinessInterface2
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static final Logger log = Logger.getLogger(InvokedBusinessInterfaceBean.class);
+
+   // --------------------------------------------------------------------------------||
+   // Instance Members ---------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   @Resource
+   public SessionContext context;
+
+   // --------------------------------------------------------------------------------||
+   // Required Implementations -------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Returns the business interface invoked upon
+    * 
+    * @return
+    */
+   public Class<?> getInvokedBusinessInterface()
+   {
+      Class<?> invokedBusiface = context.getInvokedBusinessInterface();
+      log.info("Invoked Business Interface: " + invokedBusiface);
+      return invokedBusiface;
+   }
+
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1060/unit/InvokedBusinessInterfaceUnitTestCase.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.ejb3.core.test.ejbthree1060.unit;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.ejbthree1060.BusinessInterface1;
+import org.jboss.ejb3.core.test.ejbthree1060.BusinessInterface2;
+import org.jboss.ejb3.core.test.ejbthree1060.InvokedBusinessInterfaceBean;
+import org.jboss.ejb3.session.SessionContainer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * InvokedBusinessInterfaceUnitTestCase
+ * 
+ * Test Cases to validate SessionContext.getInvokedBusinessInterface
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class InvokedBusinessInterfaceUnitTestCase extends AbstractEJB3TestCase
+{
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static SessionContainer container;
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   @Test
+   public void testGetInvokedBusinessInterface() throws Throwable
+   {
+      // Define JNDI Targets for Lookup
+      String jndiNameBase = InvokedBusinessInterfaceBean.class.getSimpleName() + "/" + "local-";
+      String jndiNameInterface1 = jndiNameBase + BusinessInterface1.class.getName();
+      String jndiNameInterface2 = jndiNameBase + BusinessInterface2.class.getName();
+
+      // Get JNDI Context
+      Context context = new InitialContext();
+
+      // Obtain
+      BusinessInterface1 busiface1 = (BusinessInterface1) context.lookup(jndiNameInterface1);
+      BusinessInterface2 busiface2 = (BusinessInterface2) context.lookup(jndiNameInterface2);
+
+      // Invoke getInvokedBusinessInterface
+      Class<?> invoked1 = busiface1.getInvokedBusinessInterface();
+      Class<?> invoked2 = busiface2.getInvokedBusinessInterface();
+
+      // Test
+      TestCase.assertEquals(BusinessInterface1.class, invoked1);
+      TestCase.assertEquals(BusinessInterface2.class, invoked2);
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Lifecycle Methods --------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractEJB3TestCase.beforeClass();
+
+      // Deploy the test SLSB
+      container = deploySessionEjb(InvokedBusinessInterfaceBean.class);
+   }
+
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      // Undeploy the test SLSB
+      undeployEjb(container);
+
+      AbstractEJB3TestCase.afterClass();
+   }
+
+}

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree1150/unit/WebServiceContextInjectionTestCase.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -71,7 +71,7 @@
       container.processMetadata();
       
       // Register the Container in ObjectStore (MC)
-      String containerName = container.getName();
+      String containerName = container.getObjectName().getCanonicalName();
       Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
 
       InitialContext ctx = new InitialContext();
@@ -81,7 +81,7 @@
       
       bean.checkWebServiceContext();
       
-      getBootstrap().getKernel().getController().uninstall(containerName);
+      Ejb3RegistrarLocator.locateRegistrar().unbind(containerName);
    }
 
    @Test
@@ -125,7 +125,7 @@
       container.processMetadata();
       
       // Register the Container in ObjectStore (MC)
-      String containerName = container.getName();
+      String containerName = container.getObjectName().getCanonicalName();
       Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
 
       InitialContext ctx = new InitialContext();

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/regression/ejbthree1253/unit/OverriddenProxyFactoryTestCase.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -28,10 +28,10 @@
 import javax.naming.InitialContext;
 
 import org.jboss.aop.Domain;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
 import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.Ejb3Registry;
 import org.jboss.ejb3.cache.persistence.PersistenceManagerFactoryRegistry;
+import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
 import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStateful;
 import org.jboss.ejb3.core.test.regression.ejbthree1253.MyStatefulBean;
@@ -40,8 +40,9 @@
 import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
 import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
 import org.jboss.ejb3.test.common.MetaDataHelper;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
@@ -72,12 +73,12 @@
       Ejb3Registry.register(container);
       
       // Register the Container in ObjectStore (MC)
-      String containerName = container.getName();
-      AbstractBeanMetaData bmd = new AbstractBeanMetaData(containerName, StatefulContainer.class.getName());
-      KernelControllerContext context = getBootstrap().getKernel().getController().install(bmd, container);
-      if(context.getError() != null)
-         throw context.getError();
-//      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
+      String containerName = container.getObjectName().getCanonicalName();
+//      AbstractBeanMetaData bmd = new AbstractBeanMetaData(containerName, StatefulContainer.class.getName());
+//      KernelControllerContext context = getBootstrap().getKernel().getController().install(bmd, container);
+//      if(context.getError() != null)
+//         throw context.getError();
+      Ejb3RegistrarLocator.locateRegistrar().bind(containerName, container);
 
       
       InitialContext ctx = new InitialContext();
@@ -92,4 +93,16 @@
       getBootstrap().getKernel().getController().uninstall(containerName);
       Ejb3Registry.unregister(container);
    }
+   
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractEJB3TestCase.beforeClass();
+   }
+
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      AbstractEJB3TestCase.afterClass();
+   }
 }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockBean.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -26,6 +26,7 @@
 import javax.ejb.PostActivate;
 import javax.ejb.PrePassivate;
 import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
 
 import org.jboss.ejb3.annotation.Cache;
 import org.jboss.ejb3.annotation.CacheConfig;
@@ -42,6 +43,7 @@
 @PersistenceManager("MyStatefulSessionFilePersistenceManager")
 @CacheConfig(idleTimeoutSeconds=1)
 @Pool("ThreadlocalPool")
+ at Stateful
 public class MockBean implements Mock
 {
    public static Object notification = new Object();

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockDeploymentUnit.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -58,7 +58,7 @@
     */
    public ClassLoader getClassLoader()
    {
-      return null;
+      return Thread.currentThread().getContextClassLoader();
    }
 
    /* (non-Javadoc)

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/MockStatefulContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -21,17 +21,14 @@
  */
 package org.jboss.ejb3.test.cachepassivation;
 
+import java.io.Serializable;
 import java.util.Hashtable;
 
 import org.jboss.aop.Domain;
 import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.ejb3.test.common.MetaDataHelper;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy;
-import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.JBossSessionPolicyDecorator;
 
 /**
  * Comment
@@ -46,25 +43,27 @@
    public MockStatefulContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
          Hashtable ctxProperties, Ejb3Deployment deployment) throws ClassNotFoundException
    {
-      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, createMockBeanMetaData());
+      super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, createMockBeanMetaData(beanClassName));
    }
-   
+
    @Override
-   public Object createSession()
+   public Serializable createSession()
    {
       // TODO Auto-generated method stub
       return super.createSession();
    }
-   
-   private static JBossSessionBeanMetaData createMockBeanMetaData()
+
+   private static JBossSessionBeanMetaData createMockBeanMetaData(String beanClassName)
    {
-      JBossMetaData metaData = new JBossMetaData();
-      JBossEnterpriseBeansMetaData enterpriseBeans = new JBossEnterpriseBeansMetaData();
-      metaData.setEnterpriseBeans(enterpriseBeans);
-      metaData.setAssemblyDescriptor(new JBossAssemblyDescriptorMetaData());
-      JBossSessionBeanMetaData sessionBeanMetaData = new JBossSessionBeanMetaData();
-      sessionBeanMetaData.setEnterpriseBeansMetaData(enterpriseBeans);
-      sessionBeanMetaData = new JBossSessionPolicyDecorator(sessionBeanMetaData, new BasicJndiBindingPolicy());
-      return sessionBeanMetaData;
+      try
+      {
+         return MetaDataHelper.getMetadataFromBeanImplClass(Thread.currentThread().getContextClassLoader().loadClass(
+               beanClassName));
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Could not load Bean Implementation class when creating new "
+               + MockStatefulContainer.class, e);
+      }
    }
 }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -86,7 +86,8 @@
       persistenceManagerFactoryRegistry.setFactories(factories);
       Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
       deployment.setPersistenceManagerFactoryRegistry(persistenceManagerFactoryRegistry);
-      MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, domain, ctxProperties, deployment);
+      MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, domain, ctxProperties,
+            deployment);
       container.instantiated();
       container.processMetadata();
       System.out.println("injectors = " + container.getInjectors());

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/test/threadlocal/MockContainer.java	2008-08-11 02:46:56 UTC (rev 76876)
@@ -283,4 +283,14 @@
 
    }
 
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.ejb3.Container#getName()
+    */
+   public String getName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
 }

Modified: projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/resources/basicbootstrap-beans.xml	2008-08-11 02:46:56 UTC (rev 76876)
@@ -83,37 +83,27 @@
     
   -->
 
-  <!-- SLSB JNDI Registrar 
+  <!-- SLSB JNDI Registrar -->
   <bean name="org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar"
     class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar">
     <constructor>
       <parameter>
-        <inject bean="org.jboss.ejb3.JndiContext" />
-      </parameter>
-      <parameter>
         org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory
       </parameter>
     </constructor>
     <depends>NameServer</depends>
-  </bean> -->
+  </bean>
 
-  <!-- SFSB JNDI Registrar 
+  <!-- SFSB JNDI Registrar -->
   <bean name="org.jboss.ejb3.JndiRegistrar.Session.SFSBJndiRegistrar"
     class="org.jboss.ejb3.proxy.jndiregistrar.JndiStatefulSessionRegistrar">
     <constructor>
       <parameter>
-        <inject bean="org.jboss.ejb3.JndiContext" />
-      </parameter>
-      <parameter>
         org.jboss.ejb3.proxy.objectfactory.session.stateful.StatefulSessionProxyObjectFactory
       </parameter>
     </constructor>
     <depends>NameServer</depends>
-  </bean> -->
-
-  <!-- JNDI Registrar Configuration -->
-  <bean name="org.jboss.ejb3.JndiContext"
-    class="javax.naming.InitialContext" />
+  </bean>
     
    <!-- Remoting Proxy Factory Registry -->
    <bean name="EJB3RemoteProxyFactoryRegistry" class="org.jboss.ejb3.proxy.factory.RemoteProxyFactoryRegistry">

Modified: projects/ejb3/trunk/core/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/core/src/test/resources/log4j.xml	2008-08-11 02:43:33 UTC (rev 76875)
+++ projects/ejb3/trunk/core/src/test/resources/log4j.xml	2008-08-11 02:46:56 UTC (rev 76876)
@@ -61,7 +61,7 @@
 
   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
     <param name="Target" value="System.out"/>
-    <param name="Threshold" value="WARN"/>
+    <param name="Threshold" value="DEBUG"/>
 
     <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
@@ -110,23 +110,22 @@
     <priority value="INFO"/>
   </category>
   
+  <!-- 
+  Unnecessary, EJB3 is exposed as DEBUG
   <category name="org.jboss.ejb3.interceptors.aop.DomainClassLoader">
     <priority value="DEBUG"/>
-  </category>
+  </category>   -->
   
   <category name="org.jboss.ejb3">
     <priority value="DEBUG"/>
   </category>
   
-  <category name="org.jboss.ejb3.test">
-    <priority value="DEBUG"/>
-  </category>
-  
   <!-- ======================= -->
   <!-- Setup the Root category -->
   <!-- ======================= -->
 
   <root>
+    <priority value="WARN" />
     <appender-ref ref="CONSOLE"/>
     <appender-ref ref="FILE"/>
   </root>




More information about the jboss-cvs-commits mailing list