geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r695376 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/built...
Date Mon, 15 Sep 2008 08:17:59 GMT
Author: jdillon
Date: Mon Sep 15 01:17:59 2008
New Revision: 695376

URL: http://svn.apache.org/viewvc?rev=695376&view=rev
Log:
Make Shell expose a CommandLineExecutor instead of being one
Expose the Shell's IO
Dropped qualifer muck needed to get around Shell/CommandLineExecutor lookup problem

Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/Shell.java
    geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/Shell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/Shell.java?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/Shell.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/Shell.java
Mon Sep 15 01:17:59 2008
@@ -21,6 +21,7 @@
 
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
+import org.apache.geronimo.gshell.io.IO;
 
 /**
  * Provides access to execute commands.
@@ -28,11 +29,12 @@
  * @version $Rev$ $Date$
  */
 public interface Shell
-    extends CommandLineExecutor
 {
-    // IO getIo(); ???
-    
+    IO getIo();
+
     Variables getVariables();
+
+    CommandLineExecutor getExecutor();
     
     /**
      * Get the runtime configuration details of the shell.

Modified: geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
(original)
+++ geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Mon Sep 15 01:17:59 2008
@@ -239,13 +239,13 @@
             }
 
             if (commands != null) {
-                gshell.execute(commands);
+                gshell.getExecutor().execute(commands);
             }
             else if (interactive) {
                 gshell.run(_args);
             }
             else {
-                gshell.execute(_args);
+                gshell.getExecutor().execute(_args);
             }
         }
         catch (ExitNotification n) {

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceCommand.java
Mon Sep 15 01:17:59 2008
@@ -27,7 +27,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -48,7 +47,6 @@
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Autowired
-    @Qualifier("default")
     private CommandLineExecutor executor;
 
     @Argument(required=true)

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
Mon Sep 15 01:17:59 2008
@@ -316,8 +316,7 @@
         // Make sure that we have a valid context
         getApplication();
 
-        // Have to use named instance to prevent unique lookup problems due to shell also
being a CommandLineExecutor instance
-        final Shell shell = applicationContainer.getBean("shell", Shell.class);
+        final Shell shell = applicationContainer.getBean(Shell.class);
 
         log.debug("Created shell instance: {}", shell);
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
Mon Sep 15 01:17:59 2008
@@ -77,11 +77,19 @@
     private ErrorHandler errorHandler;
 
     public ShellImpl() {}
-    
+
+    public IO getIo() {
+        return io;
+    }
+
     public Variables getVariables() {
         return variables;
     }
 
+    public CommandLineExecutor getExecutor() {
+        return executor;
+    }
+
     public ShellInfo getInfo() {
         return shellInfo;
     }
@@ -112,26 +120,6 @@
             }
         }
     }
-    
-    //
-    // Command Execution (all delegates)
-    //
-
-    public Object execute(final String line) throws Exception {
-        return executor.execute(line);
-    }
-
-    public Object execute(final Object... args) throws Exception {
-        return executor.execute((Object[])args);
-    }
-
-    public Object execute(final String path, final Object[] args) throws Exception {
-        return executor.execute(path, args);
-    }
-
-    public Object execute(Object[][] commands) throws Exception {
-        return executor.execute(commands);
-    }
 
     //
     // Interactive Shell
@@ -155,7 +143,7 @@
                 assert line != null;
 
                 try {
-                    Object result = ShellImpl.this.execute(line);
+                    Object result = getExecutor().execute(line);
 
                     lastResultHolder.set(result);
                 }
@@ -195,7 +183,7 @@
 
         // Check if there are args, and run them and then enter interactive
         if (args.length != 0) {
-            execute(args);
+            getExecutor().execute(args);
         }
 
         // And then spin up the console and go for a jog
@@ -340,18 +328,13 @@
     private void loadScript(final File file) throws Exception {
         assert file != null;
 
-        //
-        // FIXME: Don't use 'source 'for right now, the shell spins out of control from plexus
component loading :-(
-        //
-        // execute("source", file.toURI().toURL());
-
         BufferedReader reader = new BufferedReader(new FileReader(file));
 
         try {
             String line;
 
             while ((line = reader.readLine()) != null) {
-                execute(line);
+                getExecutor().execute(line);
             }
         }
         finally {

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml?rev=695376&r1=695375&r2=695376&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml
Mon Sep 15 01:17:59 2008
@@ -35,12 +35,7 @@
 
     <bean id="commandLineBuilder" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineBuilderImpl"/>
 
-    <bean id="commandLineExecutor" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl">
-        <!--
-        FIXME: See how we can refactor CommandLineExecutor and Shell to avoid the need for
this qualifier.
-        -->
-        <qualifier value="default"/>
-    </bean>
+    <bean id="commandLineExecutor" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl"/>
 
     <bean id="history" class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl"/>
 



Mime
View raw message