tuscany-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=960680&view=rev
Log:
Add installed command

Modified:
    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/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=960680&r1=960679&r2=960680&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 20:04:07 2010
@@ -56,7 +56,7 @@ public class Shell {
     private boolean useJline;
     final List<String> history = new ArrayList<String>();
     static final String[] COMMANDS = new String[] {"addDeploymentComposite", "addToDomainLevelComposite",
"help",
-                                                   "install", "listDeployedCompostes", "listInstalledContributions",
+                                                   "install", "installed", "listDeployedCompostes",
"listInstalledContributions",
                                                    "printDomainLevelComposite", "removeFromDomainLevelComposite",

                                                    "remove", "start", "status", "stop"};
 
@@ -102,6 +102,28 @@ public class Shell {
         return true;
     }
 
+    boolean installed(final List<String> toks) {
+        List<String> curis;
+        if (toks.size() > 1) {
+            curis = Arrays.asList(new String[]{toks.get(1)});
+        } else {
+            curis =node.getInstalledContributions();
+        }
+        for (String curi : curis) {
+            out.println(curi + " " + node.getInstalledContribution(curi).getLocation());
+            Contribution c = node.getInstalledContribution(curi);
+            for (String dcuri : node.getDeployedCompostes(curi)) {
+                for (Artifact a : c.getArtifacts()) {
+                    if (dcuri.equals(a.getURI())) {
+                        out.println("   " + dcuri + " " + ((Composite)a.getModel()).getName());
+                        break;
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
     private String getDefaultURI(String contributionURL) {
         int lastDot = contributionURL.lastIndexOf('.');
         int lastSep = contributionURL.lastIndexOf("/");
@@ -269,6 +291,9 @@ public class Shell {
         if (op.equals("install")) return new Callable<Boolean>() { public Boolean call()
throws Exception {
             return install(toks.get(1), toks);
         }};
+        if (op.equals("installed")) return new Callable<Boolean>() { public Boolean
call() throws Exception {
+            return installed(toks);
+        }};
         if (op.equals("listDeployedCompostes")) return new Callable<Boolean>() { public
Boolean call() throws Exception {
             return listDeployedCompostes(toks.get(1));
         }};



Mime
View raw message