[jboss-cvs] JBossAS SVN: r72306 - in trunk: server/src/main/org/jboss/ejb and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 16 13:29:24 EDT 2008


Author: adrian at jboss.org
Date: 2008-04-16 13:29:24 -0400 (Wed, 16 Apr 2008)
New Revision: 72306

Added:
   trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployerMBean.java
Modified:
   trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java
   trunk/server/src/main/org/jboss/ejb/EjbModule.java
   trunk/testsuite/src/main/org/jboss/test/isolation/test/IsolationUnitTestCase.java
Log:
Temporary fix to get the easy isolated deployment config stuff working again for an ear

Modified: trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java	2008-04-16 17:23:56 UTC (rev 72305)
+++ trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployer.java	2008-04-16 17:29:24 UTC (rev 72306)
@@ -23,12 +23,15 @@
 
 import java.util.Set;
 
+import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb.deployers.EjbDeployerMBean;
 import org.jboss.metadata.common.jboss.LoaderRepositoryConfigMetaData;
 import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
 import org.jboss.metadata.ear.jboss.JBossAppMetaData;
@@ -46,7 +49,8 @@
  * @author adrian at jboss.org
  * @version $Revision$
  */
-public class JBossAppParsingDeployer extends SchemaResolverDeployer<JBossAppMetaData>
+ at JMX(name="jboss.j2ee:service=EARDeployer", exposedInterface=JBossAppParsingDeployerMBean.class)
+public class JBossAppParsingDeployer extends SchemaResolverDeployer<JBossAppMetaData> implements JBossAppParsingDeployerMBean
 {
    private boolean isolated = false;
 
@@ -138,6 +142,7 @@
    }
 
    
+   // FIXME This should all be in a seperate deployer
    @Override
    protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
    {
@@ -152,24 +157,7 @@
       {
          metaData = new JBossAppMetaData();
       }
-      // Create a merged view
-      JBossAppMetaData mergedMetaData = new JBossAppMetaData();
-      mergedMetaData.merge(metaData, specMetaData);
-      // Set the merged as the output
-      unit.getTransientManagedObjects().addAttachment(JBossAppMetaData.class, mergedMetaData);
-      // Keep the raw parsed metadata as well
-      unit.addAttachment("Raw"+JBossAppMetaData.class.getName(), metaData, JBossAppMetaData.class);
-   }
-
-   /**
-    * Build the LoaderRepositoryConfig attachment
-    */
-   @Override
-   protected void init(VFSDeploymentUnit unit, JBossAppMetaData metaData, VirtualFile file)
-      throws Exception
-   {
-      // Add the loader repository config
-      if (metaData != null)
+      else
       {
          LoaderRepositoryMetaData lrmd = metaData.getLoaderRepository();
          LoaderRepositoryConfig loaderCfg = null;
@@ -183,7 +171,16 @@
             loaderCfg = new LoaderRepositoryConfig();
             loaderCfg.repositoryClassName = lrmd.getLoaderRepositoryClass();
             if(lrmd.getName() != null)
-               loaderCfg.repositoryName = new ObjectName(lrmd.getName());
+            {
+               try
+               {
+                  loaderCfg.repositoryName = new ObjectName(lrmd.getName());
+               }
+               catch (MalformedObjectNameException e)
+               {
+                  throw new DeploymentException("Invalid object name: " + lrmd.getName(), e);
+               }
+            }
             Set<LoaderRepositoryConfigMetaData> configs = lrmd.getLoaderRepositoryConfig();
             if (configs != null && configs.isEmpty() == false)
             {
@@ -196,8 +193,15 @@
          if (loaderCfg != null)
             unit.addAttachment(LoaderRepositoryConfig.class, loaderCfg);
       }
+      // Create a merged view
+      JBossAppMetaData mergedMetaData = new JBossAppMetaData();
+      mergedMetaData.merge(metaData, specMetaData);
+      // Set the merged as the output
+      unit.getTransientManagedObjects().addAttachment(JBossAppMetaData.class, mergedMetaData);
+      // Keep the raw parsed metadata as well
+      unit.addAttachment("Raw"+JBossAppMetaData.class.getName(), metaData, JBossAppMetaData.class);
       // Pass the ear callByValue setting
-      if (callByValue)
+      if (isCallByValue())
          unit.addAttachment("EAR.callByValue", Boolean.TRUE, Boolean.class);
       //Pass the unauthenticated identity
       if (this.unauthenticatedIdentity != null)

Added: trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployerMBean.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployerMBean.java	                        (rev 0)
+++ trunk/server/src/main/org/jboss/deployment/JBossAppParsingDeployerMBean.java	2008-04-16 17:29:24 UTC (rev 72306)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.deployment;
+
+/**
+ * JBossAppParsingDeployerMBean.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JBossAppParsingDeployerMBean
+{
+   boolean isIsolated();
+   void setIsolated(boolean isolated);
+
+   boolean isCallByValue();
+   void setCallByValue(boolean callByValue);
+}

Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java	2008-04-16 17:23:56 UTC (rev 72305)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java	2008-04-16 17:29:24 UTC (rev 72306)
@@ -175,12 +175,17 @@
       }
       this.name = name;
 
+      // FIXME all this deployment unit access should be replaced with deployers processing updating the metadata
       //Ask the ejb deployer whether we are call by value
       Boolean flag = unit.getAttachment("EJB.callByValue", Boolean.class);
-      if (flag == null)
+      DeploymentUnit temp = unit;
+      while (flag == null && temp != null)
       {
          //Ask the ear deployer whether we are call by value
-         flag = unit.getAttachment("EAR.callByValue", Boolean.class);
+         flag = temp.getAttachment("EAR.callByValue", Boolean.class);
+         if (flag != null)
+            break;
+         temp = temp.getParent();
       }
       if (flag != null )
             callByValue = flag.booleanValue();

Modified: trunk/testsuite/src/main/org/jboss/test/isolation/test/IsolationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/isolation/test/IsolationUnitTestCase.java	2008-04-16 17:23:56 UTC (rev 72305)
+++ trunk/testsuite/src/main/org/jboss/test/isolation/test/IsolationUnitTestCase.java	2008-04-16 17:29:24 UTC (rev 72306)
@@ -23,6 +23,7 @@
 
 import javax.management.Attribute;
 import javax.management.AttributeList;
+import javax.management.ObjectName;
 
 import org.jboss.deployment.EARDeployerMBean;
 import org.jboss.test.JBossTestCase;
@@ -90,16 +91,10 @@
       session.invokeSessionB();
    }
    
-   /**
-    * TODO: Either need to expose jmx interface for the JBossAppParsingDeployer
-    * or add ability to set bean properties.
-    * 
-    * @param value
-    * @throws Exception
-    */
    private void isolateDeployments(Boolean value) throws Exception
    {
-      //getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("Isolated", value));
-      //getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("CallByValue", value));
+      ObjectName name = new ObjectName("jboss.j2ee:service=EARDeployer");
+      getServer().setAttribute(name, new Attribute("Isolated", value));
+      getServer().setAttribute(name, new Attribute("CallByValue", value));
    }
 }




More information about the jboss-cvs-commits mailing list