[jboss-cvs] JBossAS SVN: r58056 - in trunk/deployment: . src/etc src/main/org/jboss/deployment/services

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 3 01:12:08 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-03 01:12:00 -0500 (Fri, 03 Nov 2006)
New Revision: 58056

Modified:
   trunk/deployment/.classpath
   trunk/deployment/build.xml
   trunk/deployment/src/etc/jsr88-service.xml
   trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
   trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java
Log:
Update to use the VDF deployers.

Modified: trunk/deployment/.classpath
===================================================================
--- trunk/deployment/.classpath	2006-11-03 05:33:57 UTC (rev 58055)
+++ trunk/deployment/.classpath	2006-11-03 06:12:00 UTC (rev 58056)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src/main"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
@@ -11,5 +11,6 @@
 	<classpathentry combineaccessrules="false" kind="src" path="/j2se"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/system"/>
 	<classpathentry kind="lib" path="/thirdparty/dom4j/lib/dom4j.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar" sourcepath="/aspects/C:/cygwin/home/Kabir/sourcecontrol/microcontainer/container/src/main"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/deployment/build.xml
===================================================================
--- trunk/deployment/build.xml	2006-11-03 05:33:57 UTC (rev 58055)
+++ trunk/deployment/build.xml	2006-11-03 06:12:00 UTC (rev 58056)
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!DOCTYPE project [
    <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
    <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
@@ -37,6 +36,8 @@
      | Include the normal targets.
    -->
   &targets;
+  <property name="javac.target" value="1.5"/>
+  <property name="javac.source" value="1.5"/>
 
   <!-- ================================================================== -->
   <!-- Configuration                                                      -->
@@ -58,7 +59,6 @@
     <!-- Module name(s) & version -->
     <property name="module.name" value="deployment"/>
     <property name="module.Name" value="JBoss JSR-88 Deployment"/>
-    <property name="module.version" value="DEV"/>
 
     <!-- ========= -->
     <!-- Libraries -->

Modified: trunk/deployment/src/etc/jsr88-service.xml
===================================================================
--- trunk/deployment/src/etc/jsr88-service.xml	2006-11-03 05:33:57 UTC (rev 58055)
+++ trunk/deployment/src/etc/jsr88-service.xml	2006-11-03 06:12:00 UTC (rev 58056)
@@ -4,12 +4,16 @@
 <server>
    <mbean code="org.jboss.deployment.services.DeploymentManagerService"
       name="jboss.management.local:type=JSR88DeploymentManager,name=DefaultManager">
-      <attribute name="EARDeployer">jboss.j2ee:service=EARDeployer</attribute>
-      <attribute name="EJBDeployer">jboss.ejb:service=EJBDeployer</attribute>
-      <attribute name="RARDeployer">jboss.jca:service=RARDeployer</attribute>
-      <attribute name="WARDeployer">jboss.web:service=WebServer</attribute>
-      <attribute name="CARDeployer">jboss.j2ee:service=ClientDeployer</attribute>
+      <!-- The DeploymentContext attachment types that identify each deployment
+      type 
+      -->
+      <attribute name="EarDeployerType">org.jboss.deployment.J2eeApplicationMetaData</attribute>
+      <attribute name="EjbDeployerType">org.jboss.ejb3.Ejb3Deployment</attribute>
+      <attribute name="RarDeployerType">org.jboss.resource.metadata.ConnectorMetaData</attribute>
+      <attribute name="WarDeployerType">org.jboss.metadata.WebMetaData</attribute>
+      <attribute name="CarDeployerType">org.jboss.ejb3.metamodel.ApplicationClientDD</attribute>
+      <!-- The MainDeployer to process deployments -->
+      <attribute name="MainDeployer"><inject bean="MainDeployer" /></attribute>
       <attribute name="UploadDir">${jboss.server.temp.dir}/jsr88</attribute>
-      <depends optional-attribute-name="MainDeployer">jboss.system:service=MainDeployer</depends>
    </mbean>
 </server>

Modified: trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2006-11-03 05:33:57 UTC (rev 58055)
+++ trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2006-11-03 06:12:00 UTC (rev 58056)
@@ -34,18 +34,21 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import javax.enterprise.deploy.shared.ModuleType;
 import javax.enterprise.deploy.spi.exceptions.TargetException;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
 
-import org.jboss.deployment.DeploymentInfo;
-import org.jboss.deployment.DeploymentState;
-import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.structure.DeploymentState;
 import org.jboss.deployment.spi.SerializableTargetModuleID;
-import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.logging.Logger;
 import org.jboss.util.file.Files;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 
 /**
  * A service that supports the JSR-88 DeploymentManager operations.
@@ -53,129 +56,105 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public class DeploymentManagerService extends ServiceMBeanSupport implements DeploymentManagerServiceMBean
+public class DeploymentManagerService
+   implements DeploymentManagerServiceMBean
 {
-   private Map moduleMap = Collections.synchronizedMap(new HashMap());
+   private static Logger log = Logger.getLogger(DeploymentManagerService.class);
+
    /**
-    * The name of the MainDeployer
+    * Map<deployURL, TargetID> of the deployment modules.
     */
-   private ObjectName mainDeployer;
-   private ObjectName carDeployer;
-   private ObjectName earDeployer;
-   private ObjectName ejbDeployer;
-   private ObjectName rarDeployer;
-   private ObjectName warDeployer;
+   private Map<String, SerializableTargetModuleID> moduleMap =
+      Collections.synchronizedMap(new HashMap<String, SerializableTargetModuleID>());
 
    /**
+    * The type of attachment used to identify a CAR
+    */
+   private Class carDeployerType;
+   /**
+    * The type of attachment used to identify a EAR
+    */
+   private Class earDeployerType;
+   /**
+    * The type of attachment used to identify a EJB
+    */
+   private Class ejbDeployerType;
+   /**
+    * The type of attachment used to identify a RAR
+    */
+   private Class rarDeployerType;
+   /**
+    * The type of attachment used to identify a WAR
+    */
+   private Class warDeployerType;
+   /**
+    * The MainDeployer
+    */
+   private MainDeployer mainDeployer;
+
+   /**
     * The local directory for uploaded content.
     */
-   File uploadDir;
+   private File uploadDir;
 
-   public ObjectName getMainDeployer()
+   public MainDeployer getMainDeployer()
    {
       return mainDeployer;
    }
-
-   public void setMainDeployer(ObjectName mainDeployer)
+   public void setMainDeployer(MainDeployer mainDeployer)
    {
       this.mainDeployer = mainDeployer;
    }
 
-   /**
-    * @return The EARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public ObjectName getEARDeployer()
+   public Class getCarDeployerType()
    {
-      return earDeployer;
+      return carDeployerType;
    }
-
-   /**
-    * @param name The EARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public void setEARDeployer(ObjectName name)
+   public void setCarDeployerType(Class carDeployerType)
    {
-      this.earDeployer = name;
+      this.carDeployerType = carDeployerType;
    }
-
-   /**
-    * @return The EJBDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public ObjectName getEJBDeployer()
+   public Class getEarDeployerType()
    {
-      return ejbDeployer;
+      return earDeployerType;
    }
-
-   /**
-    * @param name The EJBDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public void setEJBDeployer(ObjectName name)
+   public void setEarDeployerType(Class earDeployerType)
    {
-      this.ejbDeployer = name;
+      this.earDeployerType = earDeployerType;
    }
-
-   /**
-    * @return The RARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public ObjectName getRARDeployer()
+   public Class getEjbDeployerType()
    {
-      return rarDeployer;
+      return ejbDeployerType;
    }
-
-   /**
-    * @param name The RARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public void setRARDeployer(ObjectName name)
+   public void setEjbDeployerType(Class ejbDeployerType)
    {
-      this.rarDeployer = name;
+      this.ejbDeployerType = ejbDeployerType;
    }
-
-   /**
-    * @return The WARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public ObjectName getWARDeployer()
+   public Class getRarDeployerType()
    {
-      return warDeployer;
+      return rarDeployerType;
    }
-
-   /**
-    * @param name The WARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public void setWARDeployer(ObjectName name)
+   public void setRarDeployerType(Class rarDeployerType)
    {
-      this.warDeployer = name;
+      this.rarDeployerType = rarDeployerType;
    }
-
-   /**
-    * @return The CARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public ObjectName getCARDeployer()
+   public Class getWarDeployerType()
    {
-      return carDeployer;
+      return warDeployerType;
    }
-
-   /**
-    * @param name The CARDeployer mbean name
-    * @jmx:managed-attribute
-    */
-   public void setCARDeployer(ObjectName name)
+   public void setWarDeployerType(Class warDeployerType)
    {
-      this.carDeployer = name;
+      this.warDeployerType = warDeployerType;
    }
 
+   public void setModuleMap(Map<String, SerializableTargetModuleID> moduleMap)
+   {
+      this.moduleMap = moduleMap;
+   }
    public File getUploadDir()
    {
       return this.uploadDir;
    }
-
    public void setUploadDir(File uploadDir)
    {
       this.uploadDir = uploadDir;
@@ -240,13 +219,14 @@
       if (deployFile.exists() == false)
          throw new IOException("deployURL(" + url + ") has no local archive");
 
-      MainDeployerMBean proxy = (MainDeployerMBean)MBeanServerInvocationHandler.newProxyInstance(server, mainDeployer, MainDeployerMBean.class, false);
-      proxy.deploy(deployFile.toURL());
+      VirtualFile root = VFS.getRoot(deployFile.toURI());
+      DeploymentContext context = new AbstractDeploymentContext(root);
+      mainDeployer.addDeploymentContext(context);
+      mainDeployer.process();
       moduleID.setRunning(true);
       moduleID.clearChildModuleIDs();
       // Repopulate the child modules
-      DeploymentInfo info = proxy.getDeployment(deployFile.toURL());
-      fillChildrenTargetModuleID(moduleID, info);
+      fillChildrenTargetModuleID(moduleID, context);
    }
 
    public void stop(String url) throws Exception
@@ -263,8 +243,8 @@
       if (deployFile.exists() == false)
          throw new IOException("deployURL(" + url + ") has no local archive");
 
-      MainDeployerMBean proxy = (MainDeployerMBean)MBeanServerInvocationHandler.newProxyInstance(server, mainDeployer, MainDeployerMBean.class, false);
-      proxy.undeploy(deployFile.toURL());
+      mainDeployer.removeDeploymentContext(deployURL.toString());
+      mainDeployer.process();
       moduleID.setRunning(false);
    }
 
