geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r410879 - in /geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell: GShell.java command/CommandManager.java
Date Thu, 01 Jun 2006 16:13:35 GMT
Author: jdillon
Date: Thu Jun  1 09:13:32 2006
New Revision: 410879

URL: http://svn.apache.org/viewvc?rev=410879&view=rev
Log:
Shell variables as they should be

Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandManager.java

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java?rev=410879&r1=410878&r2=410879&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/GShell.java
Thu Jun  1 09:13:32 2006
@@ -45,6 +45,8 @@
 
     private final CommandManager commandManager;
 
+    private final Variables vars = new VariablesMap();
+
     public GShell(final IO io) throws CommandException {
         if (io == null) {
             throw new IllegalArgumentException("IO is null");
@@ -63,6 +65,14 @@
         this(new IO());
     }
 
+    public Variables getVariables() {
+        return vars;
+    }
+
+    public IO getIO() {
+        return io;
+    }
+
     public int execute(final String commandLine) throws Exception {
         assert commandLine != null;
 
@@ -72,6 +82,10 @@
         // HACK: Just to get something to work...
         //
 
+        //
+        // TODO: Move builder to field
+        //
+
         CommandLineBuilder builder = new CommandLineBuilder(this);
         CommandLine cl = builder.create(commandLine);
         cl.execute();
@@ -84,7 +98,11 @@
         return 0;
     }
 
-    public int execute(final String commandName, String[] args) throws Exception {
+    //
+    // CommandExecutor
+    //
+
+    public int execute(final String commandName, final String[] args) throws Exception {
         assert commandName != null;
         assert args != null;
 
@@ -93,13 +111,19 @@
         log.info("Executing (" + commandName + "): " + Arguments.asString(args));
 
         //
-        // HACK: Just get something working right now
+        // TODO: Insert CommandContainer bits here
         //
 
         Command cmd = commandManager.getCommand(commandName);
 
+        //
+        // TODO: DI all bits if we can, then free up "context" to replace "category" as a
term
+        //
+
+        final Variables parent = getVariables();
+
         cmd.init(new CommandContext() {
-            Variables vars = new VariablesMap();
+            final Variables vars = new VariablesMap(parent);
 
             public IO getIO() {
                 return io;

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandManager.java?rev=410879&r1=410878&r2=410879&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandManager.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/command/CommandManager.java
Thu Jun  1 09:13:32 2006
@@ -28,7 +28,7 @@
 import java.util.Collections;
 
 /**
- * ???
+ * Manager of command definitions and provides access to command instances.
  *
  * @version $Id$
  */
@@ -80,6 +80,12 @@
             throw new IllegalArgumentException("Name is empty");
         }
 
+        //
+        // TODO: Issue warning if there is whitespace, that is a programming error (for someone)
+        //       Investigate auto-trim and complain from the parser too, looks like we are
catching
+        //       non-traditional whitespace (ctrl chars, etc).
+        //
+
         // Make sure there is not funky whitespace in there (from Telnet or something)
         name = name.trim();
 
@@ -95,6 +101,10 @@
         // name checked by getCommandDefinition()
 
         CommandDefinition def = getCommandDefinition(name);
+
+        //
+        // TODO: This might change if we DI the class and let the container create
+        //
 
         Command cmd;
         try {



Mime
View raw message