You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jason Dillon <ja...@planet57.com> on 2008/04/21 20:35:03 UTC

Re: svn commit: r600872 - in /geronimo/server/trunk: ./ assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/assembly/ assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ framework/modules/geronimo-comm

Hey, what exactly does this remote-server-control command intend to
solve?  This got committed at the same time as your aliasing work...
which sorry to say I'm about to nuke.

I wish you had mentioned you wanted to work on alias stuff and I would
have given you a nudge on how I was planning on implementing it.  The
idea was to follow how the alias stuff works for the Groovy Shell
(aka. groovysh), which closely resembles how aliasing works for
/bin/bash.  To do so means adding a few hooks into the GShell core and
adding alias, unalias commands to builtins.

 * * *

Anyways, I comprehend what the alias bits are intended for, but I'm
lost for what the remote-server-control bits are for completely.

I'm a bit weary about adding some of these commands to the
distribution w/o adequate testing and documentation... or use-cases.

Perhaps if you want to keep this around we can move it to a sandbox
module, where we can test out new commands, then once they are
rocksolid move them over?

--jason


On Tue, Dec 4, 2007 at 5:46 PM,  <gd...@apache.org> wrote:
> Author: gdamour
>  Date: Tue Dec  4 02:46:27 2007
>  New Revision: 600872
>
>  URL: http://svn.apache.org/viewvc?rev=600872&view=rev
>  Log:
>  Add a couple of gshell commands to simplify the remote control of servers.
>  The commands being added are:
>  * alias: used to alias a commond along with some options and arguments.
>  etc/layout.xml provides a first aliasing mechanism: a hierarchical name is
>  mapped to a command. alias suplements this first aliasing mechanism with the
>  ability to alias a command along with its typical options and arguments.
>  * unalias: to remove an alias
>  * execute-alias: to execute an alias
>  * remote/rsh to start an rsh client
>  * remote/rsh-server to start an rsh-server
>  * remote-control/server-control to control a server
>
>  Samples for the aliasing commands:
>  // create the alias 'st' for the quoted command
>  > alias st 'geronimo/start-server -G server.name=yellow -D property=value'
>  // execute the alias 'st'. This executes the command in quote above
>  > excute-alias st
>  // display defined aliases
>  > alias
>  // remove the alias 'st'
>  > unalias st
>
>  Samples for the remote server control commands:
>  // start an rsh-server:
>  > remote/rsh-server tcp://localhost:9999
>  // remote 'start' the server 'defaultServer'
>  > remote-control/server-control start defaultServer
>  // remote 'stop' the server 'defaultServer'
>  > remote-control/server-control stop defaultServer
>
>  All the commands are implemented in Groovy. XML manipulations are done via
>  XmlSlurpers.
>
>  Aliases are stored in a configuration file located by default in
>     etc/aliases.xml
>
>  Server configurations, used by the remote control command, are stored in a
>  configuration file located by default in
>     etc/server-configuration.xml
>
>  New JARs are being added to lib/gshell for the support of the rsh bits.
>
>  Added:
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml
>     geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml
>  Modified:
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml
>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/layout.xml
>     geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml
>     geronimo/server/trunk/pom.xml
>
>  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?rev=600872&r1=600871&r2=600872&view=diff
>  ==============================================================================
>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml (original)
>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/pom.xml Tue Dec  4 02:46:27 2007
>  @@ -65,6 +65,36 @@
>          </dependency>
>
>          <dependency>
>  +            <groupId>org.apache.geronimo.gshell</groupId>
>  +            <artifactId>gshell-whisper</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +            <artifactId>gshell-remote-client</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +            <artifactId>gshell-remote-common</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +            <artifactId>gshell-remote-server</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>  +            <groupId>org.apache.mina</groupId>
>  +            <artifactId>mina-core</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>  +            <groupId>org.apache.mina</groupId>
>  +            <artifactId>mina-filter-ssl</artifactId>
>  +        </dependency>
>  +
>  +        <dependency>
>              <groupId>org.slf4j</groupId>
>              <artifactId>slf4j-log4j12</artifactId>
>          </dependency>
>
>  Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml?rev=600872&r1=600871&r2=600872&view=diff
>  ==============================================================================
>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml (original)
>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml Tue Dec  4 02:46:27 2007
>  @@ -36,6 +36,15 @@
>                  <include>org.apache.geronimo.modules:geronimo-commands</include>
>                  <include>org.apache.geronimo.gshell:gshell-embeddable</include>
>                  <include>org.apache.geronimo.gshell:gshell-cli</include>
>  +
>  +                <!-- rsh related commands -->
>  +                <include>org.apache.geronimo.gshell:gshell-whisper</include>
>  +                <include>org.apache.geronimo.gshell.remote:gshell-remote-client</include>
>  +                <include>org.apache.geronimo.gshell.remote:gshell-remote-common</include>
>  +                <include>org.apache.geronimo.gshell.remote:gshell-remote-server</include>
>  +                <include>org.apache.mina:mina-core</include>
>  +                <include>org.apache.mina:mina-filter-ssl</include>
>  +
>                  <include>org.codehaus.groovy:groovy-all</include>
>                  <include>org.apache.ant:ant</include>
>                  <include>org.apache.ant:ant-launcher</include>
>
>  Added: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml (added)
>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,30 @@
>  +<?xml version="1.0" encoding="UTF-8"?>
>  +<!--
>  +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23 Nov 2007) $ -->
>  +
>  +<aliases>
>  +  <alias id='start_DEFAULT_SERVER'>
>  +    <cli>geronimo/start-server -b</cli>
>  +  </alias>
>  +  <alias id='stop_DEFAULT_SERVER'>
>  +    <cli>geronimo/stop-server</cli>
>  +  </alias>
>  +</aliases>
>  \ No newline at end of file
>
>  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=600872&r1=600871&r2=600872&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 Tue Dec  4 02:46:27 2007
>  @@ -80,6 +80,21 @@
>              <id>gshell-builtins:unset</id>
>          </command>
>
>  +        <command>
>  +            <name>alias</name>
>  +            <id>geronimo-commands:alias</id>
>  +        </command>
>  +
>  +        <command>
>  +            <name>unalias</name>
>  +            <id>geronimo-commands:unalias</id>
>  +        </command>
>  +
>  +        <command>
>  +            <name>execute-alias</name>
>  +            <id>geronimo-commands:execute-alias</id>
>  +        </command>
>  +
>          <!-- Geronimo -->
>
>          <group>
>  @@ -94,6 +109,30 @@
>                  <command>
>                      <name>stop-server</name>
>                      <id>geronimo-commands:stop-server</id>
>  +                </command>
>  +            </nodes>
>  +        </group>
>  +
>  +        <group>
>  +            <name>remote</name>
>  +            <nodes>
>  +                <command>
>  +                    <name>rsh</name>
>  +                    <id>gshell-remote:rsh</id>
>  +                </command>
>  +                <command>
>  +                    <name>rsh-server</name>
>  +                    <id>gshell-remote:rsh-server</id>
>  +                </command>
>  +            </nodes>
>  +        </group>
>  +
>  +        <group>
>  +            <name>remote-control</name>
>  +            <nodes>
>  +                <command>
>  +                    <name>server-control</name>
>  +                    <id>geronimo-commands:remote-server-control</id>
>                  </command>
>              </nodes>
>          </group>
>
>  Added: geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml (added)
>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,40 @@
>  +<?xml version="1.0" encoding="UTF-8"?>
>  +<!--
>  +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23 Nov 2007) $ -->
>  +
>  +<configuration>
>  +  <hosts>
>  +    <host name="localhost">
>  +      <gshell>
>  +        <remote-login-cmd>remote/rsh -u NOT_USED -p NOT_USED tcp://localhost:9999</remote-login-cmd>
>  +      </gshell>
>  +    </host>
>  +  </hosts>
>  +  <servers>
>  +    <server name="defaultServer">
>  +      <host name="localhost" />
>  +      <controls>
>  +        <start>execute-alias start_DEFAULT_SERVER</start>
>  +        <stop>execute-alias stop_DEFAULT_SERVER</stop>
>  +      </controls>
>  +    </server>
>  +  </servers>
>  +</configuration>
>
>  Modified: geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml?rev=600872&r1=600871&r2=600872&view=diff
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml (original)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml Tue Dec  4 02:46:27 2007
>  @@ -49,7 +49,13 @@
>              <groupId>org.slf4j</groupId>
>              <artifactId>slf4j-api</artifactId>
>          </dependency>
>  -
>  +
>  +        <dependency>
>  +            <groupId>org.slf4j</groupId>
>  +            <artifactId>slf4j-simple</artifactId>
>  +            <scope>test</scope>
>  +        </dependency>
>  +
>          <dependency>
>              <groupId>org.apache.geronimo.gshell</groupId>
>              <artifactId>gshell-command-api</artifactId>
>  @@ -133,6 +139,7 @@
>                      <execution>
>                          <goals>
>                              <goal>compile</goal>
>  +                            <goal>testCompile</goal>
>                          </goals>
>                      </execution>
>                  </executions>
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,76 @@
>  +/*
>  + * 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 groovy.xml.StreamingMarkupBuilder
>  +
>  +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.gshell.command.annotation.Requirement
>  +import org.apache.geronimo.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.CommandSupport
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +abstract class AbstractAliasCommand extends CommandSupport {
>  +
>  +    @Option(name='-c', aliases=['--alias-configuration'], description='Alias configuration file')
>  +    String aliasFileName = 'etc/aliases.xml'
>  +
>  +    @Argument(index=0, description="alias")
>  +    String aliasName
>  +
>  +    def buildAvailableAliases = { aliases ->
>  +        def availables = '\nAvailable aliases:\n'
>  +        aliases.alias.list().sort{ it.@id.text() }.each {
>  +            availables += "    ${it.@id.text()} '${it.'*'.text()}'\n"
>  +        }
>  +        availables
>  +    }
>  +
>  +    def checkAliasFile = {
>  +        def aliasFile = new File(aliasFileName)
>  +        if (!aliasFile.exists()) {
>  +            throw new IllegalStateException("Alias file ${aliasFile.absolutePath} does not exist")
>  +        }
>  +        aliasFile
>  +    }
>  +
>  +    def serializeToXML = { aliases ->
>  +           def outputBuilder = new StreamingMarkupBuilder()
>  +           outputBuilder.bind { mkp.yield aliases }
>  +    }
>  +
>  +    def createNewAliasFile = { aliasFile, aliasFileName, xml ->
>  +        aliasFile.renameTo(new File(aliasFileName + ".bak"))
>  +
>  +        aliasFile = new File(aliasFileName)
>  +        aliasFile.createNewFile()
>  +        aliasFile.withPrintWriter {
>  +            it.write(xml)
>  +        }
>  +    }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,79 @@
>  +/*
>  + * 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 groovy.xml.StreamingMarkupBuilder
>  +
>  +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.gshell.command.annotation.Requirement
>  +import org.apache.geronimo.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.CommandSupport
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +@CommandComponent(id='geronimo-commands:alias', description="Create an alias")
>  +class AliasCommand extends AbstractAliasCommand {
>  +
>  +    @Argument(index=1, description="Command")
>  +    String command
>  +
>  +    protected Object doExecute() throws Exception {
>  +        def aliasFile = checkAliasFile()
>  +
>  +        def xml
>  +        aliasFile.withInputStream {
>  +                   def aliases = new XmlSlurper().parse(it)
>  +
>  +                   if (!aliasName) {
>  +                       io.out.println(buildAvailableAliases(aliases))
>  +                       return
>  +                   }
>  +
>  +                   if (!aliases.alias.find { it.@id.text().equals(aliasName) }.isEmpty()) {
>  +                       throw new IllegalArgumentException("${aliasName} is already defined")
>  +                   } else if (!command) {
>  +                       throw new IllegalArgumentException("command is required")
>  +                   }
>  +
>  +                   aliases.appendNode {
>  +                       alias(id: aliasName) {
>  +                           cli(command)
>  +                       }
>  +                   }
>  +
>  +                   xml = serializeToXML(aliases)
>  +        }
>  +
>  +        if (!xml) {
>  +            return false
>  +        }
>  +
>  +        createNewAliasFile(aliasFile, aliasFileName, xml)
>  +
>  +        true
>  +    }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,64 @@
>  +/*
>  + * 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.gshell.clp.Argument;
>  +import org.apache.geronimo.gshell.clp.Option
>  +import org.apache.geronimo.gshell.command.annotation.CommandComponent
>  +import org.apache.geronimo.gshell.command.annotation.Requirement
>  +import org.apache.geronimo.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.CommandSupport
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +@CommandComponent(id='geronimo-commands:execute-alias', description="Execute an alias")
>  +class ExecuteAliasCommand extends AbstractAliasCommand {
>  +
>  +    @Requirement
>  +    CommandExecutor executor
>  +
>  +    protected Object doExecute() throws Exception {
>  +        def aliasFile = checkAliasFile()
>  +
>  +        def result
>  +        aliasFile.withInputStream({
>  +            def aliases = new XmlSlurper().parse(it)
>  +
>  +            def alias = aliases.alias.find { it.@id.text().equals(aliasName) }
>  +            if (alias.isEmpty()) {
>  +                def availables = buildAvailableAliases(aliases)
>  +                throw new IllegalArgumentException("${aliasName} does not exist.${availables}")
>  +            }
>  +
>  +            def cli = alias.cli.text()
>  +            if ('' == cli) {
>  +                throw new UnsupportedOperationException("alias.cli is not defined by alias ${aliasName}")
>  +            }
>  +
>  +            result = executor.execute(cli)
>  +        })
>  +
>  +        result
>  +    }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,92 @@
>  +/*
>  + * 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.gshell.clp.Argument;
>  +import org.apache.geronimo.gshell.clp.Option
>  +import org.apache.geronimo.gshell.command.annotation.CommandComponent
>  +import org.apache.geronimo.gshell.command.annotation.Requirement
>  +import org.apache.geronimo.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.CommandSupport
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +@CommandComponent(id='geronimo-commands:remote-server-control', description="Remote server control")
>  +class RemoteServerControlCommand extends CommandSupport {
>  +
>  +    @Requirement
>  +    CommandExecutor executor
>  +
>  +    @Option(name='-c', aliases=['--server-configuration'], description='Server configuration file')
>  +    String configurationFileName = 'etc/server-configuration.xml'
>  +
>  +    @Argument(metaVar="CONTROL", required=true, index=0, description="Control")
>  +    String control
>  +
>  +    @Argument(metaVar="SERVER", required=true, index=1, description="Server")
>  +    String serverName
>  +
>  +    protected Object doExecute() throws Exception {
>  +        def configurationFile = new File(configurationFileName)
>  +        if (!configurationFile.exists()) {
>  +            throw new IllegalStateException("File ${configurationFile.absolutePath} does not exist")
>  +        }
>  +
>  +        def result
>  +        configurationFile.withInputStream {
>  +            result = executeRshCommand(it)
>  +        }
>  +        result
>  +    }
>  +
>  +       protected executeRshCommand(is) {
>  +        def configuration = new XmlSlurper().parse(is)
>  +
>  +        def retrieveByNameAttribute = { baseNode, name ->
>  +               def node = baseNode.find { it.@name.text().equals(name) }
>  +               if (node.isEmpty()) {
>  +                   def availableNames = baseNode.list().sort{ it.@name.text() }.'@name'*.text()
>  +                   throw new IllegalArgumentException("${name} does not exist. Available: ${availableNames}")
>  +               }
>  +               node
>  +        }
>  +
>  +        def server = retrieveByNameAttribute(configuration.servers.server, serverName)
>  +        def host = retrieveByNameAttribute(configuration.hosts.host, server.host.@name.text())
>  +
>  +        def rshCmd = host.gshell.'remote-login-cmd'.text()
>  +        if ('' == rshCmd) {
>  +            throw new IllegalStateException("gshell.remote-login-cmd is not defined by host ${host.@name.text()}")
>  +        }
>  +
>  +           def command = server.controls."${control}".text()
>  +           if ('' == command) {
>  +            def controls = server.controls.'*'.list().sort{ it.name() }*.name()
>  +               throw new IllegalStateException("server.controls.${control} is not defined by server "
>  +                   + "${server.@name.text()}.\nAvailable controls: ${controls}")
>  +           }
>  +
>  +        executor.execute("${rshCmd} ${command}")
>  +       }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy Tue Dec  4 02:46:27 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 groovy.xml.StreamingMarkupBuilder
>  +
>  +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.gshell.command.annotation.Requirement
>  +import org.apache.geronimo.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.CommandSupport
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +@CommandComponent(id='geronimo-commands:unalias', description="Remove an alias")
>  +class UnaliasCommand extends AbstractAliasCommand {
>  +
>  +    protected Object doExecute() throws Exception {
>  +           def aliasFile = checkAliasFile()
>  +
>  +           if (!aliasName) {
>  +               throw new IllegalArgumentException("an alias must be specified")
>  +           }
>  +
>  +        def xml
>  +        aliasFile.withInputStream {
>  +                   def aliases = new XmlSlurper().parse(it)
>  +
>  +                   def alias = aliases.alias.find { it.@id.text().equals(aliasName) }
>  +                   if ('' == alias.text()) {
>  +                       return
>  +                   }
>  +
>  +                   alias.replaceNode {}
>  +
>  +                   xml = serializeToXML(aliases)
>  +        }
>  +
>  +        if (!xml) {
>  +            return false
>  +        }
>  +
>  +        createNewAliasFile(aliasFile, aliasFileName, xml)
>  +
>  +        true
>  +    }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,86 @@
>  +/*
>  + * 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.gshell.command.IO
>  +
>  +import org.apache.geronimo.testsupport.TestSupport
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +class AliasCommandTest extends GroovyTestCase {
>  +
>  +    def command
>  +
>  +    protected void setUp() {
>  +               def testSupport = new GroovyTestSupport()
>  +
>  +        File baseFile = testSupport.resolveFile('src/test/resources/etc/aliases.xml')
>  +        def lines = baseFile.readLines()
>  +
>  +        def workingFile = testSupport.resolveFile('build/etc/aliases.xml')
>  +        workingFile.parentFile.mkdirs()
>  +        workingFile.createNewFile()
>  +        workingFile.withPrintWriter { pw ->
>  +            lines.each { pw.println(it) }
>  +        }
>  +
>  +        command = new AliasCommand([io: new IO(), aliasFileName: workingFile.absolutePath])
>  +    }
>  +
>  +       void testAliasFileDoesNotExistThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.aliasFileName = 'doesNotExist'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testNoAliasArgumentDisplaysAvailableAliases() {
>  +        command.doExecute()
>  +       }
>  +
>  +       void testAliasWithoutCommandThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.aliasName = 'anNewAlias'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testAliasAnExistingAliasThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.aliasName = 'start_DEFAULT_SERVER'
>  +               command.command = 'test'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testAlias() {
>  +        command.aliasName = 'start_DEFAULT_SERVER_TWO'
>  +        command.command = 'test'
>  +        command.doExecute()
>  +
>  +           shouldFail(IllegalArgumentException.class) {
>  +            command.doExecute()
>  +           }
>  +       }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,73 @@
>  +/*
>  + * 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.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +import org.apache.geronimo.testsupport.TestSupport
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +class ExecuteAliasCommandTest extends GroovyTestCase {
>  +
>  +    def command
>  +    def executedCommand
>  +
>  +    protected void setUp() {
>  +               def testSupport = new GroovyTestSupport()
>  +
>  +        File aliasFile = testSupport.resolveFile('src/test/resources/etc/aliases.xml')
>  +
>  +        command = new ExecuteAliasCommand([io: new IO(), aliasFileName: aliasFile.absolutePath])
>  +        command.executor = { executedCommand = it } as CommandExecutor
>  +    }
>  +
>  +       void testAliasFileDoesNotExistThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.aliasFileName = 'doesNotExist'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testExecuteUndefinedAliasThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.aliasName = 'undefined'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testExecuteAliasWithoutCLIThrowsUOE() {
>  +           shouldFail(UnsupportedOperationException.class) {
>  +               command.aliasName = 'alias_without_cli'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testExecuteAlias() {
>  +        command.aliasName = 'start_DEFAULT_SERVER'
>  +        command.doExecute()
>  +
>  +        assert 'start-server -d' == executedCommand
>  +       }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,29 @@
>  +/*
>  + * 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.testsupport.TestSupport
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +class GroovyTestSupport extends TestSupport {
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,89 @@
>  +/*
>  + * 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.gshell.command.CommandExecutor
>  +import org.apache.geronimo.gshell.command.IO
>  +
>  +import org.apache.geronimo.testsupport.TestSupport
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +class RemoteServerControlCommandTest extends GroovyTestCase {
>  +
>  +    def command
>  +    def executedCommand
>  +
>  +    protected void setUp() {
>  +               def testSupport = new GroovyTestSupport()
>  +
>  +        File configurationFile = testSupport.resolveFile('src/test/resources/etc/server-configuration.xml')
>  +
>  +        command = new RemoteServerControlCommand([io: new IO(), configurationFileName: configurationFile.absolutePath])
>  +        command.executor = { executedCommand = it } as CommandExecutor
>  +    }
>  +
>  +       void testConfigurationFileDoesNotExistThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.configurationFileName = 'doesNotExist'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testServerIsUndefinedThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.serverName = 'undefined'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testServerIsDefinedWithUndefinedHostThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.serverName = 'serverWithUndefinedHost'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testControlIsUndefinedThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.serverName = 'defaultServer'
>  +               command.control = 'undefined'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testRemoteLoginCmdIsUndefinedThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.serverName = 'serverWithUndefinedRemoteLoginCmd'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testRemoteControlOK() {
>  +        command.serverName = 'defaultServer'
>  +        command.control = 'start'
>  +        command.doExecute()
>  +
>  +        assert 'rshCommand start-server' == executedCommand
>  +       }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,71 @@
>  +/*
>  + * 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.gshell.command.IO
>  +
>  +import org.apache.geronimo.testsupport.TestSupport
>  +
>  +/**
>  + *
>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun, 30 Sep 2007) $
>  + */
>  +class UnaliasCommandTest extends GroovyTestCase {
>  +
>  +    def command
>  +
>  +    protected void setUp() {
>  +               def testSupport = new GroovyTestSupport()
>  +
>  +        File baseFile = testSupport.resolveFile('src/test/resources/etc/aliases.xml')
>  +        def lines = baseFile.readLines()
>  +
>  +        def workingFile = testSupport.resolveFile('build/etc/aliases.xml')
>  +        workingFile.delete()
>  +        workingFile.parentFile.mkdirs()
>  +        workingFile.createNewFile()
>  +        workingFile.withPrintWriter { pw ->
>  +            lines.each { pw.println(it) }
>  +        }
>  +
>  +        command = new UnaliasCommand([io: new IO(), aliasFileName: workingFile.absolutePath])
>  +    }
>  +
>  +       void testAliasFileDoesNotExistThrowsISE() {
>  +           shouldFail(IllegalStateException.class) {
>  +               command.aliasFileName = 'doesNotExist'
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testNoAliasArgumentThrowsIAE() {
>  +           shouldFail(IllegalArgumentException.class) {
>  +               command.doExecute()
>  +           }
>  +       }
>  +
>  +       void testUnalias() {
>  +        command.aliasName = 'start_DEFAULT_SERVER'
>  +        assertTrue(command.doExecute())
>  +
>  +//        assertFalse(command.doExecute())
>  +       }
>  +
>  +}
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,11 @@
>  +<aliases>
>  +  <alias id='start_DEFAULT_SERVER'>
>  +    <cli>start-server -d</cli>
>  +  </alias>
>  +  <alias id='stop_DEFAULT_SERVER'>
>  +    <cli>stop-server</cli>
>  +  </alias>
>  +  <alias id='alias_without_cli'>
>  +    <inline-script>a script</inline-script>
>  +  </alias>
>  +</aliases>
>  \ No newline at end of file
>
>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml?rev=600872&view=auto
>  ==============================================================================
>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml (added)
>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml Tue Dec  4 02:46:27 2007
>  @@ -0,0 +1,30 @@
>  +<?xml version="1.0" encoding="UTF-8"?>
>  +<configuration>
>  +  <hosts>
>  +    <host name="localhost">
>  +      <gshell>
>  +        <remote-login-cmd>rshCommand</remote-login-cmd>
>  +      </gshell>
>  +    </host>
>  +    <host name="hostWithUndefinedRemoteLoginCmd">
>  +      <gshell>
>  +        <remote-login-cmd2>rshCommand</remote-login-cmd2>
>  +      </gshell>
>  +    </host>
>  +  </hosts>
>  +  <servers>
>  +    <server name="defaultServer">
>  +      <host name="localhost" />
>  +      <controls>
>  +        <start>start-server</start>
>  +        <stop>stop-server</stop>
>  +      </controls>
>  +    </server>
>  +    <server name="serverWithUndefinedRemoteLoginCmd">
>  +      <host name="hostWithUndefinedRemoteLoginCmd" />
>  +    </server>
>  +    <server name="serverWithUndefinedHost">
>  +      <host name="undefinedHost" />
>  +    </server>
>  +  </servers>
>  +</configuration>
>
>  Modified: geronimo/server/trunk/pom.xml
>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=600872&r1=600871&r2=600872&view=diff
>  ==============================================================================
>  --- geronimo/server/trunk/pom.xml (original)
>  +++ geronimo/server/trunk/pom.xml Tue Dec  4 02:46:27 2007
>  @@ -1575,13 +1575,49 @@
>                  <artifactId>gshell-cli</artifactId>
>                  <version>1.0-alpha-1-SNAPSHOT</version>
>              </dependency>
>  -
>  +
>  +            <dependency>
>  +                <groupId>org.apache.geronimo.gshell</groupId>
>  +                <artifactId>gshell-whisper</artifactId>
>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>  +            </dependency>
>  +
>              <dependency>
>                  <groupId>org.apache.geronimo.gshell.commands</groupId>
>                  <artifactId>gshell-builtins</artifactId>
>                  <version>1.0-alpha-1-SNAPSHOT</version>
>              </dependency>
>
>  +            <dependency>
>  +                <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +                <artifactId>gshell-remote-client</artifactId>
>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>  +            </dependency>
>  +
>  +            <dependency>
>  +                <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +                <artifactId>gshell-remote-common</artifactId>
>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>  +            </dependency>
>  +
>  +            <dependency>
>  +                <groupId>org.apache.geronimo.gshell.remote</groupId>
>  +                <artifactId>gshell-remote-server</artifactId>
>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>  +            </dependency>
>  +
>  +            <dependency>
>  +                <groupId>org.apache.mina</groupId>
>  +                <artifactId>mina-core</artifactId>
>  +                <version>1.1.2</version>
>  +            </dependency>
>  +
>  +            <dependency>
>  +                <groupId>org.apache.mina</groupId>
>  +                <artifactId>mina-filter-ssl</artifactId>
>  +                <version>1.1.2</version>
>  +            </dependency>
>  +
>              <dependency>
>                  <groupId>org.codehaus.groovy</groupId>
>                  <artifactId>groovy-all</artifactId>
>
>
>

Re: svn commit: r600872 - in /geronimo/server/trunk: ./ assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/assembly/ assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ framework/modules/geronimo-comm

Posted by Gianny Damour <gi...@optusnet.com.au>.
On 23/04/2008, at 4:21 PM, Jason Dillon wrote:

>>
>>
>> Test is there:  
>> org.apache.geronimo.commands.RemoteServerControlCommandTest
>>
>> Documentation, talking about use-cases, would have been coming  
>> this week-end (I slowly started posting docos  two weeks ago with  
>> farming followed by WADI clustering support).
>>>
>
> Is there anything up there now I can look at?

No.

Thanks,
Gianny


Re: svn commit: r600872 - in /geronimo/server/trunk: ./ assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/assembly/ assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ framework/modules/geronimo-comm

Posted by Jason Dillon <ja...@planet57.com>.
On Apr 22, 2008, at 5:21 PM, Gianny Damour wrote:
> On 22/04/2008, at 4:35 AM, Jason Dillon wrote:
>
>> Hey, what exactly does this remote-server-control command intend to
>> solve?  This got committed at the same time as your aliasing work...
>> which sorry to say I'm about to nuke.
>
> Please nuke.

Aighty.


>> Anyways, I comprehend what the alias bits are intended for, but I'm
>> lost for what the remote-server-control bits are for completely.
>>
>> I'm a bit weary about adding some of these commands to the
>> distribution w/o adequate testing and documentation... or use-cases.
>
> Test is there:  
> org.apache.geronimo.commands.RemoteServerControlCommandTest
>
> Documentation, talking about use-cases, would have been coming this  
> week-end (I slowly started posting docos  two weeks ago with farming  
> followed by WADI clustering support).
>>

Is there anything up there now I can look at?

--jason


>> Perhaps if you want to keep this around we can move it to a sandbox
>> module, where we can test out new commands, then once they are
>> rocksolid move them over?
>
> Let's nuke it. I let you proceed.
>
> Thanks,
> Gianny
>
>>
>> --jason
>>
>>
>> On Tue, Dec 4, 2007 at 5:46 PM,  <gd...@apache.org> wrote:
>>> Author: gdamour
>>> Date: Tue Dec  4 02:46:27 2007
>>> New Revision: 600872
>>>
>>> URL: http://svn.apache.org/viewvc?rev=600872&view=rev
>>> Log:
>>> Add a couple of gshell commands to simplify the remote control of  
>>> servers.
>>> The commands being added are:
>>> * alias: used to alias a commond along with some options and  
>>> arguments.
>>> etc/layout.xml provides a first aliasing mechanism: a hierarchical  
>>> name is
>>> mapped to a command. alias suplements this first aliasing  
>>> mechanism with the
>>> ability to alias a command along with its typical options and  
>>> arguments.
>>> * unalias: to remove an alias
>>> * execute-alias: to execute an alias
>>> * remote/rsh to start an rsh client
>>> * remote/rsh-server to start an rsh-server
>>> * remote-control/server-control to control a server
>>>
>>> Samples for the aliasing commands:
>>> // create the alias 'st' for the quoted command
>>>> alias st 'geronimo/start-server -G server.name=yellow -D  
>>>> property=value'
>>> // execute the alias 'st'. This executes the command in quote above
>>>> excute-alias st
>>> // display defined aliases
>>>> alias
>>> // remove the alias 'st'
>>>> unalias st
>>>
>>> Samples for the remote server control commands:
>>> // start an rsh-server:
>>>> remote/rsh-server tcp://localhost:9999
>>> // remote 'start' the server 'defaultServer'
>>>> remote-control/server-control start defaultServer
>>> // remote 'stop' the server 'defaultServer'
>>>> remote-control/server-control stop defaultServer
>>>
>>> All the commands are implemented in Groovy. XML manipulations are  
>>> done via
>>> XmlSlurpers.
>>>
>>> Aliases are stored in a configuration file located by default in
>>>    etc/aliases.xml
>>>
>>> Server configurations, used by the remote control command, are  
>>> stored in a
>>> configuration file located by default in
>>>    etc/server-configuration.xml
>>>
>>> New JARs are being added to lib/gshell for the support of the rsh  
>>> bits.
>>>
>>> Added:
>>>    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/aliases.xml
>>>    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/server-configuration.xml
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommand.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommandTest.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommandTest.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/aliases.xml
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/server-configuration.xml
>>> Modified:
>>>    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> pom.xml
>>>    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/assembly/boilerplate.xml
>>>    geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/layout.xml
>>>    geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml
>>>    geronimo/server/trunk/pom.xml
>>>
>>> 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?rev=600872&r1=600871&r2=600872&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> pom.xml (original)
>>> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> pom.xml Tue Dec  4 02:46:27 2007
>>> @@ -65,6 +65,36 @@
>>>         </dependency>
>>>
>>>         <dependency>
>>> +            <groupId>org.apache.geronimo.gshell</groupId>
>>> +            <artifactId>gshell-whisper</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>> +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>> +            <artifactId>gshell-remote-client</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>> +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>> +            <artifactId>gshell-remote-common</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>> +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>> +            <artifactId>gshell-remote-server</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>> +            <groupId>org.apache.mina</groupId>
>>> +            <artifactId>mina-core</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>> +            <groupId>org.apache.mina</groupId>
>>> +            <artifactId>mina-filter-ssl</artifactId>
>>> +        </dependency>
>>> +
>>> +        <dependency>
>>>             <groupId>org.slf4j</groupId>
>>>             <artifactId>slf4j-log4j12</artifactId>
>>>         </dependency>
>>>
>>> Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>>> minimal/src/main/assembly/boilerplate.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/assembly/boilerplate.xml?rev=600872&r1=600871&r2=600872&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/assembly/boilerplate.xml (original)
>>> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/assembly/boilerplate.xml Tue Dec  4 02:46:27 2007
>>> @@ -36,6 +36,15 @@
>>>                 <include>org.apache.geronimo.modules:geronimo- 
>>> commands</include>
>>>                 <include>org.apache.geronimo.gshell:gshell- 
>>> embeddable</include>
>>>                 <include>org.apache.geronimo.gshell:gshell-cli</ 
>>> include>
>>> +
>>> +                <!-- rsh related commands -->
>>> +                <include>org.apache.geronimo.gshell:gshell- 
>>> whisper</include>
>>> +                <include>org.apache.geronimo.gshell.remote:gshell- 
>>> remote-client</include>
>>> +                <include>org.apache.geronimo.gshell.remote:gshell- 
>>> remote-common</include>
>>> +                <include>org.apache.geronimo.gshell.remote:gshell- 
>>> remote-server</include>
>>> +                <include>org.apache.mina:mina-core</include>
>>> +                <include>org.apache.mina:mina-filter-ssl</include>
>>> +
>>>                 <include>org.codehaus.groovy:groovy-all</include>
>>>                 <include>org.apache.ant:ant</include>
>>>                 <include>org.apache.ant:ant-launcher</include>
>>>
>>> Added: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>>> minimal/src/main/underlay/etc/aliases.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/aliases.xml?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/aliases.xml (added)
>>> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/aliases.xml Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,30 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<!--
>>> +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23 Nov  
>>> 2007) $ -->
>>> +
>>> +<aliases>
>>> +  <alias id='start_DEFAULT_SERVER'>
>>> +    <cli>geronimo/start-server -b</cli>
>>> +  </alias>
>>> +  <alias id='stop_DEFAULT_SERVER'>
>>> +    <cli>geronimo/stop-server</cli>
>>> +  </alias>
>>> +</aliases>
>>> \ No newline at end of file
>>>
>>> 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=600872&r1=600871&r2=600872&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 Tue Dec  4 02:46:27 2007
>>> @@ -80,6 +80,21 @@
>>>             <id>gshell-builtins:unset</id>
>>>         </command>
>>>
>>> +        <command>
>>> +            <name>alias</name>
>>> +            <id>geronimo-commands:alias</id>
>>> +        </command>
>>> +
>>> +        <command>
>>> +            <name>unalias</name>
>>> +            <id>geronimo-commands:unalias</id>
>>> +        </command>
>>> +
>>> +        <command>
>>> +            <name>execute-alias</name>
>>> +            <id>geronimo-commands:execute-alias</id>
>>> +        </command>
>>> +
>>>         <!-- Geronimo -->
>>>
>>>         <group>
>>> @@ -94,6 +109,30 @@
>>>                 <command>
>>>                     <name>stop-server</name>
>>>                     <id>geronimo-commands:stop-server</id>
>>> +                </command>
>>> +            </nodes>
>>> +        </group>
>>> +
>>> +        <group>
>>> +            <name>remote</name>
>>> +            <nodes>
>>> +                <command>
>>> +                    <name>rsh</name>
>>> +                    <id>gshell-remote:rsh</id>
>>> +                </command>
>>> +                <command>
>>> +                    <name>rsh-server</name>
>>> +                    <id>gshell-remote:rsh-server</id>
>>> +                </command>
>>> +            </nodes>
>>> +        </group>
>>> +
>>> +        <group>
>>> +            <name>remote-control</name>
>>> +            <nodes>
>>> +                <command>
>>> +                    <name>server-control</name>
>>> +                    <id>geronimo-commands:remote-server-control</ 
>>> id>
>>>                 </command>
>>>             </nodes>
>>>         </group>
>>>
>>> Added: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>>> minimal/src/main/underlay/etc/server-configuration.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/server-configuration.xml?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/server-configuration.xml (added)
>>> +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>>> src/main/underlay/etc/server-configuration.xml Tue Dec  4 02:46:27  
>>> 2007
>>> @@ -0,0 +1,40 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<!--
>>> +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23 Nov  
>>> 2007) $ -->
>>> +
>>> +<configuration>
>>> +  <hosts>
>>> +    <host name="localhost">
>>> +      <gshell>
>>> +        <remote-login-cmd>remote/rsh -u NOT_USED -p NOT_USED  
>>> tcp://localhost:9999</remote-login-cmd>
>>> +      </gshell>
>>> +    </host>
>>> +  </hosts>
>>> +  <servers>
>>> +    <server name="defaultServer">
>>> +      <host name="localhost" />
>>> +      <controls>
>>> +        <start>execute-alias start_DEFAULT_SERVER</start>
>>> +        <stop>execute-alias stop_DEFAULT_SERVER</stop>
>>> +      </controls>
>>> +    </server>
>>> +  </servers>
>>> +</configuration>
>>>
>>> Modified: geronimo/server/trunk/framework/modules/geronimo- 
>>> commands/pom.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml?rev=600872&r1=600871&r2=600872&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> pom.xml (original)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> pom.xml Tue Dec  4 02:46:27 2007
>>> @@ -49,7 +49,13 @@
>>>             <groupId>org.slf4j</groupId>
>>>             <artifactId>slf4j-api</artifactId>
>>>         </dependency>
>>> -
>>> +
>>> +        <dependency>
>>> +            <groupId>org.slf4j</groupId>
>>> +            <artifactId>slf4j-simple</artifactId>
>>> +            <scope>test</scope>
>>> +        </dependency>
>>> +
>>>         <dependency>
>>>             <groupId>org.apache.geronimo.gshell</groupId>
>>>             <artifactId>gshell-command-api</artifactId>
>>> @@ -133,6 +139,7 @@
>>>                     <execution>
>>>                         <goals>
>>>                             <goal>compile</goal>
>>> +                            <goal>testCompile</goal>
>>>                         </goals>
>>>                     </execution>
>>>                 </executions>
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/main/groovy/org/apache/geronimo/commands/ 
>>> AbstractAliasCommand.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> AbstractAliasCommand.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> AbstractAliasCommand.groovy Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,76 @@
>>> +/*
>>> + * 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 groovy.xml.StreamingMarkupBuilder
>>> +
>>> +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.gshell.command.annotation.Requirement
>>> +import org.apache.geronimo.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.CommandSupport
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +abstract class AbstractAliasCommand extends CommandSupport {
>>> +
>>> +    @Option(name='-c', aliases=['--alias-configuration'],  
>>> description='Alias configuration file')
>>> +    String aliasFileName = 'etc/aliases.xml'
>>> +
>>> +    @Argument(index=0, description="alias")
>>> +    String aliasName
>>> +
>>> +    def buildAvailableAliases = { aliases ->
>>> +        def availables = '\nAvailable aliases:\n'
>>> +        aliases.alias.list().sort{ it.@id.text() }.each {
>>> +            availables += "    ${it.@id.text()} '$ 
>>> {it.'*'.text()}'\n"
>>> +        }
>>> +        availables
>>> +    }
>>> +
>>> +    def checkAliasFile = {
>>> +        def aliasFile = new File(aliasFileName)
>>> +        if (!aliasFile.exists()) {
>>> +            throw new IllegalStateException("Alias file $ 
>>> {aliasFile.absolutePath} does not exist")
>>> +        }
>>> +        aliasFile
>>> +    }
>>> +
>>> +    def serializeToXML = { aliases ->
>>> +           def outputBuilder = new StreamingMarkupBuilder()
>>> +           outputBuilder.bind { mkp.yield aliases }
>>> +    }
>>> +
>>> +    def createNewAliasFile = { aliasFile, aliasFileName, xml ->
>>> +        aliasFile.renameTo(new File(aliasFileName + ".bak"))
>>> +
>>> +        aliasFile = new File(aliasFileName)
>>> +        aliasFile.createNewFile()
>>> +        aliasFile.withPrintWriter {
>>> +            it.write(xml)
>>> +        }
>>> +    }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy Tue  
>>> Dec  4 02:46:27 2007
>>> @@ -0,0 +1,79 @@
>>> +/*
>>> + * 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 groovy.xml.StreamingMarkupBuilder
>>> +
>>> +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.gshell.command.annotation.Requirement
>>> +import org.apache.geronimo.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.CommandSupport
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +@CommandComponent(id='geronimo-commands:alias',  
>>> description="Create an alias")
>>> +class AliasCommand extends AbstractAliasCommand {
>>> +
>>> +    @Argument(index=1, description="Command")
>>> +    String command
>>> +
>>> +    protected Object doExecute() throws Exception {
>>> +        def aliasFile = checkAliasFile()
>>> +
>>> +        def xml
>>> +        aliasFile.withInputStream {
>>> +                   def aliases = new XmlSlurper().parse(it)
>>> +
>>> +                   if (!aliasName) {
>>> +                        
>>> io.out.println(buildAvailableAliases(aliases))
>>> +                       return
>>> +                   }
>>> +
>>> +                   if (!aliases.alias.find  
>>> { it.@id.text().equals(aliasName) }.isEmpty()) {
>>> +                       throw new IllegalArgumentException("$ 
>>> {aliasName} is already defined")
>>> +                   } else if (!command) {
>>> +                       throw new  
>>> IllegalArgumentException("command is required")
>>> +                   }
>>> +
>>> +                   aliases.appendNode {
>>> +                       alias(id: aliasName) {
>>> +                           cli(command)
>>> +                       }
>>> +                   }
>>> +
>>> +                   xml = serializeToXML(aliases)
>>> +        }
>>> +
>>> +        if (!xml) {
>>> +            return false
>>> +        }
>>> +
>>> +        createNewAliasFile(aliasFile, aliasFileName, xml)
>>> +
>>> +        true
>>> +    }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/main/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommand.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommand.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommand.groovy Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,64 @@
>>> +/*
>>> + * 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.gshell.clp.Argument;
>>> +import org.apache.geronimo.gshell.clp.Option
>>> +import  
>>> org.apache.geronimo.gshell.command.annotation.CommandComponent
>>> +import org.apache.geronimo.gshell.command.annotation.Requirement
>>> +import org.apache.geronimo.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.CommandSupport
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +@CommandComponent(id='geronimo-commands:execute-alias',  
>>> description="Execute an alias")
>>> +class ExecuteAliasCommand extends AbstractAliasCommand {
>>> +
>>> +    @Requirement
>>> +    CommandExecutor executor
>>> +
>>> +    protected Object doExecute() throws Exception {
>>> +        def aliasFile = checkAliasFile()
>>> +
>>> +        def result
>>> +        aliasFile.withInputStream({
>>> +            def aliases = new XmlSlurper().parse(it)
>>> +
>>> +            def alias = aliases.alias.find  
>>> { it.@id.text().equals(aliasName) }
>>> +            if (alias.isEmpty()) {
>>> +                def availables = buildAvailableAliases(aliases)
>>> +                throw new IllegalArgumentException("${aliasName}  
>>> does not exist.${availables}")
>>> +            }
>>> +
>>> +            def cli = alias.cli.text()
>>> +            if ('' == cli) {
>>> +                throw new  
>>> UnsupportedOperationException("alias.cli is not defined by alias $ 
>>> {aliasName}")
>>> +            }
>>> +
>>> +            result = executor.execute(cli)
>>> +        })
>>> +
>>> +        result
>>> +    }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/main/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommand.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/RemoteServerControlCommand.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommand.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommand.groovy Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,92 @@
>>> +/*
>>> + * 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.gshell.clp.Argument;
>>> +import org.apache.geronimo.gshell.clp.Option
>>> +import  
>>> org.apache.geronimo.gshell.command.annotation.CommandComponent
>>> +import org.apache.geronimo.gshell.command.annotation.Requirement
>>> +import org.apache.geronimo.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.CommandSupport
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +@CommandComponent(id='geronimo-commands:remote-server-control',  
>>> description="Remote server control")
>>> +class RemoteServerControlCommand extends CommandSupport {
>>> +
>>> +    @Requirement
>>> +    CommandExecutor executor
>>> +
>>> +    @Option(name='-c', aliases=['--server-configuration'],  
>>> description='Server configuration file')
>>> +    String configurationFileName = 'etc/server-configuration.xml'
>>> +
>>> +    @Argument(metaVar="CONTROL", required=true, index=0,  
>>> description="Control")
>>> +    String control
>>> +
>>> +    @Argument(metaVar="SERVER", required=true, index=1,  
>>> description="Server")
>>> +    String serverName
>>> +
>>> +    protected Object doExecute() throws Exception {
>>> +        def configurationFile = new File(configurationFileName)
>>> +        if (!configurationFile.exists()) {
>>> +            throw new IllegalStateException("File $ 
>>> {configurationFile.absolutePath} does not exist")
>>> +        }
>>> +
>>> +        def result
>>> +        configurationFile.withInputStream {
>>> +            result = executeRshCommand(it)
>>> +        }
>>> +        result
>>> +    }
>>> +
>>> +       protected executeRshCommand(is) {
>>> +        def configuration = new XmlSlurper().parse(is)
>>> +
>>> +        def retrieveByNameAttribute = { baseNode, name ->
>>> +               def node = baseNode.find  
>>> { it.@name.text().equals(name) }
>>> +               if (node.isEmpty()) {
>>> +                   def availableNames =  
>>> baseNode.list().sort{ it.@name.text() }.'@name'*.text()
>>> +                   throw new IllegalArgumentException("${name}  
>>> does not exist. Available: ${availableNames}")
>>> +               }
>>> +               node
>>> +        }
>>> +
>>> +        def server =  
>>> retrieveByNameAttribute(configuration.servers.server, serverName)
>>> +        def host =  
>>> retrieveByNameAttribute(configuration.hosts.host,  
>>> server.host.@name.text())
>>> +
>>> +        def rshCmd = host.gshell.'remote-login-cmd'.text()
>>> +        if ('' == rshCmd) {
>>> +            throw new IllegalStateException("gshell.remote-login- 
>>> cmd is not defined by host ${host.@name.text()}")
>>> +        }
>>> +
>>> +           def command = server.controls."${control}".text()
>>> +           if ('' == command) {
>>> +            def controls =  
>>> server.controls.'*'.list().sort{ it.name() }*.name()
>>> +               throw new IllegalStateException("server.controls.$ 
>>> {control} is not defined by server "
>>> +                   + "${server.@name.text()}.\nAvailable  
>>> controls: ${controls}")
>>> +           }
>>> +
>>> +        executor.execute("${rshCmd} ${command}")
>>> +       }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy  
>>> (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy Tue  
>>> Dec  4 02:46:27 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 groovy.xml.StreamingMarkupBuilder
>>> +
>>> +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.gshell.command.annotation.Requirement
>>> +import org.apache.geronimo.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.CommandSupport
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +@CommandComponent(id='geronimo-commands:unalias',  
>>> description="Remove an alias")
>>> +class UnaliasCommand extends AbstractAliasCommand {
>>> +
>>> +    protected Object doExecute() throws Exception {
>>> +           def aliasFile = checkAliasFile()
>>> +
>>> +           if (!aliasName) {
>>> +               throw new IllegalArgumentException("an alias must  
>>> be specified")
>>> +           }
>>> +
>>> +        def xml
>>> +        aliasFile.withInputStream {
>>> +                   def aliases = new XmlSlurper().parse(it)
>>> +
>>> +                   def alias = aliases.alias.find  
>>> { it.@id.text().equals(aliasName) }
>>> +                   if ('' == alias.text()) {
>>> +                       return
>>> +                   }
>>> +
>>> +                   alias.replaceNode {}
>>> +
>>> +                   xml = serializeToXML(aliases)
>>> +        }
>>> +
>>> +        if (!xml) {
>>> +            return false
>>> +        }
>>> +
>>> +        createNewAliasFile(aliasFile, aliasFileName, xml)
>>> +
>>> +        true
>>> +    }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy  
>>> (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy  
>>> Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,86 @@
>>> +/*
>>> + * 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.gshell.command.IO
>>> +
>>> +import org.apache.geronimo.testsupport.TestSupport
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +class AliasCommandTest extends GroovyTestCase {
>>> +
>>> +    def command
>>> +
>>> +    protected void setUp() {
>>> +               def testSupport = new GroovyTestSupport()
>>> +
>>> +        File baseFile = testSupport.resolveFile('src/test/ 
>>> resources/etc/aliases.xml')
>>> +        def lines = baseFile.readLines()
>>> +
>>> +        def workingFile = testSupport.resolveFile('build/etc/ 
>>> aliases.xml')
>>> +        workingFile.parentFile.mkdirs()
>>> +        workingFile.createNewFile()
>>> +        workingFile.withPrintWriter { pw ->
>>> +            lines.each { pw.println(it) }
>>> +        }
>>> +
>>> +        command = new AliasCommand([io: new IO(), aliasFileName:  
>>> workingFile.absolutePath])
>>> +    }
>>> +
>>> +       void testAliasFileDoesNotExistThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.aliasFileName = 'doesNotExist'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testNoAliasArgumentDisplaysAvailableAliases() {
>>> +        command.doExecute()
>>> +       }
>>> +
>>> +       void testAliasWithoutCommandThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.aliasName = 'anNewAlias'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testAliasAnExistingAliasThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.aliasName = 'start_DEFAULT_SERVER'
>>> +               command.command = 'test'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testAlias() {
>>> +        command.aliasName = 'start_DEFAULT_SERVER_TWO'
>>> +        command.command = 'test'
>>> +        command.doExecute()
>>> +
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +            command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommandTest.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/ExecuteAliasCommandTest.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommandTest.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> ExecuteAliasCommandTest.groovy Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,73 @@
>>> +/*
>>> + * 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.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +import org.apache.geronimo.testsupport.TestSupport
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +class ExecuteAliasCommandTest extends GroovyTestCase {
>>> +
>>> +    def command
>>> +    def executedCommand
>>> +
>>> +    protected void setUp() {
>>> +               def testSupport = new GroovyTestSupport()
>>> +
>>> +        File aliasFile = testSupport.resolveFile('src/test/ 
>>> resources/etc/aliases.xml')
>>> +
>>> +        command = new ExecuteAliasCommand([io: new IO(),  
>>> aliasFileName: aliasFile.absolutePath])
>>> +        command.executor = { executedCommand = it } as  
>>> CommandExecutor
>>> +    }
>>> +
>>> +       void testAliasFileDoesNotExistThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.aliasFileName = 'doesNotExist'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testExecuteUndefinedAliasThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.aliasName = 'undefined'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testExecuteAliasWithoutCLIThrowsUOE() {
>>> +           shouldFail(UnsupportedOperationException.class) {
>>> +               command.aliasName = 'alias_without_cli'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testExecuteAlias() {
>>> +        command.aliasName = 'start_DEFAULT_SERVER'
>>> +        command.doExecute()
>>> +
>>> +        assert 'start-server -d' == executedCommand
>>> +       }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/groovy/org/apache/geronimo/commands/ 
>>> GroovyTestSupport.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy  
>>> (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy  
>>> Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,29 @@
>>> +/*
>>> + * 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.testsupport.TestSupport
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +class GroovyTestSupport extends TestSupport {
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommandTest.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/RemoteServerControlCommandTest.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommandTest.groovy (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/ 
>>> RemoteServerControlCommandTest.groovy Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,89 @@
>>> +/*
>>> + * 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.gshell.command.CommandExecutor
>>> +import org.apache.geronimo.gshell.command.IO
>>> +
>>> +import org.apache.geronimo.testsupport.TestSupport
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +class RemoteServerControlCommandTest extends GroovyTestCase {
>>> +
>>> +    def command
>>> +    def executedCommand
>>> +
>>> +    protected void setUp() {
>>> +               def testSupport = new GroovyTestSupport()
>>> +
>>> +        File configurationFile = testSupport.resolveFile('src/ 
>>> test/resources/etc/server-configuration.xml')
>>> +
>>> +        command = new RemoteServerControlCommand([io: new IO(),  
>>> configurationFileName: configurationFile.absolutePath])
>>> +        command.executor = { executedCommand = it } as  
>>> CommandExecutor
>>> +    }
>>> +
>>> +       void testConfigurationFileDoesNotExistThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.configurationFileName = 'doesNotExist'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testServerIsUndefinedThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.serverName = 'undefined'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testServerIsDefinedWithUndefinedHostThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.serverName = 'serverWithUndefinedHost'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testControlIsUndefinedThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.serverName = 'defaultServer'
>>> +               command.control = 'undefined'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testRemoteLoginCmdIsUndefinedThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.serverName =  
>>> 'serverWithUndefinedRemoteLoginCmd'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testRemoteControlOK() {
>>> +        command.serverName = 'defaultServer'
>>> +        command.control = 'start'
>>> +        command.doExecute()
>>> +
>>> +        assert 'rshCommand start-server' == executedCommand
>>> +       }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/groovy/org/apache/geronimo/commands/ 
>>> UnaliasCommandTest.groovy
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy  
>>> (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy  
>>> Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,71 @@
>>> +/*
>>> + * 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.gshell.command.IO
>>> +
>>> +import org.apache.geronimo.testsupport.TestSupport
>>> +
>>> +/**
>>> + *
>>> + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700 (Sun,  
>>> 30 Sep 2007) $
>>> + */
>>> +class UnaliasCommandTest extends GroovyTestCase {
>>> +
>>> +    def command
>>> +
>>> +    protected void setUp() {
>>> +               def testSupport = new GroovyTestSupport()
>>> +
>>> +        File baseFile = testSupport.resolveFile('src/test/ 
>>> resources/etc/aliases.xml')
>>> +        def lines = baseFile.readLines()
>>> +
>>> +        def workingFile = testSupport.resolveFile('build/etc/ 
>>> aliases.xml')
>>> +        workingFile.delete()
>>> +        workingFile.parentFile.mkdirs()
>>> +        workingFile.createNewFile()
>>> +        workingFile.withPrintWriter { pw ->
>>> +            lines.each { pw.println(it) }
>>> +        }
>>> +
>>> +        command = new UnaliasCommand([io: new IO(),  
>>> aliasFileName: workingFile.absolutePath])
>>> +    }
>>> +
>>> +       void testAliasFileDoesNotExistThrowsISE() {
>>> +           shouldFail(IllegalStateException.class) {
>>> +               command.aliasFileName = 'doesNotExist'
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testNoAliasArgumentThrowsIAE() {
>>> +           shouldFail(IllegalArgumentException.class) {
>>> +               command.doExecute()
>>> +           }
>>> +       }
>>> +
>>> +       void testUnalias() {
>>> +        command.aliasName = 'start_DEFAULT_SERVER'
>>> +        assertTrue(command.doExecute())
>>> +
>>> +//        assertFalse(command.doExecute())
>>> +       }
>>> +
>>> +}
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/resources/etc/aliases.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/aliases.xml?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/aliases.xml (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/aliases.xml Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,11 @@
>>> +<aliases>
>>> +  <alias id='start_DEFAULT_SERVER'>
>>> +    <cli>start-server -d</cli>
>>> +  </alias>
>>> +  <alias id='stop_DEFAULT_SERVER'>
>>> +    <cli>stop-server</cli>
>>> +  </alias>
>>> +  <alias id='alias_without_cli'>
>>> +    <inline-script>a script</inline-script>
>>> +  </alias>
>>> +</aliases>
>>> \ No newline at end of file
>>>
>>> Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>>> src/test/resources/etc/server-configuration.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-commands/src/test/resources/etc/server-configuration.xml?rev=600872&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/server-configuration.xml (added)
>>> +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>>> test/resources/etc/server-configuration.xml Tue Dec  4 02:46:27 2007
>>> @@ -0,0 +1,30 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<configuration>
>>> +  <hosts>
>>> +    <host name="localhost">
>>> +      <gshell>
>>> +        <remote-login-cmd>rshCommand</remote-login-cmd>
>>> +      </gshell>
>>> +    </host>
>>> +    <host name="hostWithUndefinedRemoteLoginCmd">
>>> +      <gshell>
>>> +        <remote-login-cmd2>rshCommand</remote-login-cmd2>
>>> +      </gshell>
>>> +    </host>
>>> +  </hosts>
>>> +  <servers>
>>> +    <server name="defaultServer">
>>> +      <host name="localhost" />
>>> +      <controls>
>>> +        <start>start-server</start>
>>> +        <stop>stop-server</stop>
>>> +      </controls>
>>> +    </server>
>>> +    <server name="serverWithUndefinedRemoteLoginCmd">
>>> +      <host name="hostWithUndefinedRemoteLoginCmd" />
>>> +    </server>
>>> +    <server name="serverWithUndefinedHost">
>>> +      <host name="undefinedHost" />
>>> +    </server>
>>> +  </servers>
>>> +</configuration>
>>>
>>> Modified: geronimo/server/trunk/pom.xml
>>> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=600872&r1=600871&r2=600872&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- geronimo/server/trunk/pom.xml (original)
>>> +++ geronimo/server/trunk/pom.xml Tue Dec  4 02:46:27 2007
>>> @@ -1575,13 +1575,49 @@
>>>                 <artifactId>gshell-cli</artifactId>
>>>                 <version>1.0-alpha-1-SNAPSHOT</version>
>>>             </dependency>
>>> -
>>> +
>>> +            <dependency>
>>> +                <groupId>org.apache.geronimo.gshell</groupId>
>>> +                <artifactId>gshell-whisper</artifactId>
>>> +                <version>1.0-alpha-1-SNAPSHOT</version>
>>> +            </dependency>
>>> +
>>>             <dependency>
>>>                 <groupId>org.apache.geronimo.gshell.commands</ 
>>> groupId>
>>>                 <artifactId>gshell-builtins</artifactId>
>>>                 <version>1.0-alpha-1-SNAPSHOT</version>
>>>             </dependency>
>>>
>>> +            <dependency>
>>> +                <groupId>org.apache.geronimo.gshell.remote</ 
>>> groupId>
>>> +                <artifactId>gshell-remote-client</artifactId>
>>> +                <version>1.0-alpha-1-SNAPSHOT</version>
>>> +            </dependency>
>>> +
>>> +            <dependency>
>>> +                <groupId>org.apache.geronimo.gshell.remote</ 
>>> groupId>
>>> +                <artifactId>gshell-remote-common</artifactId>
>>> +                <version>1.0-alpha-1-SNAPSHOT</version>
>>> +            </dependency>
>>> +
>>> +            <dependency>
>>> +                <groupId>org.apache.geronimo.gshell.remote</ 
>>> groupId>
>>> +                <artifactId>gshell-remote-server</artifactId>
>>> +                <version>1.0-alpha-1-SNAPSHOT</version>
>>> +            </dependency>
>>> +
>>> +            <dependency>
>>> +                <groupId>org.apache.mina</groupId>
>>> +                <artifactId>mina-core</artifactId>
>>> +                <version>1.1.2</version>
>>> +            </dependency>
>>> +
>>> +            <dependency>
>>> +                <groupId>org.apache.mina</groupId>
>>> +                <artifactId>mina-filter-ssl</artifactId>
>>> +                <version>1.1.2</version>
>>> +            </dependency>
>>> +
>>>             <dependency>
>>>                 <groupId>org.codehaus.groovy</groupId>
>>>                 <artifactId>groovy-all</artifactId>
>>>
>>>
>>>
>


Re: svn commit: r600872 - in /geronimo/server/trunk: ./ assemblies/geronimo-boilerplate-minimal/ assemblies/geronimo-boilerplate-minimal/src/main/assembly/ assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ framework/modules/geronimo-comm

Posted by Gianny Damour <gi...@optusnet.com.au>.
On 22/04/2008, at 4:35 AM, Jason Dillon wrote:

> Hey, what exactly does this remote-server-control command intend to
> solve?  This got committed at the same time as your aliasing work...
> which sorry to say I'm about to nuke.

Please nuke.

>
> I wish you had mentioned you wanted to work on alias stuff and I would
> have given you a nudge on how I was planning on implementing it.  The
> idea was to follow how the alias stuff works for the Groovy Shell
> (aka. groovysh), which closely resembles how aliasing works for
> /bin/bash.  To do so means adding a few hooks into the GShell core and
> adding alias, unalias commands to builtins.

Do not wish anymore. This was discussed along with the remote-server- 
control bits:

http://www.mail-archive.com/dev@geronimo.apache.org/msg54184.html

>
>  * * *
>
> Anyways, I comprehend what the alias bits are intended for, but I'm
> lost for what the remote-server-control bits are for completely.
>
> I'm a bit weary about adding some of these commands to the
> distribution w/o adequate testing and documentation... or use-cases.

Test is there:  
org.apache.geronimo.commands.RemoteServerControlCommandTest

Documentation, talking about use-cases, would have been coming this  
week-end (I slowly started posting docos  two weeks ago with farming  
followed by WADI clustering support).

>
> Perhaps if you want to keep this around we can move it to a sandbox
> module, where we can test out new commands, then once they are
> rocksolid move them over?

Let's nuke it. I let you proceed.

Thanks,
Gianny

>
> --jason
>
>
> On Tue, Dec 4, 2007 at 5:46 PM,  <gd...@apache.org> wrote:
>> Author: gdamour
>>  Date: Tue Dec  4 02:46:27 2007
>>  New Revision: 600872
>>
>>  URL: http://svn.apache.org/viewvc?rev=600872&view=rev
>>  Log:
>>  Add a couple of gshell commands to simplify the remote control of  
>> servers.
>>  The commands being added are:
>>  * alias: used to alias a commond along with some options and  
>> arguments.
>>  etc/layout.xml provides a first aliasing mechanism: a  
>> hierarchical name is
>>  mapped to a command. alias suplements this first aliasing  
>> mechanism with the
>>  ability to alias a command along with its typical options and  
>> arguments.
>>  * unalias: to remove an alias
>>  * execute-alias: to execute an alias
>>  * remote/rsh to start an rsh client
>>  * remote/rsh-server to start an rsh-server
>>  * remote-control/server-control to control a server
>>
>>  Samples for the aliasing commands:
>>  // create the alias 'st' for the quoted command
>>> alias st 'geronimo/start-server -G server.name=yellow -D  
>>> property=value'
>>  // execute the alias 'st'. This executes the command in quote above
>>> excute-alias st
>>  // display defined aliases
>>> alias
>>  // remove the alias 'st'
>>> unalias st
>>
>>  Samples for the remote server control commands:
>>  // start an rsh-server:
>>> remote/rsh-server tcp://localhost:9999
>>  // remote 'start' the server 'defaultServer'
>>> remote-control/server-control start defaultServer
>>  // remote 'stop' the server 'defaultServer'
>>> remote-control/server-control stop defaultServer
>>
>>  All the commands are implemented in Groovy. XML manipulations are  
>> done via
>>  XmlSlurpers.
>>
>>  Aliases are stored in a configuration file located by default in
>>     etc/aliases.xml
>>
>>  Server configurations, used by the remote control command, are  
>> stored in a
>>  configuration file located by default in
>>     etc/server-configuration.xml
>>
>>  New JARs are being added to lib/gshell for the support of the rsh  
>> bits.
>>
>>  Added:
>>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/aliases.xml
>>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/server-configuration.xml
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/AbstractAliasCommand.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ExecuteAliasCommand.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommand.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommandTest.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommandTest.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/aliases.xml
>>     geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/server-configuration.xml
>>  Modified:
>>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> pom.xml
>>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/assembly/boilerplate.xml
>>     geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/layout.xml
>>     geronimo/server/trunk/framework/modules/geronimo-commands/pom.xml
>>     geronimo/server/trunk/pom.xml
>>
>>  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? 
>> rev=600872&r1=600871&r2=600872&view=diff
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> pom.xml (original)
>>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> pom.xml Tue Dec  4 02:46:27 2007
>>  @@ -65,6 +65,36 @@
>>          </dependency>
>>
>>          <dependency>
>>  +            <groupId>org.apache.geronimo.gshell</groupId>
>>  +            <artifactId>gshell-whisper</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>  +            <artifactId>gshell-remote-client</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>  +            <artifactId>gshell-remote-common</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>  +            <groupId>org.apache.geronimo.gshell.remote</groupId>
>>  +            <artifactId>gshell-remote-server</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>  +            <groupId>org.apache.mina</groupId>
>>  +            <artifactId>mina-core</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>  +            <groupId>org.apache.mina</groupId>
>>  +            <artifactId>mina-filter-ssl</artifactId>
>>  +        </dependency>
>>  +
>>  +        <dependency>
>>              <groupId>org.slf4j</groupId>
>>              <artifactId>slf4j-log4j12</artifactId>
>>          </dependency>
>>
>>  Modified: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>> minimal/src/main/assembly/boilerplate.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/ 
>> assemblies/geronimo-boilerplate-minimal/src/main/assembly/ 
>> boilerplate.xml?rev=600872&r1=600871&r2=600872&view=diff
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/assembly/boilerplate.xml (original)
>>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/assembly/boilerplate.xml Tue Dec  4 02:46:27 2007
>>  @@ -36,6 +36,15 @@
>>                  <include>org.apache.geronimo.modules:geronimo- 
>> commands</include>
>>                  <include>org.apache.geronimo.gshell:gshell- 
>> embeddable</include>
>>                  <include>org.apache.geronimo.gshell:gshell-cli</ 
>> include>
>>  +
>>  +                <!-- rsh related commands -->
>>  +                <include>org.apache.geronimo.gshell:gshell- 
>> whisper</include>
>>  +                 
>> <include>org.apache.geronimo.gshell.remote:gshell-remote-client</ 
>> include>
>>  +                 
>> <include>org.apache.geronimo.gshell.remote:gshell-remote-common</ 
>> include>
>>  +                 
>> <include>org.apache.geronimo.gshell.remote:gshell-remote-server</ 
>> include>
>>  +                <include>org.apache.mina:mina-core</include>
>>  +                <include>org.apache.mina:mina-filter-ssl</include>
>>  +
>>                  <include>org.codehaus.groovy:groovy-all</include>
>>                  <include>org.apache.ant:ant</include>
>>                  <include>org.apache.ant:ant-launcher</include>
>>
>>  Added: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>> minimal/src/main/underlay/etc/aliases.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/ 
>> assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ 
>> aliases.xml?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/aliases.xml (added)
>>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/aliases.xml Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,30 @@
>>  +<?xml version="1.0" encoding="UTF-8"?>
>>  +<!--
>>  +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23  
>> Nov 2007) $ -->
>>  +
>>  +<aliases>
>>  +  <alias id='start_DEFAULT_SERVER'>
>>  +    <cli>geronimo/start-server -b</cli>
>>  +  </alias>
>>  +  <alias id='stop_DEFAULT_SERVER'>
>>  +    <cli>geronimo/stop-server</cli>
>>  +  </alias>
>>  +</aliases>
>>  \ No newline at end of file
>>
>>  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=600872&r1=600871&r2=600872&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 Tue Dec  4 02:46:27 2007
>>  @@ -80,6 +80,21 @@
>>              <id>gshell-builtins:unset</id>
>>          </command>
>>
>>  +        <command>
>>  +            <name>alias</name>
>>  +            <id>geronimo-commands:alias</id>
>>  +        </command>
>>  +
>>  +        <command>
>>  +            <name>unalias</name>
>>  +            <id>geronimo-commands:unalias</id>
>>  +        </command>
>>  +
>>  +        <command>
>>  +            <name>execute-alias</name>
>>  +            <id>geronimo-commands:execute-alias</id>
>>  +        </command>
>>  +
>>          <!-- Geronimo -->
>>
>>          <group>
>>  @@ -94,6 +109,30 @@
>>                  <command>
>>                      <name>stop-server</name>
>>                      <id>geronimo-commands:stop-server</id>
>>  +                </command>
>>  +            </nodes>
>>  +        </group>
>>  +
>>  +        <group>
>>  +            <name>remote</name>
>>  +            <nodes>
>>  +                <command>
>>  +                    <name>rsh</name>
>>  +                    <id>gshell-remote:rsh</id>
>>  +                </command>
>>  +                <command>
>>  +                    <name>rsh-server</name>
>>  +                    <id>gshell-remote:rsh-server</id>
>>  +                </command>
>>  +            </nodes>
>>  +        </group>
>>  +
>>  +        <group>
>>  +            <name>remote-control</name>
>>  +            <nodes>
>>  +                <command>
>>  +                    <name>server-control</name>
>>  +                    <id>geronimo-commands:remote-server-control</ 
>> id>
>>                  </command>
>>              </nodes>
>>          </group>
>>
>>  Added: geronimo/server/trunk/assemblies/geronimo-boilerplate- 
>> minimal/src/main/underlay/etc/server-configuration.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/ 
>> assemblies/geronimo-boilerplate-minimal/src/main/underlay/etc/ 
>> server-configuration.xml?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/server-configuration.xml (added)
>>  +++ geronimo/server/trunk/assemblies/geronimo-boilerplate-minimal/ 
>> src/main/underlay/etc/server-configuration.xml Tue Dec  4 02:46:27  
>> 2007
>>  @@ -0,0 +1,40 @@
>>  +<?xml version="1.0" encoding="UTF-8"?>
>>  +<!--
>>  +    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: 597481 $ $Date: 2007-11-23 06:25:03 +1100 (Fri, 23  
>> Nov 2007) $ -->
>>  +
>>  +<configuration>
>>  +  <hosts>
>>  +    <host name="localhost">
>>  +      <gshell>
>>  +        <remote-login-cmd>remote/rsh -u NOT_USED -p NOT_USED  
>> tcp://localhost:9999</remote-login-cmd>
>>  +      </gshell>
>>  +    </host>
>>  +  </hosts>
>>  +  <servers>
>>  +    <server name="defaultServer">
>>  +      <host name="localhost" />
>>  +      <controls>
>>  +        <start>execute-alias start_DEFAULT_SERVER</start>
>>  +        <stop>execute-alias stop_DEFAULT_SERVER</stop>
>>  +      </controls>
>>  +    </server>
>>  +  </servers>
>>  +</configuration>
>>
>>  Modified: geronimo/server/trunk/framework/modules/geronimo- 
>> commands/pom.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/pom.xml? 
>> rev=600872&r1=600871&r2=600872&view=diff
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> pom.xml (original)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> pom.xml Tue Dec  4 02:46:27 2007
>>  @@ -49,7 +49,13 @@
>>              <groupId>org.slf4j</groupId>
>>              <artifactId>slf4j-api</artifactId>
>>          </dependency>
>>  -
>>  +
>>  +        <dependency>
>>  +            <groupId>org.slf4j</groupId>
>>  +            <artifactId>slf4j-simple</artifactId>
>>  +            <scope>test</scope>
>>  +        </dependency>
>>  +
>>          <dependency>
>>              <groupId>org.apache.geronimo.gshell</groupId>
>>              <artifactId>gshell-command-api</artifactId>
>>  @@ -133,6 +139,7 @@
>>                      <execution>
>>                          <goals>
>>                              <goal>compile</goal>
>>  +                            <goal>testCompile</goal>
>>                          </goals>
>>                      </execution>
>>                  </executions>
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/main/groovy/org/apache/geronimo/commands/ 
>> AbstractAliasCommand.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/main/groovy/org/apache/geronimo/ 
>> commands/AbstractAliasCommand.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> AbstractAliasCommand.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> AbstractAliasCommand.groovy Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,76 @@
>>  +/*
>>  + * 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 groovy.xml.StreamingMarkupBuilder
>>  +
>>  +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.gshell.command.annotation.Requirement
>>  +import org.apache.geronimo.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.CommandSupport
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +abstract class AbstractAliasCommand extends CommandSupport {
>>  +
>>  +    @Option(name='-c', aliases=['--alias-configuration'],  
>> description='Alias configuration file')
>>  +    String aliasFileName = 'etc/aliases.xml'
>>  +
>>  +    @Argument(index=0, description="alias")
>>  +    String aliasName
>>  +
>>  +    def buildAvailableAliases = { aliases ->
>>  +        def availables = '\nAvailable aliases:\n'
>>  +        aliases.alias.list().sort{ it.@id.text() }.each {
>>  +            availables += "    ${it.@id.text()} '${it.'*'.text 
>> ()}'\n"
>>  +        }
>>  +        availables
>>  +    }
>>  +
>>  +    def checkAliasFile = {
>>  +        def aliasFile = new File(aliasFileName)
>>  +        if (!aliasFile.exists()) {
>>  +            throw new IllegalStateException("Alias file $ 
>> {aliasFile.absolutePath} does not exist")
>>  +        }
>>  +        aliasFile
>>  +    }
>>  +
>>  +    def serializeToXML = { aliases ->
>>  +           def outputBuilder = new StreamingMarkupBuilder()
>>  +           outputBuilder.bind { mkp.yield aliases }
>>  +    }
>>  +
>>  +    def createNewAliasFile = { aliasFile, aliasFileName, xml ->
>>  +        aliasFile.renameTo(new File(aliasFileName + ".bak"))
>>  +
>>  +        aliasFile = new File(aliasFileName)
>>  +        aliasFile.createNewFile()
>>  +        aliasFile.withPrintWriter {
>>  +            it.write(xml)
>>  +        }
>>  +    }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/main/groovy/org/apache/geronimo/commands/AliasCommand.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/main/groovy/org/apache/geronimo/ 
>> commands/AliasCommand.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/AliasCommand.groovy Tue  
>> Dec  4 02:46:27 2007
>>  @@ -0,0 +1,79 @@
>>  +/*
>>  + * 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 groovy.xml.StreamingMarkupBuilder
>>  +
>>  +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.gshell.command.annotation.Requirement
>>  +import org.apache.geronimo.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.CommandSupport
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +@CommandComponent(id='geronimo-commands:alias',  
>> description="Create an alias")
>>  +class AliasCommand extends AbstractAliasCommand {
>>  +
>>  +    @Argument(index=1, description="Command")
>>  +    String command
>>  +
>>  +    protected Object doExecute() throws Exception {
>>  +        def aliasFile = checkAliasFile()
>>  +
>>  +        def xml
>>  +        aliasFile.withInputStream {
>>  +                   def aliases = new XmlSlurper().parse(it)
>>  +
>>  +                   if (!aliasName) {
>>  +                       io.out.println(buildAvailableAliases 
>> (aliases))
>>  +                       return
>>  +                   }
>>  +
>>  +                   if (!aliases.alias.find { it.@id.text().equals 
>> (aliasName) }.isEmpty()) {
>>  +                       throw new IllegalArgumentException("$ 
>> {aliasName} is already defined")
>>  +                   } else if (!command) {
>>  +                       throw new IllegalArgumentException 
>> ("command is required")
>>  +                   }
>>  +
>>  +                   aliases.appendNode {
>>  +                       alias(id: aliasName) {
>>  +                           cli(command)
>>  +                       }
>>  +                   }
>>  +
>>  +                   xml = serializeToXML(aliases)
>>  +        }
>>  +
>>  +        if (!xml) {
>>  +            return false
>>  +        }
>>  +
>>  +        createNewAliasFile(aliasFile, aliasFileName, xml)
>>  +
>>  +        true
>>  +    }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/main/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommand.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/main/groovy/org/apache/geronimo/ 
>> commands/ExecuteAliasCommand.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommand.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommand.groovy Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,64 @@
>>  +/*
>>  + * 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.gshell.clp.Argument;
>>  +import org.apache.geronimo.gshell.clp.Option
>>  +import  
>> org.apache.geronimo.gshell.command.annotation.CommandComponent
>>  +import org.apache.geronimo.gshell.command.annotation.Requirement
>>  +import org.apache.geronimo.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.CommandSupport
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +@CommandComponent(id='geronimo-commands:execute-alias',  
>> description="Execute an alias")
>>  +class ExecuteAliasCommand extends AbstractAliasCommand {
>>  +
>>  +    @Requirement
>>  +    CommandExecutor executor
>>  +
>>  +    protected Object doExecute() throws Exception {
>>  +        def aliasFile = checkAliasFile()
>>  +
>>  +        def result
>>  +        aliasFile.withInputStream({
>>  +            def aliases = new XmlSlurper().parse(it)
>>  +
>>  +            def alias = aliases.alias.find { it.@id.text().equals 
>> (aliasName) }
>>  +            if (alias.isEmpty()) {
>>  +                def availables = buildAvailableAliases(aliases)
>>  +                throw new IllegalArgumentException("${aliasName}  
>> does not exist.${availables}")
>>  +            }
>>  +
>>  +            def cli = alias.cli.text()
>>  +            if ('' == cli) {
>>  +                throw new UnsupportedOperationException 
>> ("alias.cli is not defined by alias ${aliasName}")
>>  +            }
>>  +
>>  +            result = executor.execute(cli)
>>  +        })
>>  +
>>  +        result
>>  +    }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/main/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommand.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/main/groovy/org/apache/geronimo/ 
>> commands/RemoteServerControlCommand.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommand.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommand.groovy Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,92 @@
>>  +/*
>>  + * 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.gshell.clp.Argument;
>>  +import org.apache.geronimo.gshell.clp.Option
>>  +import  
>> org.apache.geronimo.gshell.command.annotation.CommandComponent
>>  +import org.apache.geronimo.gshell.command.annotation.Requirement
>>  +import org.apache.geronimo.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.CommandSupport
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +@CommandComponent(id='geronimo-commands:remote-server-control',  
>> description="Remote server control")
>>  +class RemoteServerControlCommand extends CommandSupport {
>>  +
>>  +    @Requirement
>>  +    CommandExecutor executor
>>  +
>>  +    @Option(name='-c', aliases=['--server-configuration'],  
>> description='Server configuration file')
>>  +    String configurationFileName = 'etc/server-configuration.xml'
>>  +
>>  +    @Argument(metaVar="CONTROL", required=true, index=0,  
>> description="Control")
>>  +    String control
>>  +
>>  +    @Argument(metaVar="SERVER", required=true, index=1,  
>> description="Server")
>>  +    String serverName
>>  +
>>  +    protected Object doExecute() throws Exception {
>>  +        def configurationFile = new File(configurationFileName)
>>  +        if (!configurationFile.exists()) {
>>  +            throw new IllegalStateException("File $ 
>> {configurationFile.absolutePath} does not exist")
>>  +        }
>>  +
>>  +        def result
>>  +        configurationFile.withInputStream {
>>  +            result = executeRshCommand(it)
>>  +        }
>>  +        result
>>  +    }
>>  +
>>  +       protected executeRshCommand(is) {
>>  +        def configuration = new XmlSlurper().parse(is)
>>  +
>>  +        def retrieveByNameAttribute = { baseNode, name ->
>>  +               def node = baseNode.find { it.@name.text().equals 
>> (name) }
>>  +               if (node.isEmpty()) {
>>  +                   def availableNames = baseNode.list().sort 
>> { it.@name.text() }.'@name'*.text()
>>  +                   throw new IllegalArgumentException("${name}  
>> does not exist. Available: ${availableNames}")
>>  +               }
>>  +               node
>>  +        }
>>  +
>>  +        def server = retrieveByNameAttribute 
>> (configuration.servers.server, serverName)
>>  +        def host = retrieveByNameAttribute 
>> (configuration.hosts.host, server.host.@name.text())
>>  +
>>  +        def rshCmd = host.gshell.'remote-login-cmd'.text()
>>  +        if ('' == rshCmd) {
>>  +            throw new IllegalStateException("gshell.remote-login- 
>> cmd is not defined by host ${host.@name.text()}")
>>  +        }
>>  +
>>  +           def command = server.controls."${control}".text()
>>  +           if ('' == command) {
>>  +            def controls = server.controls.'*'.list().sort 
>> { it.name() }*.name()
>>  +               throw new IllegalStateException("server.controls.$ 
>> {control} is not defined by server "
>>  +                   + "${server.@name.text()}.\nAvailable  
>> controls: ${controls}")
>>  +           }
>>  +
>>  +        executor.execute("${rshCmd} ${command}")
>>  +       }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/main/groovy/org/apache/geronimo/ 
>> commands/UnaliasCommand.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy  
>> (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> main/groovy/org/apache/geronimo/commands/UnaliasCommand.groovy Tue  
>> Dec  4 02:46:27 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 groovy.xml.StreamingMarkupBuilder
>>  +
>>  +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.gshell.command.annotation.Requirement
>>  +import org.apache.geronimo.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.CommandSupport
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +@CommandComponent(id='geronimo-commands:unalias',  
>> description="Remove an alias")
>>  +class UnaliasCommand extends AbstractAliasCommand {
>>  +
>>  +    protected Object doExecute() throws Exception {
>>  +           def aliasFile = checkAliasFile()
>>  +
>>  +           if (!aliasName) {
>>  +               throw new IllegalArgumentException("an alias must  
>> be specified")
>>  +           }
>>  +
>>  +        def xml
>>  +        aliasFile.withInputStream {
>>  +                   def aliases = new XmlSlurper().parse(it)
>>  +
>>  +                   def alias = aliases.alias.find { it.@id.text 
>> ().equals(aliasName) }
>>  +                   if ('' == alias.text()) {
>>  +                       return
>>  +                   }
>>  +
>>  +                   alias.replaceNode {}
>>  +
>>  +                   xml = serializeToXML(aliases)
>>  +        }
>>  +
>>  +        if (!xml) {
>>  +            return false
>>  +        }
>>  +
>>  +        createNewAliasFile(aliasFile, aliasFileName, xml)
>>  +
>>  +        true
>>  +    }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/groovy/org/apache/geronimo/ 
>> commands/AliasCommandTest.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy  
>> (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/AliasCommandTest.groovy  
>> Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,86 @@
>>  +/*
>>  + * 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.gshell.command.IO
>>  +
>>  +import org.apache.geronimo.testsupport.TestSupport
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +class AliasCommandTest extends GroovyTestCase {
>>  +
>>  +    def command
>>  +
>>  +    protected void setUp() {
>>  +               def testSupport = new GroovyTestSupport()
>>  +
>>  +        File baseFile = testSupport.resolveFile('src/test/ 
>> resources/etc/aliases.xml')
>>  +        def lines = baseFile.readLines()
>>  +
>>  +        def workingFile = testSupport.resolveFile('build/etc/ 
>> aliases.xml')
>>  +        workingFile.parentFile.mkdirs()
>>  +        workingFile.createNewFile()
>>  +        workingFile.withPrintWriter { pw ->
>>  +            lines.each { pw.println(it) }
>>  +        }
>>  +
>>  +        command = new AliasCommand([io: new IO(), aliasFileName:  
>> workingFile.absolutePath])
>>  +    }
>>  +
>>  +       void testAliasFileDoesNotExistThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.aliasFileName = 'doesNotExist'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testNoAliasArgumentDisplaysAvailableAliases() {
>>  +        command.doExecute()
>>  +       }
>>  +
>>  +       void testAliasWithoutCommandThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.aliasName = 'anNewAlias'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testAliasAnExistingAliasThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.aliasName = 'start_DEFAULT_SERVER'
>>  +               command.command = 'test'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testAlias() {
>>  +        command.aliasName = 'start_DEFAULT_SERVER_TWO'
>>  +        command.command = 'test'
>>  +        command.doExecute()
>>  +
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +            command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommandTest.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/groovy/org/apache/geronimo/ 
>> commands/ExecuteAliasCommandTest.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommandTest.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> ExecuteAliasCommandTest.groovy Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,73 @@
>>  +/*
>>  + * 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.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +import org.apache.geronimo.testsupport.TestSupport
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +class ExecuteAliasCommandTest extends GroovyTestCase {
>>  +
>>  +    def command
>>  +    def executedCommand
>>  +
>>  +    protected void setUp() {
>>  +               def testSupport = new GroovyTestSupport()
>>  +
>>  +        File aliasFile = testSupport.resolveFile('src/test/ 
>> resources/etc/aliases.xml')
>>  +
>>  +        command = new ExecuteAliasCommand([io: new IO(),  
>> aliasFileName: aliasFile.absolutePath])
>>  +        command.executor = { executedCommand = it } as  
>> CommandExecutor
>>  +    }
>>  +
>>  +       void testAliasFileDoesNotExistThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.aliasFileName = 'doesNotExist'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testExecuteUndefinedAliasThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.aliasName = 'undefined'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testExecuteAliasWithoutCLIThrowsUOE() {
>>  +           shouldFail(UnsupportedOperationException.class) {
>>  +               command.aliasName = 'alias_without_cli'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testExecuteAlias() {
>>  +        command.aliasName = 'start_DEFAULT_SERVER'
>>  +        command.doExecute()
>>  +
>>  +        assert 'start-server -d' == executedCommand
>>  +       }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/groovy/org/apache/geronimo/ 
>> commands/GroovyTestSupport.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy  
>> (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/GroovyTestSupport.groovy  
>> Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,29 @@
>>  +/*
>>  + * 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.testsupport.TestSupport
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +class GroovyTestSupport extends TestSupport {
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommandTest.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/groovy/org/apache/geronimo/ 
>> commands/RemoteServerControlCommandTest.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommandTest.groovy (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/ 
>> RemoteServerControlCommandTest.groovy Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,89 @@
>>  +/*
>>  + * 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.gshell.command.CommandExecutor
>>  +import org.apache.geronimo.gshell.command.IO
>>  +
>>  +import org.apache.geronimo.testsupport.TestSupport
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +class RemoteServerControlCommandTest extends GroovyTestCase {
>>  +
>>  +    def command
>>  +    def executedCommand
>>  +
>>  +    protected void setUp() {
>>  +               def testSupport = new GroovyTestSupport()
>>  +
>>  +        File configurationFile = testSupport.resolveFile('src/ 
>> test/resources/etc/server-configuration.xml')
>>  +
>>  +        command = new RemoteServerControlCommand([io: new IO(),  
>> configurationFileName: configurationFile.absolutePath])
>>  +        command.executor = { executedCommand = it } as  
>> CommandExecutor
>>  +    }
>>  +
>>  +       void testConfigurationFileDoesNotExistThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.configurationFileName = 'doesNotExist'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testServerIsUndefinedThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.serverName = 'undefined'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testServerIsDefinedWithUndefinedHostThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.serverName = 'serverWithUndefinedHost'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testControlIsUndefinedThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.serverName = 'defaultServer'
>>  +               command.control = 'undefined'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testRemoteLoginCmdIsUndefinedThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.serverName =  
>> 'serverWithUndefinedRemoteLoginCmd'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testRemoteControlOK() {
>>  +        command.serverName = 'defaultServer'
>>  +        command.control = 'start'
>>  +        command.doExecute()
>>  +
>>  +        assert 'rshCommand start-server' == executedCommand
>>  +       }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/groovy/org/apache/geronimo/commands/ 
>> UnaliasCommandTest.groovy
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/groovy/org/apache/geronimo/ 
>> commands/UnaliasCommandTest.groovy?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy  
>> (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/groovy/org/apache/geronimo/commands/UnaliasCommandTest.groovy  
>> Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,71 @@
>>  +/*
>>  + * 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.gshell.command.IO
>>  +
>>  +import org.apache.geronimo.testsupport.TestSupport
>>  +
>>  +/**
>>  + *
>>  + * @version $Rev: 580864 $ $Date: 2007-09-30 23:47:39 -0700  
>> (Sun, 30 Sep 2007) $
>>  + */
>>  +class UnaliasCommandTest extends GroovyTestCase {
>>  +
>>  +    def command
>>  +
>>  +    protected void setUp() {
>>  +               def testSupport = new GroovyTestSupport()
>>  +
>>  +        File baseFile = testSupport.resolveFile('src/test/ 
>> resources/etc/aliases.xml')
>>  +        def lines = baseFile.readLines()
>>  +
>>  +        def workingFile = testSupport.resolveFile('build/etc/ 
>> aliases.xml')
>>  +        workingFile.delete()
>>  +        workingFile.parentFile.mkdirs()
>>  +        workingFile.createNewFile()
>>  +        workingFile.withPrintWriter { pw ->
>>  +            lines.each { pw.println(it) }
>>  +        }
>>  +
>>  +        command = new UnaliasCommand([io: new IO(),  
>> aliasFileName: workingFile.absolutePath])
>>  +    }
>>  +
>>  +       void testAliasFileDoesNotExistThrowsISE() {
>>  +           shouldFail(IllegalStateException.class) {
>>  +               command.aliasFileName = 'doesNotExist'
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testNoAliasArgumentThrowsIAE() {
>>  +           shouldFail(IllegalArgumentException.class) {
>>  +               command.doExecute()
>>  +           }
>>  +       }
>>  +
>>  +       void testUnalias() {
>>  +        command.aliasName = 'start_DEFAULT_SERVER'
>>  +        assertTrue(command.doExecute())
>>  +
>>  +//        assertFalse(command.doExecute())
>>  +       }
>>  +
>>  +}
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/resources/etc/aliases.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/resources/etc/aliases.xml? 
>> rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/aliases.xml (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/aliases.xml Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,11 @@
>>  +<aliases>
>>  +  <alias id='start_DEFAULT_SERVER'>
>>  +    <cli>start-server -d</cli>
>>  +  </alias>
>>  +  <alias id='stop_DEFAULT_SERVER'>
>>  +    <cli>stop-server</cli>
>>  +  </alias>
>>  +  <alias id='alias_without_cli'>
>>  +    <inline-script>a script</inline-script>
>>  +  </alias>
>>  +</aliases>
>>  \ No newline at end of file
>>
>>  Added: geronimo/server/trunk/framework/modules/geronimo-commands/ 
>> src/test/resources/etc/server-configuration.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/ 
>> modules/geronimo-commands/src/test/resources/etc/server- 
>> configuration.xml?rev=600872&view=auto
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/server-configuration.xml (added)
>>  +++ geronimo/server/trunk/framework/modules/geronimo-commands/src/ 
>> test/resources/etc/server-configuration.xml Tue Dec  4 02:46:27 2007
>>  @@ -0,0 +1,30 @@
>>  +<?xml version="1.0" encoding="UTF-8"?>
>>  +<configuration>
>>  +  <hosts>
>>  +    <host name="localhost">
>>  +      <gshell>
>>  +        <remote-login-cmd>rshCommand</remote-login-cmd>
>>  +      </gshell>
>>  +    </host>
>>  +    <host name="hostWithUndefinedRemoteLoginCmd">
>>  +      <gshell>
>>  +        <remote-login-cmd2>rshCommand</remote-login-cmd2>
>>  +      </gshell>
>>  +    </host>
>>  +  </hosts>
>>  +  <servers>
>>  +    <server name="defaultServer">
>>  +      <host name="localhost" />
>>  +      <controls>
>>  +        <start>start-server</start>
>>  +        <stop>stop-server</stop>
>>  +      </controls>
>>  +    </server>
>>  +    <server name="serverWithUndefinedRemoteLoginCmd">
>>  +      <host name="hostWithUndefinedRemoteLoginCmd" />
>>  +    </server>
>>  +    <server name="serverWithUndefinedHost">
>>  +      <host name="undefinedHost" />
>>  +    </server>
>>  +  </servers>
>>  +</configuration>
>>
>>  Modified: geronimo/server/trunk/pom.xml
>>  URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml? 
>> rev=600872&r1=600871&r2=600872&view=diff
>>   
>> ===================================================================== 
>> =========
>>  --- geronimo/server/trunk/pom.xml (original)
>>  +++ geronimo/server/trunk/pom.xml Tue Dec  4 02:46:27 2007
>>  @@ -1575,13 +1575,49 @@
>>                  <artifactId>gshell-cli</artifactId>
>>                  <version>1.0-alpha-1-SNAPSHOT</version>
>>              </dependency>
>>  -
>>  +
>>  +            <dependency>
>>  +                <groupId>org.apache.geronimo.gshell</groupId>
>>  +                <artifactId>gshell-whisper</artifactId>
>>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>>  +            </dependency>
>>  +
>>              <dependency>
>>                  <groupId>org.apache.geronimo.gshell.commands</ 
>> groupId>
>>                  <artifactId>gshell-builtins</artifactId>
>>                  <version>1.0-alpha-1-SNAPSHOT</version>
>>              </dependency>
>>
>>  +            <dependency>
>>  +                <groupId>org.apache.geronimo.gshell.remote</ 
>> groupId>
>>  +                <artifactId>gshell-remote-client</artifactId>
>>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>>  +            </dependency>
>>  +
>>  +            <dependency>
>>  +                <groupId>org.apache.geronimo.gshell.remote</ 
>> groupId>
>>  +                <artifactId>gshell-remote-common</artifactId>
>>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>>  +            </dependency>
>>  +
>>  +            <dependency>
>>  +                <groupId>org.apache.geronimo.gshell.remote</ 
>> groupId>
>>  +                <artifactId>gshell-remote-server</artifactId>
>>  +                <version>1.0-alpha-1-SNAPSHOT</version>
>>  +            </dependency>
>>  +
>>  +            <dependency>
>>  +                <groupId>org.apache.mina</groupId>
>>  +                <artifactId>mina-core</artifactId>
>>  +                <version>1.1.2</version>
>>  +            </dependency>
>>  +
>>  +            <dependency>
>>  +                <groupId>org.apache.mina</groupId>
>>  +                <artifactId>mina-filter-ssl</artifactId>
>>  +                <version>1.1.2</version>
>>  +            </dependency>
>>  +
>>              <dependency>
>>                  <groupId>org.codehaus.groovy</groupId>
>>                  <artifactId>groovy-all</artifactId>
>>
>>
>>