[jboss-cvs] JBossAS SVN: r65049 - in trunk/ejb3/src/main/org/jboss: ejb3/mdb and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 4 11:41:36 EDT 2007


Author: wolfc
Date: 2007-09-04 11:41:36 -0400 (Tue, 04 Sep 2007)
New Revision: 65049

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
   trunk/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
   trunk/ejb3/src/main/org/jboss/ejb3/session/ProxyDeployer.java
   trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
   trunk/ejb3/src/main/org/jboss/injection/AbstractHandler.java
Log:
EJBTHREE-1042: initialize proxy deployer and class container early in the game

Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -432,7 +432,7 @@
    public void processMetadata()
    {
       // XML must be done first so that any annotation overrides are initialized
-
+      
       // todo injection handlers should be pluggable from XML
       Collection<InjectionHandler> handlers = new ArrayList<InjectionHandler>();
       handlers.add(new EJBHandler());
@@ -497,9 +497,6 @@
          // EJBTHREE-1025
          this.checkForDuplicateLocalAndRemoteInterfaces();
          
-         // once the metadata is setup we can resolve the business interfaces
-         this.businessInterfaces = resolveBusinessInterfaces();
-         
          for(Class<?> businessInterface : getBusinessInterfaces())
             ((JBoss5DependencyPolicy) getDependencyPolicy()).addSupply(businessInterface);
          
@@ -723,7 +720,6 @@
 
    public void create() throws Exception
    {
-      // EJBTHREE-655: we need an instance after create
       initializeClassContainer();
       for (int i = 0; i < constructors.length; i++)
       {
@@ -1243,6 +1239,20 @@
       return deployment;
    }
    
+   public abstract boolean hasJNDIBinding(String jndiName);
+   
+   /**
+    * After XML processing has been done this allows the container
+    * to further initialize the meta data.
+    */
+   public void instantiated()
+   {
+      this.businessInterfaces = resolveBusinessInterfaces();
+      
+      // Before we start to process annotations, make sure we also have the ones from interceptors-aop.
+      initializeClassContainer();
+   }
+   
    public String toString()
    {
       return getObjectName().getCanonicalName();

Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -482,7 +482,7 @@
             // EJBContainer has finished with all metadata initialization from XML files and such.
             // this is really a hook to do some processing after XML has been set up and before
             // and processing of dependencies and such.
-//            ((EJBContainer)con).instantiated();
+            ((EJBContainer)con).instantiated();
             this.ejbContainers.put(con.getObjectName(), con);
             Ejb3Registry.register(con);
          }
@@ -509,7 +509,7 @@
             // EJBContainer has finished with all metadata initialization from XML files and such.
             // this is really a hook to do some processing after XML has been set up and before
             // and processing of dependencies and such.
-//            ((EJBContainer)con).instantiated();
+            ((EJBContainer)con).instantiated();
             this.ejbContainers.put(con.getObjectName(), con);
             Ejb3Registry.register(con);
          }

Modified: trunk/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/ejb3/mdb/MessagingContainer.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -638,4 +638,14 @@
 
       return destType;
    }
+   
+   /**
+    * A messaging container is bound to a message destination and
+    * thus has no JNDI binding of it's own.
+    */
+   @Override
+   public boolean hasJNDIBinding(String jndiName)
+   {
+      return false;
+   }
 }
\ No newline at end of file

Modified: trunk/ejb3/src/main/org/jboss/ejb3/session/ProxyDeployer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/session/ProxyDeployer.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/ejb3/session/ProxyDeployer.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -25,27 +25,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.annotation.ejb.Clustered;
 import org.jboss.annotation.ejb.LocalBinding;
 import org.jboss.annotation.ejb.LocalBindingImpl;
 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.Advisor;
 import org.jboss.ejb3.ProxyFactory;
 import org.jboss.ejb3.ProxyFactoryHelper;
 import org.jboss.ejb3.remoting.RemoteProxyFactory;
