diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-29 14:27:04 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-09-29 14:27:04 +0000 |
commit | ed33ba727ae79a6a9f9d2be61ffcbad17f857303 (patch) | |
tree | 6684a2a0502ae31c913c82728d83d56ea1ebc375 /sca-java-2.x/trunk/modules/shell/src | |
parent | c39df2745384393d50b6f1bebbaa123718456394 (diff) |
Update the Shell with a 'load' command that can load a node from an xml file
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1002652 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/shell/src')
2 files changed, 29 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 59e98d2c84..7046586828 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",
- "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();
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 64d5613cab..98c609d917 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 @@ -54,6 +54,7 @@ public class TShellCompletor extends ArgumentCompletor { // 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()}); |