From 069ff5365820c918eedfcb6aa943bf882dc77ac0 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 11 May 2011 14:42:50 +0000 Subject: Update Shell installed and start commands to work with the latest Node/registry changes git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1101898 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/shell/Shell.java | 72 ++++++++++------------ 1 file changed, 33 insertions(+), 39 deletions(-) (limited to 'sca-java-2.x/trunk') 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 76f76f6d1b..66156ad4ac 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 @@ -209,31 +209,23 @@ public class Shell { } boolean installed(final List toks) { - List curis; - if (toks.size() > 1) { - curis = Arrays.asList(new String[] {toks.get(1)}); - } else { - if (getNode() == null) { - return true; - } - curis = getNode().getInstalledContributionURIs(); + if (getNode() == null) { + return true; } - boolean full = false; - for (String curi : curis) { - out.println(" " + curi); - if (full) { + if (toks.size() > 1) { + String curi = toks.get(1); + Contribution c = getNode().getInstalledContribution(toks.get(1)); + if (c == null) { + out.println("Contribution " + curi + " not installed"); + } else { + out.println("Contribution " + curi); + out.println(" URL: " + c.getLocation()); // TODO: add full detail view of contribution showing - // uri, url, dependent cintrubutions, deployables, exports - out.println(curi + " " + getNode().getInstalledContribution(curi).getLocation()); - Contribution c = getNode().getInstalledContribution(curi); - List deployeds = getNode().getStartedCompositeURIs(curi); - for (Artifact a : c.getArtifacts()) { - if (a.getModel() instanceof Composite) { - Composite composite = (Composite)a.getModel(); - String running = deployeds.contains(composite.getURI()) ? "***running***" : ""; - out.println(" " + composite.getURI() + " " + composite.getName() + " " + running); - } - } + // uri, url, dependent contrubutions, deployables, exports + } + } else { + for (String curi : getNode().getInstalledContributionURIs()) { + out.println(" " + curi); } } return true; @@ -390,22 +382,24 @@ public class Shell { } boolean start(String curi, String compositeURI) throws ActivationException, ValidationException, ContributionReadException { - Contribution c = getNode().getInstalledContribution(curi); - for (Artifact a : c.getArtifacts()) { - if (compositeURI.equals(a.getURI())) { - getNode().start(curi, compositeURI); - return true; - } - } - // external composite file ('composite by value') - try { - URL url = IOHelper.getLocationAsURL(compositeURI); - InputStream is = IOHelper.openStream(url); - BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); - getNode().start(curi, br); - } catch (Exception e) { - System.out.println(e); - } + getNode().start(curi, compositeURI); + +// Contribution c = getNode().getInstalledContribution(curi); +// for (Artifact a : c.getArtifacts()) { +// if (compositeURI.equals(a.getURI())) { +// getNode().start(curi, compositeURI); +// return true; +// } +// } +// // external composite file ('composite by value') +// try { +// URL url = IOHelper.getLocationAsURL(compositeURI); +// InputStream is = IOHelper.openStream(url); +// BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); +// getNode().start(curi, br); +// } catch (Exception e) { +// System.out.println(e); +// } return true; } -- cgit v1.2.3