[jboss-cvs] JBossAS SVN: r58878 - in trunk/deployment: . src/etc src/main/org/jboss/deployment src/main/org/jboss/deployment/remoting src/main/org/jboss/deployment/spi src/main/org/jboss/deployment/spi/factories

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 6 15:48:01 EST 2006


Author: scott.stark at jboss.org
Date: 2006-12-06 15:47:52 -0500 (Wed, 06 Dec 2006)
New Revision: 58878

Added:
   trunk/deployment/src/main/org/jboss/deployment/remoting/
   trunk/deployment/src/main/org/jboss/deployment/remoting/DeployHandler.java
   trunk/deployment/src/main/org/jboss/deployment/remoting/StreamingTarget.java
Modified:
   trunk/deployment/.classpath
   trunk/deployment/build.xml
   trunk/deployment/src/etc/jsr88-service.xml
   trunk/deployment/src/main/org/jboss/deployment/spi/DeploymentManagerImpl.java
   trunk/deployment/src/main/org/jboss/deployment/spi/JMXTarget.java
   trunk/deployment/src/main/org/jboss/deployment/spi/SerializableTargetModuleID.java
   trunk/deployment/src/main/org/jboss/deployment/spi/factories/DeploymentFactoryImpl.java
Log:
Add support for a remoting streaming target implementation.

Modified: trunk/deployment/.classpath
===================================================================
--- trunk/deployment/.classpath	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/.classpath	2006-12-06 20:47:52 UTC (rev 58878)
@@ -11,6 +11,7 @@
 	<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" />
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/remoting/lib/jboss-remoting.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/deployment/build.xml
===================================================================
--- trunk/deployment/build.xml	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/build.xml	2006-12-06 20:47:52 UTC (rev 58878)
@@ -88,6 +88,7 @@
       <path refid="jboss.j2se.classpath"/>
       <path refid="jboss.system.classpath"/>
       <path refid="jboss.systemjmx.classpath"/>
+      <path refid="jboss.remoting.classpath"/>
     </path>
 
     <!-- ===== -->

Modified: trunk/deployment/src/etc/jsr88-service.xml
===================================================================
--- trunk/deployment/src/etc/jsr88-service.xml	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/etc/jsr88-service.xml	2006-12-06 20:47:52 UTC (rev 58878)
@@ -8,7 +8,8 @@
       type 
       -->
       <attribute name="EarDeployerType">org.jboss.deployment.J2eeApplicationMetaData</attribute>
-      <attribute name="EjbDeployerType">org.jboss.ejb3.Ejb3Deployment</attribute>
+      <attribute name="EjbDeployerType">org.jboss.metadata.ApplicationMetaData</attribute>
+      <attribute name="Ejb3DeployerType">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>

Added: trunk/deployment/src/main/org/jboss/deployment/remoting/DeployHandler.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/remoting/DeployHandler.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/remoting/DeployHandler.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.remoting;
+
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
+import org.jboss.deployment.services.DeploymentManagerServiceMBean;
+import org.jboss.deployment.spi.SerializableTargetModuleID;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.stream.StreamInvocationHandler;
+
+/**
+ * A remoting StreamInvocationHandler installed as the JSR88 subsystem
+ * handler and used by the StreamingTarget implementation. 
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DeployHandler implements StreamInvocationHandler
+{
+   static Logger log = Logger.getLogger(DeployHandler.class);
+
+   private DeploymentManagerServiceMBean deployService;
+
+   public DeploymentManagerServiceMBean getDeployService()
+   {
+      return deployService;
+   }
+
+   public void setDeployService(DeploymentManagerServiceMBean deployService)
+   {
+      this.deployService = deployService;
+   }
+
+   /**
+    * Handle a deployService deploy invocation
+    * @param request - the remoting invocation
+    */
+   public Object handleStream(InputStream contentIS, InvocationRequest request)
+      throws Throwable
+   {
+      SerializableTargetModuleID moduleID = (SerializableTargetModuleID) request.getParameter();
+      log.debug("handleStream, moduleID: "+moduleID);
+      moduleID.setContentIS(contentIS);
+      deployService.deploy(moduleID);
+      return null;
+   }
+
+   public void addListener(InvokerCallbackHandler arg0)
+   {      
+   }
+
+   /**
+    * Handle a deployService invocation other than deploy
+    * @param request - the remoting invocation
+    */
+   public Object invoke(InvocationRequest request) throws Throwable
+   {
+      String name = request.getParameter().toString();
+      Map payload = request.getRequestPayload();
+      String url = (String) payload.get("moduleID");
+      Object returnValue = null;
+      log.debug("invoke, moduleID: "+url+", payload: "+payload);
+
+      if( name.equals("start") )
+      {
+         deployService.start(url);
+      }
+      else if( name.equals("stop") )
+      {
+         deployService.stop(url);
+         
+      }
+      else if( name.equals("undeploy") )
+      {
+         deployService.undeploy(url);         
+      }
+      else if( name.equals("getAvailableModules") )
+      {
+         Integer moduleType = (Integer) payload.get("moduleType");
+         SerializableTargetModuleID[] ids = deployService.getAvailableModules(moduleType);
+         returnValue = ids;
+      }
+      return returnValue;
+   }
+
+   public void removeListener(InvokerCallbackHandler arg0)
+   {
+   }
+
+   public void setInvoker(ServerInvoker arg0)
+   {
+   }
+
+   /**
+    * Legacy initialzation of the DeploymentManagerServiceMBean via
+    * jmx lookup.
+    * TODO: the deployService should be injected.
+    */
+   public void setMBeanServer(MBeanServer server)
+   {
+      try
+      {
+         ObjectName jsr88 = new ObjectName("jboss.management.local:type=JSR88DeploymentManager,name=DefaultManager");
+         deployService = (DeploymentManagerServiceMBean)
+            MBeanServerInvocationHandler.newProxyInstance(server, jsr88, DeploymentManagerServiceMBean.class, false);
+         log.debug("Initialzied DeploymentManagerServiceMBean");
+      }
+      catch(Exception e)
+      {
+         log.warn("Failed to lookup DeploymentManagerServiceMBean", e);
+      }
+   }
+
+}

