[jboss-cvs] JBossAS SVN: r63719 - in trunk/deployment: src/main/org/jboss/deployment/services and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 28 13:21:40 EDT 2007


Author: adrian at jboss.org
Date: 2007-06-28 13:21:40 -0400 (Thu, 28 Jun 2007)
New Revision: 63719

Modified:
   trunk/deployment/.classpath
   trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
   trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java
Log:
Deployers reloaded

Modified: trunk/deployment/.classpath
===================================================================
--- trunk/deployment/.classpath	2007-06-28 17:21:24 UTC (rev 63718)
+++ trunk/deployment/.classpath	2007-06-28 17:21:40 UTC (rev 63719)
@@ -5,7 +5,6 @@
 	<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"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/j2se"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/system"/>
@@ -15,5 +14,10 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs.jar" sourcepath="/thirdparty/jboss/jboss-vfs/lib/jboss-vfs-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee.jar" sourcepath="/thirdparty/jboss/jboss-javaee/lib/jboss-javaee-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-src.zip"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-client-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-core-spi-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-structure-spi-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-impl-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-deployers-vfs-spi-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2007-06-28 17:21:24 UTC (rev 63718)
+++ trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2007-06-28 17:21:40 UTC (rev 63719)
@@ -27,42 +27,41 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.enterprise.deploy.shared.ModuleType;
 import javax.enterprise.deploy.spi.exceptions.TargetException;
-
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.jboss.dependency.spi.Controller;
-import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
-import org.jboss.deployers.spi.deployer.DeploymentUnit;
-import org.jboss.deployers.spi.IncompleteDeploymentsBuilder;
-import org.jboss.deployers.spi.IncompleteDeployments;
-import org.jboss.deployers.spi.IncompleteDeploymentException;
-import org.jboss.deployers.spi.deployment.MainDeployer;
-import org.jboss.deployers.spi.structure.DeploymentContext;
-import org.jboss.deployers.spi.structure.DeploymentState;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
 import org.jboss.deployment.spi.SerializableTargetModuleID;
 import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.system.metadata.ServiceMetaData;
 import org.jboss.util.file.Files;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.system.metadata.ServiceMetaData;
-
 /**
  * A service that supports the JSR-88 DeploymentManager operations.
  * 
  * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
  * @version $Revision$
  */
 public class DeploymentManagerService
