[jboss-cvs] JBossAS SVN: r61479 - in trunk/server/src: main/org/jboss/deployment and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 19 22:28:13 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-03-19 22:28:13 -0400 (Mon, 19 Mar 2007)
New Revision: 61479

Modified:
   trunk/server/src/etc/deployers/ear-deployer-beans.xml
   trunk/server/src/etc/deployers/ejb-deployer-beans.xml
   trunk/server/src/main/org/jboss/deployment/EARDeployment.java
   trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java
   trunk/server/src/main/org/jboss/ejb/EjbModule.java
   trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
Log:
JBAS-4214, port the legacy EARDeployer/EJBDeployer isolation and call by value flags

Modified: trunk/server/src/etc/deployers/ear-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/ear-deployer-beans.xml	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/etc/deployers/ear-deployer-beans.xml	2007-03-20 02:28:13 UTC (rev 61479)
@@ -42,6 +42,14 @@
             <this/>
          </parameter>
       </uninstall>
-      <property name="type">ear</property>      
-   </bean> 
+      <property name="type">ear</property>
+      <!-- A flag indicating if ear deployments should have their own scoped
+         class loader to isolate their classes from other deployments.
+      -->      
+      <property name="isolated">false</property>
+      <!-- A flag indicating if the ear components should have in VM call
+         optimization disabled.
+      -->
+      <property name="callByValue">false</property>      
+   </bean>
 </deployment>

Modified: trunk/server/src/etc/deployers/ejb-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/ejb-deployer-beans.xml	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/etc/deployers/ejb-deployer-beans.xml	2007-03-20 02:28:13 UTC (rev 61479)
@@ -46,6 +46,11 @@
        <property name="cachedConnectionManagerName">jboss.jca:service=CachedConnectionManager</property>
        <!-- The ejb timer service -->
        <property name="timerServiceName">jboss.ejb:service=EJBTimerService</property>
+       <!-- A flag indicating if the ejb components should have in VM call
+          optimization disabled.
+       -->
+       <property name="callByValue">false</property> 
+       
        <depends>SecurityDeployer</depends>
     </bean>
 </deployment>

Modified: trunk/server/src/main/org/jboss/deployment/EARDeployment.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/EARDeployment.java	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/main/org/jboss/deployment/EARDeployment.java	2007-03-20 02:28:13 UTC (rev 61479)
@@ -25,6 +25,7 @@
 
 import javax.management.ObjectName;
 
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
 import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.system.ServiceMBeanSupport;
 
@@ -64,7 +65,14 @@
          name = BASE_EAR_DEPLOYMENT_NAME + ",url='" + di.shortName + "'";
       return name;
    }
-   
+   public static String getJMXName(J2eeApplicationMetaData metaData, DeploymentUnit unit)
+   {
+      String name = metaData.getJMXName();
+      if( name == null )
+         name = BASE_EAR_DEPLOYMENT_NAME + ",url='" + unit.getSimpleName() + "'";
+      return name;
+   }
+
    // Constructors --------------------------------------------------
 
    public EARDeployment(final DeploymentInfo di)

Modified: trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java	2007-03-20 02:28:13 UTC (rev 61479)
@@ -21,26 +21,35 @@
  */
 package org.jboss.deployment;
 
+import javax.management.ObjectName;
+
 import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.mx.loading.LoaderRepositoryFactory;
 import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
 import org.jboss.xb.binding.ObjectModelFactory;
