[jboss-cvs] JBossAS SVN: r79362 - projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Oct 11 20:51:20 EDT 2008


Author: ALRubinger
Date: 2008-10-11 20:51:20 -0400 (Sat, 11 Oct 2008)
New Revision: 79362

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
Log:
[EJBTHREE-1130] Throw an error on deployment if @RemoteBinding is specified with no remote business interface

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-10-12 00:50:37 UTC (rev 79361)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-10-12 00:51:20 UTC (rev 79362)
@@ -35,6 +35,7 @@
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.Dispatcher;
+import org.jboss.ejb3.annotation.RemoteBindings;
 import org.jboss.ejb3.common.registrar.spi.DuplicateBindException;
 import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.common.registrar.spi.NotBoundException;
@@ -43,6 +44,7 @@
 import org.jboss.ejb3.proxy.factory.session.SessionProxyFactory;
 import org.jboss.ejb3.proxy.objectfactory.ProxyFactoryReferenceAddressTypes;
 import org.jboss.ejb3.proxy.remoting.ProxyRemotingUtils;
+import org.jboss.ejb3.proxy.spi.common.ErrorCodes;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
@@ -325,7 +327,37 @@
          // Remote Bindings are defined, create a binding for each
          else
          {
+
             /*
+             * EJBTHREE-1130
+             * 
+             * Ensure we've got remote business interfaces, otherwise
+             * throw an error to the bean provider
+             */
+
+            // Get the remote business interface
+            String remoteBusinessInterface = smd.getRemote();
+
+            // Check that it's provided
+            if (remoteBusinessInterface == null || remoteBusinessInterface.trim().length() > 0)
+            {
+               // We've got an invalid @RemoteBindings definition with no proper
+               // remote business interface; throw an error
+
+               /*
+                * Maintainer's note: The Unit Test will check for the String "EJBTHREE-1130"
+                * in this error message
+                */
+               throw new RuntimeException("Encountered EJB " + smd.getName() + " with @"
+                     + RemoteBindings.class.getName() + " defined but with no remote business interface.  ["
+                     + ErrorCodes.ERROR_MESSAGE_CODE_EJBTHREE1130 + "]");
+            }
+
+            /*
+             * EJBTHREE-1130 OK, continue along
+             */
+
+            /*
              * Bind all explicitly-declared remote bindings
              */
 
@@ -659,7 +691,7 @@
          String defaultLocalJndiName = smd.getLocalJndiName();
 
          // Remove local proxy factory
-         String localProxyFactoryKey = this.getProxyFactoryRegistryKey(defaultLocalJndiName,smd,true);
+         String localProxyFactoryKey = this.getProxyFactoryRegistryKey(defaultLocalJndiName, smd, true);
          this.deregisterProxyFactory(localProxyFactoryKey);
 
          // Determine if local home and business locals are bound to same JNDI Address
@@ -959,7 +991,7 @@
     * Returns the name of the unique key under which a Proxy Factory will 
     * be registered.  Will follow form:
     * 
-    * ProxyFactory/(jndiName)
+    * ProxyFactory/{ejbName}/{jndiName}
     * 
     * @param jndiName
     * @param smd
@@ -978,7 +1010,7 @@
             + " key prefix for binding to registry is not specified";
 
       // Assemble and return
-      String key = JndiSessionRegistrarBase.KEY_PREFIX_PROXY_FACTORY_REGISTRY + suffix;
+      String key = JndiSessionRegistrarBase.KEY_PREFIX_PROXY_FACTORY_REGISTRY + smd.getEjbName() + "/" + suffix;
       return key;
    }
 




More information about the jboss-cvs-commits mailing list