@@ -70,6 +69,9 @@
 {
    private static Logger log = Logger.getLogger(DeploymentManagerService.class);
 
+   /** The deployment factory */
+   VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+   
    /**
     * Map<deployURL, TargetID> of the deployment modules.
     */
@@ -100,7 +102,7 @@
    /**
     * The MainDeployer
     */
-   private MainDeployer mainDeployer;
+   private MainDeployerImpl mainDeployer;
 
    /**
     * The controller
@@ -113,12 +115,33 @@
    private File uploadDir;
    private boolean failOnCollision;
    private boolean deleteOnUndeploy;
+   
+   /**
+    * Get the deployment name
+    * 
+    * @param file the file
+    * @return the name;
+    */
+   public static String getDeploymentName(VirtualFile file)
+   {
+      if (file == null)
+         throw new IllegalArgumentException("Null file");
+      try
+      {
+         URI uri = file.toURI();
+         return uri.toString();
+      }
+      catch (Exception e)
+      {
+         throw new IllegalArgumentException("File does not have a valid uri: " + file, e);
+      }
+   }
 
-   public MainDeployer getMainDeployer()
+   public MainDeployerImpl getMainDeployer()
    {
       return mainDeployer;
    }
-   public void setMainDeployer(MainDeployer mainDeployer)
+   public void setMainDeployer(MainDeployerImpl mainDeployer)
    {
       this.mainDeployer = mainDeployer;
    }
@@ -331,16 +354,18 @@
       File deployFile = new File(uploadDir, archive);
 
       VirtualFile root = VFS.getRoot(deployFile.toURI());
-      DeploymentContext context = mainDeployer.getDeploymentContext(AbstractDeploymentContext.getDeploymentName(root));
+      Deployment deployment = mainDeployer.getDeployment(getDeploymentName(root));
 
       /* TODO: that is a hack */
-      if (context == null) {
-         context = new AbstractDeploymentContext(root);
-         mainDeployer.addDeploymentContext(context);
+      if (deployment == null)
+      {
+         deployment = deploymentFactory.createVFSDeployment(root);
+         mainDeployer.addDeployment(deployment);
          mainDeployer.process();
          moduleID.setRunning(true);
          moduleID.clearChildModuleIDs();
          // Repopulate the child modules
+         DeploymentContext context = mainDeployer.getDeploymentContext(deployment.getName()); 
          fillChildrenTargetModuleID(moduleID, context);
       }
 
@@ -362,7 +387,7 @@
 
    public void deploy_phase2(String url) throws Exception
    {
-      SerializableTargetModuleID moduleID = (SerializableTargetModuleID)moduleMap.get(url);
+      SerializableTargetModuleID moduleID = moduleMap.get(url);
       if (moduleID == null)
          throw new IOException("deployURL(" + url + ") has not been distributed");
       if (moduleID.isRunning())
@@ -379,53 +404,13 @@
          throw new IOException("deployURL(" + url + ") has no local archive");
 
       VirtualFile root = VFS.getRoot(deployFile.toURI());
-      DeploymentContext context = new AbstractDeploymentContext(root);
-      mainDeployer.addDeploymentContext(context);
-      try {
+      Deployment deployment = deploymentFactory.createVFSDeployment(root);
+      mainDeployer.addDeployment(deployment);
+      DeploymentContext context = mainDeployer.getDeploymentContext(deployment.getName());
+      try
+      {
          mainDeployer.process();
-         IncompleteDeployments incomplete = IncompleteDeploymentsBuilder.build(mainDeployer, controller);
-         if (incomplete.isIncomplete())
-         {
-            boolean itisme = false;
-
-            /* Check that it is our context */
-            /* TODO check also incomplete.getContextsMissingDependencies() */
-            Map contexts = incomplete.getContextsInError();
-            Set set = contexts.keySet();
-            Object [] stringset = set.toArray();
-
-            String componentname =  getComponentName(context);
-            for (int i=0; componentname != null && i<stringset.length; i++)
-            {
-               if (componentname.compareTo((String)stringset[i]) == 0)
-               {
-                  itisme = true;
-                  break;
-               }
-            }
-
-            /* Check the deployment */
-            /* TODO check also incomplete.getDeploymentsMissingDeployer() */
-            contexts = incomplete.getDeploymentsInError();
-            set = contexts.keySet();
-            stringset = set.toArray();
-            componentname = context.getDeploymentUnit().getName();
-            for (int i=0; i<stringset.length; i++)
-            {
-               if (componentname.compareTo((String)stringset[i]) == 0)
-               {
-                  itisme = true;
-                  break;
-               }
-            }
-
-            /* If we have had the problem throw the exception */
-            if (itisme)
-            {
-               IncompleteDeploymentException e = new IncompleteDeploymentException(incomplete);
-               throw e;
-            }
-         }
+         mainDeployer.checkComplete(deployment);
       }
       catch (Exception e)
       {
@@ -434,7 +419,7 @@
          /* clear the child */
          moduleID.clearChildModuleIDs();
          /* remove the deployment */
-         mainDeployer.removeDeploymentContext(AbstractDeploymentContext.getDeploymentName(root));
+         mainDeployer.removeDeployment(getDeploymentName(root));
          mainDeployer.process();
 
          /* remove the map */
@@ -470,7 +455,7 @@
          throw new IOException("deployURL(" + url + ") has no local archive");
 
       VirtualFile root = VFS.getRoot(deployFile.toURI());
-      mainDeployer.removeDeploymentContext(AbstractDeploymentContext.getDeploymentName(root));
+      mainDeployer.removeDeployment(getDeploymentName(root));
       mainDeployer.process();
       moduleID.setRunning(false);
    }
@@ -524,7 +509,7 @@
    private void fillChildrenTargetModuleID(SerializableTargetModuleID moduleID,
          DeploymentContext info)
    {
-      Set<DeploymentContext> children = info.getChildren();
+      List<DeploymentContext> children = info.getChildren();
       for(DeploymentContext ctx : children)
       {
          try

Modified: trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java	2007-06-28 17:21:24 UTC (rev 63718)
+++ trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerServiceMBean.java	2007-06-28 17:21:40 UTC (rev 63719)
@@ -27,7 +27,7 @@
 import javax.enterprise.deploy.spi.exceptions.TargetException;
 
 import org.jboss.dependency.spi.Controller;
-import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
 import org.jboss.deployment.spi.SerializableTargetModuleID;
 
 /**
@@ -35,6 +35,7 @@
  * DeploymentManager implementation.
  * 
  * @author Scott.Stark at jboss.org
+ * @author adrian at jboss.org
  * @version $Revision$
  */
 public interface DeploymentManagerServiceMBean
@@ -45,8 +46,8 @@
 
    public void setUploadDir(File uploadDir);
 
-   public MainDeployer getMainDeployer();
-   public void setMainDeployer(MainDeployer deployer);
+   public MainDeployerImpl getMainDeployer();
+   public void setMainDeployer(MainDeployerImpl deployer);
 
    public Class getCarDeployerType();
    public void setCarDeployerType(Class carDeployerType);




More information about the jboss-cvs-commits mailing list