[jboss-cvs] JBossAS SVN: r82748 - 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 Jan 10 00:04:51 EST 2009


Author: ALRubinger
Date: 2009-01-10 00:04:51 -0500 (Sat, 10 Jan 2009)
New Revision: 82748

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
Log:
[EJBTHREE-1668] Do not bind default business interface if there is no business view

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	2009-01-10 05:04:17 UTC (rev 82747)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2009-01-10 05:04:51 UTC (rev 82748)
@@ -185,8 +185,10 @@
       String remoteHome = StringUtils.adjustWhitespaceStringToNull(smd.getHome());
 
       // Determine if there are local/remote views
-      boolean hasLocalView = (localHome != null || (businessLocals != null && businessLocals.size() > 0));
-      boolean hasRemoteView = (remoteHome != null || (businessRemotes != null && businessRemotes.size() > 0));
+      boolean hasLocalBusinessView = (businessLocals != null && businessLocals.size() > 0);
+      boolean hasRemoteBusinessView = (businessRemotes != null && businessRemotes.size() > 0);
+      boolean hasLocalView = (localHome != null || hasLocalBusinessView);
+      boolean hasRemoteView = (remoteHome != null || hasRemoteBusinessView);
 
       /*
        * Create and Register Proxy Factories
@@ -291,8 +293,8 @@
          // Get RemoteBindings
          List<RemoteBindingMetaData> remoteBindings = smd.getRemoteBindings();
 
-         // If there are no @RemoteBindings defined
-         if (remoteBindings == null)
+         // If there are no @RemoteBindings defined and there's a remote business (EJB3) view
+         if (remoteBindings == null && hasRemoteBusinessView)
          {
             // Use the default Client Bind URL
             String clientBindUrl = defaultClientBindUrl;
@@ -322,8 +324,13 @@
             bindingSet.addDefaultRemoteBinding(new JndiReferenceBinding(defaultRemoteJndiName, defaultRemoteRef));
 
          }
+         
+         /*
+          * If there are @RemoteBindings and a remote view 
+          */
+         
          // Remote Bindings are defined, create a binding for each
-         else
+         else if (remoteBindings != null && hasRemoteView)
          {
 
             /*
@@ -530,33 +537,34 @@
          /*
           * Bind ObjectFactory for default local businesses (and LocalHome if bound together)
           */
+         
+         if (hasLocalBusinessView)
+         {
+            // Get Classname to set for Reference
+            String defaultLocalClassName = this.getHumanReadableListOfInterfacesInRefAddrs(refAddrsForDefaultLocal);
 
-         // Get Classname to set for Reference
-         String defaultLocalClassName = this.getHumanReadableListOfInterfacesInRefAddrs(refAddrsForDefaultLocal);
+            // Create a Reference
+            Reference defaultLocalRef = createStandardReference(
+                  JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + defaultLocalClassName,
+                  localProxyFactoryKey, containerName, true);
 
-         // Create a Reference
-         Reference defaultLocalRef = createStandardReference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX
-               + defaultLocalClassName, localProxyFactoryKey, containerName, true);
+            // Add all Reference Addresses for Default Local Reference
+            for (RefAddr refAddr : refAddrsForDefaultLocal)
+            {
+               log.debug("Adding " + RefAddr.class.getSimpleName() + " to Default Local "
+                     + Reference.class.getSimpleName() + ": Type \"" + refAddr.getType() + "\", Content \""
+                     + refAddr.getContent() + "\"");
+               defaultLocalRef.add(refAddr);
+            }
 
-         // Add all Reference Addresses for Default Local Reference
-         for (RefAddr refAddr : refAddrsForDefaultLocal)
-         {
-            log.debug("Adding " + RefAddr.class.getSimpleName() + " to Default Local "
-                  + Reference.class.getSimpleName() + ": Type \"" + refAddr.getType() + "\", Content \""
-                  + refAddr.getContent() + "\"");
-            defaultLocalRef.add(refAddr);
-         }
+            // Bind the Default Local Reference to JNDI
+            String defaultLocalAddress = smd.getLocalJndiName();
+            log.debug("Default Local Business View for EJB " + smd.getEjbName() + " to be bound into JNDI at \""
+                  + defaultLocalAddress + "\"");
 
-         // Bind the Default Local Reference to JNDI
-         String defaultLocalAddress = smd.getLocalJndiName();
-         log.debug("Default Local Business View for EJB " + smd.getEjbName() + " to be bound into JNDI at \""
-               + defaultLocalAddress + "\"");
+            bindingSet.addDefaultLocalBinding(new JndiReferenceBinding(defaultLocalAddress, defaultLocalRef));
 
-         bindingSet.addDefaultLocalBinding(new JndiReferenceBinding(defaultLocalAddress, defaultLocalRef));
-
-         // Bind ObjectFactory specific to each Local Business Interface
-         if (businessLocals != null)
-         {
+            // Bind ObjectFactory specific to each Local Business Interface
             for (String businessLocal : businessLocals)
             {
                RefAddr refAddr = new StringRefAddr(




More information about the jboss-cvs-commits mailing list