[jboss-cvs] JBossAS SVN: r63557 - in trunk/ejb3/src/main/org/jboss/ejb3: service and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 18 11:17:42 EDT 2007


Author: bdecoste
Date: 2007-06-18 11:17:42 -0400 (Mon, 18 Jun 2007)
New Revision: 63557

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/BaseContext.java
   trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java
   trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
Log:
[EJBTHREE-905] merge from branch 4.2

Modified: trunk/ejb3/src/main/org/jboss/ejb3/BaseContext.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/BaseContext.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/BaseContext.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -54,6 +54,11 @@
    public BaseContext()
    {
    }
+   
+   public Object getId()
+   {
+      return null;
+   }
 
    public Object getInstance()
    {

Modified: trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/BaseSessionContext.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -335,9 +335,11 @@
    {
       try
       {
-         return (EJBLocalObject)container.getInitialContext().lookup(ProxyFactoryHelper.getLocalJndiName(container, false));
+         Object id = baseContext.getId();
+         EJBLocalObject proxy =  (EJBLocalObject)((SessionContainer)container).createLocalProxy(id);
+         return proxy;
       }
-      catch (NamingException e)
+      catch (Exception e)
       {
          throw new IllegalStateException(e);
       }
@@ -347,9 +349,11 @@
    {
       try
       {
-         return (EJBObject)container.getInitialContext().lookup(ProxyFactoryHelper.getRemoteJndiName(container, false));
+         Object id = baseContext.getId();
+         EJBObject proxy =  (EJBObject)((SessionContainer)container).createRemoteProxy(id);
+         return proxy;
       }
-      catch (NamingException e)
+      catch (Exception e)
       {
          throw new IllegalStateException(e);
       }

Modified: trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/SessionContainer.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -69,6 +69,10 @@
       public boolean isLocalInterface;
       public Method method;
    }
+   
+   public abstract Object createLocalProxy(Object id) throws Exception;
+   
+   public abstract Object createRemoteProxy(Object id) throws Exception;
 
    protected ThreadLocalStack<InvokedMethod> invokedMethod = new ThreadLocalStack<InvokedMethod>();
 

Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -472,7 +472,22 @@
       return delegate.getMBeanInfo();
    }
 
+   public Object createLocalProxy(Object id) throws Exception
+   {
+      ServiceLocalProxyFactory factory = new ServiceLocalProxyFactory();
+      factory.setContainer(this);
 
+      return factory.createProxy(id);
+   }
+   
+   public Object createRemoteProxy(Object id) throws Exception
+   {
+      ServiceRemoteProxyFactory factory = new ServiceRemoteProxyFactory();
+      factory.setContainer(this);
+
+      return factory.createProxy(id);
+   }
+
    private void registerManagementInterface()
    {
       try

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -628,7 +628,36 @@
          return null;
       }
    }
+   
+   public Object createLocalProxy(Object id) throws Exception
+   {
+      StatefulLocalProxyFactory factory = new StatefulLocalProxyFactory();
+      factory.setContainer(this);
+      factory.init();
 
+      return factory.createProxy(id);
+   }
+   
+   public Object createRemoteProxy(Object id) throws Exception
+   {
+      RemoteBinding binding = null;
+      RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
+      if (bindings != null)
+         binding = bindings.value()[0];
+      else
+         binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
+      
+      StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory();
+      factory.setContainer(this);
+      factory.setRemoteBinding(binding);
+      factory.init();
+
+      if (id != null)
+         return factory.createProxy(id);
+      else
+         return factory.createProxy();
+   }
+
    protected InvocationResponse invokeHomeMethod(MethodInfo info,
                                                  StatefulRemoteInvocation statefulInvocation) throws Throwable
    {

Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2007-06-18 15:15:12 UTC (rev 63556)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateless/StatelessContainer.java	2007-06-18 15:17:42 UTC (rev 63557)
@@ -370,7 +370,36 @@
          return null;
       }
    }
+   
+   public Object createLocalProxy(Object id) throws Exception
+   {
+      StatelessLocalProxyFactory factory = new StatelessLocalProxyFactory();
+      factory.setContainer(this);
+      factory.init();
 
+      Object proxy = factory.createProxy();
+
+      return proxy;
+   }
+   
+   public Object createRemoteProxy(Object id) throws Exception
+   {
+      RemoteBinding binding = null;
+
+      RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
+      if (bindings != null)
+         binding = bindings.value()[0];
+      else
+         binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
+
+      StatelessRemoteProxyFactory factory = new StatelessRemoteProxyFactory();
+      factory.setContainer(this);
+      factory.setRemoteBinding(binding);
+      factory.init();
+
+      return factory.createProxy();
+   }
+
    protected Object invokeHomeMethod(MethodInfo info, MethodInvocation invocation) throws Throwable
    {
       Method unadvisedMethod = info.getUnadvisedMethod();




More information about the jboss-cvs-commits mailing list