[jboss-cvs] JBossAS SVN: r64838 - branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 23 21:01:24 EDT 2007


Author: bdecoste
Date: 2007-08-23 21:01:24 -0400 (Thu, 23 Aug 2007)
New Revision: 64838

Modified:
   branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
Log:
corrected fix in [EJBTHREE-942] which was causing factoryxml to fail - use default RemoteBindings for injection if not provided

Modified: branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-08-24 01:00:49 UTC (rev 64837)
+++ branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-08-24 01:01:24 UTC (rev 64838)
@@ -53,6 +53,10 @@
 
 import org.jboss.annotation.ejb.Clustered;
 import org.jboss.annotation.ejb.PoolClass;
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.annotation.ejb.RemoteBindingImpl;
+import org.jboss.annotation.ejb.RemoteBindings;
+import org.jboss.annotation.ejb.RemoteBindingsImpl;
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.ClassContainer;
 import org.jboss.aop.MethodInfo;
@@ -1024,4 +1028,30 @@
    {
       return false;
    }
+   
+   public RemoteBindings getRemoteBindings()
+   {
+      RemoteBindings bindings = (RemoteBindings)resolveAnnotation(RemoteBindings.class);
+      if (bindings != null)
+         return bindings;
+      
+      RemoteBinding[] newBindings = new RemoteBinding[1];
+      
+      RemoteBinding binding = (RemoteBinding)resolveAnnotation(RemoteBinding.class);
+      if (binding != null)
+         newBindings[0] = binding;
+      else
+      {
+         // create default RemoteBindings. This should only be necessary when a bean
+         // is trying to inject a bean using the default jndi binding
+         String jndiName = ProxyFactoryHelper.getDefaultRemoteJndiName(this);
+         RemoteBindingImpl defaultBinding = new RemoteBindingImpl();
+         defaultBinding.setJndiBinding(jndiName);
+         newBindings[0] = defaultBinding;
+      }
+         
+      RemoteBindingsImpl bindingsImpl = new RemoteBindingsImpl(newBindings);
+
+      return bindingsImpl;
+   }
 }

Modified: branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-24 01:00:49 UTC (rev 64837)
+++ branches/JBPAPP_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-24 01:01:24 UTC (rev 64838)
@@ -280,15 +280,8 @@
          {
             if (clazz.getName().equals(businessInterface.getName()))
             {
-               RemoteBindings bindings = (RemoteBindings) advisor.resolveAnnotation(RemoteBindings.class);
-               if (bindings == null)
-               {
-                  RemoteBinding binding = (RemoteBinding) advisor.resolveAnnotation(RemoteBinding.class);
-                  if (binding == null)
-                     throw new RuntimeException("RemoteBindings should not be null: " + container.getEjbName());
-
-                  return getRemoteJndiName(container, binding);
-               }
+               RemoteBindings bindings = (RemoteBindings) ((EJBContainer)container).getRemoteBindings();
+               
                return getRemoteJndiName(container, bindings.value()[0]);
             }
          }




More information about the jboss-cvs-commits mailing list