summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-10-01 11:25:16 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-10-01 11:25:16 +0000
commite5c558ce456d0750fe62485977d0d4686d5f4761 (patch)
tree7244ebe7ea4b23b06153b3e98939148dd41d121c
parent549a24b45096c4a3bf92b9af0098bf452ddd322a (diff)
Add start of save command, all the shell bits but still need to implement the actual writing of the state
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1003487 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java27
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java1
2 files changed, 27 insertions, 1 deletions
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 4913a5c5fb..db6ec54a01 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
@@ -59,7 +59,7 @@ public class Shell {
private Map<String, Node> nodes = new HashMap<String, Node>();
public static final String[] COMMANDS = new String[] {"bye", "domain", "domains", "help", "install", "installed",
- "load", "printDomainLevelComposite", "remove", "run", "start", "status",
+ "load", "printDomainLevelComposite", "remove", "run", "save", "start", "status",
"stop"};
public static void main(final String[] args) throws Exception {
@@ -240,6 +240,11 @@ public class Shell {
return true;
}
+ boolean save(final String directory) throws IOException {
+ out.println("TODO: not yet implemented");
+ return true;
+ }
+
public boolean stop(List<String> toks) throws ActivationException {
String curi = toks.get(1);
if (toks.size() > 2) {
@@ -443,6 +448,12 @@ public class Shell {
return help(toks);
}
};
+ if (op.equalsIgnoreCase("save"))
+ return new Callable<Boolean>() {
+ public Boolean call() throws Exception {
+ return save(toks.get(1));
+ }
+ };
if (op.equalsIgnoreCase("stop"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
@@ -546,6 +557,8 @@ public class Shell {
helpRun();
} else if ("printDomainLevelComposite".equalsIgnoreCase(command)) {
helpPrintDomainLevelComposite();
+ } else if ("save".equalsIgnoreCase(command)) {
+ helpSave();
} else if ("start".equalsIgnoreCase(command)) {
helpStart();
} else if ("status".equalsIgnoreCase(command)) {
@@ -578,6 +591,7 @@ public class Shell {
out.println(" remove <contributionURI>");
out.println(" run <commandsFileURL>");
out.println(" printDomainLevelComposite");
+ out.println(" save <directoryPath>");
out.println(" start <curi> <compositeUri>|<contentURL>");
out.println(" start <name> [<compositeUri>] <contributionURL> [-duris <uri,uri,...>]");
out.println(" status [<curi> <compositeUri>]");
@@ -691,6 +705,17 @@ public class Shell {
out.println(" none");
}
+ void helpSave() {
+ out.println(" save <directoryPath>");
+ out.println();
+ out.println(" Saves the current Node state to directory.");
+ out.println(" This will include a node-config.xml file and copies of all artifacts");
+ out.println(" being used by the Node.");
+ out.println();
+ out.println(" Arguments:");
+ out.println(" directoryPath - (required) the URL of a directory to be used to store the state.");
+ }
+
void helpStart() {
out.println(" start <curi> <compositeUri>|<contentURL>");
out.println(" start <name> [<compositeUri>] <contributionURL> [-duris <uri,uri,...>]");
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java
index 616e34b7ad..5bcf772f57 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java
@@ -59,6 +59,7 @@ public class TShellCompletor extends ArgumentCompletor {
completors.put("run", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()});
completors.put("addDeploymentComposite", new Completor[]{commandCompletor, new ICURICompletor(shell), new FileNameCompletor(), new NullCompletor()});
completors.put("printDomainLevelComposite", new Completor[]{commandCompletor, new NullCompletor()});
+ completors.put("save", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()});
completors.put("start", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
completors.put("status", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});
completors.put("stop", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()});