You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/06/09 19:55:43 UTC

svn commit: r665804 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/command/ gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/ gshell-core/src/main/java/org/apache/geronimo/gshell/...

Author: jdillon
Date: Mon Jun  9 10:55:43 2008
New Revision: 665804

URL: http://svn.apache.org/viewvc?rev=665804&view=rev
Log:
More baby steps to getting rid of CommandSupport

Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandExecutor.java
    geronimo/gshell/trunk/gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/CommandSupport.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/container/DefaultCommandContainer.java

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java?rev=665804&r1=665803&r2=665804&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java (original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandContainer.java Mon Jun  9 10:55:43 2008
@@ -19,8 +19,6 @@
 
 package org.apache.geronimo.gshell.command;
 
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
 /**
  * ???
  * 
@@ -28,13 +26,13 @@
  */
 public interface CommandContainer
 {
-    String getId();
-
-    String getDescription();
-
     Executable getExecutable();
     
     // TODO: Change to ShellContext, let the container build its own CommandContext
 
     Object execute(CommandContext context, Object... args) throws Exception;
+
+    // TODO: Completor
+
+    // TODO: Documentor (for --help and `help <command>`) handling
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandExecutor.java?rev=665804&r1=665803&r2=665804&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandExecutor.java (original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandExecutor.java Mon Jun  9 10:55:43 2008
@@ -26,6 +26,10 @@
  */
 public interface CommandExecutor
 {
+    //
+    // TODO: This is starting to look like it needs a CommandExecutionRequest and CommandExecutionResult object
+    //
+    
     Object execute(String line) throws Exception;
 
     Object execute(String command, final Object[] args) throws Exception;

Modified: geronimo/gshell/trunk/gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/CommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/CommandSupport.java?rev=665804&r1=665803&r2=665804&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/CommandSupport.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-command-support/src/main/java/org/apache/geronimo/gshell/command/CommandSupport.java Mon Jun  9 10:55:43 2008
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.command;
 
-import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.io.IO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,43 +29,22 @@
  * @version $Rev$ $Date$
  */
 public abstract class CommandSupport
-    implements Command
+    implements Executable
 {
     protected Logger log = LoggerFactory.getLogger(getClass());
 
-    protected CommandContext context;
-
     protected IO io;
 
     protected Variables variables;
 
-    @Deprecated
-    public String getId() {
-        CommandComponent cmd = getClass().getAnnotation(CommandComponent.class);
-        if (cmd == null) {
-            throw new IllegalStateException("Command id not found");
-        }
-        return cmd.id();
-    }
-
-    @Deprecated
-    public String getDescription() {
-        CommandComponent cmd = getClass().getAnnotation(CommandComponent.class);
-        if (cmd == null) {
-            throw new IllegalStateException("Command description not found");
-        }
-        return cmd.description();
-    }
-
     public void init(final CommandContext context) {
         assert context != null;
 
-        this.context = context;
         this.io = context.getIO();
         this.variables = context.getVariables();
 
         // Re-setup logging using our id
-        String id = getId();
+        String id = context.getInfo().getId();
         log = LoggerFactory.getLogger(getClass().getName() + "." + id);
     }
 

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/container/DefaultCommandContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/container/DefaultCommandContainer.java?rev=665804&r1=665803&r2=665804&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/container/DefaultCommandContainer.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/container/DefaultCommandContainer.java Mon Jun  9 10:55:43 2008
@@ -69,16 +69,6 @@
 
     // CommandContainer
 
-    public String getId() {
-        return commandId;
-    }
-
-    public String getDescription() {
-        assert container != null;
-        
-        return container.getComponentDescriptor(CommandContainer.class.getName(), commandId).getDescription();
-    }
-
     public Executable getExecutable() {
         assert container != null;