tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r960660 - in /tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell: JLine.java Shell.java
Date Mon, 05 Jul 2010 19:02:07 GMT
Author: antelder
Date: Mon Jul  5 19:02:07 2010
New Revision: 960660

URL: http://svn.apache.org/viewvc?rev=960660&view=rev
Log:
Update stop command to support stopping individual contributions and composites

Modified:
    tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
    tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java

Modified: tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java?rev=960660&r1=960659&r2=960660&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/JLine.java
Mon Jul  5 19:02:07 2010
@@ -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);
             }
         });

Modified: tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java?rev=960660&r1=960659&r2=960660&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
Mon Jul  5 19:02:07 2010
@@ -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);



Mime
View raw message