[jboss-cvs] JBossAS SVN: r102376 - in projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3: session and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Mar 13 11:17:07 EST 2010


Author: jaikiran
Date: 2010-03-13 11:17:06 -0500 (Sat, 13 Mar 2010)
New Revision: 102376

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
Log:
EJBTHREE-2010 Allow for EJBContainer to be created without mandating a EJB3Deployment

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-03-13 08:30:16 UTC (rev 102375)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContainer.java	2010-03-13 16:17:06 UTC (rev 102376)
@@ -248,7 +248,75 @@
       
       this.dependencyPolicy = deployment.createDependencyPolicy(this);
    }
+   
+   /**
+    * Create an EJBContainer
+    * 
+    * @param name                  Name for the EJB container
+    * @param manager               Domain to get interceptor bindings from
+    * @param cl                    the EJB's classloader
+    * @param beanClassName  Fully qualified name of the ejb class
+    * @param ejbName    The name of the EJB to which this container corresponds
+    * @param ctxProperties  Context properties for this bean
+    * @param beanMetaData           the meta data for this bean or null
+    */
 
+   public EJBContainer(String name, Domain domain, ClassLoader cl,
+                       String beanClassName, String ejbName, Hashtable ctxProperties,
+                       JBossEnterpriseBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      assert name != null : "name is null";
+      
+      this.name = name;
+      this.beanClassName = beanClassName;
+      this.classloader = cl;
+      this.xml = beanMetaData;
+         
+      this.beanClass = classloader.loadClass(beanClassName);
+      
+      // We can't type cast the direct container, because we just loaded the beanClass
+      // so assuming we have an object is a safe bet.
+      this.beanContainer = new BeanContainer(this);
+      
+      this.ejbName = ejbName;
+      
+      String on = createObjectName(ejbName);     
+      try
+      {
+         objectName = new ObjectName(on);
+      }
+      catch (MalformedObjectNameException e)
+      {
+         throw new RuntimeException("failed to create object name for: " + on, e);
+      }
+      
+      // Because interceptors will query back the EJBContainer for annotations
+      // we must have set beanContainer first and then do the advisor. 
+      try
+      {
+         beanContainer.initialize(ejbName, domain, beanClass, beanMetaData, cl);
+      }
+      catch(Exception e)
+      {
+         throw new RuntimeException("failed to initialize bean container ",e);
+      }
+      
+      //annotations = new AnnotationRepositoryToMetaData(this);
+      
+      initialContextProperties = ctxProperties;
+      try
+      {
+         Util.createSubcontext(getEnc(), "env");
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+      bindORB();
+      bindEJBContext();
+      
+   }
+
    private void bindEJBContext()
    {
       try 

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2010-03-13 08:30:16 UTC (rev 102375)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2010-03-13 16:17:06 UTC (rev 102376)
@@ -121,6 +121,13 @@
       super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, deployment, beanMetaData);
       proxyDeployer = new ProxyDeployer(this);
    }
+   
+   public SessionContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+         Hashtable ctxProperties, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(Ejb3Module.BASE_EJB3_JMX_NAME + ",name=" + ejbName, domain, cl, beanClassName, ejbName, ctxProperties, beanMetaData);
+      proxyDeployer = new ProxyDeployer(this);
+   }
 
    protected SessionProxyFactory getProxyFactory(LocalBinding binding)
    {

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2010-03-13 08:30:16 UTC (rev 102375)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2010-03-13 16:17:06 UTC (rev 102376)
@@ -71,6 +71,12 @@
       super(cl, beanClassName, ejbName, domain, ctxProperties, deployment, beanMetaData);
    }
    
+   public SessionSpecContainer(ClassLoader cl, String beanClassName, String ejbName, Domain domain,
+         Hashtable ctxProperties, JBossSessionBeanMetaData beanMetaData) throws ClassNotFoundException
+   {
+      super(cl, beanClassName, ejbName, domain, ctxProperties, beanMetaData);
+   }
+   
    /**
     * Invokes the specified method upon the specified session, passing the specified
     * arguments.




More information about the jboss-cvs-commits mailing list