Added: trunk/deployment/src/main/org/jboss/deployment/remoting/StreamingTarget.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/remoting/StreamingTarget.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/remoting/StreamingTarget.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -0,0 +1,309 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.remoting;
+
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.TargetException;
+
+import org.jboss.deployment.spi.DeploymentManagerImpl;
+import org.jboss.deployment.spi.JBossTarget;
+import org.jboss.deployment.spi.SerializableTargetModuleID;
+import org.jboss.deployment.spi.TargetModuleIDImpl;
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+
+/**
+ * A JBossTarget implementation that uses remoting streaming to upload
+ * deployments. This target is selected by including a targetType=remote
+ * param in the DeploymentManager deployURI. 
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class StreamingTarget implements JBossTarget
+{
+   private static final Logger log = Logger.getLogger(StreamingTarget.class);
+   public static final String DESCRIPTION = "JBoss remoting streaming deployment target";
+
+   /**
+    * The default remoting subsystem
+    */
+   private static final String REMOTING_SUBSYSTEM = "JSR88";
+
+   /** The deployment target uri */
+   private URI deployURI;
+
+   /**
+    * Create a target given a remoting locator URI 
+    * @param deployURI
+    */
+   public StreamingTarget(URI deployURI)
+   {
+      log.debug("new StreamingTarget: " + deployURI);
+      try
+      {
+         String localHostName = InetAddress.getLocalHost().getHostName();
+
+         String scheme = deployURI.getScheme();
+         String host = deployURI.getHost();
+         int port = deployURI.getPort();
+         String query = deployURI.getRawQuery();
+
+         String uri = deployURI.toASCIIString();
+         if (uri.startsWith(DeploymentManagerImpl.DEPLOYER_URI))
+         {
+            // Using unified invoker remoting defaults
+            scheme = "socket";
+            host = localHostName;
+            port = 4446;
+            query = null;
+         }
+
+         StringBuffer tmp = new StringBuffer(scheme + "://");
+         tmp.append(host != null ? host : localHostName);
+         tmp.append(port > 0 ? ":" + port : "");
+         tmp.append(query != null ? "/?" + query : "");
+         deployURI = new URI(tmp.toString());
+
+         log.debug("URI changed to: " + deployURI);
+         this.deployURI = deployURI;
+      }
+      catch (Exception e)
+      {
+         log.error(e);
+      }
+
+   }
+
+   /**
+    * Get the target's description
+    * @return the description
+    */
+   public String getDescription()
+   {
+      return DESCRIPTION;
+   }
+
+   /**
+    * Get the target's name
+    * @return the name
+    */
+   public String getName()
+   {
+      return deployURI.toString();
+   }
+
+   /**
+    * Get the target's host name
+    */
+   public String getHostName()
+   {
+      return deployURI.getHost();
+   }
+
+   /**
+    * Deploy a given module
+    */
+   public void deploy(TargetModuleID targetModuleID) throws Exception
+   {
+      TargetModuleIDImpl moduleID = (TargetModuleIDImpl)targetModuleID;
+      SerializableTargetModuleID smoduleID = new SerializableTargetModuleID(moduleID);
+      Client client = getClient();
+      log.info("Begin deploy: " + moduleID);
+      transferDeployment(client, smoduleID);
+      log.info("End deploy");
+      client.disconnect();
+   }
+
+   /**
+    * Start a given module
+    */
+   public void start(TargetModuleID targetModuleID) throws Exception
+   {
+      Client client = getClient();
+      URL url = new URL(targetModuleID.getModuleID());
+      log.debug("Start: " + url);
+      HashMap<String, String> args = new HashMap<String, String>(1);
+      args.put("moduleID", url.toExternalForm());
+      log.info("Begin start: " + url);
+      invoke(client, "start", args);
+      log.info("End start");
+   }
+
+   /**
+    * Stop a given module
+    */
+   public void stop(TargetModuleID targetModuleID) throws Exception
+   {
+      Client client = getClient();
+      URL url = new URL(targetModuleID.getModuleID());
+      log.debug("Start: " + url);
+      HashMap<String, String> args = new HashMap<String, String>(1);
+      args.put("moduleID", url.toExternalForm());
+      log.info("Begin stop: " + url);
+      invoke(client, "stop", args);
+      log.info("End stop");
+   }
+
+   /**
+    * Undeploy a given module
+    */
+   public void undeploy(TargetModuleID targetModuleID) throws Exception
+   {
+      Client client = getClient();
+      URL url = new URL(targetModuleID.getModuleID());
+      log.debug("Start: " + url);
+      HashMap<String, String> args = new HashMap<String, String>(1);
+      args.put("moduleID", url.toExternalForm());
+      log.info("Begin undeploy: " + url);
+      invoke(client, "undeploy", args);
+      log.info("End undeploy");
+   }
+
+   /**
+    * Retrieve the list of all J2EE application modules running or not running
+    * on the identified targets.
+    */
+   public TargetModuleID[] getAvailableModules(ModuleType moduleType) throws TargetException
+   {
+      try
+      {
+         Client client = getClient();
+         HashMap<String, Integer> args = new HashMap<String, Integer>(1);
+         args.put("moduleType", moduleType.getValue());
+         SerializableTargetModuleID[] modules = (SerializableTargetModuleID[])
+            invoke(client, "getAvailableModules", args);
+         List<TargetModuleID> list = new ArrayList<TargetModuleID>();
+         for (int n = 0; n < modules.length; n++)
+         {
+            SerializableTargetModuleID id = modules[n];
+            String moduleID = id.getModuleID();
+            boolean isRunning = id.isRunning();
+            ModuleType type = ModuleType.getModuleType(id.getModuleType());
+            TargetModuleIDImpl tmid = new TargetModuleIDImpl(this, moduleID, null, isRunning, type);
+            convertChildren(tmid, id);
+            list.add(tmid);
+         }
+
+         TargetModuleID[] targetModuleIDs = new TargetModuleID[list.size()];
+         list.toArray(targetModuleIDs);
+         return targetModuleIDs;
+      }
+      catch (Exception e)
+      {
+         TargetException tex = new TargetException("Failed to get available modules");
+         tex.initCause(e);
+         throw tex;
+      }
+   }
+
+   private void convertChildren(TargetModuleIDImpl parent, SerializableTargetModuleID parentID)
+   {
+      SerializableTargetModuleID[] children = parentID.getChildModuleIDs();
+      int length = children != null ? children.length : 0;
+      for (int n = 0; n < length; n++)
+      {
+         SerializableTargetModuleID id = children[n];
+         String moduleID = id.getModuleID();
+         boolean isRunning = id.isRunning();
+         ModuleType type = ModuleType.getModuleType(id.getModuleType());
+         TargetModuleIDImpl child = new TargetModuleIDImpl(this, moduleID, parent, isRunning, type);
+         parent.addChildTargetModuleID(child);
+         convertChildren(child, id);
+      }
+   }
+
+   /**
+    * Get the remoting client connection
+    * @return
+    * @throws Exception
+    */
+   private Client getClient() throws Exception
+   {
+      String locatorURI = deployURI.toString();
+      InvokerLocator locator = new InvokerLocator(locatorURI);
+      log.debug("Calling remoting server with locator uri of: " + locatorURI);
+
+      Client remotingClient = new Client(locator, REMOTING_SUBSYSTEM);
+      remotingClient.connect();
+      return remotingClient;
+   }
+
+   private void transferDeployment(Client client, SerializableTargetModuleID smoduleID)
+      throws Exception
+   {
+      URL deployURL = new URL(smoduleID.getModuleID());
+      InputStream is = deployURL.openStream();
+      try
+      {
+         client.invoke(is, smoduleID);
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Error e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch(Throwable e)
+      {
+         throw new RuntimeException(e);         
+      }
+      finally
+      {
+         is.close();
+      }
+   }
+
+   private Object invoke(Client client, String name, HashMap args)
+      throws Exception
+   {
+      try
+      {
+         Object returnValue = client.invoke(name, args);
+         return returnValue;
+      }
+      catch(Exception e)
+      {
+         throw e;
+      }
+      catch(Error e)
+      {
+         throw new RuntimeException(e);
+      }
+      catch(Throwable e)
+      {
+         throw new RuntimeException(e);         
+      }      
+   }
+}

