summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-05 19:02:07 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-05 19:02:07 +0000
commit067ee7cf4654e9a812865abf71d75735acb03fde (patch)
tree06397b5f86dd12cf1afcafc1c3f9e63cef97b1e9 /sca-java-2.x
parentd5bbdc51613f32dde2f8a4150443502f24dfb502 (diff)
Update stop command to support stopping individual contributions and composites
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960660 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java8
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java26
2 files changed, 26 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
index 88a0e7ca51..d09a72f84f 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
@@ -32,6 +32,8 @@ import jline.ConsoleReader;
import jline.FileNameCompletor;
import jline.SimpleCompletor;
+import org.apache.tuscany.sca.runtime.ActivationException;
+
/**
* Keep all the JLine specific code out of the Shell class so that it runs ok
* when jline isn't on the classpath.
@@ -48,7 +50,11 @@ public class JLine {
// Add a Ctrl-c listener
reader.addTriggeredAction((char)3, new ActionListener() {
public void actionPerformed(ActionEvent e) {
- shell.stop();
+ try {
+ shell.stop(null);
+ } catch (ActivationException e1) {
+ e1.printStackTrace();
+ }
System.exit(0);
}
});
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
index a8ed16c5ff..75b7a5c4ba 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
@@ -180,14 +180,26 @@ public class Shell {
out.println(" listInstalledContributions");
out.println(" printDomainLevelComposite");
out.println(" status [<curi> <compositeUri>]");
- out.println(" stop");
+ out.println(" stop [<curi> <compositeUri>]");
out.println();
return true;
}
- boolean stop() {
- node.stop();
- return false;
+ boolean stop(List<String> toks) throws ActivationException {
+ if (toks == null || toks.size() < 2) {
+ node.stop();
+ return false;
+ }
+ String curi = toks.get(1);
+ if (toks.size() > 2) {
+ node.removeFromDomainLevelComposite(curi + "/" + toks.get(2));
+ } else {
+ for (String compositeURI : node.getDeployedCompostes(curi)) {
+ node.removeFromDomainLevelComposite(curi + "/" + compositeURI);
+ }
+ }
+
+ return true;
}
boolean status(final List<String> toks) {
@@ -211,7 +223,7 @@ public class Shell {
}
for (String compositeUri : dcs) {
for (Artifact a : c.getArtifacts()) {
- if (compositeUri.equals(curi + "/" + a.getURI())) {
+ if (compositeUri.equals(a.getURI())) {
out.println(" " + curi + " " + c.getLocation() + " " + compositeUri + " " + ((Composite)a.getModel()).getName());
}
}
@@ -272,8 +284,8 @@ public class Shell {
if (op.equals("help")) return new Callable<Boolean>() { public Boolean call() {
return help();
}};
- if (op.equals("stop")) return new Callable<Boolean>() { public Boolean call() {
- return stop();
+ if (op.equals("stop")) return new Callable<Boolean>() { public Boolean call() throws Exception {
+ return stop(toks);
}};
if (op.equals("status")) return new Callable<Boolean>() { public Boolean call() {
return status(toks);