[jboss-cvs] JBossAS SVN: r75475 - in projects/ejb3/dev/proxy-int/proxy: src/main/java/org/jboss/ejb3/proxy/factory/session and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 8 01:58:47 EDT 2008


Author: ALRubinger
Date: 2008-07-08 01:58:47 -0400 (Tue, 08 Jul 2008)
New Revision: 75475

Modified:
   projects/ejb3/dev/proxy-int/proxy/pom.xml
   projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
   projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
   projects/ejb3/dev/proxy-int/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java
Log:
[JBMETA-68][EJBTHREE-1345] Refactor EJB3 Proxy to use non-deprecated methods for jboss-metadata

Modified: projects/ejb3/dev/proxy-int/proxy/pom.xml
===================================================================
--- projects/ejb3/dev/proxy-int/proxy/pom.xml	2008-07-08 05:57:22 UTC (rev 75474)
+++ projects/ejb3/dev/proxy-int/proxy/pom.xml	2008-07-08 05:58:47 UTC (rev 75475)
@@ -107,7 +107,7 @@
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-common</artifactId>
-      <version>0.1.1</version>
+      <version>0.1.3-SNAPSHOT</version>
     </dependency>
 
     <dependency>

Modified: projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java	2008-07-08 05:57:22 UTC (rev 75474)
+++ projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java	2008-07-08 05:58:47 UTC (rev 75475)
@@ -366,7 +366,7 @@
       }
 
       // If there's a home defined and its bound to the same binding as the default
-      if (hasHomeInterface && this.getMetadata().determineJndiName().equals(this.getMetadata().getHomeJndiName()))
+      if (hasHomeInterface && this.getMetadata().getJndiName().equals(this.getMetadata().getHomeJndiName()))
       {
          defaultProxyInterfaces.add(homeInterfaceClass);
       }

Modified: projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
===================================================================
--- projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-07-08 05:57:22 UTC (rev 75474)
+++ projects/ejb3/dev/proxy-int/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-07-08 05:58:47 UTC (rev 75475)
@@ -42,6 +42,7 @@
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.jboss.RemoteBindingMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
 import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
 import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
 import org.jboss.naming.Util;
@@ -263,7 +264,7 @@
          }
 
          // Bind the Default Remote Reference to JNDI
-         String defaultRemoteAddress = smd.determineJndiName();
+         String defaultRemoteAddress = smd.getJndiName();
          log.debug("Default Remote Business View for EJB " + smd.getEjbName() + " to be bound into JNDI at \""
                + defaultRemoteAddress + "\"");
          this.bind(context, defaultRemoteRef, defaultRemoteAddress, remoteProxyFactoryKey, containerName);
@@ -280,7 +281,7 @@
                      this.getSessionProxyObjectFactoryType(), null);
                ref.add(refAddrBusinessInterface);
                ref.add(refAddrRemoting);
-               String address = smd.determineResolvedJndiName(businessRemote);
+               String address = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessRemote);
                log.debug("Remote Business View for " + businessRemote + " of EJB " + smd.getEjbName()
                      + " to be bound into JNDI at \"" + address + "\"");
                this.bind(context, ref, address, remoteProxyFactoryKey, containerName);
@@ -354,7 +355,7 @@
          }
 
          // Bind the Default Local Reference to JNDI
-         String defaultLocalAddress = smd.determineLocalJndiName();
+         String defaultLocalAddress = smd.getLocalJndiName();
          log.debug("Default Local Business View for EJB " + smd.getEjbName() + " to be bound into JNDI at \""
                + defaultLocalAddress + "\"");
          this.bind(context, defaultLocalRef, defaultLocalAddress, localProxyFactoryKey, containerName);
@@ -369,7 +370,7 @@
                Reference ref = new Reference(JndiSessionRegistrarBase.OBJECT_FACTORY_CLASSNAME_PREFIX + businessLocal,
                      this.getSessionProxyObjectFactoryType(), null);
                ref.add(refAddr);
