From 284d6e3cb53db506e92fcc936400aaf84d12571a Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 6 Jul 2010 19:47:33 +0000 Subject: Start adding help detail git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960996 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/shell/Shell.java | 238 +++++++++++++++++++-- 1 file changed, 215 insertions(+), 23 deletions(-) (limited to 'sca-java-2.x/trunk/modules') 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 d475af6a89..0351baacf5 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 @@ -198,27 +198,6 @@ public class Shell { return true; } - boolean help() { - out.println("Apache Tuscany Shell (" + Version.getVersion() + " " + Version.getRevsion() + " " + Version.getBuildTime() + ")"); - out.println("Commands:"); - out.println(); - out.println(" help"); - out.println(" install [-uri -norun -metadata -duris ]"); - out.println(" installed []"); - out.println(" remove "); - out.println(" addDeploymentComposite "); - out.println(" addToDomainLevelComposite "); - out.println(" removeFromDomainLevelComposite "); - out.println(" listDeployedCompostes "); - out.println(" listInstalledContributions"); - out.println(" printDomainLevelComposite"); - out.println(" start "); - out.println(" status [ ]"); - out.println(" stop [ ]"); - out.println(); - return true; - } - boolean stop(List toks) throws ActivationException { if (toks == null || toks.size() < 2) { node.stop(); @@ -325,7 +304,7 @@ public class Shell { return removeFromDomainLevelComposite(toks.get(1)); }}; if (op.equals("help")) return new Callable() { public Boolean call() { - return help(); + return help(toks); }}; if (op.equals("stop")) return new Callable() { public Boolean call() throws Exception { return stop(toks); @@ -358,7 +337,7 @@ public class Shell { } public void run() throws IOException { - help(); + help(null); Object reader; if (useJline) { reader = JLine.createJLineReader(this); @@ -383,5 +362,218 @@ public class Shell { IOHelper.close(is); } } + + boolean help(List toks) { + String command = (toks == null || toks.size() < 2) ? null : toks.get(1); + if (command == null) { + helpOverview(); + } else if ("help".equalsIgnoreCase(command)){ + helpHelp(); + } else if ("install".equalsIgnoreCase(command)) { + helpInstall(); + } else if ("installed".equalsIgnoreCase(command)) { + helpInstalled(); + } else if ("remove".equalsIgnoreCase(command)) { + helpRemove(); + } else if ("addDeploymentComposite".equalsIgnoreCase(command)) { + helpAddDeploymentComposite(); + } else if ("addToDomainLevelComposite".equalsIgnoreCase(command)) { + helpAddToDomainLevelComposite(); + } else if ("removeFromDomainLevelComposite".equalsIgnoreCase(command)) { + helpRemoveFromDomainLevelComposite(); + } else if ("listDeployedCompostes".equalsIgnoreCase(command)) { + helpListDeployedCompostes(); + } else if ("listInstalledContributions".equalsIgnoreCase(command)) { + helpListInstalledContributions(); + } else if ("printDomainLevelComposite".equalsIgnoreCase(command)) { + helpPrintDomainLevelComposite(); + } else if ("start".equalsIgnoreCase(command)) { + helpStart(); + } else if ("status".equalsIgnoreCase(command)) { + helpStatus(); + } else if ("stop".equalsIgnoreCase(command)) { + helpStop(); + } else if ("startup".equalsIgnoreCase(command)){ + helpStartUp(); + } + return true; + } + + boolean helpOverview() { + out.println("Apache Tuscany Shell (" + Version.getVersion() + " " + Version.getRevsion() + " " + Version.getBuildTime() + ")"); + out.println("Commands:"); + out.println(); + out.println(" help"); + out.println(" install [-uri -norun -metadata -duris ]"); + out.println(" installed []"); + out.println(" remove "); + out.println(" addDeploymentComposite "); + out.println(" addToDomainLevelComposite "); + out.println(" removeFromDomainLevelComposite "); + out.println(" listDeployedCompostes "); + out.println(" listInstalledContributions"); + out.println(" printDomainLevelComposite"); + out.println(" start "); + out.println(" status [ ]"); + out.println(" stop [ ]"); + out.println(); + return true; + } + void helpHelp() { + out.println(" help []"); + out.println(); + out.println(" Outputs help on the Tuscany Shell"); + out.println(" If the command argument is used it provides detailed help on that command otherwise"); + out.println(" it provides an overview of available Shell commands"); + out.println(); + out.println(" To get help on starting the Tuscany Shell use 'help startup'"); + out.println(); + out.println(" Arguments:"); + out.println(" - (optional) the command to get detailed help on"); + } + + void helpAddDeploymentComposite() { + out.println(" addDeploymentComposite "); + out.println(); + out.println(" Adds a deployment composite using a supplied composite ('composite by value' - a data"); + out.println(" structure, not an existing resource in the Domain) to the contribution identified by a"); + out.println(" supplied contribution URI. The added deployment composite is given a relative URI that"); + out.println(" matches the @name attribute of the composite, with a '.composite' suffix. Since all composites"); + out.println(" run within the context of an installed contribution (any component implementations or other"); + out.println(" definitions are resolved within that contribution), this functionality makes it possible"); + out.println(" for the deployer to create a composite with final configuration and wiring decisions and add"); + out.println(" it to an installed contribution without having to modify the contents of the root contribution."); + out.println(); + out.println(" Arguments:"); + out.println(" - (required) the URI of an installed contribution"); + out.println(" - (required) the location of the composite"); + } + + void helpInstall() { + out.println(" install [-uri -norun -metadata -duris ]"); + out.println(); + out.println(" Creates an installed contribution with a supplied root contribution, installed at base URI."); + out.println(); + out.println(" Arguments:"); + out.println(" contributionURL - (required) the URL to the contribution to install"); + out.println(" -uri - (optional) the URI (name) to use for the contribution. When"); + out.println(" no uri is defined a default URI is automatically choosen based on the contribution URL"); + out.println(" -norun - (optional) do not start any composites listed as deployable in the sca-contribution.xml file"); + out.println(" -metadata - (optional) the URL to an external contribution meta data document that should be"); + out.println(" merged into any existing sca-contributions.xml file within the contribution."); + out.println(" -duris - (optional) specifies the URIs of contributions that are used to resolve the"); + out.println(" dependencies of the root contribution and other dependent contributions."); + out.println(" When not specified all installed contributions are used to resolve dependencies."); + } + void helpInstalled() { + out.println(" installed []"); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" contributionURI - (optional) the URI of an installed contribution"); + } + + void helpRemove() { + out.println(" remove "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" contributionURI - (optional) the URI of an installed contribution"); + } + + void helpAddToDomainLevelComposite() { + out.println(" addToDomainLevelComposite "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } + + void helpRemoveFromDomainLevelComposite() { + out.println(" removeFromDomainLevelComposite "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } + + void helpListDeployedCompostes() { + out.println(" listDeployedCompostes "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" contributionURI - (required) the URI of an installed contribution"); + } + + void helpListInstalledContributions() { + out.println(" listInstalledContributions"); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } + + void helpPrintDomainLevelComposite() { + out.println(" printDomainLevelComposite"); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } + + void helpStart() { + out.println(" start "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" curi - (optional) the URI of an installed contribution"); + out.println(" compositeUri - (optional) the URI of a composite"); + } + + void helpStatus() { + out.println(" status [ ]"); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" curi - (optional) the URI of an installed contribution"); + out.println(" compositeUri - (optional) the URI of a composite"); + } + + void helpStop() { + out.println(" stop [ ]"); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" curi - (optional) the URI of an installed contribution"); + out.println(" compositeUri - (optional) the URI of a composite"); + } + + void helpStartUp() { + out.println(" XXX "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } + + void helpXXX() { + out.println(" XXX "); + out.println(); + out.println(" XXX"); + out.println(); + out.println(" Arguments:"); + out.println(" xxx - (required) xxx"); + } } -- cgit v1.2.3