1 package org.apache.geronimo.deployment.cli;
2
3 import javax.enterprise.deploy.spi.status.ProgressObject;
4 import javax.enterprise.deploy.spi.DeploymentManager;
5 import javax.enterprise.deploy.spi.TargetModuleID;
6 import java.io.PrintWriter;
7
8 /**
9 * The CLI deployer logic to restart.
10 */
11 public class CommandRestart extends CommandStart {
12 public CommandRestart() {
13 super("restart", "1. Common Commands", "[ModuleID|TargetModuleID]+",
14 "Accepts the configId of a module, or the fully-qualified " +
15 "TargetModuleID identifying both the module and the server or cluster it's " +
16 "on, and restarts that module. The module should be available to the server " +
17 "and running. If multiple modules are specified, they will all be restarted.\n");
18 }
19
20 protected ProgressObject runCommand(PrintWriter out, DeploymentManager mgr, TargetModuleID[] ids) {
21 ProgressObject po = mgr.stop(ids);
22 waitForProgress(out, po);
23 if(po.getDeploymentStatus().isCompleted()) {
24 po = mgr.start(ids);
25 waitForProgress(out, po);
26 }
27 return po;
28 }
29
30 protected String getAction() {
31 return "Restarted";
32 }
33 }