Update for API changes and rename 'status' command to be 'started' to match the pattern the other commands use

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1039645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
antelder 2010-11-27 10:23:14 +00:00
parent ab6fca3a55
commit 262894a11c
3 changed files with 20 additions and 20 deletions

View file

@ -68,7 +68,7 @@ public class Shell {
private Map<String, Node> nodes = new HashMap<String, Node>();
public static final String[] COMMANDS = new String[] {"bye", "domain", "domains", "help", "install", "installed", "invoke",
"load", "remove", "run", "save", "services", "start", "status", "stop"};
"load", "remove", "run", "save", "services", "start", "started", "stop"};
public static void main(final String[] args) throws Exception {
boolean useJline = true;
@ -202,12 +202,12 @@ public class Shell {
if (getNode() == null) {
return true;
}
curis = getNode().getInstalledContributions();
curis = getNode().getInstalledContributionURIs();
}
for (String curi : curis) {
out.println(curi + " " + getNode().getInstalledContribution(curi).getLocation());
Contribution c = getNode().getInstalledContribution(curi);
List<String> deployeds = getNode().getDeployedComposites(curi);
List<String> deployeds = getNode().getStartedCompositeURIs(curi);
for (Artifact a : c.getArtifacts()) {
if (a.getModel() instanceof Composite) {
Composite composite = (Composite)a.getModel();
@ -369,7 +369,7 @@ public class Shell {
currentDomain = "";
}
} else {
for (String compositeURI : getNode().getDeployedComposites(curi)) {
for (String compositeURI : getNode().getStartedCompositeURIs(curi)) {
getNode().stop(curi, compositeURI);
}
}
@ -416,13 +416,13 @@ public class Shell {
return true;
}
boolean status(final List<String> toks) {
boolean started(final List<String> toks) {
if (standaloneNodes.size() > 0) {
out.println("Standalone Nodes:");
for (String nodeName : standaloneNodes.keySet()) {
Node node = standaloneNodes.get(nodeName);
for (String curi : node.getInstalledContributions()) {
for (String dc : node.getDeployedComposites(curi)) {
for (String curi : node.getInstalledContributionURIs()) {
for (String dc : node.getStartedCompositeURIs(curi)) {
out.println(" " + nodeName + " " + dc);
}
}
@ -437,17 +437,17 @@ public class Shell {
ics = new ArrayList<String>();
ics.add(toks.get(1));
} else {
ics = node.getInstalledContributions();
ics = node.getInstalledContributionURIs();
}
for (String curi : ics) {
Contribution c = node.getInstalledContribution(curi);
List<String> dcs = node.getDeployedComposites(curi);
List<String> dcs = node.getStartedCompositeURIs(curi);
if (toks.size() > 2) {
dcs = new ArrayList<String>();
dcs.add(toks.get(2));
} else {
dcs = node.getDeployedComposites(curi);
dcs = node.getStartedCompositeURIs(curi);
}
for (String compositeUri : dcs) {
for (Artifact a : c.getArtifacts()) {
@ -602,10 +602,10 @@ public class Shell {
}
}
};
if (op.equalsIgnoreCase("status"))
if (op.equalsIgnoreCase("started"))
return new Callable<Boolean>() {
public Boolean call() {
return status(toks);
return started(toks);
}
};
if (op.equalsIgnoreCase("history"))
@ -673,8 +673,8 @@ public class Shell {
helpSave();
} else if ("start".equalsIgnoreCase(command)) {
helpStart();
} else if ("status".equalsIgnoreCase(command)) {
helpStatus();
} else if ("started".equalsIgnoreCase(command)) {
helpStarted();
} else if ("stop".equalsIgnoreCase(command)) {
helpStop();
} else if ("startup".equalsIgnoreCase(command)) {
@ -710,7 +710,7 @@ public class Shell {
out.println(" services");
out.println(" start <curi> <compositeUri>|<contentURL>");
out.println(" start <name> [<compositeUri>] <contributionURL> [-duris <uri,uri,...>]");
out.println(" status [<curi> [<compositeUri>]]");
out.println(" started [<curi> [<compositeUri>]]");
out.println(" stop [<curi> [<compositeUri>]]");
out.println(" bye");
out.println();
@ -870,10 +870,10 @@ public class Shell {
out.println(" dependencies of the root contribution and other dependent contributions.");
}
void helpStatus() {
out.println(" status [<curi> [<compositeUri>]]");
void helpStarted() {
out.println(" started [<curi> [<compositeUri>]]");
out.println();
out.println(" Shows the status of the Node, listing for each deployed composite its");
out.println(" Shows the status of the Node, listing for each started composite, its");
out.println(" contribution URI, the composite URI, and the composite QName.");
out.println();
out.println(" Arguments:");

View file

@ -40,7 +40,7 @@ public class ICURICompletor extends SimpleCompletor {
@Override
public int complete(final String buffer, final int cursor, final List clist) {
if (shell.getNode() != null) {
List<String> ics = shell.getNode().getInstalledContributions();
List<String> ics = shell.getNode().getInstalledContributionURIs();
setCandidateStrings(ics.toArray(new String[ics.size()]));
}
return super.complete(buffer, cursor, clist);

View file

@ -61,7 +61,7 @@ public class TShellCompletor extends ArgumentCompletor {
completors.put("run", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()});
completors.put("save", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()});
completors.put("start", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
completors.put("status", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
completors.put("started", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
completors.put("stop", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
}