[jboss-cvs] JBossAS SVN: r79357 - 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
Fri Oct 10 20:32:10 EDT 2008


Author: ALRubinger
Date: 2008-10-10 20:32:10 -0400 (Fri, 10 Oct 2008)
New Revision: 79357

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
Log:
[EJBTHREE-1525] Default @RemoteBinding.jndiBinding, if not present, to JBossSessionBeanMetaData.getJndiName()

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-11 00:31:15 UTC (rev 79356)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-10-11 00:32:10 UTC (rev 79357)
@@ -335,89 +335,91 @@
                // Get the defined JNDI Name
                String remoteBindingJndiName = binding.getJndiName();
 
-               // If the JNDI Name is defined
-               if (remoteBindingJndiName != null && remoteBindingJndiName.trim().length() > 0)
+               // If the JNDI Name isn't defined
+               if (remoteBindingJndiName == null || remoteBindingJndiName.trim().length() == 0)
                {
-                  // Get the client bind URL
-                  String clientBindUrl = defaultClientBindUrl;
-                  String remoteBindingClientBindUrl = binding.getClientBindUrl();
-                  if (remoteBindingClientBindUrl != null && remoteBindingClientBindUrl.trim().length() > 0)
-                  {
-                     clientBindUrl = remoteBindingClientBindUrl;
-                  }
+                  // Set a default remote binding JNDI name
+                  remoteBindingJndiName = smd.getJndiName();
+               }
 
-                  // Get the interceptor stack
-                  String interceptorStack = binding.getInterceptorStack();
+               // Get the client bind URL
+               String clientBindUrl = defaultClientBindUrl;
+               String remoteBindingClientBindUrl = binding.getClientBindUrl();
+               if (remoteBindingClientBindUrl != null && remoteBindingClientBindUrl.trim().length() > 0)
+               {
+                  clientBindUrl = remoteBindingClientBindUrl;
+               }
 
-                  /*
-                   * Obtain a Proxy Factory for this Binding
-                   */
+               // Get the interceptor stack
+               String interceptorStack = binding.getInterceptorStack();
 
-                  // Create and register a remote proxy factory specific to this binding
-                  String remoteBindingProxyFactoryKey = this.getProxyFactoryRegistryKey(remoteBindingJndiName, smd,
-                        false);
-                  SessionProxyFactory remoteBindingProxyFactory = null;
-                  boolean reregister = true;
-                  try
-                  {
-                     // Check if it's already available
-                     remoteBindingProxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(
-                           remoteBindingProxyFactoryKey, SessionProxyFactory.class);
-                  }
-                  catch (NotBoundException nbe)
-                  {
-                     reregister = false;
-                  }
+               /*
+                * Obtain a Proxy Factory for this Binding
+                */
 
-                  // If we need to reregister with this newly-defined Proxy Factory
-                  if (reregister)
-                  {
-                     Ejb3RegistrarLocator.locateRegistrar().unbind(remoteBindingProxyFactoryKey);
-                  }
+               // Create and register a remote proxy factory specific to this binding
+               String remoteBindingProxyFactoryKey = this.getProxyFactoryRegistryKey(remoteBindingJndiName, smd, false);
+               SessionProxyFactory remoteBindingProxyFactory = null;
+               boolean reregister = true;
+               try
+               {
+                  // Check if it's already available
+                  remoteBindingProxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(
+                        remoteBindingProxyFactoryKey, SessionProxyFactory.class);
+               }
+               catch (NotBoundException nbe)
+               {
+                  reregister = false;
+               }
 
-                  // Create the Proxy Factory
-                  remoteBindingProxyFactory = this.createRemoteProxyFactory(remoteBindingProxyFactoryKey,
-                        containerName, containerGuid, smd, cl, clientBindUrl, advisor, interceptorStack);
-                  try
-                  {
-                     this.registerProxyFactory(remoteBindingProxyFactoryKey, remoteBindingProxyFactory, smd);
-                  }
-                  catch (DuplicateBindException dbe)
-                  {
-                     throw new RuntimeException(dbe);
-                  }
+               // If we need to reregister with this newly-defined Proxy Factory
+               if (reregister)
+               {
+                  Ejb3RegistrarLocator.locateRegistrar().unbind(remoteBindingProxyFactoryKey);
+               }
 
