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/09/29 16:27:04 UTC

svn commit: r1002652 - 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: Wed Sep 29 14:27:04 2010
New Revision: 1002652

URL: http://svn.apache.org/viewvc?rev=1002652&view=rev
Log:
Update the Shell with a 'load' command that can load a node from an xml file

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=1002652&r1=1002651&r2=1002652&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 Wed Sep 29 14:27:04 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",
-                                                          "printDomainLevelComposite", "remove", "start", "status",
+                                                          "load", "printDomainLevelComposite", "remove", "start", "status",
                                                           "stop"};
 
     public static void main(final String[] args) throws Exception {
@@ -189,6 +189,13 @@ public class Shell {
         return true;
     }
 
+    boolean load(final String configXmlUrl) throws ContributionReadException, ActivationException, ValidationException {
+        Node node = factory.createNodeFromXML(configXmlUrl);
+        currentDomain = node.getDomainName();
+        nodes.put(currentDomain, node);
+        return true;
+    }
+
     boolean printDomainLevelComposite() throws ContributionReadException, ActivationException, ValidationException {
         out.println("TODO");
         // out.println(node.getDomainLevelCompositeAsString());
@@ -377,6 +384,12 @@ public class Shell {
                     return installed(toks);
                 }
             };
+        if (op.equalsIgnoreCase("load"))
+            return new Callable<Boolean>() {
+                public Boolean call() throws Exception {
+                    return load(toks.get(1));
+                }
+            };
         if (op.equalsIgnoreCase("printDomainLevelComposite"))
             return new Callable<Boolean>() {
                 public Boolean call() throws Exception {
@@ -496,6 +509,8 @@ public class Shell {
             helpInstall();
         } else if ("installed".equalsIgnoreCase(command)) {
             helpInstalled();
+        } else if ("load".equalsIgnoreCase(command)) {
+            helpLoad();
         } else if ("remove".equalsIgnoreCase(command)) {
             helpRemove();
         } else if ("printDomainLevelComposite".equalsIgnoreCase(command)) {
@@ -528,6 +543,7 @@ public class Shell {
         out.println("   domains");
         out.println("   install [<uri>] <contributionURL> [-start -metadata <url> -duris <uri,uri,...>]");
         out.println("   installed [<contributionURI>]");
+        out.println("   load <configXmlURL>");
         out.println("   remove <contributionURI>");
         out.println("   printDomainLevelComposite");
         out.println("   start <curi> <compositeUri>|<contentURL>");
@@ -603,6 +619,17 @@ public class Shell {
         out.println("      contributionURI - (optional) the URI of an installed contribution");
     }
 
+    void helpLoad() {
+        out.println("   load <configXmlUrl>");
+        out.println();
+        out.println("   Shows information about the contributions installed on this node,");
+        out.println("   including the contribution URI and location along with the URI");
+        out.println("   and QName of any composites within the contribution");
+        out.println();
+        out.println("   Arguments:");
+        out.println("      configXmlUrl - (required) the URL of the config file to load");
+    }
+
     void helpRemove() {
         out.println("   remove <contributionURI>");
         out.println();

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=1002652&r1=1002651&r2=1002652&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 Wed Sep 29 14:27:04 2010
@@ -54,6 +54,7 @@ public class TShellCompletor extends Arg
 //        completors.put("install", new Completor[]{commandCompletor, new InstallCompletor(), new NullCompletor()});    
         completors.put("install", new Completor[]{commandCompletor, new FileNameCompletor(), new FileNameCompletor(), new NullCompletor()});    
         completors.put("installed", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()});    
+        completors.put("load", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()});    
         completors.put("remove", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()});    
         completors.put("addDeploymentComposite", new Completor[]{commandCompletor, new ICURICompletor(shell), new FileNameCompletor(), new NullCompletor()});    
         completors.put("printDomainLevelComposite", new Completor[]{commandCompletor, new NullCompletor()});