geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: rev 56648 - in geronimo/trunk/modules: assembly deployment/src/java/org/apache/geronimo/deployment/cli
Date Fri, 05 Nov 2004 05:09:45 GMT
Author: ammulder
Date: Thu Nov  4 21:09:43 2004
New Revision: 56648

Added:
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDeploy.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListModules.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListTargets.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandPackage.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStart.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStop.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployCommand.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeploymentSyntaxException.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
Modified:
   geronimo/trunk/modules/assembly/maven.xml
Log:
New command-line deployer with hot deploy and offine distribute+package support


Modified: geronimo/trunk/modules/assembly/maven.xml
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml	(original)
+++ geronimo/trunk/modules/assembly/maven.xml	Thu Nov  4 21:09:43 2004
@@ -204,122 +204,121 @@
             deploymentFactory="org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl"
             />
 
-        <!-- build the system configuration and server.jar -->
-        <ant:echo>Building server.jar</ant:echo>
+        <!-- build the new deployer JAR -->
+        <ant:echo>Building new-deployer.jar</ant:echo>
         <ant:mkdir dir="${distDir}/bin"/>
         <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
             <ant:arg value="--plan"/>
-            <ant:arg value="target/plan/system-plan.xml"/>
+            <ant:arg value="target/plan/deployer-system-plan.xml"/>
             <ant:arg value="--outfile"/>
-            <ant:arg value="${distDir}/bin/server.jar"/>
+            <ant:arg value="${distDir}/bin/new-deployer.jar"/>
             <ant:arg value="--mainClass"/>
-            <ant:arg value="org.apache.geronimo.system.main.Daemon"/>
+            <ant:arg value="org.apache.geronimo.deployment.cli.DeployTool"/>
+            <ant:arg value="--classPath"/>
+            <ant:arg value="${deploy.classpath}"/>
+        </ant:java>
+
+        <!-- build the system configuration and server.jar -->
+        <ant:echo>Building server.jar</ant:echo>
+        <ant:mkdir dir="${distDir}/bin"/>
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
+            <ant:jvmarg value="-ea"/>
+            <ant:arg value="package"/>
             <ant:arg value="--classPath"/>
             <ant:arg value="${server.classpath}"/>
+            <ant:arg value="--mainClass"/>
+            <ant:arg value="org.apache.geronimo.system.main.Daemon"/>
+            <ant:arg value="target/plan/system-plan.xml"/>
+            <ant:arg value="${distDir}/bin/server.jar"/>
         </ant:java>
 
         <!-- build the J2EEServer configuration -->
         <ant:echo>Building server configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/j2ee-server-plan.xml"/>
         </ant:java>
 
         <!-- building tranql connector default database configuration-->
         <ant:echo>Building default database configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/default-database-plan.xml"/>
-            <ant:arg value="--module"/>
             <ant:arg value="${maven.repo.local}/tranql/rars/tranql-connector-${tranql_connector_version}.rar"/>
         </ant:java>
 
         <!-- building system database configuration-->
         <ant:echo>Building system database configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/system-database-plan.xml"/>
-            <ant:arg value="--module"/>
             <ant:arg value="${maven.repo.local}/tranql/rars/tranql-connector-${tranql_connector_version}.rar"/>
         </ant:java>
 
         <!-- building system activemq configuration-->
         <ant:echo>Building system activemq configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/system-activemq-plan.xml"/>
         </ant:java>
 
         <!-- building system jms configuration-->
         <ant:echo>Building system jms configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/system-jms-plan.xml"/>
-            <ant:arg value="--module"/>
             <ant:arg value="${maven.repo.local}/activemq/rars/activemq-ra-${activemq_version}.rar"/>
         </ant:java>
 
         <!-- build the J2EEServer secure configuration -->
         <ant:echo>Building secure server configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/j2ee-secure-plan.xml"/>
         </ant:java>
 
         <!-- build the system configuration and client.jar -->
         <ant:echo>Building client.jar</ant:echo>
         <ant:mkdir dir="${distDir}/bin"/>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
-            <ant:arg value="target/plan/client-system-plan.xml"/>
-            <ant:arg value="--outfile"/>
-            <ant:arg value="${distDir}/bin/client.jar"/>
+            <ant:arg value="package"/>
             <ant:arg value="--mainClass"/>
             <ant:arg value="org.apache.geronimo.system.main.ClientCommandLine"/>
             <ant:arg value="--classPath"/>
             <ant:arg value="${client.classpath}"/>
+            <ant:arg value="target/plan/client-system-plan.xml"/>
+            <ant:arg value="${distDir}/bin/client.jar"/>
         </ant:java>
 
         <!-- build the J2EE client configuration -->
         <ant:echo>Building J2EE Client configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--plan"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="target/plan/j2ee-client-plan.xml"/>
         </ant:java>
 
         <!-- build the Demo configuration -->
         <ant:echo>Building demo website configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--module"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="${maven.repo.local}/geronimo/wars/geronimo-demo-${pom.currentVersion}.war"/>
         </ant:java>
 
         <!-- build the Debug Tool configuration "org/apache/geronimo/DebugConsole"-->
         <ant:echo>Building debug tool configuration</ant:echo>
