You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2007/12/10 07:32:13 UTC
svn commit: r602789 - in /geronimo/server/trunk:
assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/
framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/
framework/modules/geronimo-cli/src/test/java/org/apache/geron...
Author: gawor
Date: Sun Dec 9 22:32:00 2007
New Revision: 602789
URL: http://svn.apache.org/viewvc?rev=602789&view=rev
Log:
gshell commands for list-targets and list-modules
Added:
geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsImpl.java
- copied, changed from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java
geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommand.groovy
geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java (with props)
geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListTargetsCommand.groovy
Modified:
geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml
geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java
geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java
geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java
Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml?rev=602789&r1=602788&r2=602789&view=diff
==============================================================================
--- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml (original)
+++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml Sun Dec 9 22:32:00 2007
@@ -185,6 +185,16 @@
<name>undeploy</name>
<id>geronimo-commands:undeploy-module</id>
</command>
+
+ <command>
+ <name>list-targets</name>
+ <id>geronimo-commands:list-targets</id>
+ </command>
+
+ <command>
+ <name>list-modules</name>
+ <id>geronimo-commands:list-modules</id>
+ </command>
</nodes>
</group>
Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java?rev=602789&r1=602788&r2=602789&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java Sun Dec 9 22:32:00 2007
@@ -16,81 +16,15 @@
*/
package org.apache.geronimo.cli.deployer;
-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;
-import org.apache.geronimo.cli.CLParserException;
-
/**
* @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
*/
-public class ListModulesCommandArgs implements CommandArgs {
- private final static String ARGUMENT_ALL_SHORTFORM = "a";
- private final static String ARGUMENT_ALL = "all";
-
- private final static String ARGUMENT_STARTED_SHORTFORM = "s";
- private final static String ARGUMENT_STARTED = "started";
+public interface ListModulesCommandArgs extends CommandArgs {
- private final static String ARGUMENT_STOPPED_SHORTFORM = "t";
- private final static String ARGUMENT_STOPPED = "stopped";
+ boolean isAll();
- protected final Options options;
- protected CommandLine commandLine;
-
- public ListModulesCommandArgs(String[] args) throws CLParserException {
- options = new Options();
- addState();
-
- CommandLineParser parser = new GnuParser();
- try {
- commandLine = parser.parse(options, args, true);
- } catch (ParseException e) {
- throw new CLParserException(e.getMessage(), e);
- }
- }
-
- public boolean isAll() {
- return commandLine.hasOption(ARGUMENT_ALL_SHORTFORM);
- }
-
- public boolean isStarted() {
- return commandLine.hasOption(ARGUMENT_STARTED_SHORTFORM);
- }
+ boolean isStarted();
- public boolean isStopped() {
- return commandLine.hasOption(ARGUMENT_STOPPED_SHORTFORM);
- }
-
- public String[] getArgs() {
- return commandLine.getArgs();
- }
-
- protected void addState() {
- OptionGroup optionGroup = new OptionGroup();
-
- Option option = new Option(ARGUMENT_ALL_SHORTFORM,
- ARGUMENT_ALL,
- false,
- "All modules will be listed.");
- optionGroup.addOption(option);
-
- option = new Option(ARGUMENT_STARTED_SHORTFORM,
- ARGUMENT_STARTED,
- false,
- "Only started modules will be listed.");
- optionGroup.addOption(option);
-
- option = new Option(ARGUMENT_STOPPED_SHORTFORM,
- ARGUMENT_STOPPED,
- false,
- "Only stopped modules will be listed.");
- optionGroup.addOption(option);
-
- options.addOptionGroup(optionGroup);
- }
+ boolean isStopped();
}
Copied: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsImpl.java (from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsImpl.java?p2=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsImpl.java&p1=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java&r1=602776&r2=602789&rev=602789&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgs.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsImpl.java Sun Dec 9 22:32:00 2007
@@ -28,7 +28,7 @@
/**
* @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
*/
-public class ListModulesCommandArgs implements CommandArgs {
+public class ListModulesCommandArgsImpl implements ListModulesCommandArgs {
private final static String ARGUMENT_ALL_SHORTFORM = "a";
private final static String ARGUMENT_ALL = "all";
@@ -41,7 +41,7 @@
protected final Options options;
protected CommandLine commandLine;
- public ListModulesCommandArgs(String[] args) throws CLParserException {
+ public ListModulesCommandArgsImpl(String[] args) throws CLParserException {
options = new Options();
addState();
Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java?rev=602789&r1=602788&r2=602789&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/ListModulesCommandMetaData.java Sun Dec 9 22:32:00 2007
@@ -35,7 +35,7 @@
}
public CommandArgs parse(String[] args) throws CLParserException {
- return new ListModulesCommandArgs(args);
+ return new ListModulesCommandArgsImpl(args);
}
}
Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java?rev=602789&r1=602788&r2=602789&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/ListModulesCommandArgsTest.java Sun Dec 9 22:32:00 2007
@@ -26,7 +26,7 @@
public class ListModulesCommandArgsTest extends TestCase {
public void testArgs() throws Exception {
- ListModulesCommandArgs args = new ListModulesCommandArgs(new String[] {"--all", "arg1", "arg2"});
+ ListModulesCommandArgs args = new ListModulesCommandArgsImpl(new String[] {"--all", "arg1", "arg2"});
String[] theArgs = args.getArgs();
assertEquals(2 , theArgs.length);
assertEquals("arg1" , theArgs[0]);
@@ -34,44 +34,44 @@
}
public void testAll() throws Exception {
- ListModulesCommandArgs args = new ListModulesCommandArgs(new String[] {"--all"});
+ ListModulesCommandArgs args = new ListModulesCommandArgsImpl(new String[] {"--all"});
assertTrue(args.isAll());
- args = new ListModulesCommandArgs(new String[] {"-a"});
+ args = new ListModulesCommandArgsImpl(new String[] {"-a"});
assertTrue(args.isAll());
}
public void testStarted() throws Exception {
- ListModulesCommandArgs args = new ListModulesCommandArgs(new String[] {"--started"});
+ ListModulesCommandArgs args = new ListModulesCommandArgsImpl(new String[] {"--started"});
assertTrue(args.isStarted());
- args = new ListModulesCommandArgs(new String[] {"-s"});
+ args = new ListModulesCommandArgsImpl(new String[] {"-s"});
assertTrue(args.isStarted());
}
public void testStopped() throws Exception {
- ListModulesCommandArgs args = new ListModulesCommandArgs(new String[] {"--stopped"});
+ ListModulesCommandArgs args = new ListModulesCommandArgsImpl(new String[] {"--stopped"});
assertTrue(args.isStopped());
- args = new ListModulesCommandArgs(new String[] {"-t"});
+ args = new ListModulesCommandArgsImpl(new String[] {"-t"});
assertTrue(args.isStopped());
}
public void testStatePermutationsFail() throws Exception {
try {
- new ListModulesCommandArgs(new String[] {"-a", "-s"});
+ new ListModulesCommandArgsImpl(new String[] {"-a", "-s"});
fail();
} catch (CLParserException e) {
}
try {
- new ListModulesCommandArgs(new String[] {"-a", "-t"});
+ new ListModulesCommandArgsImpl(new String[] {"-a", "-t"});
fail();
} catch (CLParserException e) {
}
try {
- new ListModulesCommandArgs(new String[] {"-s", "-t"});
+ new ListModulesCommandArgsImpl(new String[] {"-s", "-t"});
fail();
} catch (CLParserException e) {
}
Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommand.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommand.groovy?rev=602789&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommand.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommand.groovy Sun Dec 9 22:32:00 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.commands
+
+import jline.ConsoleReader
+
+import org.apache.geronimo.gshell.clp.Argument
+import org.apache.geronimo.gshell.clp.Option
+import org.apache.geronimo.gshell.command.annotation.CommandComponent
+import org.apache.geronimo.deployment.cli.CommandListModules
+
+/**
+ * List modules.
+ *
+ * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
+ */
+@CommandComponent(id='geronimo-commands:list-modules', description="List modules")
+class ListModulesCommand extends ConnectCommand {
+
+ @Option(name='-a', aliases=['--all'], description='Show started or stopped modules')
+ boolean all = true
+
+ @Option(name='-t', aliases=['--stopped'], description='Show stopped modules only')
+ boolean stopped = false
+
+ @Option(name='-r', aliases=['--started'], description='Show started modules only')
+ boolean started = false
+
+ @Argument(metaVar="TARGET", description="Target name")
+ List<String> targets = []
+
+ protected Object doExecute() throws Exception {
+ def connection = variables.get("ServerConnection")
+ if (!connection) {
+ connection = super.doExecute()
+ }
+
+ def command = new CommandListModules()
+ def consoleReader = new ConsoleReader(io.inputStream, io.out)
+ def args = new ListModulesCommandArgsImpl((String[])targets, all, started, stopped)
+
+ command.execute(consoleReader, connection, args)
+ }
+
+}
\ No newline at end of file
Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java?rev=602789&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java Sun Dec 9 22:32:00 2007
@@ -0,0 +1,54 @@
+/**
+ * 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.commands;
+
+import org.apache.geronimo.cli.deployer.ListModulesCommandArgs;
+
+/**
+ * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $
+ */
+public class ListModulesCommandArgsImpl implements ListModulesCommandArgs {
+
+ private String[] args;
+ private boolean all;
+ private boolean started;
+ private boolean stopped;
+
+ public ListModulesCommandArgsImpl(String[] args, boolean all, boolean started, boolean stopped) {
+ this.args = args;
+ this.all = all;
+ this.started = started;
+ this.stopped = stopped;
+ }
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public boolean isStarted() {
+ return this.started;
+ }
+
+ public boolean isStopped() {
+ return this.stopped;
+ }
+
+ public String[] getArgs() {
+ return this.args;
+ }
+
+}
Propchange: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListModulesCommandArgsImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListTargetsCommand.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListTargetsCommand.groovy?rev=602789&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListTargetsCommand.groovy (added)
+++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ListTargetsCommand.groovy Sun Dec 9 22:32:00 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.commands
+
+import jline.ConsoleReader
+
+import org.apache.geronimo.gshell.clp.Argument
+import org.apache.geronimo.gshell.command.annotation.CommandComponent
+import org.apache.geronimo.cli.deployer.BaseCommandArgs
+import org.apache.geronimo.deployment.cli.CommandListTargets
+
+/**
+ * List targets.
+ *
+ * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
+ */
+@CommandComponent(id='geronimo-commands:list-targets', description="List targets")
+class ListTargetsCommand extends ConnectCommand {
+
+ protected Object doExecute() throws Exception {
+ def connection = variables.get("ServerConnection")
+ if (!connection) {
+ connection = super.doExecute()
+ }
+
+ def command = new CommandListTargets()
+ def consoleReader = new ConsoleReader(io.inputStream, io.out)
+ def args = new BaseCommandArgs( (String[])[] )
+
+ command.execute(consoleReader, connection, args)
+ }
+}
\ No newline at end of file