geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r570622 - in /geronimo/sandbox/gshell/trunk: ./ gshell-api/src/main/java/org/apache/geronimo/gshell/util/ gshell-assembly/ gshell-bootstrap/ gshell-cli/ gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ gshell-commands/ gshell-comman...
Date Wed, 29 Aug 2007 03:05:48 GMT
Author: jdillon
Date: Tue Aug 28 20:05:46 2007
New Revision: 570622

URL: http://svn.apache.org/viewvc?rev=570622&view=rev
Log:
Bring the standard commands back to a compilable state

Added:
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
  (contents, props changed)
      - copied, changed from r570606, geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package.html
Removed:
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package.html
Modified:
    geronimo/sandbox/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
    geronimo/sandbox/gshell/trunk/gshell-assembly/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-bootstrap/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ProcessingException.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-scripting-commands/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/CatCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/EchoCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ExecuteCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/SleepCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/WaitCommand.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/PumpStreamHandler.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/StreamPumper.java
    geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs-commands/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-commands/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-testsuite/pom.xml
    geronimo/sandbox/gshell/trunk/javacc-maven-plugin/pom.xml
    geronimo/sandbox/gshell/trunk/pom.xml

Modified: geronimo/sandbox/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/util/Arguments.java
Tue Aug 28 20:05:46 2007
@@ -19,6 +19,8 @@
 
 package org.apache.geronimo.gshell.util;
 
+import java.util.List;
+
 /**
  * Utils for command-line arguments.
  *
@@ -47,6 +49,21 @@
         for (int i=0; i<args.length; i++ ) {
             buff.append(args[i]);
             if (i + 1 < args.length) {
+                buff.append(", ");
+            }
+        }
+
+        return buff.toString();
+    }
+
+    public static String asString(final List args) {
+        assert args != null;
+
+        StringBuffer buff = new StringBuffer();
+
+        for (int i=0; i<args.size(); i++ ) {
+            buff.append(args.get(i));
+            if (i + 1 < args.size()) {
                 buff.append(", ");
             }
         }

Modified: geronimo/sandbox/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-assembly/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-assembly/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
 
     <artifactId>gshell-assembly</artifactId>
@@ -54,13 +53,13 @@
             <version>${version}</version>
         </dependency>
 
-        <!--
         <dependency>
             <groupId>${pom.groupId}</groupId>
             <artifactId>gshell-standard-commands</artifactId>
             <version>${version}</version>
         </dependency>
-        
+
+        <!--
         <dependency>
             <groupId>${pom.groupId}</groupId>
             <artifactId>gshell-scripting-commands</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-bootstrap/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-bootstrap/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-bootstrap/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-bootstrap/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-bootstrap</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-cli</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ProcessingException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ProcessingException.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ProcessingException.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-clp/src/main/java/org/apache/geronimo/gshell/clp/ProcessingException.java
Tue Aug 28 20:05:46 2007
@@ -38,6 +38,6 @@
     }
 
     public ProcessingException(Throwable cause) {
-        super(msg);
+        super(cause);
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-scripting-commands/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-scripting-commands/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-scripting-commands/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-scripting-commands/pom.xml Tue Aug
28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell-commands</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-scripting-commands</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/pom.xml Tue Aug
28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell-commands</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-standard-commands</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/CatCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/CatCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/CatCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/CatCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,24 +19,19 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.command.MessageSource;
-import org.apache.geronimo.gshell.command.CommandException;
-import org.apache.geronimo.gshell.console.IO;
-import org.apache.geronimo.gshell.util.Arguments;
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.InputStreamReader;
-import java.net.URL;
 import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandSupport;
+import org.apache.geronimo.gshell.console.IO;
 
 /**
  * Concatenate and print files and/or URLs.
@@ -46,56 +41,28 @@
 public class CatCommand
     extends CommandSupport
 {
+    @Option(name="-n", description="Number the output lines, starting at 1")
     private boolean displayLineNumbers;
-    
-    public CatCommand() {
-        super("cat");
-    }
 
-    protected Options getOptions() {
-        MessageSource messages = getMessageSource();
+    @Argument(description="File or URL", required=true)
+    private List<String> args;
 
-        Options options = super.getOptions();
-
-        options.addOption(OptionBuilder
-            .withDescription(messages.getMessage("cli.option.n"))
-            .create('n'));
-
-        return options;
+    public CatCommand() {
+        super("cat");
     }
 
     protected String getUsage() {
         return super.getUsage() + " [<file|url> ...]";
     }
 
-    protected boolean processCommandLine(final CommandLine line) throws CommandException
{
-        assert line != null;
-
-        if (line.hasOption('n')) {
-            displayLineNumbers = true;
-        }
-
-        return false;
-    }
-
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
-
-        String[] files;
-
-        // No args, then read from STDIN
-        if (args.length == 0) {
-            files = new String[] { "-" };
-        }
-        else {
-            files = Arguments.toStringArray(args);
-        }
-
+    protected Object doExecute() throws Exception {
         IO io = getIO();
 
-        for (String filename : files) {
+        for (String filename : args) {
             BufferedReader reader;
 
+            // FIXME:
+            /*
             //
             // Support "-" if length is one, and read from io.in
             // This will help test command pipelines.
@@ -105,6 +72,7 @@
                 reader = new BufferedReader(io.in);
             }
             else {
+            */
                 // First try a URL
                 try {
                     URL url = new URL(filename);
@@ -117,15 +85,19 @@
                     log.info("Printing file: " + file);
                     reader = new BufferedReader(new FileReader(file));
                 }