+import org.w3c.dom.Element;
 
 /**
  * An ObjectModelFactoryDeployer for translating jboss-app.xml descriptors into
  * J2eeApplicationMetaData instances.
  * 
  * @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
  */
 public class JBossAppParsingDeployer extends ObjectModelFactoryDeployer<J2eeApplicationMetaData>
 {
    /** The name of the application descriptor in the deployment context metadata path */
    private String appXmlPath = "jboss-app.xml";
 
+   private boolean isolated = false;
+
+   private boolean callByValue = false;
+
    /**
-    * Set the relative order to PARSER_DEPLOYER+1 by default
+    * Set the relative order to PARSER_DEPLOYER+1 by default so
+    * that this runs after the application.xml parser.
     *
     */   
    public JBossAppParsingDeployer()
@@ -72,6 +81,38 @@
    }
 
    /**
+    * @return whether ear deployments should be isolated
+    */
+   public boolean isIsolated()
+   {
+      return isolated;
+   }
+   
+   /**
+    * @param isolated whether ear deployments should be isolated
+    */
+   public void setIsolated(boolean isolated)
+   {
+      this.isolated = isolated;
+   }
+   
+   /**
+    * @return whether ear deployments should be call by value
+    */
+   public boolean isCallByValue()
+   {
+      return callByValue;
+   }
+   
+   /**
+    * @param callByValue whether ear deployments should be call by value
+    */
+   public void setCallByValue(boolean callByValue)
+   {
+      this.callByValue = callByValue;
+   }
+
+   /**
     * Overriden to indicate we expect to run the parse even if an existing
     * J2eeApplicationMetaData attachment is found.
     * @return true.
@@ -103,10 +144,43 @@
       
       // Add the loader repository config
       J2eeApplicationMetaData earMetaData = unit.getAttachment(J2eeApplicationMetaData.class);
-      if (earMetaData != null && earMetaData.getLoaderCfg() != null)
+      if (earMetaData != null)
       {
          LoaderRepositoryConfig loaderCfg = earMetaData.getLoaderCfg();
-         unit.addAttachment(LoaderRepositoryConfig.class, loaderCfg);
+         if (loaderCfg == null && isolated)
+         {
+            // If no config was given and isolation is on, create an isolated config
+            loaderCfg = initLoaderRepository(earMetaData, unit);
+         }
+         if (loaderCfg != null)
+            unit.addAttachment(LoaderRepositoryConfig.class, loaderCfg);
       }
+      // Pass the ear callByValue setting
+      if (callByValue)
+         unit.addAttachment("EAR.callByValue", Boolean.TRUE, Boolean.class);
    }
+
+   /** Build the ear scoped repository
+   *
+   * @param metaData the deployment info passed to deploy
+   * @return LoaderRepositoryConfig to use
+   * @throws Exception
+   */
+  protected LoaderRepositoryConfig initLoaderRepository(J2eeApplicationMetaData metaData, DeploymentUnit unit)
+     throws DeploymentException
+  {
+     try
+     {
+        String name = EARDeployment.getJMXName(metaData, unit) + ",extension=LoaderRepository";
+        ObjectName objectName = new ObjectName(name);
+        LoaderRepositoryConfig config = new LoaderRepositoryFactory.LoaderRepositoryConfig();
+        config.repositoryName = objectName;
+        return config;
+     }
+     catch(Exception e)
+     {
+        throw new DeploymentException("Failed to create LoaderRepositoryConfig", e);
+     }
+  }
+
 }


Property changes on: trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-03-20 02:28:13 UTC (rev 61479)
@@ -171,7 +171,17 @@
          name = name.substring(0, name.length() - 1);
       }
       this.name = name;
-      
+
+      //Ask the ejb deployer whether we are call by value
+      Boolean flag = unit.getAttachment("EJB.callByValue", Boolean.class);
+      if (flag == null)
+      {
+         //Ask the ear deployer whether we are call by value
+         flag = unit.getAttachment("EAR.callByValue", Boolean.class);
+      }
+      if (flag != null )
+            callByValue = flag.booleanValue();
+
       // Add the ApplicationMetaData for the jbossws ejb21 deployer to pickup later
       if (unit.getAttachment(ApplicationMetaData.class) == null)
          unit.addAttachment(ApplicationMetaData.class, metaData);
@@ -350,28 +360,6 @@
 
       log.debug("createService, begin");
 
-      //Ask the ejb deployer whether we are call by value
-      try
-      {
-         if (((Boolean) server.getAttribute(EJBDeployerMBean.OBJECT_NAME, "CallByValue")).booleanValue())
-            callByValue = true;         
-      }
-      catch (Exception ignored)
-      {
-         log.debug("Unable to ask the EJBDeployer whether we are call by value", ignored);
-      }
-
-      //Ask the ear deployer whether we are call by value
-      try
-      {
-         if (callByValue == false && ((Boolean) server.getAttribute(EARDeployerMBean.OBJECT_NAME, "CallByValue")).booleanValue())
-            callByValue = true;         
-      }
-      catch (Exception ignored)
-      {
-         log.debug("Unable to ask the EARDeployer whether we are call by value", ignored);
-      }
-      
       //Set up the beans in this module.
       try
       {

Modified: trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-03-20 01:50:00 UTC (rev 61478)
+++ trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-03-20 02:28:13 UTC (rev 61479)
@@ -44,7 +44,7 @@
  * the ejb module service mbeans.
  * 
  * @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
  */
 public class EjbDeployer extends AbstractSimpleRealDeployer<ApplicationMetaData>
 {
@@ -55,7 +55,9 @@
    /** The CachedConnectionManager service used by the CachedConnectionInterceptor */
    private String ccmServiceName;
    /** The ejb timer service */
-   private String timerServiceName; 
+   private String timerServiceName;
+   
+   private boolean callByValue;
 
    public EjbDeployer()
    {
@@ -103,6 +105,17 @@
       this.timerServiceName = timerServiceName;
    }
 
+
+   public boolean isCallByValue()
+   {
+      return callByValue;
+   }
+
+   public void setCallByValue(boolean callByValue)
+   {
+      this.callByValue = callByValue;
+   }
+
    @Override
    public void deploy(DeploymentUnit unit, ApplicationMetaData deployment)
       throws DeploymentException
@@ -185,6 +198,9 @@
       ejbModule.setDependencies(dependencies);
 
       unit.addAttachment(ServiceMetaData.class, ejbModule);
+      // Pass the ejb callByValue setting
+      if (callByValue)
+         unit.addAttachment("EJB.callByValue", Boolean.TRUE, Boolean.class);
    }
 
    @Override


Property changes on: trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision




More information about the jboss-cvs-commits mailing list