-                  // Create a default remote remoting RefAddr, using the default (as none was explicitly-specified)
-                  RefAddr remoteBindingRemotingRefAddr = this.createRemotingRefAddr(clientBindUrl);
+               // Create the Proxy Factory
+               remoteBindingProxyFactory = this.createRemoteProxyFactory(remoteBindingProxyFactoryKey, containerName,
+                     containerGuid, smd, cl, clientBindUrl, advisor, interceptorStack);
+               try
+               {
+                  this.registerProxyFactory(remoteBindingProxyFactoryKey, remoteBindingProxyFactory, smd);
+               }
+               catch (DuplicateBindException dbe)
+               {
+                  throw new RuntimeException(dbe);
+               }
 
-                  // Create a Reference
-                  Reference remoteBindingRef = createStandardReference(
-                        JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + defaultRemoteClassName,
-                        remoteBindingProxyFactoryKey, containerName, false);
+               // Create a default remote remoting RefAddr, using the default (as none was explicitly-specified)
+               RefAddr remoteBindingRemotingRefAddr = this.createRemotingRefAddr(clientBindUrl);
 
-                  // Add a Reference Address for the Remoting URL
+               // Create a Reference
+               Reference remoteBindingRef = createStandardReference(
+                     JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + defaultRemoteClassName,
+                     remoteBindingProxyFactoryKey, containerName, false);
+
+               // Add a Reference Address for the Remoting URL
+               log.debug("Adding " + RefAddr.class.getSimpleName() + " to @RemoteBinding "
+                     + Reference.class.getSimpleName() + ": Type \"" + remoteBindingRemotingRefAddr.getType()
+                     + "\", Content \"" + remoteBindingRemotingRefAddr.getContent() + "\"");
+               remoteBindingRef.add(remoteBindingRemotingRefAddr);
+
+               // Add all Reference Addresses for @RemoteBinding Reference
+               for (RefAddr refAddr : refAddrsForRemote)
+               {
                   log.debug("Adding " + RefAddr.class.getSimpleName() + " to @RemoteBinding "
-                        + Reference.class.getSimpleName() + ": Type \"" + remoteBindingRemotingRefAddr.getType()
-                        + "\", Content \"" + remoteBindingRemotingRefAddr.getContent() + "\"");
-                  remoteBindingRef.add(remoteBindingRemotingRefAddr);
+                        + Reference.class.getSimpleName() + ": Type \"" + refAddr.getType() + "\", Content \""
+                        + refAddr.getContent() + "\"");
+                  remoteBindingRef.add(refAddr);
+               }
 
-                  // Add all Reference Addresses for @RemoteBinding Reference
-                  for (RefAddr refAddr : refAddrsForRemote)
-                  {
-                     log.debug("Adding " + RefAddr.class.getSimpleName() + " to @RemoteBinding "
-                           + Reference.class.getSimpleName() + ": Type \"" + refAddr.getType() + "\", Content \""
-                           + refAddr.getContent() + "\"");
-                     remoteBindingRef.add(refAddr);
-                  }
+               // Create the binding
+               JndiReferenceBinding remoteBindingJndiBinding = new JndiReferenceBinding(remoteBindingJndiName,
+                     remoteBindingRef);
 
-                  // Create the binding
-                  JndiReferenceBinding remoteBindingJndiBinding = new JndiReferenceBinding(remoteBindingJndiName,
-                        remoteBindingRef);
+               // Add the binding
+               bindingSet.addDefaultRemoteBinding(remoteBindingJndiBinding);
 
-                  // Add the binding
-                  bindingSet.addDefaultRemoteBinding(remoteBindingJndiBinding);
-
-               }
             }
          }
 




More information about the jboss-cvs-commits mailing list