From 4a4c29c19e0adf94868198ba1805c4e93fa51185 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 5 Jul 2010 20:04:07 +0000 Subject: Add installed command git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960680 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/shell/Shell.java | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/shell/src/main') 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 de83eae259..7408778f89 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 @@ -56,7 +56,7 @@ public class Shell { private boolean useJline; final List history = new ArrayList(); 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 toks) { + List 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() { public Boolean call() throws Exception { return install(toks.get(1), toks); }}; + if (op.equals("installed")) return new Callable() { public Boolean call() throws Exception { + return installed(toks); + }}; if (op.equals("listDeployedCompostes")) return new Callable() { public Boolean call() throws Exception { return listDeployedCompostes(toks.get(1)); }}; -- cgit v1.2.3