-            }
+            /*}*/
 
             String line;
             int lineno = 1;
 
             while ((line = reader.readLine()) != null) {
                 if (displayLineNumbers) {
-                    String gutter = StringUtils.leftPad(String.valueOf(lineno++), 6);
-                    io.out.print(gutter);
+                    // FIXME:
+                    // String gutter = StringUtils.leftPad(String.valueOf(lineno++), 6);
+                    // io.out.print(gutter);
+
+
+                    io.out.println(lineno++);
                     io.out.print("  ");
                 }
                 io.out.println(line);

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/EchoCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/EchoCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/EchoCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/EchoCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,14 +19,12 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
+import java.util.List;
 
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.Command;
 import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.command.MessageSource;
-import org.apache.geronimo.gshell.command.CommandException;
 import org.apache.geronimo.gshell.console.IO;
 
 /**
@@ -37,50 +35,34 @@
 public class EchoCommand
     extends CommandSupport
 {
+    @Option(name="-n", description="Do not print the trailing newline character")
     private boolean trailingNewline = true;
-    
-    public EchoCommand() {
-        super("echo");
-    }
-
-    protected Options getOptions() {
-        MessageSource messages = getMessageSource();
-
-        Options options = super.getOptions();
-
-        options.addOption(OptionBuilder
-            .withDescription(messages.getMessage("cli.option.n"))
-            .create('n'));
-
-        return options;
-    }
 
-    protected boolean processCommandLine(final CommandLine line) throws CommandException
{
-        assert line != null;
+    @Argument(description="Arguments")
+    private List<String> args;
 
-        if (line.hasOption('n')) {
-            trailingNewline = false;
-        }
-
-        return false;
+    public EchoCommand() {
+        super("echo");
     }
 
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
-
+    protected Object doExecute() throws Exception {
         IO io = getIO();
 
-        for (int i=0; i < args.length; i++) {
-            io.out.print(args[i]);
-            if (i + 1 < args.length) {
-                io.out.print(" ");
+        if (args != null) {
+            int c=0;
+
+            for (String arg : args) {
+                io.out.print(arg);
+                if (c++ < args.size()) {
+                    io.out.print(" ");
+                }
             }
         }
 
         if (trailingNewline) {
             io.out.println();
         }
-        
+
         return Command.SUCCESS;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ExecuteCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ExecuteCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ExecuteCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/ExecuteCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,14 +19,12 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
+import java.util.List;
 
+import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.command.CommandException;
-import org.apache.geronimo.gshell.command.MessageSource;
-import org.apache.geronimo.gshell.console.IO;
 import org.apache.geronimo.gshell.commands.standard.util.PumpStreamHandler;
+import org.apache.geronimo.gshell.console.IO;
 
 /**
  * Execute system processes.
@@ -38,64 +36,18 @@
 {
     private ProcessBuilder builder;
 
+    @Argument(description="Argument", required=true)
+    private List<String> args;
+
     public ExecuteCommand() {
         super("exec");
     }
 
-    protected Options getOptions() {
-        MessageSource messages = getMessageSource();
-
-        Options options = super.getOptions();
-
-//        options.addOption(OptionBuilder
-//            .withDescription(messages.getMessage("cli.option.n"))
-//            .create('n'));
-
-        return options;
-    }
-
     protected String getUsage() {
         return super.getUsage() + " <command> (<arg>)*";
     }
 
-    protected boolean processCommandLine(final CommandLine line) throws CommandException
{
-        assert line != null;
-
-        String[] args = line.getArgs();
-
-        // Need at least one argument
-        if (args.length < 1) {
-            return true;
-        }
-        else {
-            builder = new ProcessBuilder(args);
-        }
-
-        //
-        // TODO: Allow ENV to be changed (default is given environ)
-        //
-
-        //
-        // TODO: Allow working dir to be set (default is user.dir)
-        //
-
-        //
-        // TODO: Allow error redirection to be enabled (default is false)
-        //
-
-        //
-        // TODO: Add timeout; default is no timeout
-        //
-
-        //
-        // TODO: Add spawn flag (process not killed when vm exits; default is not to spawn)
-        //
-
-        return false;
-    }
-
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
+    protected Object doExecute() throws Exception {
         assert builder != null;
 
         boolean info = log.isInfoEnabled();

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/JavaCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,19 +19,14 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
+import java.lang.reflect.Method;
+import java.util.List;
 
-import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.command.MessageSource;
-import org.apache.geronimo.gshell.command.CommandException;
-import org.apache.geronimo.gshell.console.IO;
 import org.apache.geronimo.gshell.util.Arguments;
 
-import java.lang.reflect.Method;
-
 /**
  * Execute a Java standard application.
  *
@@ -44,66 +39,27 @@
 public class JavaCommand
     extends CommandSupport
 {
+    @Option(name="-m", aliases={"--method"}, description="Invoke a named method")
     private String methodName = "main";
 
-    public JavaCommand() {
-        super("java");
-    }
-
-    protected Options getOptions() {
-        MessageSource messages = getMessageSource();
+    @Argument(index=0, description="Class name", required=true)
+    private String className;
 
-        Options options = super.getOptions();
+    @Argument(index=1, description="Arguments")
+    private List<String> args;
 
-        options.addOption(OptionBuilder.withLongOpt("method")
-            .withDescription(messages.getMessage("cli.option.method"))
-            .hasArg()
-            .withArgName("method")
-            .create('M'));
-
-        return options;
+    public JavaCommand() {
+        super("java");
     }
 
     protected String getUsage() {
         return super.getUsage() + " <classname> [arguments]";
     }
 
-    protected boolean processCommandLine(final CommandLine line) throws CommandException
{
-        assert line != null;
-
-        String[] args = line.getArgs();
-
-        IO io = getIO();
-        MessageSource messages = getMessageSource();
-
-        if (args.length == 0) {
-            io.err.println(messages.getMessage("cli.error.missing_classname"));
-
-            return true;
-        }
-        if (line.hasOption('M')) {
-            methodName = line.getOptionValue('M');
-        }
-
-        return false;
-    }
-
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
-
-        run(String.valueOf(args[0]), Arguments.toStringArray(Arguments.shift(args)));
-
-        return Command.SUCCESS;
-    }
-
-
-    private void run(final String classname, final String[] args) throws Exception {
-        assert classname != null;
-        assert args != null;
-
+    protected Object doExecute() throws Exception {
         boolean info = log.isInfoEnabled();
 
-        Class type = Thread.currentThread().getContextClassLoader().loadClass(classname);
+        Class type = Thread.currentThread().getContextClassLoader().loadClass(className);
         if (info) {
             log.info("Using type: " + type);
         }
@@ -122,5 +78,7 @@
         if (info) {
             log.info("Result: " + result);
         }
+
+        return SUCCESS;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/SleepCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/SleepCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/SleepCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/SleepCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,11 +19,9 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.commons.cli.CommandLine;
-
+import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.Command;
 import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.command.CommandException;
 
 /**
  * Sleep... zzzZ
@@ -33,7 +31,8 @@
 public class SleepCommand
     extends CommandSupport
 {
-    private long time = -1;
+    @Argument(description="Time in milliseconds", required=true)
+    private int time = -1;
 
     public SleepCommand() {
         super("sleep");
@@ -43,24 +42,7 @@
         return super.getUsage() + " <milliseconds>";
     }
 
-    protected boolean processCommandLine(final CommandLine line) throws CommandException
{
-        assert line != null;
-
-        String[] args = line.getArgs();
-
-        if (args.length != 1) {
-            return true;
-        }
-        else {
-            time = Long.parseLong(args[0]);
-        }
-
-        return false;
-    }
-
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
-
+    protected Object doExecute() throws Exception {
         log.info("Sleeping for " + time);
 
         try {

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/WaitCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/WaitCommand.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/WaitCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/WaitCommand.java
Tue Aug 28 20:05:46 2007
@@ -19,8 +19,8 @@
 
 package org.apache.geronimo.gshell.commands.standard;
 
-import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandSupport;
 
 //
 // HACK: This is a temporary to handle shells which need to keep around after running
@@ -39,9 +39,7 @@
         super("wait");
     }
 
-    protected Object doExecute(final Object[] args) throws Exception {
-        assert args != null;
-
+    protected Object doExecute() throws Exception {
         log.info("Waiting...");
 
         synchronized (this) {

Copied: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
(from r570606, geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package.html)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java?p2=geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java&p1=geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package.html&r1=570606&r2=570622&rev=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package.html
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
Tue Aug 28 20:05:46 2007
@@ -1,32 +1,25 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
+/*
+ * 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.
+ */
 
-<!--
-    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$ $Date$ -->
-
-</head>
-<body bgcolor="white">
-
-Provides standard commands, which add useful functionality.
-
-</body>
-</html>
\ No newline at end of file
+/**
+ * Provides standard commands, which add useful functionality.
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.geronimo.gshell.cli;

Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/PumpStreamHandler.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/PumpStreamHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/PumpStreamHandler.java
Tue Aug 28 20:05:46 2007
@@ -19,13 +19,13 @@
 
 package org.apache.geronimo.gshell.commands.standard.util;
 
-import org.apache.geronimo.gshell.console.IO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+
+import org.apache.geronimo.gshell.console.IO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 //
 // Based on Apache Ant 1.6.5

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/StreamPumper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/StreamPumper.java?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/StreamPumper.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-standard-commands/src/main/java/org/apache/geronimo/gshell/commands/standard/util/StreamPumper.java
Tue Aug 28 20:05:46 2007
@@ -19,12 +19,12 @@
 
 package org.apache.geronimo.gshell.commands.standard.util;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 //
 // Based on Apache Ant 1.6.5

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs-commands/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs-commands/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs-commands/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/gshell-vfs-commands/pom.xml Tue Aug 28 20:05:46
2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell-commands</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-vfs-commands</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-commands/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-commands/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-commands/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-commands/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-commands</artifactId>
@@ -45,8 +44,10 @@
     
     <modules>
         <module>gshell-standard-commands</module>
+        <!--
         <module>gshell-scripting-commands</module>
         <module>gshell-vfs-commands</module>
+        -->
     </modules>
     
 </project>

Modified: geronimo/sandbox/gshell/trunk/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-core</artifactId>

Modified: geronimo/sandbox/gshell/trunk/gshell-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-testsuite/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-testsuite/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-testsuite/pom.xml Tue Aug 28 20:05:46 2007
@@ -28,7 +28,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>gshell-testsuite</artifactId>

Modified: geronimo/sandbox/gshell/trunk/javacc-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/javacc-maven-plugin/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/javacc-maven-plugin/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/javacc-maven-plugin/pom.xml Tue Aug 28 20:05:46 2007
@@ -26,7 +26,6 @@
         <groupId>org.apache.geronimo.gshell</groupId>
         <artifactId>gshell</artifactId>
         <version>1.0-alpha-1-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
     </parent>
     
     <artifactId>javacc-maven-plugin</artifactId>

Modified: geronimo/sandbox/gshell/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/pom.xml?rev=570622&r1=570621&r2=570622&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/pom.xml Tue Aug 28 20:05:46 2007
@@ -269,8 +269,8 @@
         <module>gshell-api</module>
         <module>gshell-core</module>
         <module>gshell-cli</module>
-        <!--
         <module>gshell-commands</module>
+        <!--
         <module>gshell-testsuite</module>
         -->
         <module>gshell-assembly</module>



Mime
View raw message