-        <ant:java fork="true" jar="${distDir}/bin/deployer.jar" failonerror="true">
+        <ant:java fork="true" jar="${distDir}/bin/new-deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="--module"/>
+            <ant:arg value="distribute"/>
             <ant:arg value="${maven.repo.local}/geronimo/wars/geronimo-jmxdebug-${pom.currentVersion}.war"/>
         </ant:java>
     </goal>

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/AbstractCommand.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,146 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Base class for CLI deployer commands.  Tracks some simple properties and
+ * has common utility methods.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public abstract class AbstractCommand implements DeployCommand {
+    private String command;
+    private String group;
+    private String helpArgumentList;
+    private String helpText;
+
+    public AbstractCommand(String command, String group, String helpArgumentList, String helpText) {
+        this.command = command;
+        this.group = group;
+        this.helpArgumentList = helpArgumentList;
+        this.helpText = helpText;
+    }
+
+    public String getCommandName() {
+        return command;
+    }
+
+    public String getHelpArgumentList() {
+        return helpArgumentList;
+    }
+
+    public String getHelpText() {
+        return helpText;
+    }
+
+    public String getCommandGroup() {
+        return group;
+    }
+
+    public boolean isLocalOnly() {
+        return false;
+    }
+
+    protected static TargetModuleID[] waitForProgress(PrintWriter out, ProgressObject po) {
+        while(po.getDeploymentStatus().isRunning()) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+        if(po.getDeploymentStatus().isFailed()) {
+            out.println("Deployment failed");
+            out.println("  Server reports: "+po.getDeploymentStatus().getMessage());
+        }
+        return po.getResultTargetModuleIDs();
+    }
+
+    protected static boolean isMultipleTargets(TargetModuleID[] ids) {
+        Set set = new HashSet();
+        for(int i = 0; i < ids.length; i++) {
+            TargetModuleID id = ids[i];
+            set.add(id.getTarget().getName());
+        }
+        return set.size() > 1;
+    }
+
+    protected static Target[] identifyTargets(List targetNames, final DeploymentManager mgr) throws DeploymentException {
+        Target[] tlist = new Target[targetNames.size()];
+        Target[] all = mgr.getTargets();
+        Set found = new HashSet();
+        for (int i = 0; i < tlist.length; i++) {
+            if(found.contains(targetNames.get(i))) {
+                throw new DeploymentException("Target list should not contain duplicates ("+targetNames.get(i)+")");
+            }
+            for (int j = 0; j < all.length; j++) {
+                Target server = all[j];
+                if(server.getName().equals(targetNames.get(i))) {
+                    tlist[i] = server;
+                    found.add(server.getName());
+                    break;
+                }
+            }
+            if(tlist[i] == null) {
+                throw new DeploymentException("No target named '"+targetNames.get(i)+"' was found");
+            }
+        }
+        return tlist;
+    }
+
+    protected static Collection identifyTargetModuleIDs(TargetModuleID[] allModules, String name) throws DeploymentException {
+        List list = new LinkedList();
+        int pos;
+        if((pos = name.indexOf('|')) > -1) {
+            String target = name.substring(0, pos);
+            String module = name.substring(pos+1);
+            // First pass: exact match
+            for(int i=0; i<allModules.length; i++) {
+                if(allModules[i].getTarget().getName().equals(target) && allModules[i].getModuleID().equals(module)) {
+                    list.add(allModules[i]);
+                }
+            }
+        }
+        if(!list.isEmpty()) {
+            return list;
+        }
+        // second pass: module matches
+        for(int i = 0; i < allModules.length; i++) {
+            if(allModules[i].getModuleID().equals(name)) {
+                list.add(allModules[i]);
+            }
+        }
+        if(list.isEmpty()) {
+            throw new DeploymentException(name+" does not appear to be a module name or a TargetModuleID.  For a TargetModuleID, specify it as TargetName|ModuleName");
+        }
+        return list;
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDeploy.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDeploy.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import java.io.PrintWriter;
+import java.io.File;
+
+/**
+ * The CLI deployer logic to deploy (distribute plus start).
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandDeploy extends CommandDistribute {
+    public CommandDeploy() {
+        super("deploy", "1. Common Commands", "[--targets target,target,...] [module] [plan]",
+                "Normally both a module and plan are passed to the deployer.  " +
+                "Sometimes the module contains a plan, or requires no plan, in which case " +
+                "the plan may be omitted.  Sometimes the plan references a module already " +
+                "deployed in the Geronimo server environment, in which case a module does " +
+                "not need to be provided.\n" +
+                "If the server is not currently running, the module will be marked " +
+                "to start next time the server is started.\n" +
+                "If no targets are provided, the module is deployed to all available" +
+                "targets.  Geronimo only provides one target (ever), so this is primarily" +
+                "useful when using a different driver.");
+    }
+
+    protected String getAction() {
+        return "Deployed";
+    }
+
+    protected ProgressObject runCommand(DeploymentManager mgr, PrintWriter out, Target[] tlist, File module, File plan) {
+        TargetModuleID[] modules = waitForProgress(out, mgr.distribute(tlist, module, plan));
+        return mgr.start(modules);
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(!connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        super.execute(out, connection, args);
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandDistribute.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,159 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import java.io.PrintWriter;
+import java.io.File;
+import java.util.*;
+
+/**
+ * The CLI deployer logic to distribute.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandDistribute extends AbstractCommand {
+    public CommandDistribute() {
+        super("distribute", "2. Other Commands", "[--targets target,target,...] [module] [plan]",
+                "Processes a module and adds it to the server environment, but does "+
+                "not start it or mark it to be started in the future." +
+                "Normally both a module and plan are passed to the deployer.  " +
+                "Sometimes the module contains a plan, or requires no plan, in which case " +
+                "the plan may be omitted.  Sometimes the plan references a module already " +
+                "deployed in the Geronimo server environment, in which case a module does " +
+                "not need to be provided.\n" +
+                "If no targets are provided, the module is distributed to all available" +
+                "targets.  Geronimo only provides one target (ever), so this is primarily" +
+                "useful when using a different driver.\n" +
+                "If the server is not running when this command is invoked, no targets may be" +
+                "specified.");
+    }
+
+    protected CommandDistribute(String command, String group, String helpArgumentList, String helpText) {
+        super(command, group, helpArgumentList, helpText);
+    }
+
+    protected ProgressObject runCommand(DeploymentManager mgr, PrintWriter out, Target[] tlist, File module, File plan) {
+        return mgr.distribute(tlist, module, plan);
+    }
+
+    protected String getAction() {
+        return "Distributed";
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(args.length == 0) {
+            throw new DeploymentSyntaxException("Must specify a module or plan (or both)");
+        }
+        List targets = new ArrayList();
+        args = processTargets(args, targets);
+        if(targets.size() > 0 && !connection.isOnline()) {
+            throw new DeploymentSyntaxException("Cannot specify targets unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        if(args.length > 2) {
+            throw new DeploymentSyntaxException("Too many arguments");
+        }
+        File module = null;
+        File plan = null;
+        if(args.length > 0) {
+            File test = new File(args[0]);
+            if(DeployUtils.isJarFile(test)) {
+                if(module != null) {
+                    throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+                }
+                module = test;
+            } else {
+                if(plan != null) {
+                    throw new DeploymentSyntaxException("Module or plan must be a JAR file!");
+                }
+                plan = test;
+            }
+        }
+        if(args.length > 1) {
+            File test = new File(args[1]);
+            if(DeployUtils.isJarFile(test)) {
+                if(module != null) {
+                    throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+                }
+                module = test;
+            } else {
+                if(plan != null) {
+                    throw new DeploymentSyntaxException("Module or plan must be a JAR file!");
+                }
+                plan = test;
+            }
+        }
+        if(module != null) {
+            module = module.getAbsoluteFile();
+        }
+        if(plan != null) {
+            plan = plan.getAbsoluteFile();
+        }
+        if(connection.isOnline()) {
+            executeOnline(connection, targets, out, module, plan);
+        } else {
+            executeOffline(connection, out, module, plan);
+        }
+    }
+
+    private void executeOffline(ServerConnection connection, PrintWriter out, File module, File plan) throws DeploymentException {
+        List list = (List)connection.invokeOfflineDeployer("deploy", new Object[]{module, plan},
+                        new String[]{File.class.getName(), File.class.getName()});
+        for(Iterator it = list.iterator(); it.hasNext();) {
+            out.println(getAction()+" "+it.next());
+        }
+    }
+
+    private void executeOnline(ServerConnection connection, List targets, PrintWriter out, File module, File plan) throws DeploymentException {
+        final DeploymentManager mgr = connection.getDeploymentManager();
+        TargetModuleID[] results;
+        boolean multipleTargets;
+        if(targets.size() > 0) {
+            Target[] tlist = identifyTargets(targets, mgr);
+            multipleTargets = tlist.length > 1;
+            results = waitForProgress(out, runCommand(mgr, out, tlist, module, plan));
+        } else {
+            final Target[] tlist = mgr.getTargets();
+            multipleTargets = tlist.length > 1;
+            results = waitForProgress(out, runCommand(mgr, out, tlist, module, plan));
+        }
+        for (int i = 0; i < results.length; i++) {
+            TargetModuleID result = results[i];
+            out.println(getAction()+" "+result.getModuleID()+(multipleTargets ? " to "+result.getTarget().getName() : ""));
+        }
+    }
+
+    private String[] processTargets(String[] args, List targets) {
+        if(args.length >= 2 && args[0].equals("--targets")) {
+            String value = args[1];
+            StringTokenizer tok = new StringTokenizer(value, ",", false);
+            while(tok.hasMoreTokens()) {
+                targets.add(tok.nextToken());
+            }
+            String[] temp = new String[args.length-2];
+            System.arraycopy(args, 2, temp, 0, temp.length);
+            args = temp;
+        }
+        return args;
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListModules.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListModules.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.TargetException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The CLI deployer logic to list modules.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandListModules extends AbstractCommand {
+    public CommandListModules() {
+        super("list-modules", "2. Other Commands", "[--all|--started|--stopped] [target*]",
+                "Lists the modules available on the specified targets.  If " +
+                "--started or --stopped is specified, only started or stopped modules will " +
+                "be listed; otherwise all modules will be listed.  If no targets are " +
+                "specified, then modules on all targets will be listed; otherwise only " +
+                "modules on the specified targets.");
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(!connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        List targets = new ArrayList();
+        Boolean started = null;
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if(arg.startsWith("--")) {
+                if(arg.equals("--all")) {
+                    if(started != null) {
+                        throw new DeploymentSyntaxException("Cannot specify more than one of --all, --started, --stopped");
+                    }
+                } else if(arg.equals("--started")) {
+                    if(started != null) {
+                        throw new DeploymentSyntaxException("Cannot specify more than one of --all, --started, --stopped");
+                    }
+                    started = Boolean.TRUE;
+                } else if(arg.equals("--stopped")) {
+                    if(started != null) {
+                        throw new DeploymentSyntaxException("Cannot specify more than one of --all, --started, --stopped");
+                    }
+                    started = Boolean.FALSE;
+                } else {
+                    throw new DeploymentSyntaxException("Unrecognized option '"+arg+"'");
+                }
+            } else {
+                targets.add(arg);
+            }
+        }
+        final DeploymentManager mgr = connection.getDeploymentManager();
+        TargetModuleID[] results;
+        Target[] tlist = identifyTargets(targets, mgr);
+        if(tlist.length == 0) {
+            tlist = mgr.getTargets();
+        }
+        try {
+            if(started == null) {
+                results = mgr.getAvailableModules(null, tlist);
+            } else if(started.booleanValue()) {
+                results = mgr.getRunningModules(null, tlist);
+            } else {
+                results = mgr.getNonRunningModules(null, tlist);
+            }
+        } catch (TargetException e) {
+            throw new DeploymentException("Unable to query modules", e);
+        } catch (IllegalStateException e) {
+            throw new DeploymentSyntaxException(e.getMessage());
+        }
+        if(results == null) {
+            results = new TargetModuleID[0];
+        }
+        out.println("Found "+results.length+" module"+(results.length != 1 ? "s" : ""));
+        for (int i = 0; i < results.length; i++) {
+            TargetModuleID result = results[i];
+            out.println("    "+result.getModuleID()+(tlist.length > 1 ? " on "+result.getTarget().getName(): ""));
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListTargets.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandListTargets.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.io.PrintWriter;
+import javax.enterprise.deploy.spi.Target;
+
+/**
+ * The CLI deployer logic to list targets.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandListTargets extends AbstractCommand {
+    public CommandListTargets() {
+        super("list-targets", "2. Other Commands", "",
+                "Lists the targets known to the server you've connected to.\n" +
+                "In the case of Geronimo, each configuration store is a separate " +
+                "target.  Geronimo does not yet support clusters as targets.");
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(!connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        Target[] list = connection.getDeploymentManager().getTargets();
+        out.println("Available Targets:");
+        for(int i = 0; i < list.length; i++) {
+            Target target = list[i];
+            out.println("  "+target.getName());
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandPackage.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandPackage.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,121 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.io.PrintWriter;
+import java.io.File;
+import java.util.List;
+
+/**
+ * The CLI deployer logic to create a configuration package.  Can only be run
+ * in ofline mode (not via JSR-88).
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandPackage extends AbstractCommand {
+    public CommandPackage() {
+        super("package", "3. Use if you know what you're doing", "[--classPath path] [--mainClass class] [module] [plan] fileName",
+                "Creates a configuration JAR rather than installing into the server " +
+                "environment.  The fileName argument specifies the JAR to create.  The " +
+                "optional classPath argument specifies a Class-Path to include in the JAR " +
+                "manifest.  The mainClass argument specifies the Main-Class to include in " +
+                "the JAR manifest.\n" +
+                "The standard arguments may not be used with this command -- it " +
+                "never connects to a remote server.");
+    }
+
+    public boolean isLocalOnly() {
+        return true;
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run when the server is running.  Make sure the server is shut down first.");
+        }
+        String classPath = null;
+        String mainClass = null;
+        File module = null;
+        File plan = null;
+        File packageFile;
+        int i;
+        for(i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if(arg.equals("--classPath")) {
+                classPath = args[++i];
+            } else if(arg.equals("--mainClass")) {
+                mainClass = args[++i];
+            } else if(arg.startsWith("--")) {
+                throw new DeploymentSyntaxException("Invalid argument '"+arg+"'");
+            } else {
+                break;
+            }
+        }
+        if(i >= args.length) {
+            throw new DeploymentSyntaxException("No fileName specified for package command");
+        }
+        packageFile = new File(args[args.length-1]);
+        File parent = packageFile.getAbsoluteFile().getParentFile();
+        if(!parent.exists() || !parent.canWrite()) {
+            throw new DeploymentSyntaxException("Cannot write to output file "+packageFile.getAbsolutePath());
+        }
+        if(i < args.length-1) {
+            File test = new File(args[args.length-2]);
+            if(DeployUtils.isJarFile(test)) {
+                if(module != null) {
+                    throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+                }
+                module = test;
+            } else {
+                if(plan != null) {
+                    throw new DeploymentSyntaxException("Module or plan must be a text file!");
+                }
+                plan = test;
+            }
+        }
+        if(i < args.length-2) {
+            File test = new File(args[args.length-2]);
+            if(DeployUtils.isJarFile(test)) {
+                if(module != null) {
+                    throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+                }
+                module = test;
+            } else {
+                if(plan != null) {
+                    throw new DeploymentSyntaxException("Module or plan must be a text file!");
+                }
+                plan = test;
+            }
+        }
+        if(i < args.length - 3) {
+            throw new DeploymentSyntaxException("Too many arguments for deploy command");
+        }
+        if(module != null) {
+            module = module.getAbsoluteFile();
+        }
+        if(plan != null) {
+            plan = plan.getAbsoluteFile();
+        }
+        List list = (List)connection.invokeOfflineDeployer("deploy", new Object[]{plan, module, packageFile, Boolean.TRUE, mainClass, classPath},
+                        new String[]{File.class.getName(), File.class.getName(), File.class.getName(), boolean.class.getName(), String.class.getName(), String.class.getName()});
+        for (int j = 0; j < list.size(); j++) {
+            out.println("Packaged configuration "+list.get(j)+" to "+packageFile);
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,118 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.io.PrintWriter;
+import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.exceptions.TargetException;
+
+/**
+ * The CLI deployer logic to redeploy.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandRedeploy extends AbstractCommand {
+    public CommandRedeploy() {
+        super("redeploy", "1. Common Commands", "[module] [plan] [ModuleID|TargetModuleID+]",
+                "A shortcut to undeploy a module from one or more servers, then " +
+                "deploy a new version.  This is not a smooth cutover -- some client " +
+                "requests may be rejected while the redeploy takes place.\n" +
+                "Normally both a module and plan are passed to the deployer. " +
+                "Sometimes the module contains a plan, or requires no plan, in which case " +
+                "the plan may be omitted.  Sometimes the plan references a module already " +
+                "deployed in the Geronimo server environment, in which case a module does " +
+                "not need to be provided.\n" +
+                "If more than one TargetModuleID is provided, all TargetModuleIDs " +
+                "must refer to the same module (just running on different targets).\n" +
+                "Regardless of whether the old module was running or not, the new " +
+                "module will be started (if the server is running) or marked to start (if " +
+                "the server is not running).\n" +
+                "Note: To specify a TargetModuleID, use the form TargetName|ModuleName");
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(!connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        if(args.length < 2) {
+            throw new DeploymentSyntaxException("Must specify a module or plan (or both) and one or more module IDs to replace");
+        }
+        DeploymentManager mgr = connection.getDeploymentManager();
+        Target[] allTargets = mgr.getTargets();
+        TargetModuleID[] allModules = new TargetModuleID[0];
+        try {
+            allModules = mgr.getAvailableModules(null, allTargets);
+        } catch(TargetException e) {
+            throw new DeploymentException("Unable to load modules from server", e);
+        }
+        List modules = new ArrayList();
+        File module = null;
+        File plan = null;
+        File test = new File(args[0]);
+        if(!test.exists()) {
+            throw new DeploymentSyntaxException("Must specify a module or plan (or both) and one or more module IDs to replace");
+        }
+        if(!test.canRead()) {
+            throw new DeploymentException("Cannot read file "+test.getAbsolutePath());
+        }
+        if(DeployUtils.isJarFile(test)) {
+            if(module != null) {
+                throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+            }
+            module = test;
+        } else {
+            if(plan != null) {
+                throw new DeploymentSyntaxException("Module or plan must be a JAR file!");
+            }
+            plan = test;
+        }
+        test = new File(args[1]);
+        if(test.exists() && test.canRead()) {
+            if(DeployUtils.isJarFile(test)) {
+                if(module != null) {
+                    throw new DeploymentSyntaxException("Module and plan cannot both be JAR files!");
+                }
+                module = test;
+            } else {
+                if(plan != null) {
+                    throw new DeploymentSyntaxException("Module or plan must be a JAR file!");
+                }
+                plan = test;
+            }
+        } else {
+            modules.addAll(identifyTargetModuleIDs(allModules, args[1]));
+        }
+        for(int i=2; i<args.length; i++) {
+            modules.addAll(identifyTargetModuleIDs(allModules, args[i]));
+        }
+        TargetModuleID[] ids = (TargetModuleID[]) modules.toArray(new TargetModuleID[modules.size()]);
+        boolean multiple = isMultipleTargets(ids);
+        TargetModuleID[] done = waitForProgress(out, mgr.redeploy(ids, module, plan));
+        for(int i = 0; i < done.length; i++) {
+            TargetModuleID id = done[i];
+            out.println("Redeployed "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : ""));
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStart.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStart.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,87 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.exceptions.TargetException;
+
+/**
+ * The CLI deployer logic to start.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandStart extends AbstractCommand {
+    public CommandStart() {
+        super("start", "1. Common Commands", "[ModuleID|TargetModuleID]+",
+                "Accepts the configId of a module, or the fully-qualified " +
+                "TargetModuleID identifying both the module and the server or cluster it's " +
+                "on, and starts that module.  The module should be available to the server " +
+                "but not currently running.  If multiple modules are specified, they will " +
+                "all be started.\n" +
+                "If the server is not running, the module will be marked to start " +
+                "next time the server is started.");
+    }
+
+    public CommandStart(String command, String group, String helpArgumentList, String helpText) {
+        super(command, group, helpArgumentList, helpText);
+    }
+
+    public void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException {
+        if(!connection.isOnline()) {
+            throw new DeploymentException("This command cannot be run unless connecting to a running server.  Specify --url if server is not running on the default port on localhost.");
+        }
+        if(args.length == 0) {
+            throw new DeploymentSyntaxException("Must specify at least one module name or TargetModuleID");
+        }
+        DeploymentManager mgr = connection.getDeploymentManager();
+        Target[] allTargets = mgr.getTargets();
+        TargetModuleID[] allModules = new TargetModuleID[0];
+        try {
+            allModules = mgr.getAvailableModules(null, allTargets);
+        } catch(TargetException e) {
+            throw new DeploymentException("Unable to load module list from server", e);
+        }
+        List modules = new ArrayList();
+        for(int i=0; i<args.length; i++) {
+            modules.addAll(identifyTargetModuleIDs(allModules, args[i]));
+        }
+        TargetModuleID[] ids = (TargetModuleID[]) modules.toArray(new TargetModuleID[modules.size()]);
+        boolean multiple = isMultipleTargets(ids);
+        TargetModuleID[] done = runCommand(out, mgr, ids);
+        for(int i = 0; i < done.length; i++) {
+            TargetModuleID id = done[i];
+            out.println(getAction()+" "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : ""));
+        }
+    }
+
+    protected TargetModuleID[] runCommand(PrintWriter out, DeploymentManager mgr, TargetModuleID[] ids) {
+        return waitForProgress(out, mgr.start(ids));
+    }
+
+    protected String getAction() {
+        return "Started";
+    }
+
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStop.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandStop.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,49 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import java.io.PrintWriter;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.DeploymentManager;
+
+/**
+ * The CLI deployer logic to stop.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandStop extends CommandStart {
+    public CommandStop() {
+        super("stop", "1. Common Commands", "[ModuleID|TargetModuleID]+",
+                "Accepts the configId of a module, or the fully-qualified " +
+                "TargetModuleID identifying both the module and the server or cluster it's " +
+                "on, and stops that module.  The module should be available to the server " +
+                "and running.  After stop is completed, the server still has the module and " +
+                "deployment information available, it's just not running.  If multiple " +
+                "modules are specified, they will all be stopped.\n" +
+                "If the server is not running, the module will be marked to not " +
+                "start next time the server is started.");
+    }
+
+    protected TargetModuleID[] runCommand(PrintWriter out, DeploymentManager mgr, TargetModuleID[] ids) {
+        return waitForProgress(out, mgr.stop(ids));
+    }
+
+    protected String getAction() {
+        return "Stopped";
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import java.io.PrintWriter;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.DeploymentManager;
+
+/**
+ * the CLI deployer logic to undeploy.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class CommandUndeploy extends CommandStart {
+    public CommandUndeploy() {
+        super("undeploy", "1. Common Commands", "[ModuleID|TargetModuleID]+",
+                "Accepts the configId of a module, or the fully-qualified " +
+                "TargetModuleID identifying both the module and the server or cluster it's " +
+                "on, stops that module, and removes the deployment files for that module " +
+                "from the server environment.  If multiple modules are specified, they will " +
+                "all be undeployed.");
+    }
+
+    protected TargetModuleID[] runCommand(PrintWriter out, DeploymentManager mgr, TargetModuleID[] ids) {
+        return waitForProgress(out, mgr.undeploy(ids));
+    }
+
+    protected String getAction() {
+        return "Undeployed";
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployCommand.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployCommand.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.io.PrintWriter;
+
+/**
+ * An abstraction of various CLI deployer commands.  Holds metadata like help
+ * text, and also the logic to validate arguments and execute the command.
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public interface DeployCommand {
+    String getCommandGroup();
+    String getCommandName();
+    String getHelpArgumentList();
+    String getHelpText();
+    boolean isLocalOnly();
+    void execute(PrintWriter out, ServerConnection connection, String[] args) throws DeploymentException;
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployTool.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,255 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+import java.util.*;
+import java.io.PrintWriter;
+import java.io.OutputStreamWriter;
+
+/**
+ * The main class for the CLI deployer.  Handles chunking the input arguments
+ * and formatting help text and maintaining the list of individual commands.
+ * Uses a ServerConnection to handle the server connection and arguments, and
+ * a list of DeployCommands to manage the details of the various available
+ * commands.
+ *
+ * Returns 0 normally, or 1 of any exceptions or error messages were generated
+ * (whether for syntax or other failure).
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class DeployTool {
+    private final static Map commands = new HashMap();
+
+    public static void registerCommand(DeployCommand command) {
+        String key = command.getCommandName();
+        if(commands.containsKey(key)) {
+            throw new IllegalArgumentException("Command "+key+" is already registered!");
+        } else {
+            commands.put(key, command);
+        }
+    }
+
+    private static DeployCommand getCommand(String name) {
+        return (DeployCommand) commands.get(name);
+    }
+
+    private static DeployCommand[] getAllCommands() {
+        DeployCommand[] list = (DeployCommand[]) commands.values().toArray(new DeployCommand[0]);
+        Arrays.sort(list, new Comparator() {
+            public int compare(Object o1, Object o2) {
+                return ((DeployCommand)o1).getCommandName().compareTo(((DeployCommand)o2).getCommandName());
+            }
+        });
+        return list;
+    }
+
+    static {
+        registerCommand(new CommandDeploy());
+        registerCommand(new CommandDistribute());
+        registerCommand(new CommandListModules());
+        registerCommand(new CommandListTargets());
+        registerCommand(new CommandPackage());
+        registerCommand(new CommandRedeploy());
+        registerCommand(new CommandStart());
+        registerCommand(new CommandStop());
+        registerCommand(new CommandUndeploy());
+    }
+
+    private boolean failed = false;
+
+    public boolean execute(String args[]) {
+        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), true);
+        String command;
+        String[] commonArgs = new String[0];
+        String[] commandArgs = new String[0];
+        if(args.length == 0) {
+            command = "help";
+        } else {
+            String[] temp = getCommonArgsAndCommand(args);
+            if(temp == null) {
+                command = "help";
+            } else {
+                command = temp[temp.length-1];
+                commonArgs = new String[temp.length-1];
+                System.arraycopy(temp, 0, commonArgs, 0, temp.length-1);
+                commandArgs = new String[args.length - temp.length];
+                System.arraycopy(args, temp.length, commandArgs, 0, commandArgs.length);
+            }
+        }
+        if(command.equals("help")) {
+            showHelp(out, commandArgs);
+        } else {
+            DeployCommand dc = getCommand(command);
+            if(dc == null) {
+                showHelp(out, new String[0]);
+            } else {
+                ServerConnection con = null;
+                try {
+                    con = new ServerConnection(commonArgs, dc.isLocalOnly());
+                    try {
+                        dc.execute(out, con, commandArgs);
+                    } catch (DeploymentSyntaxException e) {
+                        processException(out, e);
+                    } catch (DeploymentException e) {
+                        processException(out, e);
+                    } finally {
+                        try {
+                            con.close();
+                        } catch(DeploymentException e) {
+                            processException(out, e);
+                        }
+                    }
+                } catch(DeploymentException e) {
+                    processException(out, e);
+                }
+            }
+        }
+        out.flush();
+        return !failed;
+    }
+
+    private void processException(PrintWriter out, Exception e) {
+        failed = true;
+        out.println(DeployUtils.reformat("Error: "+e.getMessage(),4,72));
+        if(e.getCause() != null) {
+            e.getCause().printStackTrace(out);
+        }
+    }
+
+    private void showHelp(PrintWriter out, String[] args) {
+        out.println();
+        out.println("Command-line deployer syntax:");
+        out.println("    deployer [general options] command [command options]");
+        out.println();
+        if(args.length > 0) {
+            DeployCommand command = getCommand(args[0]);
+            if(command != null) {
+                out.println("Help for command: "+command.getCommandName());
+                out.println();
+                out.println("    deployer "+hangingIndent(command.getCommandName()+" "+command.getHelpArgumentList(), 13));
+                out.println();
+                out.println(DeployUtils.reformat(command.getHelpText(), 8, 72));
+                out.println();
+                return;
+            } else if(args[0].equals("options")) {
+                out.println("Help on general options:");
+                out.println();
+                Map map = ServerConnection.getOptionHelp();
+                for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+                    String s = (String) it.next();
+                    out.println("   "+s);
+                    out.println();
+                    out.println(DeployUtils.reformat((String)map.get(s), 8, 72));
+                }
+                return;
+            } else if(args[0].equals("all")) {
+                DeployCommand[] all = getAllCommands();
+                out.println();
+                out.println("All commands");
+                out.println();
+                for (int i = 0; i < all.length; i++) {
+                    DeployCommand cmd = all[i];
+                    out.println("    deployer "+hangingIndent(cmd.getCommandName()+" "+cmd.getHelpArgumentList(), 13));
+                    out.println(DeployUtils.reformat(cmd.getHelpText(), 8, 72));
+                }
+                out.println();
+                return;
+            }
+        }
+        out.println("The general options are:");
+        Map map = ServerConnection.getOptionHelp();
+        for (Iterator it = map.keySet().iterator(); it.hasNext();) {
+            String s = (String) it.next();
+            out.println("    "+s);
+        }
+        out.println();
+        out.println("The available commands are:");
+        renderCommandList(out, getAllCommands());
+        out.println();
+        out.println("For more information about a specific command, run");
+        out.println("    deployer help [command name]");
+        out.println();
+        out.println("For more information about general options, run");
+        out.println("    deployer help options");
+        out.println();
+    }
+
+    private String hangingIndent(String source, int cols) {
+        String s = DeployUtils.reformat(source, cols, 72);
+        return s.substring(cols);
+    }
+
+    private void renderCommandList(PrintWriter out, DeployCommand[] all) {
+        Map temp = new HashMap();
+        for (int i = 0; i < all.length; i++) {
+            DeployCommand command = all[i];
+            List list = (List) temp.get(command.getCommandGroup());
+            if(list == null) {
+                list = new ArrayList();
+                temp.put(command.getCommandGroup(), list);
+            }
+            list.add(command.getCommandName());
+        }
+        List groups = new ArrayList(temp.keySet());
+        Collections.sort(groups);
+        for (int i = 0; i < groups.size(); i++) {
+            String name = (String) groups.get(i);
+            out.println("    "+name);
+            List list = (List) temp.get(name);
+            Collections.sort(list);
+            for (int j = 0; j < list.size(); j++) {
+                String cmd = (String) list.get(j);
+                out.println("        "+cmd);
+            }
+        }
+    }
+
+    private String[] getCommonArgsAndCommand(String[] all) {
+        List list = new ArrayList();
+        boolean prefix = false;
+        for (int i = 0; i < all.length; i++) {
+            String s = all[i];
+            list.add(s);
+            if(s.startsWith("-")) {
+                if(prefix) {
+                    return null;
+                } else {
+                    prefix = true;
+                }
+            } else {
+                if(prefix) {
+                    prefix = false;
+                } else {
+                    break;
+                }
+            }
+        }
+        return (String[]) list.toArray(new String[list.size()]);
+    }
+
+    public static void main(String[] args) {
+        if(!new DeployTool().execute(args)) {
+            System.exit(1);
+        } else {
+            System.exit(0);
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeployUtils.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,93 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import java.io.*;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+/**
+ *
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class DeployUtils {
+    public static String reformat(String source, int indent, int endCol) {
+        StringBuffer buf = new StringBuffer((int)(source.length()*1.1));
+        String prefix = indent == 0 ? "" : buildIndent(indent);
+        try {
+            BufferedReader in = new BufferedReader(new StringReader(source));
+            String line;
+            int pos;
+            while((line = in.readLine()) != null) {
+                if(buf.length() > 0) {
+                    buf.append('\n');
+                }
+                while(line.length() > 0) {
+                    line = prefix + line;
+                    if(line.length() > endCol) {
+                        pos = line.lastIndexOf(' ', endCol);
+                        if(pos < 0) {
+                            pos = line.indexOf(' ', endCol);
+                            if(pos < 0) {
+                                pos = line.length();
+                            }
+                        }
+                        buf.append(line.substring(0, pos)).append('\n');
+                        if(pos < line.length()-1) {
+                            line = line.substring(pos+1);
+                        } else {
+                            break;
+                        }
+                    } else {
+                        buf.append(line).append("\n");
+                        break;
+                    }
+                }
+            }
+        } catch (IOException e) {
+            throw new AssertionError("This should be impossible");
+        }
+        return buf.toString();
+    }
+
+    private static String buildIndent(int indent) {
+        StringBuffer buf = new StringBuffer(indent);
+        for(int i=0; i<indent; i++) {
+            buf.append(' ');
+        }
+        return buf.toString();
+    }
+
+    public static boolean isJarFile(File file) throws DeploymentException {
+        if(!file.canRead()) {
+            throw new DeploymentException("Cannot read file "+file.getAbsolutePath());
+        }
+        if(file.length() < 4) {
+            return false;
+        }
+        try {
+            DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
+            int test = in.readInt();
+            in.close();
+            return test == 0x504b0304;
+        } catch(IOException e) {
+            throw new DeploymentException("Cannot read from file "+file.getAbsolutePath(), e);
+        }
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeploymentSyntaxException.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/DeploymentSyntaxException.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import org.apache.geronimo.deployment.DeploymentException;
+
+/**
+ * Something was wrong with the user's syntax (as opposed to the command
+ * failed for some other reason).
+ * 
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class DeploymentSyntaxException extends DeploymentException {
+    public DeploymentSyntaxException() {
+    }
+
+    public DeploymentSyntaxException(Throwable cause) {
+        super(cause);
+    }
+
+    public DeploymentSyntaxException(String message) {
+        super(message);
+    }
+
+    public DeploymentSyntaxException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/cli/ServerConnection.java	Thu Nov  4 21:09:43 2004
@@ -0,0 +1,188 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.deployment.cli;
+
+import java.util.*;
+import java.net.URI;
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.geronimo.deployment.plugin.factories.AuthenticationFailedException;
+import org.apache.geronimo.system.main.CommandLine;
+
+/**
+ * Supports two types of connections to the server.  One, via JSR-88, is valid
+ * whenever the server is online, for any command except "package".  The other,
+ * via direct Kernel invocation, is valid when the server is not running for
+ * only the commands "distribute" and "package".
+ *
+ * @version $Rev: 53762 $ $Date: 2004-10-04 18:54:53 -0400 (Mon, 04 Oct 2004) $
+ */
+public class ServerConnection {
+    private final static Map OPTION_HELP = new LinkedHashMap(4);
+    static {
+        OPTION_HELP.put("--uri", "A URI to contact the server.  The server must be running for this " +
+                "to work.  If not specified, the deployer default to operating on a " +
+                "Geronimo server running on the standard port on localhost, or if nothing " +
+                "is available there, then the Geronimo server installation that the " +
+                "deployer JAR is part of.\n" +
+                "A URI to connect to Geronimo has the form: " +
+                "geronimo:deployer:jmx:rmi://localhost/jndi/rmi:/JMXConnector");
+        OPTION_HELP.put("--driver", "If you want to use this tool with a server other than Geronimo, " +
+                "then you must provide the path to its driver JAR.  Currently, manifest " +
+                "Class-Path entries in that JAR are ignored.");
+        OPTION_HELP.put("--user", "If the deployment operation requires authentication, then you can " +
+                "specify the username to use to connect.  If no password is specified, the " +
+                "deployer will attempt to connect to the server with no password, and if " +
+                "that fails, will prompt you for a password.");
+        OPTION_HELP.put("--password", "Specifies a password to use to authenticate to the server.");
+    }
+    public static Map getOptionHelp() {
+        return OPTION_HELP;
+    }
+
+    private final static String DEPLOYER_OBJECT_NAME="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer";
+    private final static String DEFAULT_URI = "deployer:geronimo:jmx:rmi://localhost/jndi/rmi:/JMXConnector";
+
+    private DeploymentManager manager;
+    private KernelWrapper kernel;
+
+    public ServerConnection(String[] args, boolean forceLocal) throws DeploymentException {
+        String uri = null, driver = null, user = null, password = null;
+        for(int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if(arg.equals("--uri")) {
+                uri = args[++i];
+            } else if(arg.equals("--driver")) {
+                driver = args[++i];
+            } else if(arg.equals("--user")) {
+                user = args[++i];
+            } else if(arg.equals("--password")) {
+                password = args[++i];
+            } else {
+                throw new DeploymentException("Invalid option "+arg);
+            }
+        }
+        if((driver != null) && uri == null) {
+            throw new DeploymentSyntaxException("A custom driver requires a custom URI");
+        }
+        if(forceLocal && (uri != null || driver != null || user != null || password != null)) {
+            throw new DeploymentSyntaxException("This command does not use normal server connectivity.  No standard options are allowed.");
+        }
+        if(!forceLocal) {
+            tryToConnect(uri, driver, user, password);
+            if(manager == null) { // uri must be null too or we'd have thrown an exception
+                initializeKernel();
+            }
+        } else {
+            initializeKernel();
+        }
+    }
+
+    private void initializeKernel() throws DeploymentException {
+        if(kernel != null) {
+            throw new IllegalStateException("Kernel is already running!");
+        }
+        kernel = new KernelWrapper();
+        kernel.start();
+    }
+
+    public void close() throws DeploymentException {
+        if(manager != null) {
+            manager.release();
+        }
+        if(kernel != null) {
+            kernel.stop();
+        }
+    }
+
+    private void tryToConnect(String uri, String driver, String user, String password) throws DeploymentException {
+        DeploymentFactoryManager mgr = DeploymentFactoryManager.getInstance();
+        mgr.registerDeploymentFactory(new DeploymentFactoryImpl());
+        if(driver != null) {
+            try {
+                DeploymentFactory factory = (DeploymentFactory) Class.forName(driver).newInstance();
+                mgr.registerDeploymentFactory(factory);
+            } catch(Exception e) {
+                throw new DeploymentSyntaxException("Unable to load driver class "+driver, e);
+            }
+        }
+        try {
+            manager = mgr.getDeploymentManager(uri == null ? DEFAULT_URI : uri, user, password);
+        } catch(AuthenticationFailedException e) { // server's there, you just can't talk to it
+            throw new DeploymentException("Unable to connect to server: "+e.getMessage());
+        } catch(DeploymentManagerCreationException e) {
+            if(uri != null) {
+                throw new DeploymentException("Unable to connect to server at "+uri+" -- "+e.getMessage());
+            } //else, fall through and try local access
+        }
+    }
+
+    public DeploymentManager getDeploymentManager() {
+        return manager;
+    }
+
+    public boolean isOnline() {
+        return manager != null;
+    }
+
+    public Object invokeOfflineDeployer(String method, Object[] args, String[] argTypes) throws DeploymentException {
+        if(kernel == null) {
+            throw new IllegalStateException("Cannot attempt to package when no local kernel is available");
+        }
+        try {
+            return kernel.invoke(new ObjectName(DEPLOYER_OBJECT_NAME), method, args, argTypes);
+        } catch(MalformedObjectNameException e) {
+            throw new DeploymentException("This should never happen", e);
+        }
+    }
+
+    private static class KernelWrapper extends CommandLine {
+        public Object invoke(ObjectName target, String method, Object[] args, String[] argTypes) throws DeploymentException {
+            try {
+                return getKernel().invoke(target, method, args, argTypes);
+            } catch(Exception e) {
+                throw new DeploymentException("Unable to connect to local deployer service", e);
+            }
+        }
+
+        public void start() throws DeploymentException {
+            //todo: load configuration list dynamically once the bootstrapper builds this deploy tool
+            List configurations = new ArrayList();
+            try {
+                configurations.add(new URI("org/apache/geronimo/J2EEDeployer"));
+                super.startKernel(configurations);
+            } catch(Exception e) {
+                throw new DeploymentException("Unable to start local kernel", e);
+            }
+        }
+
+        public void stop() throws DeploymentException {
+            try {
+                super.stopKernel();
+            } catch(Exception e) {
+                throw new DeploymentException("Unable to stop local kernel", e);
+            }
+        }
+    }
+}

Mime
View raw message