From c737cb99bcd1c364fe5f7f66c3662dee75ea7ae9 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 19 May 2011 12:21:55 +0000 Subject: Add a way to run commands on remote nodes and add Node API and Shell commands to start and stop composites on remote nodes. Initial code so a little prototypy but it does work so committing it now for review git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1124705 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/shell/Shell.java | 25 +++++++++++++++++++++- 1 file changed, 24 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 2403cab294..a407f3e105 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 @@ -73,7 +73,7 @@ public class Shell { private Map nodes = new HashMap(); public static final String[] COMMANDS = new String[] {"bye", "domain", "domains", "domainComposite", "help", "install", "installed", "invoke", - "load", "members", "remove", "run", "save", "services", "start", "started", "stop"}; + "load", "members", "remoteStart", "remoteStop", "remove", "run", "save", "services", "start", "started", "stop"}; public static void main(final String[] args) throws Exception { boolean useJline = true; @@ -444,6 +444,17 @@ public class Shell { return true; } + boolean remoteStart(final List toks) { + String response = getNode().remoteStart(toks.get(1), toks.get(2), toks.get(3)); + out.println(response); + return true; + } + boolean remoteStop(final List toks) { + String response = getNode().remoteStop(toks.get(1), toks.get(2), toks.get(3)); + out.println(response); + return true; + } + boolean started(final List toks) { if (standaloneNodes.size() > 0) { out.println("Standalone Nodes:"); @@ -662,6 +673,18 @@ public class Shell { return bye(); } }; + if (op.equalsIgnoreCase("remoteStart")) + return new Callable() { + public Boolean call() throws Exception { + return remoteStart(toks); + } + }; + if (op.equalsIgnoreCase("remoteStop")) + return new Callable() { + public Boolean call() throws Exception { + return remoteStop(toks); + } + }; if (op.equalsIgnoreCase("start")) return new Callable() { public Boolean call() throws Exception { -- cgit v1.2.3