Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 20554 invoked from network); 10 Dec 2007 18:20:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Dec 2007 18:20:43 -0000 Received: (qmail 40732 invoked by uid 500); 10 Dec 2007 18:20:31 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 40697 invoked by uid 500); 10 Dec 2007 18:20:31 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 40686 invoked by uid 99); 10 Dec 2007 18:20:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Dec 2007 10:20:31 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Dec 2007 18:20:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 476B91A9832; Mon, 10 Dec 2007 10:20:15 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r602983 - 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... Date: Mon, 10 Dec 2007 18:20:12 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071210182015.476B91A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Mon Dec 10 10:20:09 2007 New Revision: 602983 URL: http://svn.apache.org/viewvc?rev=602983&view=rev Log: gshell commands for install-library, deploy, distribute, and redeploy commands Added: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsImpl.java - copied, changed from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgsImpl.java - copied, changed from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DeployModuleCommand.groovy geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeCommandArgsImpl.java (with props) geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeModuleCommand.groovy geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommand.groovy geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommandArgsImpl.java (with props) geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RedeployModuleCommand.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/DeployCommandMetaData.java geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandMetaData.java geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.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=602983&r1=602982&r2=602983&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 Mon Dec 10 10:20:09 2007 @@ -195,6 +195,26 @@ list-modules geronimo-commands:list-modules + + + install-library + geronimo-commands:install-library + + + + redeploy + geronimo-commands:redeploy-module + + + + distribute + geronimo-commands:distribute-module + + + + deploy + geronimo-commands:deploy-module + Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployCommandMetaData.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployCommandMetaData.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployCommandMetaData.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DeployCommandMetaData.java Mon Dec 10 10:20:09 2007 @@ -38,7 +38,7 @@ } public CommandArgs parse(String[] args) throws CLParserException { - return new DistributeCommandArgs(args); + return new DistributeCommandArgsImpl(args); } } Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java Mon Dec 10 10:20:09 2007 @@ -16,80 +16,13 @@ */ 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.OptionBuilder; -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 DistributeCommandArgs implements CommandArgs { - private final static String ARGUMENT_IN_PLACE_SHORTFORM = "i"; - private final static String ARGUMENT_IN_PLACE = "inPlace"; - - private final static String ARGUMENT_TARGETS_SHORTFORM = "t"; - private final static String ARGUMENT_TARGETS = "targets"; +public interface DistributeCommandArgs extends CommandArgs { - protected final Options options; - protected CommandLine commandLine; - - public DistributeCommandArgs(String[] args) throws CLParserException { - options = new Options(); - addInPlace(); - addTargets(); - - CommandLineParser parser = new GnuParser(); - try { - commandLine = parser.parse(options, args, true); - } catch (ParseException e) { - throw new CLParserException(e.getMessage(), e); - } - - if (0 == commandLine.getArgs().length) { - throw new CLParserException("Must specify a module or plan (or both)"); - } else if (2 < commandLine.getArgs().length) { - throw new CLParserException("Too many arguments"); - } - } - - protected void addTargets() { - OptionBuilder optionBuilder = OptionBuilder.hasArg().withArgName("targets"); - optionBuilder = optionBuilder.withLongOpt(ARGUMENT_TARGETS); - optionBuilder = optionBuilder - .withDescription("If no targets are provided, the module is distributed to all available " - + "targets. Geronimo only provides one target (ever), so this is primarily " - + "useful when using a different driver.\n"); - Option option = optionBuilder.create(ARGUMENT_TARGETS_SHORTFORM); - options.addOption(option); - } - - protected void addInPlace() { - options.addOption(ARGUMENT_IN_PLACE_SHORTFORM, - ARGUMENT_IN_PLACE, - false, - "If inPlace is provided, the module is not copied to the configuration " - + "store of the selected targets. The targets directly use the module."); - } - - public String[] getTargets() { - String targets = commandLine.getOptionValue(ARGUMENT_TARGETS_SHORTFORM); - if (null == targets) { - return new String[0]; - } - return targets.split(";"); - } + String[] getTargets(); - public boolean isInPlace() { - return commandLine.hasOption(ARGUMENT_IN_PLACE_SHORTFORM); - } - - public String[] getArgs() { - return commandLine.getArgs(); - } + boolean isInPlace(); } Copied: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsImpl.java (from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java) URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsImpl.java?p2=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsImpl.java&p1=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java&r1=602776&r2=602983&rev=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgs.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsImpl.java Mon Dec 10 10:20:09 2007 @@ -28,7 +28,7 @@ /** * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $ */ -public class DistributeCommandArgs implements CommandArgs { +public class DistributeCommandArgsImpl implements DistributeCommandArgs { private final static String ARGUMENT_IN_PLACE_SHORTFORM = "i"; private final static String ARGUMENT_IN_PLACE = "inPlace"; @@ -38,7 +38,7 @@ protected final Options options; protected CommandLine commandLine; - public DistributeCommandArgs(String[] args) throws CLParserException { + public DistributeCommandArgsImpl(String[] args) throws CLParserException { options = new Options(); addInPlace(); addTargets(); Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/DistributeCommandMetaData.java Mon Dec 10 10:20:09 2007 @@ -43,7 +43,7 @@ } public CommandArgs parse(String[] args) throws CLParserException { - return new DistributeCommandArgs(args); + return new DistributeCommandArgsImpl(args); } } Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java Mon Dec 10 10:20:09 2007 @@ -16,59 +16,11 @@ */ 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.OptionBuilder; -import org.apache.commons.cli.Options; -import org.apache.commons.cli.ParseException; -import org.apache.geronimo.cli.CLParserException; - /** * @version $Rev$ $Date$ */ -public class InstallLibraryCommandArgs implements CommandArgs { - private final static String ARGUMENT_GROUP_ID_SHORTFORM = "g"; - private final static String ARGUMENT_GROUP_ID = "groupId"; - - protected final Options options; - protected CommandLine commandLine; - - public InstallLibraryCommandArgs(String[] args) throws CLParserException { - options = new Options(); - addGroupId(); - - CommandLineParser parser = new GnuParser(); - try { - commandLine = parser.parse(options, args, true); - } catch (ParseException e) { - throw new CLParserException(e.getMessage(), e); - } - - if (0 == commandLine.getArgs().length) { - throw new CLParserException("Must specify a LibraryFile."); - } else if (1 < commandLine.getArgs().length) { - throw new CLParserException("Too many arguments."); - } - } - - protected void addGroupId() { - OptionBuilder optionBuilder = OptionBuilder.hasArg().withArgName(ARGUMENT_GROUP_ID); - optionBuilder = optionBuilder.withLongOpt(ARGUMENT_GROUP_ID); - optionBuilder = optionBuilder - .withDescription("If a groupId is provided, the library file will be installed under that groupId. "+ - "Otherwise, default will be used."); - Option option = optionBuilder.create(ARGUMENT_GROUP_ID_SHORTFORM); - options.addOption(option); - } - - public String getGroupId() { - return commandLine.getOptionValue(ARGUMENT_GROUP_ID_SHORTFORM); - } - - public String[] getArgs() { - return commandLine.getArgs(); - } +public interface InstallLibraryCommandArgs extends CommandArgs { + String getGroupId(); + } Copied: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgsImpl.java (from r602776, geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java) URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgsImpl.java?p2=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgsImpl.java&p1=geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java&r1=602776&r2=602983&rev=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgs.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandArgsImpl.java Mon Dec 10 10:20:09 2007 @@ -28,14 +28,14 @@ /** * @version $Rev$ $Date$ */ -public class InstallLibraryCommandArgs implements CommandArgs { +public class InstallLibraryCommandArgsImpl implements InstallLibraryCommandArgs { private final static String ARGUMENT_GROUP_ID_SHORTFORM = "g"; private final static String ARGUMENT_GROUP_ID = "groupId"; protected final Options options; protected CommandLine commandLine; - public InstallLibraryCommandArgs(String[] args) throws CLParserException { + public InstallLibraryCommandArgsImpl(String[] args) throws CLParserException { options = new Options(); addGroupId(); Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandMetaData.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandMetaData.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandMetaData.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/main/java/org/apache/geronimo/cli/deployer/InstallLibraryCommandMetaData.java Mon Dec 10 10:20:09 2007 @@ -34,6 +34,6 @@ } public CommandArgs parse(String[] newArgs) throws CLParserException { - return new InstallLibraryCommandArgs(newArgs); + return new InstallLibraryCommandArgsImpl(newArgs); } } Modified: geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-cli/src/test/java/org/apache/geronimo/cli/deployer/DistributeCommandArgsTest.java Mon Dec 10 10:20:09 2007 @@ -26,21 +26,21 @@ public class DistributeCommandArgsTest extends TestCase { public void testInPlace() throws Exception { - DistributeCommandArgs args = new DistributeCommandArgs(new String[] {"--inPlace", "plan.xml"}); + DistributeCommandArgs args = new DistributeCommandArgsImpl(new String[] {"--inPlace", "plan.xml"}); assertTrue(args.isInPlace()); - args = new DistributeCommandArgs(new String[] {"-i", "plan.xml"}); + args = new DistributeCommandArgsImpl(new String[] {"-i", "plan.xml"}); assertTrue(args.isInPlace()); } public void testTargets() throws Exception { - DistributeCommandArgs args = new DistributeCommandArgs(new String[] {"--targets", "t1;t2", "plan.xml"}); + DistributeCommandArgs args = new DistributeCommandArgsImpl(new String[] {"--targets", "t1;t2", "plan.xml"}); String[] targets = args.getTargets(); assertEquals(2, targets.length); assertEquals("t1", targets[0]); assertEquals("t2", targets[1]); - args = new DistributeCommandArgs(new String[] {"-t", "t1;t2", "plan.xml"}); + args = new DistributeCommandArgsImpl(new String[] {"-t", "t1;t2", "plan.xml"}); targets = args.getTargets(); assertEquals(2, targets.length); assertEquals("t1", targets[0]); @@ -49,7 +49,7 @@ public void testNoPlanOrModuleFails() throws Exception { try { - new DistributeCommandArgs(new String[] {"--targets", "t1;t2"}); + new DistributeCommandArgsImpl(new String[] {"--targets", "t1;t2"}); fail(); } catch (CLParserException e) { } @@ -57,7 +57,7 @@ public void testTooManyArgsFails() throws Exception { try { - new DistributeCommandArgs(new String[] {"plan.xml", "module.jar", "extra"}); + new DistributeCommandArgsImpl(new String[] {"plan.xml", "module.jar", "extra"}); fail(); } catch (CLParserException e) { } Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DeployModuleCommand.groovy URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DeployModuleCommand.groovy?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DeployModuleCommand.groovy (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DeployModuleCommand.groovy Mon Dec 10 10:20:09 2007 @@ -0,0 +1,69 @@ +/* + * 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.CommandDeploy + +/** + * Deploy module. + * + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ + */ +@CommandComponent(id='geronimo-commands:deploy-module', description="Deploy a module") +class DeployModuleCommand extends ConnectCommand { + + @Option(name='-i', aliases=['--inPlace'], description='In-place deployment') + boolean inPlace + + @Option(name='-t', aliases=['--targets'], metaVar="TARGET;TARGET;...", description='Targets') + String targets + + @Argument(metaVar="MODULE-FILE", required=true, index=0, description="Module file") + String module + + @Argument(metaVar="MODULE-PLAN", index=1, description="Module plan") + String modulePlan + + protected Object doExecute() throws Exception { + def connection = variables.get("ServerConnection") + if (!connection) { + connection = super.doExecute() + } + + def command = new CommandDeploy() + def consoleReader = new ConsoleReader(io.inputStream, io.out) + + def commandArgs = [] + commandArgs.add(module) + if (modulePlan) { + commandArgs.add(modulePlan) + } + + def args = new DistributeCommandArgsImpl((String[])commandArgs, targets, inPlace) + + 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/DistributeCommandArgsImpl.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeCommandArgsImpl.java?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeCommandArgsImpl.java (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeCommandArgsImpl.java Mon Dec 10 10:20:09 2007 @@ -0,0 +1,51 @@ +/** + * 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.DistributeCommandArgs; + +/** + * @version $Rev: 476049 $ $Date: 2006-11-17 15:35:17 +1100 (Fri, 17 Nov 2006) $ + */ +public class DistributeCommandArgsImpl implements DistributeCommandArgs { + + private String[] args; + private String targets; + private boolean inPlace; + + public DistributeCommandArgsImpl(String[] args, String targets, boolean inPlace) { + this.args = args; + this.targets = targets; + this.inPlace = inPlace; + } + + public String[] getTargets() { + if (null == this.targets) { + return new String[0]; + } + return this.targets.split(";"); + } + + public boolean isInPlace() { + return this.inPlace; + } + + public String[] getArgs() { + return this.args; + } + +} Propchange: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeCommandArgsImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeModuleCommand.groovy URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeModuleCommand.groovy?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeModuleCommand.groovy (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/DistributeModuleCommand.groovy Mon Dec 10 10:20:09 2007 @@ -0,0 +1,69 @@ +/* + * 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.CommandDistribute + +/** + * Distribute module. + * + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ + */ +@CommandComponent(id='geronimo-commands:distribute-module', description="Distribute a module") +class DistributeModuleCommand extends ConnectCommand { + + @Option(name='-i', aliases=['--inPlace'], description='In-place deployment') + boolean inPlace + + @Option(name='-t', aliases=['--targets'], metaVar="TARGET;TARGET;...", description='Targets') + String targets + + @Argument(metaVar="MODULE-FILE", required=true, index=0, description="Module file") + String module + + @Argument(metaVar="MODULE-PLAN", index=1, description="Module plan") + String modulePlan + + protected Object doExecute() throws Exception { + def connection = variables.get("ServerConnection") + if (!connection) { + connection = super.doExecute() + } + + def command = new CommandDistribute() + def consoleReader = new ConsoleReader(io.inputStream, io.out) + + def commandArgs = [] + commandArgs.add(module) + if (modulePlan) { + commandArgs.add(modulePlan) + } + + def args = new DistributeCommandArgsImpl((String[])commandArgs, targets, inPlace) + + 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/InstallLibraryCommand.groovy URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommand.groovy?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommand.groovy (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommand.groovy Mon Dec 10 10:20:09 2007 @@ -0,0 +1,56 @@ +/* + * 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.CommandInstallLibrary + +/** + * Installs a library file into repository. + * + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ + */ +@CommandComponent(id='geronimo-commands:install-library', description="Install library") +class InstallLibraryCommand extends ConnectCommand { + + @Option(name='-g', aliases=['--groupId'], description='Group id') + String groupId + + @Argument(metaVar="LIBRARY-FILE", required=true, description="Library file") + String libraryFile + + protected Object doExecute() throws Exception { + def connection = variables.get("ServerConnection") + if (!connection) { + connection = super.doExecute() + } + + def command = new CommandInstallLibrary() + def consoleReader = new ConsoleReader(io.inputStream, io.out) + def args = new InstallLibraryCommandArgsImpl(libraryFile, groupId) + + 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/InstallLibraryCommandArgsImpl.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommandArgsImpl.java?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommandArgsImpl.java (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommandArgsImpl.java Mon Dec 10 10:20:09 2007 @@ -0,0 +1,42 @@ +/** + * 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.InstallLibraryCommandArgs; + +/** + * @version $Rev: 597690 $ $Date: 2007-11-23 10:43:02 -0500 (Fri, 23 Nov 2007) $ + */ +public class InstallLibraryCommandArgsImpl implements InstallLibraryCommandArgs { + + private String libraryFile; + private String groupId; + + public InstallLibraryCommandArgsImpl(String libraryFile, String groupId) { + this.libraryFile = libraryFile; + this.groupId = groupId; + } + + public String getGroupId() { + return this.groupId; + } + + public String[] getArgs() { + return new String[] {this.libraryFile}; + } + +} Propchange: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/InstallLibraryCommandArgsImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RedeployModuleCommand.groovy URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RedeployModuleCommand.groovy?rev=602983&view=auto ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RedeployModuleCommand.groovy (added) +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RedeployModuleCommand.groovy Mon Dec 10 10:20:09 2007 @@ -0,0 +1,70 @@ +/* + * 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.CommandRedeploy + +/** + * Redeploy module. + * + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $ + */ +@CommandComponent(id='geronimo-commands:redeploy-module', description="Redeploy a module") +class RedeployModuleCommand extends ConnectCommand { + + @Argument(metaVar="MODULE", index=0, description="Module file") + String moduleName + + @Argument(metaVar="PLAN", index=1, description="Module plan") + String modulePlan + + @Argument(metaVar="MODULE_ID", index=2, description="Module id") + List moduleIds + + protected Object doExecute() throws Exception { + def connection = variables.get("ServerConnection") + if (!connection) { + connection = super.doExecute() + } + + def command = new CommandRedeploy() + def consoleReader = new ConsoleReader(io.inputStream, io.out) + + def commandArgs = [] + if (moduleName) { + commandArgs.add(moduleName) + } + if (modulePlan) { + commandArgs.add(modulePlan) + } + if (moduleIds) { + commandArgs.addAll(moduleIds) + } + + def args = new BaseCommandArgs( (String[])commandArgs ) + + command.execute(consoleReader, connection, args) + } +} \ No newline at end of file Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java?rev=602983&r1=602982&r2=602983&view=diff ============================================================================== --- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java (original) +++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/CommandInstallLibrary.java Mon Dec 10 10:20:09 2007 @@ -39,6 +39,9 @@ throw new DeploymentSyntaxException("CommandArgs has the type [" + commandArgs.getClass() + "]; expected [" + InstallLibraryCommandArgs.class + "]"); } InstallLibraryCommandArgs installLibraryCommandArgs = (InstallLibraryCommandArgs)commandArgs; + if (installLibraryCommandArgs.getArgs().length == 0) { + throw new DeploymentException("Must specify a LibraryFile"); + } File libFile = new File(installLibraryCommandArgs.getArgs()[0]); if(!libFile.exists() || !libFile.isFile() || !libFile.canRead()) { throw new DeploymentException("File does not exist or not a normal file or not readable. "+libFile);