-import org.jboss.ejb3.service.ServiceContainer;
-import org.jboss.ejb3.service.ServiceLocalProxyFactory;
-import org.jboss.ejb3.service.ServiceRemoteProxyFactory;
-import org.jboss.ejb3.stateful.StatefulClusterProxyFactory;
-import org.jboss.ejb3.stateful.StatefulContainer;
-import org.jboss.ejb3.stateful.StatefulLocalProxyFactory;
-import org.jboss.ejb3.stateful.StatefulRemoteProxyFactory;
-import org.jboss.ejb3.stateless.StatelessClusterProxyFactory;
-import org.jboss.ejb3.stateless.StatelessLocalProxyFactory;
-import org.jboss.ejb3.stateless.StatelessRemoteProxyFactory;
 import org.jboss.logging.Logger;
 
 /**
@@ -104,6 +92,28 @@
       }
    }
 
+   protected boolean hasJNDIBinding(String jndiName)
+   {
+      assert jndiName != null : "jndiName is null";
+      
+      if(localBinding != null)
+      {
+         if(localBinding.jndiBinding().equals(jndiName))
+            return true;
+      }
+      
+      if(remoteBindings != null)
+      {
+         for(RemoteBinding binding : remoteBindings.value())
+         {
+            if(binding.jndiBinding().equals(jndiName))
+               return true;
+         }
+      }
+      
+      return false;
+   }
+   
    public void initializeLocalBindingMetadata()
    {
       localBinding = (LocalBinding) container.resolveAnnotation(LocalBinding.class);
@@ -116,7 +126,6 @@
          }
       }
    }
-
    
    private RemoteBinding initializeRemoteBinding(RemoteBinding binding)
    {

Modified: trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/ejb3/session/SessionContainer.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -184,11 +184,11 @@
    }
 
    @Override
-   public void processMetadata()
+   public void instantiated()
    {
-      super.processMetadata();
-      //proxyDeployer.initializeRemoteBindingMetadata();
-      //proxyDeployer.initializeLocalBindingMetadata();
+      super.instantiated();
+      proxyDeployer.initializeRemoteBindingMetadata();
+      proxyDeployer.initializeLocalBindingMetadata();
    }
 
    protected List<Class<?>> resolveBusinessInterfaces()
@@ -199,15 +199,6 @@
       return list;
    }
    
-   public void create() throws Exception
-   {
-      super.create();
-      
-      // moved from processMetadata so AspectDomain is processed before proxy metadata
-      proxyDeployer.initializeRemoteBindingMetadata();
-      proxyDeployer.initializeLocalBindingMetadata();
-   }
-   
    public void start() throws Exception
    {
       super.start();
@@ -464,6 +455,15 @@
       throw new RuntimeException("NYI");
    }
    
+   /**
+    * Checks if this session bean binds to the given JNDI name.
+    */
+   @Override
+   public boolean hasJNDIBinding(String jndiName)
+   {
+      return proxyDeployer.hasJNDIBinding(jndiName);
+   }
+   
    protected Object invokeEJBObjectMethod(ProxyFactory factory, Object id, MethodInfo info, Object args[]) throws Exception
    {
       Method unadvisedMethod = info.getUnadvisedMethod();

Modified: trunk/ejb3/src/main/org/jboss/injection/AbstractHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/injection/AbstractHandler.java	2007-09-04 15:35:32 UTC (rev 65048)
+++ trunk/ejb3/src/main/org/jboss/injection/AbstractHandler.java	2007-09-04 15:41:36 UTC (rev 65049)
@@ -72,6 +72,10 @@
    
    protected void addJNDIDependency(InjectionContainer container, String jndiName)
    {
+      // Do not depend on myself
+      if(((EJBContainer) container).hasJNDIBinding(jndiName))
+         return;
+      
       ((JBoss5DependencyPolicy) container.getDependencyPolicy()).addJNDIName(jndiName);
    }
 }




More information about the jboss-cvs-commits mailing list