You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/12/14 20:26:08 UTC

svn commit: r890450 - in /geronimo/server/trunk/framework/modules: geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ geronimo-shell-base/ geronimo-shell-base/src/main/java/org/apache/geronimo/shell/

Author: rickmcguire
Date: Mon Dec 14 19:24:54 2009
New Revision: 890450

URL: http://svn.apache.org/viewvc?rev=890450&view=rev
Log:
GERONIMO-4986 Convert shell commands to gogo command infrastructure.
initial command base classes and the first set of converted groovy scripts. 

Added:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java   (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/InputPrompt.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java Mon Dec 14 19:24:54 2009
@@ -30,7 +30,6 @@
 import javax.enterprise.deploy.spi.status.ProgressListener;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import jline.ConsoleReader;
 import org.apache.geronimo.common.DeploymentException;
 
 /**
@@ -83,8 +82,7 @@
                 Thread.sleep(100);
             } catch (InterruptedException e) {
                 try {
-                    out.printString(e.getMessage());
-                    out.printNewline();
+                    out.println(e.getMessage());
                 } catch (IOException e1) {
                     //ignore
                 }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java Mon Dec 14 19:24:54 2009
@@ -25,7 +25,6 @@
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
 import org.apache.geronimo.common.DeploymentException;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to deploy (distribute plus start).

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java Mon Dec 14 19:24:54 2009
@@ -28,7 +28,6 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import jline.ConsoleReader;
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.cli.deployer.DistributeCommandArgs;
 import org.apache.geronimo.common.DeploymentException;
@@ -183,7 +182,7 @@
         }
         return args;
     }
-    
+
     private String[] processInPlace(String[] args, BooleanHolder inPlaceHolder) {
         if(args.length >= 2 && args[0].equals("--inPlace")) {
         	inPlaceHolder.inPlace = true;
@@ -193,7 +192,7 @@
         }
         return args;
     }
-    
+
     private final class BooleanHolder {
     	public boolean inPlace;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java Mon Dec 14 19:24:54 2009
@@ -28,7 +28,6 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.system.plugin.DownloadResults;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to start.
@@ -57,7 +56,7 @@
                 long start = System.currentTimeMillis();
                 DownloadResults results = showProgress(consoleReader, mgr, key);
                 int time = (int)(System.currentTimeMillis() - start) / 1000;
-                printResults(consoleReader, results, time);            
+                printResults(consoleReader, results, time);
             } catch (IOException e) {
                 throw new DeploymentException("Cannot install plugin", e);
             }
@@ -96,8 +95,8 @@
             }
         }
     }
-    
-    static void printResults(ConsoleReader consoleReader, DownloadResults results, int time) throws IOException, DeploymentException {
+
+    public static void printResults(ConsoleReader consoleReader, DownloadResults results, int time) throws IOException, DeploymentException {
         consoleReader.printNewline();
         if (!results.isFailed()) {
             DeployUtils.println("**** Installation Complete!", 0, consoleReader);

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java Mon Dec 14 19:24:54 2009
@@ -27,7 +27,6 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
 import org.apache.geronimo.kernel.repository.Artifact;
-import jline.ConsoleReader;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java Mon Dec 14 19:24:54 2009
@@ -32,8 +32,6 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.security.auth.login.FailedLoginException;
 
-import jline.ConsoleReader;
-
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
@@ -97,14 +95,13 @@
         if (all.length == 1) {
             String repo = all[0].toString();
             consoleReader.printNewline();
-            consoleReader.printString("Selected repository: " + repo);
+            consoleReader.println("Selected repository: " + repo);
             consoleReader.printNewline();
             return repo;
         }
 
         consoleReader.printNewline();
-        consoleReader.printString("Select repository:");
-        consoleReader.printNewline();
+        consoleReader.println("Select repository:");
         for (int i = 0; i < all.length; i++) {
             URL url = all[i];
             DeployUtils.printTo("  " + (i + 1) + ". ", 8, consoleReader);
@@ -162,7 +159,7 @@
         List<String> appList = getApplicationModuleLists(mgr);
 
         PluginListType appPlugin = getPluginsFromIds(appList, data);
-        
+
         // let's add framework plugin group manually so that users can choose it
         for (PluginType metadata : data.getPlugin()) {
             for (PluginArtifactType testInstance : metadata.getPluginArtifact()) {
@@ -173,10 +170,10 @@
                 }
             }
         }
-        
+
         return appPlugin;
     }
-    
+
     public PluginListType getLocalPluginGroups(GeronimoDeploymentManager mgr, ConsoleReader consoleReader) throws DeploymentException, IOException {
         PluginListType data = getLocalPluginCategories(mgr, consoleReader);
         PluginListType appData = new PluginListType();
@@ -190,19 +187,19 @@
             if (metadata.getCategory() == null) {
                 metadata.setCategory("Unspecified");
             }
-       
+
             //determine if the plugin is a plugin group
             if (metadata.isPluginGroup() != null && metadata.isPluginGroup()) {
                 appData.getPlugin().add(metadata);
             }
         }
-        
+
         if (appData == null || appData.getPlugin().size() == 0) {
             return null;
         }
         return appData;
     }
-    
+
     private Map<String, Collection<PluginType>> writePluginList(PluginListType data, ConsoleReader consoleReader) throws IOException {
         if (data == null) {
             consoleReader.printNewline();
@@ -238,17 +235,17 @@
         for (PluginType metadata : plugins1.getPlugin()) {
             plugins.getPlugin().add(metadata);
         }
-        
+
         for (PluginType metadata : plugins2.getPlugin()) {
             plugins.getPlugin().add(metadata);
-        }        
-        
+        }
+
         return getInstallList(plugins, consoleReader, repo);
     }
     public PluginListType getInstallList(PluginListType plugins, ConsoleReader consoleReader, String repo) throws IOException {
         Map<String, Collection<PluginType>> categories = writePluginList(plugins, consoleReader);
         List<String> defaultRepoLocations = plugins.getDefaultRepository();
-        
+
         if (categories == null) {
             return null;
         }
@@ -285,11 +282,11 @@
             PluginType target = available.get(selection - 1);
             list.getPlugin().add(target);
         }
-        
+
         if (repo != null) {
             list.getDefaultRepository().add(repo);
         }
-        
+
         //let's add the repo's default-repository to the list
         for (String defaultRepoLocation : defaultRepoLocations) {
             list.getDefaultRepository().add(defaultRepoLocation);
@@ -338,12 +335,12 @@
         PluginListType selected = getPluginsFromIds(list, all);
         assembleServer(mgr, selected, repositoryPath, relativeServerPath, consoleReader);
     }
-    
+
     private List<String> getApplicationModuleLists(GeronimoDeploymentManager mgr) throws DeploymentException {
         List<String> apps = new ArrayList<String>();
-        
+
         TargetModuleID[] modules;
-        
+
         try {
             modules = mgr.getAvailableModules(null, mgr.getTargets());
         } catch (TargetException e) {
@@ -351,7 +348,7 @@
         } catch (IllegalStateException e) {
             throw new DeploymentSyntaxException(e.getMessage(), e);
         }
-        
+
         for (int i = 0; i < modules.length; i++) {
             ModuleType type = ((TargetModuleIDImpl)modules[i]).getType();
             if (type != null) {
@@ -360,8 +357,8 @@
                 }
             }
         }
-        
+
         return apps;
-        
+
     }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java Mon Dec 14 19:24:54 2009
@@ -30,7 +30,6 @@
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.cli.deployer.ListModulesCommandArgs;
 import org.apache.geronimo.common.DeploymentException;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to list modules.
@@ -51,7 +50,7 @@
         } else if (listModulesCommandArgs.isStopped()) {
             started = Boolean.FALSE;
         }
-        
+
         List targets = Arrays.asList(listModulesCommandArgs.getArgs());
 
         final DeploymentManager mgr = connection.getDeploymentManager();
@@ -88,7 +87,7 @@
                 consoleReader.printString(" deployed to " + tlist.length + " target" + (tlist.length != 1 ? "s" : ""));
             }
             consoleReader.printNewline();
-            
+
             // for each target, print the modules that were deployed to it
             for (int i = 0; (tlist != null) && (i < tlist.length); i++) {
                 Target target = tlist[i];
@@ -110,7 +109,7 @@
      * Prints the names of the modules (that belong to the target) on
      * the provided PrintWriter.
      *
-     * @param out a <code>PrintWriter</code> 
+     * @param out a <code>PrintWriter</code>
      * @param target a <code>Target</code> value; only the modules
      * whose target equals this one will be listed.  Must not be null.
      * @param modules a <code>TargetModuleID[]</code> value, must not

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java Mon Dec 14 19:24:54 2009
@@ -23,7 +23,6 @@
 
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.common.DeploymentException;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to list targets.

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java Mon Dec 14 19:24:54 2009
@@ -30,7 +30,6 @@
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.crypto.EncryptionManager;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to start.

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java Mon Dec 14 19:24:54 2009
@@ -32,7 +32,6 @@
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.FileUtils;
 import org.apache.geronimo.kernel.repository.Artifact;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to redeploy.

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java Mon Dec 14 19:24:54 2009
@@ -22,8 +22,6 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import jline.ConsoleReader;
-
 /**
  * The CLI deployer logic to restart.
  */

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java Mon Dec 14 19:24:54 2009
@@ -30,7 +30,6 @@
 
 import org.apache.geronimo.cli.deployer.CommandArgs;
 import org.apache.geronimo.common.DeploymentException;
-import jline.ConsoleReader;
 
 /**
  * The CLI deployer logic to start.

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java Mon Dec 14 19:24:54 2009
@@ -23,8 +23,6 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import jline.ConsoleReader;
-
 /**
  * The CLI deployer logic to stop.
  *

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java Mon Dec 14 19:24:54 2009
@@ -23,8 +23,6 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 
-import jline.ConsoleReader;
-
 /**
  * the CLI deployer logic to undeploy.
  *

Added: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,78 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.IOException;
+
+/**
+ * Abstract interface for an interface between command components
+ * and a console.
+ */
+public interface ConsoleReader {
+    /**
+     * Print an end-of-line marker.
+     *
+     * @exception IOException
+     */
+    void printNewline() throws IOException;
+
+    /**
+     * Print a string to the console (without a newline).
+     *
+     * @param s      The string to print.
+     *
+     * @exception IOException
+     */
+    void printString(String s) throws IOException;
+
+    /**
+     * Print a line to the console (with a newline).
+     *
+     * @param s      The string to print.
+     *
+     * @exception IOException
+     */
+    void println(String s) throws IOException;
+
+
+    /**
+     * Read a line from the console.
+     *
+     * @return The next line from the console.
+     * @exception IOException
+     */
+    String readLine() throws IOException;
+
+
+    /**
+     * Read a line from the console with a prompt.
+     *
+     * @param prompt The prompt string used for the reading.
+     *
+     * @return The next line from the console.
+     * @exception IOException
+     */
+    String readLine(String prompt) throws IOException;
+
+
+    /**
+     * Flush any pending writes to the console.
+     *
+     * @exception IOException
+     */
+    void flushConsole() throws IOException;
+}
+

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ConsoleReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java Mon Dec 14 19:24:54 2009
@@ -24,8 +24,6 @@
 import java.io.Reader;
 import java.io.BufferedReader;
 
-import jline.ConsoleReader;
-
 /**
  * An abstraction of various CLI deployer commands.
  *

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java Mon Dec 14 19:24:54 2009
@@ -57,8 +57,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import jline.ConsoleReader;
-
 
 /**
  * The main class for the CLI deployer.  Handles chunking the input arguments
@@ -109,13 +107,13 @@
         this.kernel = kernel;
         this.deploymentFactory = deploymentFactory;
     }
-    
+
     public int execute(Object opaque) {
         if (! (opaque instanceof DeployerCLParser)) {
             throw new IllegalArgumentException("Argument type is [" + opaque.getClass() + "]; expected [" + DeployerCLParser.class + "]");
         }
         DeployerCLParser parser = (DeployerCLParser) opaque;
-        
+
         PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), true);
         InputStream in = System.in;
 
@@ -165,13 +163,11 @@
                         con = new ServerConnection(parser, out, in, kernel, deploymentFactory);
                     }
                     try {
-                        dc.execute(new ConsoleReader(in, out), con, commandArgs);
+                        dc.execute(new StreamConsoleReader(in, out), con, commandArgs);
                     } catch (DeploymentSyntaxException e) {
                         processException(out, e);
                     } catch (DeploymentException e) {
                         processException(out, e);
-                    } catch (IOException e) {
-                        processException(out, e);
                     } finally {
                         if(!multipleCommands) {
                             try {
@@ -212,24 +208,24 @@
     }
 
     private void processException(PrintWriter out, Exception e) {
-        failed = true;       
+        failed = true;
         log.error("Error: ", e);
     }
 
     public static final GBeanInfo GBEAN_INFO;
     public static final String GBEAN_REF_DEPLOYMENT_FACTORY = "DeploymentFactory";
-    
+
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("DeployTool", DeployTool.class, "DeployTool");
 
         infoBuilder.addReference(GBEAN_REF_DEPLOYMENT_FACTORY, DeploymentFactory.class);
         infoBuilder.addInterface(Main.class);
-        
+
         infoBuilder.setConstructor(new String[] {"kernel", GBEAN_REF_DEPLOYMENT_FACTORY});
-        
+
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
-    
+
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java Mon Dec 14 19:24:54 2009
@@ -28,8 +28,6 @@
 import java.io.StringReader;
 import java.util.Properties;
 
-import jline.ConsoleReader;
-
 import org.apache.geronimo.crypto.EncryptionManager;
 import org.apache.geronimo.deployment.plugin.ConfigIDExtractor;
 
@@ -39,10 +37,10 @@
  * @version $Rev$ $Date$
  */
 public class DeployUtils extends ConfigIDExtractor {
-    
+
     private final static String DEFAULT_URI = "deployer:geronimo:jmx";
     private final static String DEFAULT_SECURE_URI = "deployer:geronimo:jmxs";
-    
+
     /**
      * Split up an output line so it indents at beginning and end (to fit in a
      * typical terminal) and doesn't break in the middle of a word.
@@ -103,47 +101,14 @@
     private final static int DEFAULT_WIDTH = 76;
 
     public static void println(String line, int indent, ConsoleReader consoleReader) throws IOException {
-        int endCol = consoleReader.getTermwidth();
-        int start = consoleReader.getCursorBuffer().cursor;
-
-        // some terminals will give a terminal width of zero (e.g. emacs shell). 
-        // in that case, default to a reasonable term width value.
-        if (endCol == 0) {
-            endCol = DEFAULT_WIDTH;
-        }
+        // we don't have sophisticated shell information available with the karaf shell, so just write out
+        // the information as a line
 
-        if (endCol - indent < 10) {
-            throw new IllegalArgumentException("Need at least 10 spaces for " +
-                "printing, but indent=" + indent + " and endCol=" + endCol);
-        }
-        String prefix = indent == 0 ? "" : buildIndent(indent);
-        int pos;
-        while (line.length() > 0) {
-            if (start == 0) {
-                line = prefix + line;
-            }
-            if (line.length() > endCol - start) {
-                pos = line.lastIndexOf(' ', endCol - start);
-                if (pos < indent) {
-                    pos = line.indexOf(' ', endCol - start);
-                    if (pos < indent) {
-                        pos = line.length();
-                    }
-                }
-                consoleReader.printString(line.substring(0, pos));
-                consoleReader.printNewline();
-                if (pos < line.length() - 1) {
-                    line = line.substring(pos + 1);
-                } else {
-                    break;
-                }
-                start = 0;
-            } else {
-                consoleReader.printString(line);
-                consoleReader.printNewline();
-                break;
-            }
+        if (indent != 0) {
+            consoleReader.printString(buildIndent(indent));
         }
+        // just write the line
+        consoleReader.println(line);
     }
 
     public static void printTo(String string, int col, ConsoleReader consoleReader) throws IOException {
@@ -160,7 +125,7 @@
         }
         return buf.toString();
     }
-    
+
     public static String getConnectionURI(String host, Integer port, boolean secure) {
         if (host == null) {
             host = "localhost";
@@ -172,11 +137,11 @@
         uri += "://" + host + ":" + port;
         return uri;
     }
-    
+
     public static SavedAuthentication readSavedCredentials(String uri) throws IOException {
         SavedAuthentication auth = null;
         InputStream in;
-        
+
         // First check for .geronimo-deployer on class path (e.g. packaged in deployer.jar)
         in = DeployUtils.class.getResourceAsStream("/.geronimo-deployer");
         // If not there, check in home directory
@@ -190,7 +155,7 @@
                 }
             }
         }
-        
+
         if (in != null) {
             try {
                 Properties props = new Properties();
@@ -221,14 +186,14 @@
                 }
             }
         }
-        
+
         return auth;
     }
-    
+
     public final static class SavedAuthentication implements Serializable {
 
         private static final long serialVersionUID = -3127576258038677899L;
-        
+
         private String uri;
         private String user;
         private char[] password;
@@ -238,15 +203,15 @@
             this.user = user;
             this.password = password;
         }
-        
+
         public String getURI() {
             return this.uri;
         }
-        
+
         public String getUser() {
             return this.user;
         }
-        
+
         public char[] getPassword() {
             return this.password;
         }

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/InputPrompt.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/InputPrompt.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/InputPrompt.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/InputPrompt.java Mon Dec 14 19:24:54 2009
@@ -24,8 +24,6 @@
 import java.io.PrintWriter;
 import java.io.OutputStreamWriter;
 
-import jline.ConsoleReader;
-
 /**
  * Prompts a user for input; optionally masking.
  *
@@ -39,7 +37,7 @@
     private ConsoleReader reader;
 
     public InputPrompt(final InputStream in, final Writer out) throws IOException {
-        this.reader = new ConsoleReader(in, out);
+        this.reader = new StreamConsoleReader(in, out);
     }
 
     public InputPrompt(final InputStream in, final OutputStream out) throws IOException {
@@ -50,12 +48,8 @@
      * Displays the prompt, grabs the input.
      */
     public String getInput(final String prompt, final Character mask) throws IOException {
-        if (mask == null) {
-            return reader.readLine(prompt);
-        }
-        else {
-            return reader.readLine(prompt, mask);
-        }
+        // since jline is not getting used any more, the character mask doesn't work.
+        return reader.readLine(prompt);
     }
 
     public String getInput(final String prompt, final char mask) throws IOException {

Added: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,115 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+/**
+ * Abstract interface for an interface between command components
+ * and a console.
+ */
+public class StreamConsoleReader implements ConsoleReader {
+    // the standard streams to write to
+    protected BufferedReader keyboard;
+    protected PrintWriter console;
+
+    public StreamConsoleReader(InputStream in, PrintWriter out) {
+        keyboard = new BufferedReader(new InputStreamReader(in));
+        console = out;
+    }
+
+    public StreamConsoleReader(InputStream in, OutputStream out) {
+        this(in, new PrintWriter(new OutputStreamWriter(out)));
+    }
+
+    public StreamConsoleReader(InputStream in, Writer out) {
+        this(in, new PrintWriter(out));
+    }
+
+    /**
+     * Print an end-of-line marker.
+     *
+     * @exception IOException
+     */
+    public void printNewline() throws IOException {
+        console.println();
+    }
+
+    /**
+     * Print a string to the console (without a newline).
+     *
+     * @param s      The string to print.
+     *
+     * @exception IOException
+     */
+    public void printString(String s) throws IOException {
+        console.print(s);
+    }
+
+    /**
+     * Print a line to the console (with a newline).
+     *
+     * @param s      The string to print.
+     *
+     * @exception IOException
+     */
+    public void println(String s) throws IOException {
+        console.println(s);
+    }
+
+
+    /**
+     * Read a line from the console.
+     *
+     * @return The next line from the console.
+     * @exception IOException
+     */
+    public String readLine() throws IOException {
+        return keyboard.readLine();
+    }
+
+
+    /**
+     * Read a line from the console with a prompt.
+     *
+     * @param prompt The prompt string used for the reading.
+     *
+     * @return The next line from the console.
+     * @exception IOException
+     */
+    public String readLine(String prompt) throws IOException {
+        printString(prompt);
+        return readLine();
+    }
+
+
+    /**
+     * Flush any pending writes to the console.
+     *
+     * @exception IOException
+     */
+    public void flushConsole() throws IOException {
+        console.flush();
+    }
+}
+

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/pom.xml?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/pom.xml Mon Dec 14 19:24:54 2009
@@ -18,6 +18,19 @@
             <artifactId>geronimo-kernel</artifactId>
             <version>${pom.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-cli</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-deploy-tool</artifactId>
+            <version>${version}</version>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.felix.karaf.shell</groupId>
             <artifactId>org.apache.felix.karaf.shell.console</artifactId>

Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.shell;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import java.util.List;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Option;
+
+import org.apache.geronimo.deployment.cli.ServerConnection;
+import org.apache.geronimo.deployment.cli.CommandListConfigurations;
+import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
+
+import org.osgi.service.command.CommandSession;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(scope = "geronimo", name = "assemble-server", description = "Extract a geronimo server from the current one")
+public class AssembleServerCommand extends ConnectCommand {
+    @Option (name = "-l", aliases = {"--list"}, description = "refresh plugin list")
+    boolean refreshList = false;
+
+    @Option (name = "-m", aliases = {"--mode"}, description = "custom assembly mode")
+    String mode;
+
+    @Option (name = "-t", aliases = {"--path"}, description = "assembly location")
+    String relativeServerPath = "var/temp/assembly";
+
+    @Option (name = "-g", aliases = {"--groupId"}, description = "server groupId")
+    String group;
+
+    @Option (name = "-a", aliases = {"--artifact"}, description = "server artifact name")
+    String artifact;
+
+    @Option (name = "-v", aliases = {"--version"}, description = "server version")
+    String version = "1.0";
+
+    @Option (name = "-f", aliases = {"--format"}, description = "zip or tar.gz")
+    String format = "tar.gz";
+
+    @Argument (multiValued = true)
+    List<String> pluginArtifacts;
+
+    /**
+     * Override of the post-connection execute method.
+     *
+     * @param connection The current session connection.
+     *
+     * @return The return value from the command.
+     * @exception Exception
+     */
+    protected Object doExecute(ServerConnection connection) throws Exception {
+        CommandListConfigurations command = new CommandListConfigurations();
+
+        if (mode == null) {
+            println("Available custom assembly modes:");
+            println(" 1:    Function Centric");
+            println(" 2:    Application Centric");
+            println(" 3:    Expert Users");
+
+            mode = readLine("Please select a custom assembly mode [1,2,3]").trim();
+            if (mode == null || (mode.compareTo("1") != 0 && mode.compareTo("2") != 0 && mode.compareTo("3") != 0)) {
+                throw new IllegalArgumentException("Please enter a valid Assembly server mode");
+            }
+        }
+
+        if (group == null) {
+            group = readLine("Assembly server group name: ").trim();
+            if (group.equals("")) {
+                throw new IllegalArgumentException("Assembly server group name is required");
+            }
+        }
+
+        if (artifact == null) {
+            artifact = readLine("Assembly server artifact name: ").trim();
+            if (artifact.equals("")) {
+                throw new IllegalArgumentException("Assembly server artifact name is required");
+            }
+        }
+
+        PluginListType plugins = (PluginListType)session.get("LocalPlugins");
+
+        if (refreshList || plugins == null) {
+            plugins = command.getLocalPluginCategories((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
+            session.put("LocalPlugins", plugins);
+        }
+
+        if (pluginArtifacts != null) {
+            command.assembleServer((GeronimoDeploymentManager)connection.getDeploymentManager(), pluginArtifacts, plugins, "repository", relativeServerPath, this);
+            ((GeronimoDeploymentManager)connection.getDeploymentManager()).archive(relativeServerPath, "var/temp", new Artifact(group, artifact, (String)version, format));
+        } else {
+            PluginListType pluginsToInstall;
+
+            if (mode.compareTo("1") == 0) {
+                println("Listing plugin groups and application plugins from the local Geronimo server");
+                PluginListType pluginGroups = (PluginListType)session.get("LocalPluginGroups");
+                PluginListType appPlugins = (PluginListType)session.get("LocalAppPlugins");
+
+                if (refreshList || pluginGroups == null) {
+                    pluginGroups = command.getLocalPluginGroups((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
+                    session.put("LocalPluginGroups", pluginGroups);
+                }
+
+                if (refreshList || appPlugins == null) {
+                    appPlugins = command.getLocalApplicationPlugins((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
+                    session.put("LocalAppPlugins", appPlugins);
+                }
+                pluginsToInstall = command.getInstallList(pluginGroups, appPlugins, this, null);
+
+            } else if (mode.compareTo("2") == 0) {
+                println("Listing application plugins and required framework plugin group from the local Geronimo server");
+                PluginListType appPlugins = (PluginListType)session.get("LocalAppPlugins");
+
+                if (refreshList || appPlugins == null) {
+                    appPlugins = command.getLocalApplicationPlugins((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
+                    session.put("LocalAppPlugins", appPlugins);
+                }
+                pluginsToInstall = command.getInstallList(appPlugins, this, null);
+            } else {
+                println("Listing plugins from the local Geronimo server");
+                pluginsToInstall = command.getInstallList(plugins, this, null);
+            }
+
+            if (pluginsToInstall == null) {
+                command.assembleServer((GeronimoDeploymentManager)connection.getDeploymentManager(), pluginsToInstall, "repository", relativeServerPath, this);
+                ((GeronimoDeploymentManager)connection.getDeploymentManager()).archive(relativeServerPath, "var/temp", new Artifact(group, artifact, (String)version, format));
+            }
+        }
+        return null;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/AssembleServerCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.shell;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import org.apache.felix.karaf.shell.console.OsgiCommandSupport;
+import org.apache.geronimo.deployment.cli.ConsoleReader;
+import org.apache.geronimo.kernel.Kernel;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseCommandSupport extends OsgiCommandSupport implements ConsoleReader {
+
+
+    /**
+     * Print an end-of-line marker.
+     *
+     * @exception IOException
+     */
+    public void printNewline() throws IOException {
+        session.getConsole().println();
+    }
+
+
+    /**
+     * Write a line of output to the command shell session.
+     *
+     * @param data   The line to write.
+     */
+    public void println(String data) {
+        session.getConsole().println(data);
+    }
+
+
+    /**
+     * Write a string of output to the command shell session.
+     *
+     * @param data   The line to write.
+     */
+    public void printString(String data) {
+        session.getConsole().print(data);
+    }
+
+
+    /**
+     * Read a line of output from the command shell session.
+     *
+     * @return The next line from the session input.
+     * @exception IOException
+     */
+    public String readLine() throws IOException {
+        return new BufferedReader(new InputStreamReader(session.getKeyboard())).readLine();
+    }
+
+
+    /**
+     * Utility method for issuing shell prompts.
+     *
+     * @param prompt The prompt string.
+     *
+     * @return The string return result.
+     */
+    public String readLine(String prompt) throws IOException {
+        printString(prompt);
+        return readLine();
+    }
+
+
+    /**
+     * Flush any pending writes to the console.
+     *
+     * @exception IOException
+     */
+    public void flushConsole() throws IOException {
+        session.getConsole().flush();
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.shell;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import java.util.Map;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Option;
+
+import org.apache.geronimo.deployment.cli.CommandInstallCAR;
+import org.apache.geronimo.deployment.cli.ServerConnection;
+import org.apache.geronimo.deployment.cli.CommandListConfigurations;
+import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
+import org.apache.geronimo.system.plugin.Farm;
+import org.apache.geronimo.system.plugin.DownloadResults;
+
+import org.osgi.service.command.CommandSession;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(scope = "geronimo", name = "cluster", description = "administer cluster")
+public class ClusterCommand extends ConnectCommand {
+    @Option(name="-c", aliases={"--cluster"}, description="Cluster to perform action on")
+    String clusterName;
+
+    @Option(name="-l", aliases={"--pluginlist"}, description="Plugin List to perform action on")
+    String pluginList;
+
+    @Option(name="-a", aliases={"--pluginartifact"}, description="Plugin Artifact to perform action on")
+    String plugin;
+
+    @Argument(name="ACTION", required=true, index=0, description="Action (add/remove) to perform")
+    String action;
+
+    /**
+     * Override of the post-connection execute method.
+     *
+     * @param connection The current session connection.
+     *
+     * @return The return value from the command.
+     * @exception Exception
+     */
+    protected Object doExecute(ServerConnection connection) throws Exception {
+
+        DeploymentManager deploymentManager = connection.getDeploymentManager();
+        Farm farm = (Farm)((RemoteDeploymentManager)deploymentManager).getImplementation(Farm.class);
+        Map<String, DownloadResults> results;
+        if (action == "add") {
+            if (clusterName != null && pluginList != null && plugin != null) {
+                results = farm.addPluginToCluster(clusterName, pluginList, plugin);
+            } else if (clusterName != null && pluginList != null) {
+                results = farm.addPluginList(clusterName, pluginList);
+            } else if (pluginList != null && plugin != null) {
+                results = farm.addPlugin(pluginList, plugin);
+            } else {
+                println("add requires -c <cluster> and -l <plugin list name>, -l <plugin list name> and -a <plugin>, or all three");
+                return null;
+            }
+        } else if (action == "remove") {
+            if (clusterName != null && pluginList != null && plugin != null) {
+                println("remove requires -c <cluster> and -l <plugin list name>, or -l <plugin list name> and -a <plugin>, but not all three");
+                return null;
+            } else if (clusterName != null && pluginList != null) {
+                results = farm.removePluginListFromCluster(clusterName, pluginList);
+            } else if (pluginList != null && plugin != null) {
+                results = farm.removePluginFromPluginList(pluginList, plugin);
+            } else {
+                println("remove requires -c <cluster> and -l <plugin list name>, or -l <plugin list> and -a <plugin>");
+                return null;
+            }
+        } else {
+            println("unknown command, expecting add or remove");
+            return null;
+        }
+        println("Results:");
+        for (Map.Entry<String, DownloadResults> entry : results.entrySet()) {
+            println("results for node: " + entry.getKey());
+            CommandInstallCAR.printResults(this, entry.getValue(), 0);
+        }
+        return null;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ClusterCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java?rev=890450&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java Mon Dec 14 19:24:54 2009
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.shell;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Command;
+import org.apache.felix.gogo.commands.Option;
+import org.apache.geronimo.deployment.cli.ServerConnection;
+import org.apache.geronimo.deployment.cli.ServerConnection.UsernamePasswordHandler;
+import org.apache.geronimo.deployment.plugin.factories.BaseDeploymentFactory;
+import org.apache.geronimo.cli.deployer.ConnectionParamsImpl;
+import org.apache.geronimo.kernel.basic.BasicKernel;
+
+import org.osgi.service.command.CommandSession;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Command(scope = "geronimo", name = "connect", description = "Connect to a Geronimo server")
+public class ConnectCommand extends BaseCommandSupport {
+    // the environment variable name use to store the session. 1
+    public static final String SERVER_CONNECTION = "geronimo.ServerConnection";
+
+    @Option(name="-s", aliases={"--hostname", "--server"}, description="Hostname, default localhost", required = false, multiValued = false)
+    String hostname = "localhost";
+
+    @Option(name="-p", aliases={"--port"}, description="Port, default 1099", required = false, multiValued = false)
+    int port = 1099;
+
+    @Option(name="-u", aliases={"--username"}, description="Username", required = false, multiValued = false)
+    String username;
+
+    @Option(name="-w", aliases={"--password"}, description="Password", required = false, multiValued = false)
+    String password;
+
+    @Option(name="--secure", description="Use secure channel", required = false, multiValued = false)
+    boolean secure = false;
+
+    /**
+     * Base execution method.  This serves as both the body
+     * of the CONNECT command and the forwarder for any other
+     * command that is a connection subclass.
+     *
+     * @return
+     * @exception Exception
+     */
+    protected Object doExecute() throws Exception {
+        ServerConnection connection = openConnection(false);
+        // Forward to the override
+        return doExecute(connection);
+    }
+
+    protected Object doExecute(ServerConnection connection) throws Exception {
+        return null;
+    }
+
+
+    /**
+     * Conditionally obtain a session connection.  If there
+     * is one cached in the session, use it, otherwise connect
+     * to the target host and use it.
+     *
+     * @return A ServerConnection object for talking to the target server.
+     */
+    protected ServerConnection connect() throws Exception {
+        ServerConnection connection = (ServerConnection)session.get(SERVER_CONNECTION);
+
+        if (connection == null) {
+            connection = openConnection(false);
+        }
+
+        return connection;
+    }
+
+    /**
+     * Test if we have a valid server connection set in the
+     * shell environment.
+     *
+     * @return true if there is an active server connection, false otherwise.
+     */
+    protected boolean isConnected() {
+        return session.get(SERVER_CONNECTION) != null;
+    }
+
+    /**
+     * Disconnect the current server connection, if any.
+     */
+    protected void disconnect() {
+        // disconnect the session if there is something set in the command session
+        ServerConnection connection = (ServerConnection)session.get(SERVER_CONNECTION);
+
+        if (connection != null) {
+            try {
+            	connection.close();
+            }
+            catch (Exception e) {
+                // ignore
+            }
+        }
+        // remove the old session variable
+        session.put(SERVER_CONNECTION, null);
+    }
+
+
+    /**
+     * Open a connection to a target server and save the
+     * connection in the session environment so it may
+     * be reused for subsequent commands.
+     *
+     * @param quiet  Indicates where this should give connection status indicatores.
+     *
+     * @return The ServerConnection object for the connection.
+     * @exception Exception
+     */
+    protected ServerConnection openConnection(boolean quiet) throws Exception {
+        if (!quiet) {
+        	println("Connecting to Geronimo server: " + hostname + ":" + port);
+        }
+
+        BasicKernel kernel = new BasicKernel("Geronimo deployer", getBundleContext());
+        BaseDeploymentFactory deploymentFactory = new BaseDeploymentFactory();
+        ConnectionParamsImpl connectionParams = new ConnectionParamsImpl(null, hostname, port, null, username, password, false, false, false, secure);
+        ServerConnection connection = new ServerConnection(connectionParams, new ShellUserPasswordHandler(session), kernel, deploymentFactory);
+
+        // Disconnect previous connection if any
+        disconnect();
+        // store this in the permanent session
+        session.put(SERVER_CONNECTION, connection);
+
+        if (!quiet) {
+            println("Connection established");
+        }
+
+        return connection;
+    }
+
+
+    /**
+     * Simple password handler for the gogo shell.
+     */
+    class ShellUserPasswordHandler implements UsernamePasswordHandler {
+        CommandSession session;
+
+        public ShellUserPasswordHandler(CommandSession session) {
+            this.session = session;
+        }
+
+        public String getPassword() throws IOException {
+            // NB:  this is unmasked currently.
+            return readLine("Password: ");
+        }
+
+        public String getUsername() throws IOException {
+            return readLine("Username: ");
+        }
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/ConnectCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java?rev=890450&r1=890449&r2=890450&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/KernelCommandSupport.java Mon Dec 14 19:24:54 2009
@@ -20,14 +20,13 @@
 
 package org.apache.geronimo.shell;
 
-import org.apache.felix.karaf.shell.console.OsgiCommandSupport;
 import org.apache.geronimo.kernel.Kernel;
 import org.osgi.framework.ServiceReference;
 
 /**
  * @version $Rev$ $Date$
  */
-public abstract class KernelCommandSupport extends OsgiCommandSupport {
+public abstract class KernelCommandSupport extends BaseCommandSupport {
     protected Object doExecute() throws Exception {
 
         ServiceReference ref = getBundleContext().getServiceReference(Kernel.class.getName());