[jboss-cvs] JBossAS SVN: r64832 - branches/Branch_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 20:39:11 EDT 2007


Author: bdecoste
Date: 2007-08-23 20:39:11 -0400 (Thu, 23 Aug 2007)
New Revision: 64832

Modified:
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   branches/Branch_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/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-08-24 00:31:54 UTC (rev 64831)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-08-24 00:39:11 UTC (rev 64832)
@@ -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/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-24 00:31:54 UTC (rev 64831)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-08-24 00:39:11 UTC (rev 64832)
@@ -284,15 +284,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