@@ -290,13 +270,14 @@
       moduleMap.remove(url);
    }
 
-   public SerializableTargetModuleID[] getAvailableModules(int moduleType) throws TargetException
+   public SerializableTargetModuleID[] getAvailableModules(int moduleType)
+      throws TargetException
    {
-      ArrayList matches = new ArrayList();
-      Iterator modules = moduleMap.values().iterator();
+      ArrayList<SerializableTargetModuleID> matches = new ArrayList<SerializableTargetModuleID>();
+      Iterator<SerializableTargetModuleID> modules = moduleMap.values().iterator();
       while (modules.hasNext())
       {
-         SerializableTargetModuleID module = (SerializableTargetModuleID)modules.next();
+         SerializableTargetModuleID module = modules.next();
          if (module.getModuleType() == moduleType)
             matches.add(module);
       }
@@ -306,23 +287,24 @@
       return ids;
    }
 
-   private void fillChildrenTargetModuleID(SerializableTargetModuleID moduleID, DeploymentInfo info)
+   private void fillChildrenTargetModuleID(SerializableTargetModuleID moduleID,
+         DeploymentContext info)
    {
-      Iterator it = info.subDeployments.iterator();
-      while (it.hasNext())
+      Set<DeploymentContext> children = info.getChildren();
+      for(DeploymentContext ctx : children)
       {
-         DeploymentInfo sdi = (DeploymentInfo)it.next();
          try
          {
-            ModuleType type = getModuleType(sdi);
+            ModuleType type = getModuleType(ctx);
             // Discard unknown ModuleTypes
             if (type != null)
             {
-               String module = sdi.url.toString();
-               boolean isRunning = (DeploymentState.STARTED == sdi.state);
+               String module = ctx.getName();
+               // TODO, DEPLOYED may not be the same as running?
+               boolean isRunning = ctx.getState() == DeploymentState.DEPLOYED;
                SerializableTargetModuleID child = new SerializableTargetModuleID(moduleID, module, type.getValue(), isRunning);
                moduleID.addChildTargetModuleID(child);
-               fillChildrenTargetModuleID(child, sdi);
+               fillChildrenTargetModuleID(child, ctx);
             }
          }
          catch (UnsupportedOperationException e)
@@ -333,32 +315,35 @@
       }
    }
 
