geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r535507 [1/4] - in /geronimo/server/trunk: assemblies/geronimo-boilerplate-minimal/ configs/client-system/ configs/j2ee-system/ configs/jsr88-cli/ configs/online-deployer/ modules/geronimo-cli/ modules/geronimo-cli/src/ modules/geronimo-cli...
Date Sat, 05 May 2007 11:22:52 GMT
Author: gdamour
Date: Sat May  5 04:22:39 2007
New Revision: 535507

URL: http://svn.apache.org/viewvc?view=rev&rev=535507
Log:
Refactor the various CLIs such that oprtions parsing and arguments are done prior to boot the
boot configuration.

* Add a geronimo-cli JAR containing all the classes to perform options and arguments parsing. It is included in the lib/ folder and added to the Class-Path manifest entry of the deployer.jar, server.jar and client.jar runnable JARs;
* Use commons-cli to perform the option parsing; and
* add support for an extra verbose level, -vvv, and remap the verbose level as follows: -v -> INFO, -vv -> DEBUG, -vvv -> TRACE.

This fixes GERONIMO-3059 - CLIs refactoring - options and arguments parsing should be done prior the boot of a Kernel to provide a quicker feedback to users if they are invalid

Added:
    geronimo/server/trunk/modules/geronimo-cli/
    geronimo/server/trunk/modules/geronimo-cli/LICENSE.txt
    geronimo/server/trunk/modules/geronimo-cli/NOTICE.txt
    geronimo/server/trunk/modules/geronimo-cli/pom.xml
    geronimo/server/trunk/modules/geronimo-cli/src/
    geronimo/server/trunk/modules/geronimo-cli/src/main/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/AbstractCLI.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParser.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParserException.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/PrintHelper.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLParser.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandArgs.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandArgs.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLI.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployerCLParser.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/HelpCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallPluginCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListTargetsCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/LoginCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/RedeployCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/RestartCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/SearchPluginsCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/StartCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/StopCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/UndeployCommandMetaData.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/AbstractCLITest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/BaseCLParserTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/client/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/client/ClientCLParserTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/daemon/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/daemon/DaemonCLParserTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaDataTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DeployerCLParserTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java
    geronimo/server/trunk/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java
Modified:
    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml
    geronimo/server/trunk/configs/client-system/pom.xml
    geronimo/server/trunk/configs/j2ee-system/pom.xml
    geronimo/server/trunk/configs/jsr88-cli/pom.xml
    geronimo/server/trunk/configs/online-deployer/pom.xml
    geronimo/server/trunk/modules/geronimo-deploy-tool/pom.xml
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDeploy.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandDistribute.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallCAR.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListModules.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandListTargets.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandLogin.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRedeploy.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandRestart.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStart.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandStop.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandUndeploy.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployCommand.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployTool.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/ServerConnection.java
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StopServer.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/Main.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/MainBootstrapper.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/util/MainConfigurationBootstrapper.java
    geronimo/server/trunk/modules/geronimo-system/pom.xml
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/ClientCommandLine.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/Daemon.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedClientCommandLine.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java

Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml?view=diff&rev=535507&r1=535506&r2=535507
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml Sat May  5 04:22:39 2007
@@ -58,6 +58,10 @@
                                     <artifactId>cglib-nodep</artifactId>
                                 </artifactItem>
                                 <artifactItem>
+                                    <groupId>commons-cli</groupId>
+                                    <artifactId>commons-cli</artifactId>
+                                </artifactItem>
+                                <artifactItem>
                                     <groupId>commons-logging</groupId>
                                     <artifactId>commons-logging</artifactId>
                                 </artifactItem>
@@ -72,6 +76,11 @@
                                 <artifactItem>
                                     <groupId>xstream</groupId>
                                     <artifactId>xstream</artifactId>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.geronimo.modules</groupId>
+                                    <artifactId>geronimo-cli</artifactId>
+                                    <version>${version}</version>
                                 </artifactItem>
                                 <artifactItem>
                                     <groupId>org.apache.geronimo.modules</groupId>

Modified: geronimo/server/trunk/configs/client-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/client-system/pom.xml?view=diff&rev=535507&r1=535506&r2=535507
==============================================================================
--- geronimo/server/trunk/configs/client-system/pom.xml (original)
+++ geronimo/server/trunk/configs/client-system/pom.xml Sat May  5 04:22:39 2007
@@ -92,7 +92,7 @@
                             <Extension-Dirs>lib/ext</Extension-Dirs>
                         </manifestEntries>
                         <manifest>
-                            <mainClass>org.apache.geronimo.kernel.util.MainConfigurationBootstrapper</mainClass>
+                            <mainClass>org.apache.geronimo.cli.client.ClientCLI</mainClass>
                         </manifest>
                     </archive>
                     
@@ -102,6 +102,11 @@
                     <classpath>
                         <element>
                             <groupId>org.apache.geronimo.modules</groupId>
+                            <artifactId>geronimo-cli</artifactId>
+                            <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>org.apache.geronimo.modules</groupId>
                             <artifactId>geronimo-kernel</artifactId>
                             <version>${version}</version>
                         </element>
