You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2010/10/01 13:25:16 UTC

svn commit: r1003487 - in /tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell: Shell.java jline/TShellCompletor.java

Author: antelder
Date: Fri Oct  1 11:25:16 2010
New Revision: 1003487

URL: http://svn.apache.org/viewvc?rev=1003487&view=rev
Log:
Add start of save command, all the shell bits but still need to implement the actual writing of the state

Modified:
    tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
    tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.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=1003487&r1=1003486&r2=1003487&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 Fri Oct  1 11:25:16 2010
@@ -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,...>]");

Modified: tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java?rev=1003487&r1=1003486&r2=1003487&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/jline/TShellCompletor.java Fri Oct  1 11:25:16 2010
@@ -59,6 +59,7 @@ public class TShellCompletor extends Arg
         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()});