You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/07/14 00:20:49 UTC

svn commit: r216276 - in /geronimo/trunk/modules: deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/ deploy-tool/src/java/org/apache/geronimo/deployment/cli/

Author: ammulder
Date: Wed Jul 13 15:20:45 2005
New Revision: 216276

URL: http://svn.apache.org/viewcvs?rev=216276&view=rev
Log:
Fix start command
 - start dependencies too, if necessary
Fix redeploy command
 - use absolute file paths (GERONIMO-582)
 - don't fail if the app to redeploy isn't running
 - better incremental progress output

Modified:
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java

Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java?rev=216276&r1=216275&r2=216276&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java Wed Jul 13 15:20:45 2005
@@ -103,7 +103,7 @@
         }
     }
 
-    protected void doDeploy(ObjectName deployer, Target target) throws Exception {
+    protected void doDeploy(ObjectName deployer, Target target, boolean finished) throws Exception {
         Object[] args = {moduleArchive, deploymentPlan};
         List objectNames = (List) kernel.invoke(deployer, "deploy", args, DEPLOY_SIG);
         if (objectNames == null || objectNames.isEmpty()) {
@@ -119,6 +119,8 @@
 
         TargetModuleID moduleID = new TargetModuleIDImpl(target, parentName.toString(), childIDs);
         addModule(moduleID);
-        complete("Completed with id " + parentName);
+        if(finished) {
+            complete("Completed with id " + parentName);
+        }
     }
 }

Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java?rev=216276&r1=216275&r2=216276&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java Wed Jul 13 15:20:45 2005
@@ -59,9 +59,7 @@
             if (deployer == null) {
                 return;
             }
-
-            doDeploy(deployer, targetList[0]);
-
+            doDeploy(deployer, targetList[0], true);
         } catch (Exception e) {
             doFail(e);
         } finally {

Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=216276&r1=216275&r2=216276&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Wed Jul 13 15:20:45 2005
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.io.InputStream;
 import java.net.URI;
+import java.util.List;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.management.ObjectName;
@@ -27,9 +28,12 @@
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
 
 /**
  * @version $Rev$ $Date$
@@ -72,14 +76,42 @@
 
                 URI configID = URI.create(module.getModuleID());
                 ObjectName configName = Configuration.getConfigurationObjectName(configID);
-                kernel.stopGBean(configName);
-                configurationManager.unload(configID);
+                try {
+                    kernel.stopGBean(configName);
+                    updateStatus("Stopped "+configID);
+                } catch (GBeanNotFoundException e) {
+                    if(e.getGBeanName().equals(configName)) {
+                        // The module isn't running -- that's OK
+                    } else throw e;
+                }
+                try {
+                    configurationManager.unload(configID);
+                    updateStatus("Unloaded "+configID);
+                } catch(InternalKernelException e) {
+                    Exception cause = (Exception)e.getCause();
+                    if(cause instanceof NoSuchConfigException) {
+                        // The modules isn't loaded -- that's OK
+                    } else {
+                        throw cause;
+                    }
+                } catch (NoSuchConfigException e) {
+                    // The modules isn't loaded -- that's OK
+                }
 
                 TargetImpl target = (TargetImpl) module.getTarget();
                 ObjectName storeName = target.getObjectName();
                 kernel.invoke(storeName, "uninstall", new Object[]{configID}, UNINSTALL_SIG);
+                updateStatus("Uninstalled "+configID);
 
-                doDeploy(deployer, module.getTarget());
+                doDeploy(deployer, module.getTarget(), false);
+                updateStatus("Deployed "+configID);
+
+                List list = configurationManager.loadRecursive(configID);
+                for (int j = 0; j < list.size(); j++) {
+                    ObjectName name = (ObjectName) list.get(j);
+                    kernel.startRecursiveGBean(name);
+                    updateStatus("Started "+clean(name.getKeyProperty("name")));
+                }
             }
             complete("Completed");
         } catch (Exception e) {

Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java?rev=216276&r1=216275&r2=216276&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java Wed Jul 13 15:20:45 2005
@@ -18,6 +18,7 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.net.URI;
+import java.util.List;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
 import javax.management.ObjectName;
@@ -25,6 +26,7 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
 
 /**
  *
@@ -48,10 +50,13 @@
                 TargetModuleID module = modules[i];
 
                 URI moduleID = URI.create(module.getModuleID());
-                ObjectName configName = configurationManager.load(moduleID);
-                kernel.startRecursiveGBean(configName);
-
-                addModule(module);
+                List list = configurationManager.loadRecursive(moduleID);
+                for (int j = 0; j < list.size(); j++) {
+                    ObjectName name = (ObjectName) list.get(j);
+                    kernel.startRecursiveGBean(name);
+                    String configName = name.getKeyProperty("name");
+                    addModule(new TargetModuleIDImpl(modules[i].getTarget(), configName));
+                }
             }
             complete("Completed");
         } catch (Exception e) {

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java?rev=216276&r1=216275&r2=216276&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java (original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java Wed Jul 13 15:20:45 2005
@@ -108,6 +108,12 @@
         for(int i=2; i<args.length; i++) {
             modules.addAll(identifyTargetModuleIDs(allModules, args[i]));
         }
+        if(module != null) {
+            module = module.getAbsoluteFile();
+        }
+        if(plan != null) {
+            plan = plan.getAbsoluteFile();
+        }
         TargetModuleID[] ids = (TargetModuleID[]) modules.toArray(new TargetModuleID[modules.size()]);
         boolean multiple = isMultipleTargets(ids);
         ProgressObject po = mgr.redeploy(ids, module, plan);
@@ -115,7 +121,7 @@
         TargetModuleID[] done = po.getResultTargetModuleIDs();
         for(int i = 0; i < done.length; i++) {
             TargetModuleID id = done[i];
-            out.println("Redeployed "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : ""));
+            out.println(DeployUtils.reformat("Redeployed "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : ""), 4, 72));
         }
         if(po.getDeploymentStatus().isFailed()) {
             throw new DeploymentException("Operation failed: "+po.getDeploymentStatus().getMessage());