Modified: trunk/deployment/src/main/org/jboss/deployment/spi/DeploymentManagerImpl.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/spi/DeploymentManagerImpl.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/spi/DeploymentManagerImpl.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -60,6 +60,7 @@
 
 import org.dom4j.Document;
 import org.dom4j.io.SAXReader;
+import org.jboss.deployment.remoting.StreamingTarget;
 import org.jboss.deployment.spi.configurations.WarConfiguration;
 import org.jboss.deployment.spi.status.DeploymentStatusImpl;
 import org.jboss.deployment.spi.status.ProgressObjectImpl;
@@ -121,10 +122,12 @@
    }
 
    /**
-    * Get the available targets. This is determined by parsing the deployURI.
-    * Currently there is only one target, either a JMXTarget that uses
-    * the RMIAdaptor based on the URI info, or a LocalhostTarget if the
-    * URI opaque.
+    * Get the available targets. This is determined by parsing the deployURI
+    * and looking at the targetType query parameter if the URI is not
+    * opaque. Supported targetTypes are:
+    * jmx = JMXTarget
+    * remote = StreamingTarget
+    * LocalhostTarget is the target type used if the URI is opaque.
     *
     * @return the available targets
     * @throws IllegalStateException when the manager is disconnected
@@ -143,8 +146,27 @@
          }
          else
          {
-            log.debug("Non-Opaque URI seen, using to JMXTarget");
-            targets = new Target[] { new JMXTarget(deployURI) };
+            log.debug("Non-Opaque URI seen, checking query for targetType");
+            // Check the query parameters
+            String query = deployURI.getQuery();
+            String[] params = {};
+            if( query != null )
+            {
+               params = query.split("&|=");
+            }
+            String targetType = "jmx";
+            for(int n = 0; n < params.length; n += 2)
+            {
+               String key = params[n];
+               String value = params[n+1];
+               if( key.endsWith("targetType") )
+                  targetType = value;
+            }
+
+            if( targetType.equals("remote") )
+               targets = new Target[] { new StreamingTarget(deployURI) };               
+            else
+               targets = new Target[] { new JMXTarget(deployURI) };
          }
       }
       return targets;

Modified: trunk/deployment/src/main/org/jboss/deployment/spi/JMXTarget.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/spi/JMXTarget.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/spi/JMXTarget.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -45,7 +45,9 @@
 
 /**
  * A Target that deploys using the JMX adaptor to communicate with the
- * MainDeployer using file URLs to the deployments.
+ * MainDeployer using file URLs to the deployments. This target is selected
+ * by including a targetType=jmx param in the DeploymentManager deployURI.
+ * 
  * @author Thomas.Diesler at jboss.org
  * @author Scott.Stark at jboss.com
  * @version $Revision$
@@ -53,6 +55,7 @@
 public class JMXTarget implements JBossTarget
 {
    private static final Logger log = Logger.getLogger(JMXTarget.class);
+   public static final String DESCRIPTION = "JBoss JMX deployment target";
    /**
     * The default RMIAdaptor JNDI location
     */