-               String address = smd.determineResolvedJndiName(businessLocal);
+               String address = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessLocal);
                log.debug("Local Business View for " + businessLocal + " of EJB " + smd.getEjbName()
                      + " to be bound into JNDI at \"" + address + "\"");
                this.bind(context, ref, address, localProxyFactoryKey, containerName);
@@ -445,7 +446,7 @@
           */
 
          // Bind the Default Remote Reference to JNDI
-         String defaultRemoteAddress = smd.determineJndiName();
+         String defaultRemoteAddress = smd.getJndiName();
          log.debug("Default Remote Business View for EJB " + smd.getEjbName() + " to be unbound from JNDI at \""
                + defaultRemoteAddress + "\"");
          this.unbind(context, defaultRemoteAddress);
@@ -455,7 +456,7 @@
          {
             for (String businessRemote : businessRemotes)
             {
-               String address = smd.determineResolvedJndiName(businessRemote);
+               String address = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessRemote);
                log.debug("Remote Business View for " + businessRemote + " of EJB " + smd.getEjbName()
                      + " to be unbound from JNDI at \"" + address + "\"");
                this.unbind(context, address);
@@ -486,7 +487,7 @@
           */
 
          // Unbind the Default Local Reference to JNDI
-         String defaultLocalAddress = smd.determineLocalJndiName();
+         String defaultLocalAddress = smd.getLocalJndiName();
          log.debug("Default Local Business View for EJB " + smd.getEjbName() + " to be unbound from JNDI at \""
                + defaultLocalAddress + "\"");
          this.unbind(context, defaultLocalAddress);
@@ -496,7 +497,7 @@
          {
             for (String businessLocal : businessLocals)
             {
-               String address = smd.determineResolvedJndiName(businessLocal);
+               String address = JbossSessionBeanJndiNameResolver.resolveJndiName(smd, businessLocal);
                log.debug("Local Business View for " + businessLocal + " of EJB " + smd.getEjbName()
                      + " to be unbound from JNDI at \"" + address + "\"");
                this.unbind(context, address);
@@ -621,13 +622,13 @@
       if (isLocal)
       {
          // Bind together if Local Default JNDI Name == Local Home JNDI Name
-         bindTogether = smd.determineLocalJndiName().equals(smd.getLocalHomeJndiName());
+         bindTogether = smd.getLocalJndiName().equals(smd.getLocalHomeJndiName());
       }
       // If Remote
       else
       {
          // Bind together if Local Default JNDI Name == Local Home JNDI Name
-         bindTogether = smd.determineJndiName().equals(smd.getHomeJndiName());
+         bindTogether = smd.getJndiName().equals(smd.getHomeJndiName());
       }
 
       // Return
@@ -670,7 +671,7 @@
     * @param md
     * @param isLocal
     */
-   public String getProxyFactoryRegistryKey(JBossEnterpriseBeanMetaData md, boolean isLocal)
+   public String getProxyFactoryRegistryKey(JBossSessionBeanMetaData md, boolean isLocal)
    {
       // Initialize
       String suffix = null;
@@ -678,11 +679,11 @@
       // Set Suffix
       if (isLocal)
       {
-         suffix = md.determineLocalJndiName();
+         suffix = md.getLocalJndiName();
       }
       else
       {
-         suffix = md.determineJndiName();
+         suffix = md.getJndiName();
       }
 
       // Ensure suffix is specified

Modified: projects/ejb3/dev/proxy-int/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java
===================================================================
--- projects/ejb3/dev/proxy-int/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java	2008-07-08 05:57:22 UTC (rev 75474)
+++ projects/ejb3/dev/proxy-int/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JndiSessionRegistrarBaseTestCase.java	2008-07-08 05:58:47 UTC (rev 75475)
@@ -58,6 +58,7 @@
 import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemoteHome;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.jndipolicy.spi.JbossSessionBeanJndiNameResolver;
 import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
 import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
 import org.junit.After;
@@ -186,7 +187,8 @@
 
       assertNotNull("Failure - Lookup of remote home of SLSB returned null", home);
 
-      assertTrue("Failure - Remote Home of SLSB, returned from lookup, is NOT instance of " + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
+      assertTrue("Failure - Remote Home of SLSB, returned from lookup, is NOT instance of "
+            + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
 
       // lookup the bean local home to ensure its been bound to the jndi
       Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
@@ -194,7 +196,8 @@
 
       assertNotNull("Failure - Lookup of local home of SLSB, returned null", localHome);
 
-      assertTrue("Failure - Local SLSB returned from lookup is NOT instance of " + MyStatelessLocalHome.class, (localHome instanceof MyStatelessLocalHome));
+      assertTrue("Failure - Local SLSB returned from lookup is NOT instance of " + MyStatelessLocalHome.class,
+            (localHome instanceof MyStatelessLocalHome));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -230,14 +233,16 @@
 
       assertNotNull("Failure - Remote object of 3.0 SLSB is null", remote);
 
-      assertTrue("Failure - Remote object of 3.0 SLSB is NOT an instance of " + MyStatelessRemote.class, (remote instanceof MyStatelessRemote));
+      assertTrue("Failure - Remote object of 3.0 SLSB is NOT an instance of " + MyStatelessRemote.class,
+            (remote instanceof MyStatelessRemote));
 
       // lookup the local bean to ensure its been bound to the jndi
       Object local = ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
 
       assertNotNull("Failure - Local object of 3.0 SLSB is null", local);
 
-      assertTrue("Failure - Local object of 3.0 SLSB is NOT an instance of " + MyStatelessLocal.class, (local instanceof MyStatelessLocal));
+      assertTrue("Failure - Local object of 3.0 SLSB is NOT an instance of " + MyStatelessLocal.class,
+            (local instanceof MyStatelessLocal));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -275,13 +280,15 @@
 
       assertNotNull("Failure - Remote home of 3.0 SLSB is null", home);
 
-      assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessRemoteHome.class, (home instanceof MyStatelessRemoteHome));
+      assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessRemoteHome.class,
+            (home instanceof MyStatelessRemoteHome));
 
       Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
 
       assertNotNull("Failure - Local home of 3.0 SLSB is null", localHome);
 
-      assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessLocalHome.class, (localHome instanceof MyStatelessLocalHome));
+      assertTrue("Failure - Remote home of 3.0 SLSB is NOT an instance of " + MyStatelessLocalHome.class,
+            (localHome instanceof MyStatelessLocalHome));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -316,7 +323,8 @@
 
       assertNotNull("Failure - Lookup of remote bean returned null", remote);
 
-      assertTrue("Failure - Remote bean returned from lookup is NOT instance of " + MyStatelessRemote.class, (remote instanceof MyStatelessRemote));
+      assertTrue("Failure - Remote bean returned from lookup is NOT instance of " + MyStatelessRemote.class,
+            (remote instanceof MyStatelessRemote));
 
       // Now bind to the JNDI, some object
       ctx.bind("TestJndiName", "TestJndiObject");
@@ -359,7 +367,8 @@
 
       assertNotNull("Failure - Lookup of remote SFSB returned null", remote);
 
-      assertTrue("Failure - Remote SFSB returned from lookup is NOT instance of " + MyStatefulRemoteBusiness.class, (remote instanceof MyStatefulRemoteBusiness));
+      assertTrue("Failure - Remote SFSB returned from lookup is NOT instance of " + MyStatefulRemoteBusiness.class,
+            (remote instanceof MyStatefulRemoteBusiness));
 
       // lookup local
       Object local = (Object) ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
@@ -367,7 +376,8 @@
 
       assertNotNull("Failure - Lookup of local SFSB returned null", local);
 
-      assertTrue("Failure - Local SFSB returned from lookup is NOT instance of " + MyStatefulLocalBusiness.class, (local instanceof MyStatefulLocalBusiness));
+      assertTrue("Failure - Local SFSB returned from lookup is NOT instance of " + MyStatefulLocalBusiness.class,
+            (local instanceof MyStatefulLocalBusiness));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -405,14 +415,16 @@
 
       assertNotNull("Failure - Lookup of remote for SFSB returned null", remote);
 
-      assertTrue("Failure - Remote SFSB is NOT instance of " + MyStatefulRemoteBusiness.class, (remote instanceof MyStatefulRemoteBusiness));
+      assertTrue("Failure - Remote SFSB is NOT instance of " + MyStatefulRemoteBusiness.class,
+            (remote instanceof MyStatefulRemoteBusiness));
 
       // lookup the local 
       Object local = ctx.lookup(getDefaultBusinessLocalJndiName(sessionContainer));
 
       assertNotNull("Failure - Lookup of local for SFSB returned null", local);
 
-      assertTrue("Failure - Local SFSB is NOT instance of " + MyStatefulLocalBusiness.class, (local instanceof MyStatefulLocalBusiness));
+      assertTrue("Failure - Local SFSB is NOT instance of " + MyStatefulLocalBusiness.class,
+            (local instanceof MyStatefulLocalBusiness));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -447,14 +459,16 @@
 
       assertNotNull("Failure - Lookup of remote home for SFSB returned null", home);
 
-      assertTrue("Failure - Remote home lookup of SFSB is NOT instance of " + MyStatefulRemoteHome.class, (home instanceof MyStatefulRemoteHome));
+      assertTrue("Failure - Remote home lookup of SFSB is NOT instance of " + MyStatefulRemoteHome.class,
+            (home instanceof MyStatefulRemoteHome));
 
       // lookup the local home
       Object localHome = ctx.lookup(getLocalHomeJndiName(sessionContainer));
 
       assertNotNull("Failure - Lookup of local home for SFSB returned null", localHome);
 
-      assertTrue("Failure - Local home lookup of SFSB is NOT instance of " + MyStatefulLocalHome.class, (localHome instanceof MyStatefulLocalHome));
+      assertTrue("Failure - Local home lookup of SFSB is NOT instance of " + MyStatefulLocalHome.class,
+            (localHome instanceof MyStatefulLocalHome));
 
       unbindAndTest(ctx, sessionContainer);
 
@@ -471,7 +485,7 @@
    private String getDefaultBusinessRemoteJndiName(SessionContainer sessionContainer)
    {
       JBossSessionBeanMetaData metadata = sessionContainer.getMetaData();
-      return metadata.determineJndiName();
+      return metadata.getJndiName();
    }
 
    /**
@@ -483,7 +497,7 @@
    private String getDefaultBusinessLocalJndiName(SessionContainer sessionContainer)
    {
       JBossSessionBeanMetaData metadata = sessionContainer.getMetaData();
-      return metadata.determineLocalJndiName();
+      return metadata.getLocalJndiName();
    }
 
    /**
@@ -529,9 +543,9 @@
       Set<String> jndiNames = new HashSet<String>();
 
       // default business remote jndi name 
-      jndiNames.add(metadata.determineJndiName());
+      jndiNames.add(metadata.getJndiName());
       // default business local jndi name
-      jndiNames.add(metadata.determineLocalJndiName());
+      jndiNames.add(metadata.getLocalJndiName());
       // local home jndi name  
       jndiNames.add(metadata.getLocalHomeJndiName());
       // remote home jndi name
@@ -543,7 +557,8 @@
       {
          for (String businessRemoteInterfaceName : businessRemotesMetadata)
          {
-            jndiNames.add(metadata.determineResolvedJndiName(businessRemoteInterfaceName));
+            String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessRemoteInterfaceName);
+            jndiNames.add(jndiName);
          }
       }
 
@@ -553,11 +568,13 @@
       {
          for (String businessLocalInterfaceName : businessLocalsMetadata)
          {
-            jndiNames.add(metadata.determineResolvedJndiName(businessLocalInterfaceName));
+            String jndiName = JbossSessionBeanJndiNameResolver.resolveJndiName(metadata, businessLocalInterfaceName);
+            jndiNames.add(jndiName);
          }
       }
 
-      logger.debug("Number of jndi names associated with session container " + sessionContainer.getName() + " = " + jndiNames.size());
+      logger.debug("Number of jndi names associated with session container " + sessionContainer.getName() + " = "
+            + jndiNames.size());
 
       return jndiNames;
 




More information about the jboss-cvs-commits mailing list