@@ -109,6 +114,10 @@
                             <groupId>org.apache.geronimo.modules</groupId>
                             <artifactId>geronimo-util</artifactId>
                             <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>commons-cli</groupId>
+                            <artifactId>commons-cli</artifactId>
                         </element>
                         <element>
                             <groupId>commons-logging</groupId>

Modified: geronimo/server/trunk/configs/j2ee-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/j2ee-system/pom.xml?view=diff&rev=535507&r1=535506&r2=535507
==============================================================================
--- geronimo/server/trunk/configs/j2ee-system/pom.xml (original)
+++ geronimo/server/trunk/configs/j2ee-system/pom.xml Sat May  5 04:22:39 2007
@@ -95,7 +95,7 @@
                             <Extension-Dirs>lib/ext</Extension-Dirs>
                         </manifestEntries>
                         <manifest>
-                            <mainClass>org.apache.geronimo.kernel.util.MainConfigurationBootstrapper</mainClass>
+                            <mainClass>org.apache.geronimo.cli.daemon.DaemonCLI</mainClass>
                         </manifest>
                     </archive>
                     
@@ -105,8 +105,17 @@
                     <classpath>
                         <element>
                             <groupId>org.apache.geronimo.modules</groupId>
+                            <artifactId>geronimo-cli</artifactId>
+                            <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>org.apache.geronimo.modules</groupId>
                             <artifactId>geronimo-kernel</artifactId>
                             <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>commons-cli</groupId>
+                            <artifactId>commons-cli</artifactId>
                         </element>
                         <element>
                             <groupId>commons-logging</groupId>

Modified: geronimo/server/trunk/configs/jsr88-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/jsr88-cli/pom.xml?view=diff&rev=535507&r1=535506&r2=535507
==============================================================================
--- geronimo/server/trunk/configs/jsr88-cli/pom.xml (original)
+++ geronimo/server/trunk/configs/jsr88-cli/pom.xml Sat May  5 04:22:39 2007
@@ -69,6 +69,12 @@
 
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-cli</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-deploy-tool</artifactId>
             <version>${version}</version>
         </dependency>

Modified: geronimo/server/trunk/configs/online-deployer/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/online-deployer/pom.xml?view=diff&rev=535507&r1=535506&r2=535507
==============================================================================
--- geronimo/server/trunk/configs/online-deployer/pom.xml (original)
+++ geronimo/server/trunk/configs/online-deployer/pom.xml Sat May  5 04:22:39 2007
@@ -87,7 +87,7 @@
                             <Extension-Dirs>lib/ext</Extension-Dirs>
                         </manifestEntries>
                         <manifest>
-                            <mainClass>org.apache.geronimo.kernel.util.MainBootstrapper</mainClass>
+                            <mainClass>org.apache.geronimo.cli.deployer.DeployerCLI</mainClass>
                         </manifest>
                     </archive>
 
@@ -97,8 +97,17 @@
                     <classpath>
                         <element>
                             <groupId>org.apache.geronimo.modules</groupId>
+                            <artifactId>geronimo-cli</artifactId>
+                            <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>org.apache.geronimo.modules</groupId>
                             <artifactId>geronimo-kernel</artifactId>
                             <version>${version}</version>
+                        </element>
+                        <element>
+                            <groupId>commons-cli</groupId>
+                            <artifactId>commons-cli</artifactId>
                         </element>
                         <element>
                             <groupId>commons-logging</groupId>