@@ -86,7 +89,8 @@
          String path = deployURI.getPath();
          String query = deployURI.getRawQuery();
 
-         if (new URI(DeploymentManagerImpl.DEPLOYER_URI).equals(deployURI))
+         String uri = deployURI.toASCIIString();
+         if (uri.startsWith(DeploymentManagerImpl.DEPLOYER_URI))
          {
             // Using JNDI defaults
             scheme = "jnp";
@@ -117,12 +121,12 @@
             }
          }
 
-         StringBuffer uri = new StringBuffer(scheme + "://");
-         uri.append(host != null ? host : localHostName);
-         uri.append(port > 0 ? ":" + port : "");
-         uri.append(path != null && path.length() > 0 ? path : DEFAULT_ADAPTOR_PATH);
-         uri.append(query != null ? "?" + query : "");
-         deployURI = new URI(uri.toString());
+         StringBuffer tmp = new StringBuffer(scheme + "://");
+         tmp.append(host != null ? host : localHostName);
+         tmp.append(port > 0 ? ":" + port : "");
+         tmp.append(path != null && path.length() > 0 ? path : DEFAULT_ADAPTOR_PATH);
+         tmp.append(query != null ? "?" + query : "");
+         deployURI = new URI(tmp.toString());
 
          log.debug("URI changed to: " + deployURI);
          this.deployURI = deployURI;