-   private ModuleType getModuleType(DeploymentInfo info)
+   /**
+    * Determine the module type by looking for an attachment that identifies
+    * the deployer type.
+    * 
+    * @param info
+    * @return
+    */
+   private ModuleType getModuleType(DeploymentContext info)
    {
-      if (info.deployer == null)
-         return null;
-
       ModuleType type = null;
-      ObjectName deployer = info.deployer.getServiceName();
 
-      // Validate an ejb vs car based on the watch url
-      if (deployer.equals(carDeployer))
+      Attachments attachments = info.getTransientAttachments();      
+      if (attachments.getAttachment(carDeployerType) != null)
       {
          type = ModuleType.CAR;
       }
-      else if (deployer.equals(ejbDeployer))
+      else if (attachments.getAttachment(ejbDeployerType) != null)
       {
          type = ModuleType.EJB;
       }
-      else if (deployer.equals(earDeployer))
+      else if (attachments.getAttachment(earDeployerType) != null)
       {
          type = ModuleType.EAR;
       }
-      else if (deployer.equals(rarDeployer))
+      else if (attachments.getAttachment(rarDeployerType) != null)
       {
          type = ModuleType.RAR;
       }
-      else if (deployer.equals(warDeployer))
+      else if (attachments.getAttachment(warDeployerType) != null)
       {
          type = ModuleType.WAR;
       }

Modified: trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java	2006-11-03 05:33:57 UTC (rev 58055)
+++ trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java	2006-11-03 06:12:00 UTC (rev 58056)
@@ -25,8 +25,10 @@
 import java.util.Map;
 
 import javax.enterprise.deploy.spi.exceptions.TargetException;
-import javax.management.ObjectName;
 
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.spi.structure.vfs.StructureBuilder;
+import org.jboss.deployers.spi.structure.vfs.StructuredDeployers;
 import org.jboss.deployment.spi.SerializableTargetModuleID;
 
 /**
@@ -42,30 +44,20 @@
 
    public void setUploadDir(File uploadDir);
 
-   public ObjectName getMainDeployer();
+   public MainDeployer getMainDeployer();
+   public void setMainDeployer(MainDeployer deployer);
 
-   public void setMainDeployer(ObjectName deployer);
+   public Class getCarDeployerType();
+   public void setCarDeployerType(Class carDeployerType);
+   public Class getEarDeployerType();
+   public void setEarDeployerType(Class earDeployerType);
+   public Class getEjbDeployerType();
+   public void setEjbDeployerType(Class ejbDeployerType);
+   public Class getRarDeployerType();
+   public void setRarDeployerType(Class rarDeployerType);
+   public Class getWarDeployerType();
+   public void setWarDeployerType(Class warDeployerType);
 
-   ObjectName getEARDeployer();
-
-   void setEARDeployer(ObjectName name);
-
-   ObjectName getEJBDeployer();
-
-   void setEJBDeployer(ObjectName name);
-
-   ObjectName getRARDeployer();
-
-   void setRARDeployer(ObjectName name);
-
-   ObjectName getWARDeployer();
-
-   void setWARDeployer(ObjectName name);
-
-   ObjectName getCARDeployer();
-
-   void setCARDeployer(ObjectName name);
-
    public Map getModuleMap();
 
    public void deploy(SerializableTargetModuleID moduleID) throws Exception;




More information about the jboss-cvs-commits mailing list