Added: geronimo/server/trunk/modules/geronimo-cli/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/LICENSE.txt?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/LICENSE.txt (added)
+++ geronimo/server/trunk/modules/geronimo-cli/LICENSE.txt Sat May  5 04:22:39 2007
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: geronimo/server/trunk/modules/geronimo-cli/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/NOTICE.txt?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/NOTICE.txt (added)
+++ geronimo/server/trunk/modules/geronimo-cli/NOTICE.txt Sat May  5 04:22:39 2007
@@ -0,0 +1,6 @@
+Apache Geronimo 
+Copyright 2003-2006 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Added: geronimo/server/trunk/modules/geronimo-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/pom.xml?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/pom.xml (added)
+++ geronimo/server/trunk/modules/geronimo-cli/pom.xml Sat May  5 04:22:39 2007
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Rev: 510485 $ $Date: 2007-02-23 00:02:44 +1100 (Fri, 23 Feb 2007) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>geronimo-cli</artifactId>
+    <name>Geronimo :: CLI</name>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.agical.rmock</groupId>
+            <artifactId>rmock</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>
+

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/AbstractCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/AbstractCLI.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/AbstractCLI.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/AbstractCLI.java Sat May  5 04:22:39 2007
@@ -0,0 +1,90 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli;
+
+import java.io.PrintStream;
+
+import org.apache.geronimo.cli.CLParserException;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.geronimo.kernel.util.MainConfigurationBootstrapper;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public abstract class AbstractCLI {
+
+    private final String[] args;
+    private final PrintStream errStream;
+    
+    protected AbstractCLI(String[] args, PrintStream errStream) {
+        if (null == args) {
+            throw new IllegalArgumentException("args is required");
+        } else if (null == errStream) {
+            throw new IllegalArgumentException("errStream is required");
+        }
+        this.args = args;
+        this.errStream = errStream;
+    }
+
+    public int executeMain() {
+        CLParser parser = getCLParser();
+        try {
+            parser.parse(args);
+        } catch (CLParserException e) {
+            errStream.println(e.getMessage());
+            parser.displayHelp();
+            return 1;
+        }
+
+        if (parser.isHelp()) {
+            parser.displayHelp();
+            return 0;
+        }
+        
+        boolean executed = executeCommand(parser);
+        if (executed) {
+            return 0;
+        }
+        
+        initializeLogging(parser);
+        
+        MainConfigurationBootstrapper mainConfigurationBootstrapper = newMainConfigurationBootstrapper();
+        return MainConfigurationBootstrapper.main(mainConfigurationBootstrapper, parser);
+    }
+
+    protected boolean executeCommand(CLParser parser) {
+        return false;
+    }
+
+    protected void initializeLogging(CLParser parser) {
+        GeronimoLogging level = GeronimoLogging.WARN;
+        if (parser.isVerboseInfo()) {
+            level = GeronimoLogging.INFO;
+        } else if (parser.isVerboseDebug()) {
+            level = GeronimoLogging.DEBUG;
+        } else if (parser.isVerboseTrace()) {
+            level = GeronimoLogging.TRACE;
+        }
+        GeronimoLogging.initialize(level);
+    }
+
+    protected abstract MainConfigurationBootstrapper newMainConfigurationBootstrapper();
+
+    protected abstract CLParser getCLParser();
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/BaseCLParser.java Sat May  5 04:22:39 2007
@@ -0,0 +1,135 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli;
+
+import java.io.OutputStream;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class BaseCLParser implements CLParser {
+    private final static String ARGUMENT_HELP_SHORTFORM = "h";
+    private final static String ARGUMENT_HELP = "help";
+
+    private final static String ARGUMENT_VERBOSE_INFO_SHORTFORM = "v";
+    private final static String ARGUMENT_VERBOSE_INFO = "verbose";
+    
+    private final static String ARGUMENT_VERBOSE_DEBUG_SHORTFORM = "vv";
+    private final static String ARGUMENT_VERBOSE_DEBUG = "veryverbose";
+    
+    private final static String ARGUMENT_VERBOSE_TRACE_SHORTFORM = "vvv";
+    private final static String ARGUMENT_VERBOSE_TRACE = "veryveryverbose";
+    
+    protected final OutputStream out;
+    protected final Options options;
+    protected CommandLine commandLine;
+    
+    public BaseCLParser(OutputStream out) {
+        if (null == out) {
+            throw new IllegalArgumentException("out is required");
+        }
+        this.out = out;
+        options = new Options();
+        
+        addVerboseOptions();
+        addHelp();
+    }
+
+    public void parse(String[] args) throws CLParserException {
+        CommandLineParser parser = new GnuParser();
+        try {
+            commandLine = parser.parse(options, args, true);
+        } catch (ParseException e) {
+            throw new CLParserException(e);
+        }
+        
+        validateOptions();
+        validateRemainingArgs();
+    }
+
+    public boolean isHelp() {
+        return commandLine.hasOption(ARGUMENT_HELP_SHORTFORM);
+    }
+
+    public boolean isVerboseInfo() {
+        return commandLine.hasOption(ARGUMENT_VERBOSE_INFO_SHORTFORM);
+    }
+    
+    public boolean isVerboseDebug() {
+        return commandLine.hasOption(ARGUMENT_VERBOSE_DEBUG_SHORTFORM);
+    }
+
+    public boolean isVerboseTrace() {
+        return commandLine.hasOption(ARGUMENT_VERBOSE_TRACE_SHORTFORM);
+    }
+    
+    public String[] getArgs() {
+        return commandLine.getArgs();
+    }
+
+    public void displayHelp() {
+        throw new UnsupportedOperationException();
+    }
+
+    protected void displayHelp(String[] args) {
+        throw new UnsupportedOperationException();
+    }
+
+    protected void validateOptions() throws CLParserException {
+    }
+
+    protected void validateRemainingArgs() throws CLParserException {
+    }
+    
+    protected void addHelp() {
+        options.addOption(ARGUMENT_HELP_SHORTFORM, ARGUMENT_HELP, false, "Display this help.");
+    }
+
+    protected void addVerboseOptions() {
+        OptionGroup optionGroup = new OptionGroup();
+
+        Option option = new Option(ARGUMENT_VERBOSE_INFO_SHORTFORM,
+                ARGUMENT_VERBOSE_INFO,
+                false,
+                "Reduces the console log level to INFO, resulting in more console output than is normally present.");
+        optionGroup.addOption(option);
+
+        option = new Option(ARGUMENT_VERBOSE_DEBUG_SHORTFORM,
+                ARGUMENT_VERBOSE_DEBUG,
+                false,
+                "Reduces the console log level to DEBUG, resulting in still more console output.");
+        optionGroup.addOption(option);
+
+        option = new Option(ARGUMENT_VERBOSE_TRACE_SHORTFORM,
+                ARGUMENT_VERBOSE_TRACE,
+                false,
+                "Reduces the console log level to TRACE, resulting in still more console output.");
+        optionGroup.addOption(option);
+
+        options.addOptionGroup(optionGroup);
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParser.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParser.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParser.java Sat May  5 04:22:39 2007
@@ -0,0 +1,34 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli;
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public interface CLParser {
+    void parse(String[] args) throws CLParserException;
+
+    boolean isHelp();
+
+    boolean isVerboseInfo();
+
+    boolean isVerboseDebug();
+
+    boolean isVerboseTrace();
+
+    void displayHelp();
+}
\ No newline at end of file

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParserException.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParserException.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParserException.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/CLParserException.java Sat May  5 04:22:39 2007
@@ -0,0 +1,39 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli;
+
+
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class CLParserException extends Exception {
+
+    public CLParserException(Throwable cause) {
+        super(cause);
+    }
+
+    public CLParserException(String description, Throwable cause) {
+        super(description, cause);
+    }
+    
+    public CLParserException(String description) {
+        super(description);
+    }
+    
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/PrintHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/PrintHelper.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/PrintHelper.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/PrintHelper.java Sat May  5 04:22:39 2007
@@ -0,0 +1,434 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+
+/**
+ * This code is borrowed from commons-cli <code>org.apache.commons.cli.HelpFormatter</code> class. Its authors are 
+ * Slawek Zachcial and John Keyes (john at integralsource.com). This class has been slightly updated to meet specific
+ * requirements.
+ * 
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class PrintHelper {
+
+    public static String reformat(String source, int indent, int endCol) {
+        if(endCol-indent < 10) {
+            throw new IllegalArgumentException("This is ridiculous!");
+        }
+        StringBuffer buf = new StringBuffer((int)(source.length()*1.1));
+        String prefix = indent == 0 ? "" : buildIndent(indent);
+        try {
+            BufferedReader in = new BufferedReader(new StringReader(source));
+            String line;
+            int pos;
+            while((line = in.readLine()) != null) {
+                if(buf.length() > 0) {
+                    buf.append('\n');
+                }
+                while(line.length() > 0) {
+                    line = prefix + line;
+                    if(line.length() > endCol) {
+                        pos = line.lastIndexOf(' ', endCol);
+                        if(pos < indent) {
+                            pos = line.indexOf(' ', endCol);
+                            if(pos < indent) {
+                                pos = line.length();
+                            }
+                        }
+                        buf.append(line.substring(0, pos)).append('\n');
+                        if(pos < line.length()-1) {
+                            line = line.substring(pos+1);
+                        } else {
+                            break;
+                        }
+                    } else {
+                        buf.append(line).append("\n");
+                        break;
+                    }
+                }
+            }
+        } catch (IOException e) {
+            throw new AssertionError("This should be impossible");
+        }
+        return buf.toString();
+    }
+
+    private static String buildIndent(int indent) {
+        StringBuffer buf = new StringBuffer(indent);
+        for(int i=0; i<indent; i++) {
+            buf.append(' ');
+        }
+        return buf.toString();
+    }
+
+    public static final int DEFAULT_WIDTH = 76;
+    public static final int DEFAULT_LEFT_PAD = 1;
+    public static final int DEFAULT_DESC_PAD = 3;
+    public static final String DEFAULT_SYNTAX_PREFIX = "usage: ";
+    public static final String DEFAULT_OPT_PREFIX = "-";
+    public static final String DEFAULT_LONG_OPT_PREFIX = "--";
+    public static final String DEFAULT_ARG_NAME = "arg";
+
+    private final OutputStream outputStream;
+    public int defaultWidth;
+    public int defaultLeftPad;
+    public int defaultDescPad;
+    public String defaultSyntaxPrefix;
+    public String defaultNewLine;
+    public String defaultOptPrefix;
+    public String defaultLongOptPrefix;
+    public String defaultArgName;
+
+    public PrintHelper(OutputStream outputStream) {
+        if (null == outputStream) {
+            throw new IllegalArgumentException("outputStream is required");
+        }
+        this.outputStream = outputStream;
+        
+        defaultWidth = DEFAULT_WIDTH;
+        defaultLeftPad = DEFAULT_LEFT_PAD;
+        defaultDescPad = DEFAULT_DESC_PAD;
+        defaultSyntaxPrefix = DEFAULT_SYNTAX_PREFIX;
+        defaultNewLine = System.getProperty("line.separator");
+        defaultOptPrefix = DEFAULT_OPT_PREFIX;
+        defaultLongOptPrefix = DEFAULT_LONG_OPT_PREFIX;
+        defaultArgName = DEFAULT_ARG_NAME;
+    }
+
+    public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) {
+        printHelp(defaultWidth, cmdLineSyntax, header, options, footer, autoUsage);
+    }
+
+    public void printHelp(int width,
+            String cmdLineSyntax,
+            String header,
+            Options options,
+            String footer,
+            boolean autoUsage) {
+        PrintWriter pw = new PrintWriter(outputStream);
+        printHelp(pw, width, cmdLineSyntax, header, options, defaultLeftPad, defaultDescPad, footer, autoUsage);
+        pw.flush();
+    }
+
+    public void printHelp(PrintWriter pw,
+            int width,
+            String cmdLineSyntax,
+            String header,
+            Options options,
+            int leftPad,
+            int descPad,
+            String footer,
+            boolean autoUsage) throws IllegalArgumentException {
+        if (cmdLineSyntax == null || cmdLineSyntax.length() == 0) {
+            throw new IllegalArgumentException("cmdLineSyntax not provided");
+        }
+
+        if (autoUsage) {
+            printUsage(pw, width, cmdLineSyntax, options);
+        } else {
+            printUsage(pw, width, cmdLineSyntax);
+        }
+
+        if (header != null && header.trim().length() > 0) {
+            printWrapped(pw, width, header);
+        }
+        printOptions(pw, width, options, leftPad, descPad);
+        if (footer != null && footer.trim().length() > 0) {
+            printWrapped(pw, width, footer);
+        }
+    }
+
+    public void printUsage(PrintWriter pw, int width, String app, Options options) {
+        // create a list for processed option groups
+        ArrayList list = new ArrayList();
+
+        StringBuffer optionsBuff = new StringBuffer();
+        
+        // temp variable
+        Option option;
+
+        // iterate over the options
+        for (Iterator i = options.getOptions().iterator(); i.hasNext();) {
+            // get the next Option
+            option = (Option) i.next();
+
+            // check if the option is part of an OptionGroup
+            OptionGroup group = options.getOptionGroup(option);
+
+            // if the option is part of a group and the group has not already
+            // been processed
+            if (group != null && !list.contains(group)) {
+
+                // add the group to the processed list
+                list.add(group);
+
+                // get the names of the options from the OptionGroup
+                Collection names = group.getNames();
+
+                optionsBuff.append("[");
+
+                // for each option in the OptionGroup
+                for (Iterator iter = names.iterator(); iter.hasNext();) {
+                    optionsBuff.append(iter.next());
+                    if (iter.hasNext()) {
+                        optionsBuff.append("|");
+                    }
+                }
+                optionsBuff.append("] ");
+            } else if (group == null) {
+                // if the Option is not part of an OptionGroup
+                // if the Option is not a required option
+                if (!option.isRequired()) {
+                    optionsBuff.append("[");
+                }
+
+                if (!" ".equals(option.getOpt())) {
+                    optionsBuff.append("-").append(option.getOpt());
+                } else {
+                    optionsBuff.append("--").append(option.getLongOpt());
+                }
+
+                if (option.hasArg()) {
+                    optionsBuff.append(" ");
+                }
+
+                // if the Option has a value
+                if (option.hasArg()) {
+                    optionsBuff.append(option.getArgName());
+                }
+
+                // if the Option is not a required option
+                if (!option.isRequired()) {
+                    optionsBuff.append("]");
+                }
+                optionsBuff.append(" ");
+            }
+        }
+        
+        app = app.replace("$options", optionsBuff.toString());
+
+        // call printWrapped
+        printWrapped(pw, width, app.indexOf(' ') + 1, app);
+    }
+
+    public void printUsage(PrintWriter pw, int width, String cmdLineSyntax) {
+        int argPos = cmdLineSyntax.indexOf(' ') + 1;
+        printWrapped(pw, width, defaultSyntaxPrefix.length() + argPos, defaultSyntaxPrefix + cmdLineSyntax);
+    }
+
+    public void printOptions(PrintWriter pw, int width, Options options, int leftPad, int descPad) {
+        StringBuffer sb = new StringBuffer();
+        renderOptions(sb, width, options, leftPad, descPad, true);
+        pw.println(sb.toString());
+    }
+    
+    public void printOptions(PrintWriter pw, Options options) {
+        StringBuffer sb = new StringBuffer();
+        renderOptions(sb, defaultWidth, options, defaultLeftPad, defaultDescPad, true);
+        pw.println(sb.toString());
+    }
+    
+    public void printOptionsNoDesc(PrintWriter pw, Options options) {
+        StringBuffer sb = new StringBuffer();
+        renderOptions(sb, defaultWidth, options, defaultLeftPad, defaultDescPad, false);
+        pw.println(sb.toString());
+    }
+
+    public void printWrapped(PrintWriter pw, int width, String text) {
+        printWrapped(pw, width, 0, text);
+    }
+
+    public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) {
+        StringBuffer sb = new StringBuffer(text.length());
+        renderWrappedText(sb, width, nextLineTabStop, text);
+        pw.println(sb.toString());
+    }
+
+    protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad, boolean displayDesc) {
+        final String lpad = createPadding(leftPad);
+        final String dpad = createPadding(descPad);
+
+        //first create list containing only <lpad>-a,--aaa where -a is opt and --aaa is
+        //long opt; in parallel look for the longest opt string
+        //this list will be then used to sort options ascending
+        int max = 0;
+        StringBuffer optBuf;
+        List prefixList = new ArrayList();
+        Option option;
+        List optList = new ArrayList(options.getOptions());
+        Collections.sort(optList, new StringBufferComparator());
+        for (Iterator i = optList.iterator(); i.hasNext();) {
+            option = (Option) i.next();
+            optBuf = new StringBuffer(8);
+
+            if (option.getOpt().equals(" ")) {
+                optBuf.append(lpad).append("   " + defaultLongOptPrefix).append(option.getLongOpt());
+            } else {
+                optBuf.append(lpad).append(defaultOptPrefix).append(option.getOpt());
+                if (option.hasLongOpt()) {
+                    optBuf.append(',').append(defaultLongOptPrefix).append(option.getLongOpt());
+                }
+
+            }
+
+            if (option.hasArg()) {
+                if (option.hasArgName()) {
+                    optBuf.append(" <").append(option.getArgName()).append('>');
+                } else {
+                    optBuf.append(' ');
+                }
+            }
+
+            prefixList.add(optBuf);
+            max = optBuf.length() > max ? optBuf.length() : max;
+        }
+        int x = 0;
+        for (Iterator i = optList.iterator(); i.hasNext();) {
+            option = (Option) i.next();
+            optBuf = new StringBuffer(prefixList.get(x++).toString());
+
+            if (optBuf.length() < max) {
+                optBuf.append(createPadding(max - optBuf.length()));
+            }
+            optBuf.append(dpad);
+            
+            if (displayDesc) {
+                optBuf.append(option.getDescription());
+            }
+            int nextLineTabStop = max + descPad;
+            renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
+            if (i.hasNext()) {
+                sb.append(defaultNewLine);
+                if (displayDesc) {
+                    sb.append(defaultNewLine);
+                }
+            }
+        }
+
+        return sb;
+    }
+
+    protected StringBuffer renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text) {
+        int pos = findWrapPos(text, width, 0);
+        if (pos == -1) {
+            sb.append(rtrim(text));
+            return sb;
+        } else {
+            sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine);
+        }
+
+        //all following lines must be padded with nextLineTabStop space characters
+        final String padding = createPadding(nextLineTabStop);
+
+        while (true) {
+            text = padding + text.substring(pos).trim();
+            pos = findWrapPos(text, width, 0);
+            if (pos == -1) {
+                sb.append(text);
+                return sb;
+            }
+
+            sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine);
+        }
+
+    }
+
+    protected int findWrapPos(String text, int width, int startPos) {
+        int pos = -1;
+        // the line ends before the max wrap pos or a new line char found
+        if (((pos = text.indexOf('\n', startPos)) != -1 && pos <= width)
+                || ((pos = text.indexOf('\t', startPos)) != -1 && pos <= width)) {
+            return pos;
+        } else if ((startPos + width) >= text.length()) {
+            return -1;
+        }
+
+        //look for the last whitespace character before startPos+width
+        pos = startPos + width;
+        char c;
+        while (pos >= startPos && (c = text.charAt(pos)) != ' ' && c != '\n' && c != '\r') {
+            --pos;
+        }
+        //if we found it - just return
+        if (pos > startPos) {
+            return pos;
+        } else {
+            //must look for the first whitespace chearacter after startPos + width
+            pos = startPos + width;
+            while (pos <= text.length() && (c = text.charAt(pos)) != ' ' && c != '\n' && c != '\r') {
+                ++pos;
+            }
+            return pos == text.length() ? -1 : pos;
+        }
+    }
+
+    protected String createPadding(int len) {
+        StringBuffer sb = new StringBuffer(len);
+        for (int i = 0; i < len; ++i) {
+            sb.append(' ');
+        }
+        return sb.toString();
+    }
+
+    protected String rtrim(String s) {
+        if (s == null || s.length() == 0) {
+            return s;
+        }
+
+        int pos = s.length();
+        while (pos >= 0 && Character.isWhitespace(s.charAt(pos - 1))) {
+            --pos;
+        }
+        return s.substring(0, pos);
+    }
+
+    private static class StringBufferComparator implements Comparator {
+
+        public int compare(Object o1, Object o2) {
+            String str1 = stripPrefix(o1.toString());
+            String str2 = stripPrefix(o2.toString());
+            return (str1.compareTo(str2));
+        }
+
+        private String stripPrefix(String strOption) {
+            // Strip any leading '-' characters
+            int iStartIndex = strOption.lastIndexOf('-');
+            if (iStartIndex == -1) {
+                iStartIndex = 0;
+            }
+            return strOption.substring(iStartIndex);
+
+        }
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLI.java Sat May  5 04:22:39 2007
@@ -0,0 +1,48 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.client;
+
+import org.apache.geronimo.cli.AbstractCLI;
+import org.apache.geronimo.cli.CLParser;
+import org.apache.geronimo.kernel.util.MainConfigurationBootstrapper;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class ClientCLI extends AbstractCLI {
+
+    public static void main(String[] args) {
+        int status = new ClientCLI(args).executeMain();
+        System.exit(status);
+    }
+
+    protected ClientCLI(String[] args) {
+        super(args, System.err);
+    }
+    
+    @Override
+    protected CLParser getCLParser() {
+        return new ClientCLParser(System.out);
+    }
+
+    @Override
+    protected MainConfigurationBootstrapper newMainConfigurationBootstrapper() {
+        return new MainConfigurationBootstrapper();
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLParser.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLParser.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/client/ClientCLParser.java Sat May  5 04:22:39 2007
@@ -0,0 +1,66 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.client;
+
+import java.io.OutputStream;
+
+import org.apache.geronimo.cli.BaseCLParser;
+import org.apache.geronimo.cli.CLParserException;
+import org.apache.geronimo.cli.PrintHelper;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class ClientCLParser extends BaseCLParser {
+    
+    public ClientCLParser(OutputStream out) {
+        super(out);
+    }
+
+    public String getApplicationClientConfiguration() {
+        String[] args = commandLine.getArgs();
+        return args[0];
+    }
+    
+    public String[] getApplicationClientArgs() {
+        String[] args = commandLine.getArgs();
+        String[] newArgs = new String[args.length - 1];
+        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
+        return newArgs;
+    }
+    
+    @Override
+    protected void validateRemainingArgs() throws CLParserException {
+        if (0 == commandLine.getArgs().length) {
+            throw new CLParserException("No configuration provided");
+        }
+    }
+
+    public void displayHelp() {
+        PrintHelper printHelper = new PrintHelper(System.out);
+        printHelper.printHelp("java -jar bin/client.jar $options config-name [app_arg ...]",
+                "\nThe following options are available:",
+                options,
+                "\nThe first argument should identify the Geronimo configuration that "
+                        + "contains the application client you want to run." + "\n"
+                        + "The rest of the arguments will be passed as arguments to the "
+                        + "application client when it is started.",
+                true);
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLI.java Sat May  5 04:22:39 2007
@@ -0,0 +1,48 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.daemon;
+
+import org.apache.geronimo.cli.AbstractCLI;
+import org.apache.geronimo.cli.CLParser;
+import org.apache.geronimo.kernel.util.MainConfigurationBootstrapper;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class DaemonCLI extends AbstractCLI {
+    
+    public static void main(String[] args) {
+        int status = new DaemonCLI(args).executeMain();
+        System.exit(status);
+    }
+
+    protected DaemonCLI(String[] args) {
+        super(args, System.err);
+    }
+
+    @Override
+    protected CLParser getCLParser() {
+        return new DaemonCLParser(System.out);
+    }
+
+    @Override
+    protected MainConfigurationBootstrapper newMainConfigurationBootstrapper() {
+        return new MainConfigurationBootstrapper();
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/daemon/DaemonCLParser.java Sat May  5 04:22:39 2007
@@ -0,0 +1,107 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.daemon;
+
+import java.io.OutputStream;
+
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.geronimo.cli.BaseCLParser;
+import org.apache.geronimo.cli.PrintHelper;
+
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class DaemonCLParser extends BaseCLParser {
+    private final static String ARGUMENT_NO_PROGRESS_SHORTFORM = "q";
+    private final static String ARGUMENT_NO_PROGRESS = "quiet";
+    
+    private final static String ARGUMENT_LONG_PROGRESS_SHORTFORM = "l";
+    private final static String ARGUMENT_LONG_PROGRESS = "long";
+    
+    private final static String ARGUMENT_MODULE_OVERRIDE_SHORTFORM = "o";
+    private final static String ARGUMENT_MODULE_OVERRIDE = "override";
+    
+    public DaemonCLParser(OutputStream out) {
+        super(out);
+        addProgressOptions();
+        addOverride();
+    }
+
+    public boolean isNoProgress() {
+        return commandLine.hasOption(ARGUMENT_NO_PROGRESS_SHORTFORM);
+    }
+
+    public boolean isLongProgress() {
+        return commandLine.hasOption(ARGUMENT_LONG_PROGRESS_SHORTFORM);
+    }
+
+    public String[] getOverride() {
+        return commandLine.getOptionValues(ARGUMENT_MODULE_OVERRIDE_SHORTFORM);
+    }
+    
+    public void displayHelp() {
+        PrintHelper printHelper = new PrintHelper(out);
+        printHelper.printHelp("java -jar bin/server.jar $options",
+                "\nThe following options are available:",
+                options,
+                "\nIn addition you may specify a replacement for var/config/config.xml by setting the property "
+                        + "-Dorg.apache.geronimo.config.file=var/config/<my-config.xml>. "
+                        + "This is resolved relative to the geronimo base directory.\n",
+                true);
+    }
+    
+    protected void addOverride() {
+        OptionBuilder optionBuilder = OptionBuilder.hasArgs().withArgName("moduleId ...");
+        optionBuilder = optionBuilder.withLongOpt(ARGUMENT_MODULE_OVERRIDE);
+        optionBuilder = optionBuilder.withDescription("USE WITH CAUTION!  Overrides the modules in "
+                + "var/config/config.xml such that only the modules listed on "
+                + "the command line will be started.  Note that many J2EE "
+                + "features depend on certain modules being started, so you "
+                + "should be very careful what you omit.  Any arguments after "
+                + "this are assumed to be module names.");
+        Option option = optionBuilder.create(ARGUMENT_MODULE_OVERRIDE_SHORTFORM);
+        options.addOption(option);
+    }
+
+    protected void addProgressOptions() {
+        OptionGroup optionGroup = new OptionGroup();
+
+        Option option = new Option(ARGUMENT_NO_PROGRESS_SHORTFORM,
+                ARGUMENT_NO_PROGRESS,
+                false,
+                "Suppress the normal startup progress bar. This is typically "
+                        + "used when redirecting console output to a file, or starting "
+                        + "the server from an IDE or other tool.");
+        optionGroup.addOption(option);
+
+        option = new Option(ARGUMENT_LONG_PROGRESS_SHORTFORM,
+                ARGUMENT_LONG_PROGRESS,
+                false,
+                "Write startup progress to the console in a format that is "
+                        + "suitable for redirecting console output to a file, or starting "
+                        + "the server from an IDE or other tool (doesn't use linefeeds to "
+                        + "update the progress information that is used by default if you " + "don't specify "
+                        + ARGUMENT_NO_PROGRESS + " or " + ARGUMENT_LONG_PROGRESS + ").");
+        optionGroup.addOption(option);
+
+        options.addOptionGroup(optionGroup);
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandArgs.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandArgs.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandArgs.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandArgs.java Sat May  5 04:22:39 2007
@@ -0,0 +1,37 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.deployer;
+
+
+/**
+ * @version $Rev: 515007 $ $Date: 2007-03-06 18:26:41 +1100 (Tue, 06 Mar 2007) $
+ */
+public class BaseCommandArgs implements CommandArgs  {
+    private final String[] args;
+
+    public BaseCommandArgs(String[] args) {
+        if (null == args) {
+            throw new IllegalArgumentException("args is required");
+        }
+        this.args = args;
+    }
+
+    public String[] getArgs() {
+        return args;
+    }
+    
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandMetaData.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandMetaData.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/BaseCommandMetaData.java Sat May  5 04:22:39 2007
@@ -0,0 +1,67 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.deployer;
+
+import org.apache.geronimo.cli.CLParserException;
+
+
+/**
+ * @version $Rev: 515007 $ $Date: 2007-03-06 18:26:41 +1100 (Tue, 06 Mar 2007) $
+ */
+public abstract class BaseCommandMetaData implements CommandMetaData  {
+    private final String command;
+    private final String group;
+    private final String helpArgumentList;
+    private final String helpText;
+
+    protected BaseCommandMetaData(String command, String group, String helpArgumentList, String helpText) {
+        if (null == command) {
+            throw new IllegalArgumentException("command is required");
+        } else if (null == group) {
+            throw new IllegalArgumentException("group is required");
+        } else if (null == helpArgumentList) {
+            throw new IllegalArgumentException("helpArgumentList is required");
+        } else if (null == helpText) {
+            throw new IllegalArgumentException("helpText is required");
+        }
+        this.command = command;
+        this.group = group;
+        this.helpArgumentList = helpArgumentList;
+        this.helpText = helpText;
+    }
+
+    public CommandArgs parse(String[] newArgs) throws CLParserException {
+        return new BaseCommandArgs(newArgs);
+    }
+    
+    public String getCommandName() {
+        return command;
+    }
+
+    public String getHelpArgumentList() {
+        return helpArgumentList;
+    }
+
+    public String getHelpText() {
+        return helpText;
+    }
+
+    public String getCommandGroup() {
+        return group;
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandArgs.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandArgs.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandArgs.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandArgs.java Sat May  5 04:22:39 2007
@@ -0,0 +1,24 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.deployer;
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public interface CommandArgs {
+    String[] getArgs();
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaData.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaData.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandFileCommandMetaData.java Sat May  5 04:22:39 2007
@@ -0,0 +1,40 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.deployer;
+
+import org.apache.geronimo.cli.CLParserException;
+
+
+/**
+ * @version $Rev: 515007 $ $Date: 2007-03-06 18:26:41 +1100 (Tue, 06 Mar 2007) $
+ */
+public class CommandFileCommandMetaData extends BaseCommandMetaData  {
+    public static final CommandMetaData META_DATA = new CommandFileCommandMetaData();
+    
+    private CommandFileCommandMetaData() {
+        super("command-file", "1. Common Commands", "file",
+                "Execute all the commands listed in the provided file.");
+    }
+
+    public CommandArgs parse(String[] newArgs) throws CLParserException {
+        if (newArgs.length != 1) {
+            throw new CLParserException("Must provide a command file to read from and no other arguments");
+        }
+        return new BaseCommandArgs(newArgs);
+    }
+
+}

Added: geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandMetaData.java?view=auto&rev=535507
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandMetaData.java (added)
+++ geronimo/server/trunk/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/CommandMetaData.java Sat May  5 04:22:39 2007
@@ -0,0 +1,34 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.cli.deployer;
+
+import org.apache.geronimo.cli.CLParserException;
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public interface CommandMetaData {
+    String getCommandName();
+
+    String getHelpArgumentList();
+
+    String getHelpText();
+
+    String getCommandGroup();
+
+    CommandArgs parse(String[] newArgs) throws CLParserException;
+}
\ No newline at end of file



Mime
View raw message