@@ -143,7 +147,7 @@
     */
    public String getDescription()
    {
-      return "JBoss JMX deployment target";
+      return DESCRIPTION;
    }
 
    /**
@@ -257,8 +261,7 @@
       }
       catch (Exception e)
       {
-         log.error("Cannot get available modules", e);
-         TargetException tex = new TargetException("");
+         TargetException tex = new TargetException("Failed to get available modules");
          tex.initCause(e);
          throw tex;
       }

Modified: trunk/deployment/src/main/org/jboss/deployment/spi/SerializableTargetModuleID.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/spi/SerializableTargetModuleID.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/spi/SerializableTargetModuleID.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -21,6 +21,7 @@
  */
 package org.jboss.deployment.spi;
 
+import java.io.InputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 
@@ -40,7 +41,10 @@
    private ArrayList childModuleIDs = new ArrayList();
    private String moduleID;
    private int moduleType;
+   /** */
    private boolean isRunning;
+   /** An optional InputStream to use to copy the contents */
+   private transient InputStream contentIS;
 
    public SerializableTargetModuleID(TargetModuleIDImpl impl)
    {
@@ -112,6 +116,25 @@
       this.isRunning = flag;
    }
 
+   /**
+    * An optional deployment archive content stream for the top-level
+    * module that should be used over the moduleID url.
+    * 
+    * @return the archive input stream if it exists
+    */
+   public InputStream getContentIS()
+   {
+      return contentIS;
+   }
+   /**
+    * 
+    * @param contentIS
+    */
+   public void setContentIS(InputStream contentIS)
+   {
+      this.contentIS = contentIS;
+   }
+
    public String toString()
    {
       return "SerializableTargetModuleID{" + "parentModuleID=@" + System.identityHashCode(parentModuleID) + ", childModuleIDs=" + childModuleIDs + ", moduleID='"

Modified: trunk/deployment/src/main/org/jboss/deployment/spi/factories/DeploymentFactoryImpl.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/spi/factories/DeploymentFactoryImpl.java	2006-12-06 20:46:42 UTC (rev 58877)
+++ trunk/deployment/src/main/org/jboss/deployment/spi/factories/DeploymentFactoryImpl.java	2006-12-06 20:47:52 UTC (rev 58878)
@@ -69,21 +69,34 @@
     */
    static
    {
-      Package pkg = Package.getPackage("org.jboss.deploy.spi.factories");
-      if (pkg != null)
+      register();
+   }
+
+   /**
+    * Register a DeploymentFactoryImpl instance with the DeploymentFactoryManager.
+    * This obtains the display name and version from the Package object for
+    * org.jboss.deploy.spi.factories
+    *
+    */
+   public synchronized static void register()
+   {
+      // Register this deployment factory with the manager
+      if( DISPLAY_NAME == null )
       {
-         DISPLAY_NAME = pkg.getImplementationVendor();
-         PRODUCT_VERSION = pkg.getImplementationVersion();
+         DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance();
+         manager.registerDeploymentFactory(new DeploymentFactoryImpl());      
+         Package pkg = Package.getPackage("org.jboss.deploy.spi.factories");
+         if (pkg != null)
+         {
+            DISPLAY_NAME = pkg.getImplementationVendor();
+            PRODUCT_VERSION = pkg.getImplementationVersion();
+         }
+         if (DISPLAY_NAME == null || PRODUCT_VERSION == null)
+         {
+            DISPLAY_NAME = "DeploymentFactoryImpl";
+            PRODUCT_VERSION = "1.1-DEV";
+         }
       }
-      if (DISPLAY_NAME == null || PRODUCT_VERSION == null)
-      {
-         DISPLAY_NAME = "DeploymentFactoryImpl";
-         PRODUCT_VERSION = "1.1-DEV";
-      }
-
-      // Register this deployment factory with the manager 
-      DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance();
-      manager.registerDeploymentFactory(new DeploymentFactoryImpl());
    }
 
    /**




More information about the jboss-cvs-commits mailing list