geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r596781 - in /geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli: AbstractCommand.java CommandRedeploy.java
Date Tue, 20 Nov 2007 18:57:57 GMT
Author: gawor
Date: Tue Nov 20 10:57:56 2007
New Revision: 596781

URL: http://svn.apache.org/viewvc?rev=596781&view=rev
Log:
reuse ConsoleReader instance passed instead of creating new instance. also fixes yet another
windows build problem

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/CommandRedeploy.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=596781&r1=596780&r2=596781&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
Tue Nov 20 10:57:56 2007
@@ -40,25 +40,15 @@
  * @version $Rev$ $Date$
  */
 public abstract class AbstractCommand implements DeployCommand {
-    private ConsoleReader out;
 
     public AbstractCommand() {
-        try {
-            out = new ConsoleReader(System.in, new OutputStreamWriter(System.out));
-        } catch (IOException e) {
-            throw new RuntimeException("could not set up console", e);
-        }
     }
 
     public boolean isLocalOnly() {
         return false;
     }
 
-    public void setConsole(ConsoleReader out) {
-        this.out = out;
-    }
-
-    protected void emit(String message) throws IOException {
+    protected void emit(ConsoleReader out, String message) throws IOException {
         out.printString(DeployUtils.reformat(message, 4, 72));
         out.flushConsole();
     }
@@ -72,7 +62,7 @@
      *            trace.
      * @param po  a <code>ProgressObject</code> value
      */
-    protected void waitForProgress(ConsoleReader out, ProgressObject po) {
+    protected void waitForProgress(final ConsoleReader out, ProgressObject po) {
         po.addProgressListener(new ProgressListener() {
             String last = null;
 
@@ -80,7 +70,7 @@
                 String msg = event.getDeploymentStatus().getMessage();
                 if (last != null && !last.equals(msg)) {
                     try {
-                        emit(last);
+                        emit(out, last);
                     } catch (IOException e1) {
                         //ignore
                     }

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=596781&r1=596780&r2=596781&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
Tue Nov 20 10:57:56 2007
@@ -44,7 +44,6 @@
         ProgressObject po = null;
         try {
             String[] args = commandArgs.getArgs();
-            setConsole(consoleReader);
 
             DeploymentManager mgr = connection.getDeploymentManager();
             Target[] allTargets = mgr.getTargets();
@@ -93,7 +92,7 @@
             }
             // If we don't have any moduleIDs, try to guess one.
             if(modules.size() == 0 && connection.isGeronimo()) {
-                emit("No ModuleID or TargetModuleID provided.  Attempting to guess based
on the content of the "+(plan == null ? "archive" : "plan")+".");
+                emit(consoleReader, "No ModuleID or TargetModuleID provided.  Attempting
to guess based on the content of the "+(plan == null ? "archive" : "plan")+".");
                 String moduleId = null;
                 try {
                     if(plan != null) {
@@ -103,7 +102,7 @@
                             int pos = fileName.lastIndexOf('.');
                             String artifactId = pos > -1 ? module.getName().substring(0,
pos) : module.getName();
                             moduleId = Artifact.DEFAULT_GROUP_ID+"/"+artifactId+"//";
-                            emit("Unable to locate Geronimo deployment plan in archive. 
Calculating default ModuleID from archive name.");
+                            emit(consoleReader, "Unable to locate Geronimo deployment plan
in archive.  Calculating default ModuleID from archive name.");
                         }
                     } else if(module != null) {
                         moduleId = DeployUtils.extractModuleIdFromArchive(module);
@@ -111,17 +110,17 @@
                             int pos = module.getName().lastIndexOf('.');
                             String artifactId = pos > -1 ? module.getName().substring(0,
pos) : module.getName();
                             moduleId = Artifact.DEFAULT_GROUP_ID+"/"+artifactId+"//";
-                            emit("Unable to locate Geronimo deployment plan in archive. 
Calculating default ModuleID from archive name.");
+                            emit(consoleReader, "Unable to locate Geronimo deployment plan
in archive.  Calculating default ModuleID from archive name.");
                         }
                     }
                 } catch (IOException e) {
                     throw new DeploymentException("Unable to read input files: "+e.getMessage(),
e);
                 }
                 if(moduleId != null) {
-                    emit("Attempting to use ModuleID '"+moduleId+"'");
+                    emit(consoleReader, "Attempting to use ModuleID '"+moduleId+"'");
                     modules.addAll(DeployUtils.identifyTargetModuleIDs(allModules, moduleId,
true));
                 } else {
-                    emit("Unable to calculate a ModuleID from supplied module and/or plan.");
+                    emit(consoleReader, "Unable to calculate a ModuleID from supplied module
and/or plan.");
                 }
             }
             if(modules.size() == 0) { // Either not deploying to Geronimo or unable to identify
modules
@@ -141,11 +140,11 @@
             TargetModuleID[] done = po.getResultTargetModuleIDs();
             for(int i = 0; i < done.length; i++) {
                 TargetModuleID id = done[i];
-                emit("Redeployed "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName()
: "")+(id.getWebURL() == null ? "" : " @ "+id.getWebURL()));
+                emit(consoleReader, "Redeployed "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName()
: "")+(id.getWebURL() == null ? "" : " @ "+id.getWebURL()));
                 if(id.getChildTargetModuleID() != null) {
                     for (int j = 0; j < id.getChildTargetModuleID().length; j++) {
                         TargetModuleID child = id.getChildTargetModuleID()[j];
-                        emit("  `-> "+child.getModuleID()+(child.getWebURL() == null ?
"" : " @ "+child.getWebURL()));
+                        emit(consoleReader, "  `-> "+child.getModuleID()+(child.getWebURL()
== null ? "" : " @ "+child.getWebURL()));
                     }
                 }
             }



Mime
View raw message