geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r694177 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/ gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/ gshell-support/gshell-spring/src/main/resources/ gshell-wisd...
Date Thu, 11 Sep 2008 08:34:25 GMT
Author: jdillon
Date: Thu Sep 11 01:34:24 2008
New Revision: 694177

URL: http://svn.apache.org/viewvc?rev=694177&view=rev
Log:
Yatta!  Spring container finally boots up to a prompt

Removed:
    geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/resources/
Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
    geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
    geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/commandline/CommandLine.java
Thu Sep 11 01:34:24 2008
@@ -32,9 +32,11 @@
     /**
      * Execute the command-line.
      *
+     * @param executor  The command-line executor to handle execution of command-line elements.
+     * 
      * @return  The final result of the command-line.
      *
      * @throws Exception    Failed to execute command-line.
      */
-    Object execute() throws Exception;
+    Object execute(CommandLineExecutor executor) throws Exception;
 }

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
Thu Sep 11 01:34:24 2008
@@ -31,6 +31,7 @@
 
 import java.net.URL;
 import java.util.List;
+import java.util.Arrays;
 
 /**
  * Default {@link BeanContainer} implementation.
@@ -104,7 +105,7 @@
             throw new NoSuchBeanDefinitionException(type, "No bean defined for type: " +
type);
         }
         if (names.length > 1) {
-            throw new NoSuchBeanDefinitionException(type, "Duplicate bean defined for type:
" + type);
+            throw new NoSuchBeanDefinitionException(type, "No unique bean defined for type:
" + type + ", found matches: " + Arrays.asList(names));
         }
 
         return getBean(names[0], type);

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
Thu Sep 11 01:34:24 2008
@@ -302,7 +302,8 @@
         // Make sure that we have a valid context
         getContext();
 
-        final Shell shell = applicationContainer.getBean(Shell.class);
+        // 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);
 
         log.debug("Created shell instance: {}", shell);
 

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineBuilderImpl.java
Thu Sep 11 01:34:24 2008
@@ -28,15 +28,10 @@
 import org.apache.geronimo.gshell.parser.ASTCommandLine;
 import org.apache.geronimo.gshell.parser.CommandLineParser;
 import org.apache.geronimo.gshell.parser.ParseException;
-import org.apache.geronimo.gshell.spring.BeanContainer;
-import org.apache.geronimo.gshell.spring.BeanContainerAware;
-import org.apache.geronimo.gshell.wisdom.application.event.ApplicationConfiguredEvent;
 import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
 
 import java.io.Reader;
 import java.io.StringReader;
@@ -47,42 +42,17 @@
  * @version $Rev$ $Date$
  */
 public class CommandLineBuilderImpl
-    implements CommandLineBuilder //, BeanContainerAware, ApplicationListener
+    implements CommandLineBuilder
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Autowired
     private ApplicationManager applicationManager;
 
-    @Autowired
-    private CommandLineExecutor executor;
-
-    // private BeanContainer container;
-
     private final CommandLineParser parser = new CommandLineParser();
 
     public CommandLineBuilderImpl() {}
 
-    /*
-    public void setBeanContainer(final BeanContainer container) {
-        assert container != null;
-
-        this.container = container;
-    }
-
-    //
-    // TODO: See if we can @Autowire this puppy, since it looks like spring can handle the
cirtcular reference?
-    //
-    
-    public void onApplicationEvent(final ApplicationEvent event) {
-        log.debug("Processing application event: {}", event);
-        
-        if (event instanceof ApplicationConfiguredEvent) {
-            executor = container.getBean(CommandLineExecutor.class);
-        }
-    }
-    */
-
     private ASTCommandLine parse(final String input) throws ParseException {
         assert input != null;
 
@@ -113,14 +83,15 @@
 
         try {
             assert applicationManager != null;
-            Variables vars = applicationManager.getContext().getVariables();
-
-            assert executor != null;
-            final ExecutingVisitor visitor = new ExecutingVisitor(executor, vars);
+            final Variables vars = applicationManager.getContext().getVariables();
             final ASTCommandLine root = parse(commandLine);
 
             return new CommandLine() {
-                public Object execute() throws Exception {
+                public Object execute(final CommandLineExecutor executor) throws Exception
{
+                    assert executor != null;
+
+                    ExecutingVisitor visitor = new ExecutingVisitor(executor, vars);
+
                     return root.jjtAccept(visitor, null);
                 }
             };

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
Thu Sep 11 01:34:24 2008
@@ -75,9 +75,9 @@
         log.info("Executing (String): {}", line);
 
         try {
-            CommandLine cl = commandLineBuilder.create(line);
+            CommandLine commandLine = commandLineBuilder.create(line);
 
-            return cl.execute();
+            return commandLine.execute(this);
         }
         catch (ErrorNotification n) {
             // Decode the error notifiation

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
Thu Sep 11 01:34:24 2008
@@ -48,7 +48,7 @@
     public HistoryImpl() {}
 
     public void onApplicationEvent(final ApplicationEvent event) {
-        log.debug("Processing application event: {}", event);
+        assert event != null;
 
         if (event instanceof ApplicationConfiguredEvent) {
             assert applicationManager != null;

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
Thu Sep 11 01:34:24 2008
@@ -94,9 +94,8 @@
         return true;
     }
 
-
     public void onApplicationEvent(final ApplicationEvent event) {
-        log.debug("Processing application event: {}", event);
+        assert event != null;
 
         if (event instanceof ApplicationConfiguredEvent) {
             assert applicationManager != null;
@@ -145,7 +144,6 @@
 
         log.debug("Starting interactive console; args: {}", args);
 
-
         assert branding != null;
         loadUserScript(branding.getInteractiveScriptName());
 

Modified: geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml?rev=694177&r1=694176&r2=694177&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/src/main/resources/META-INF/spring/components.xml
Thu Sep 11 01:34:24 2008
@@ -55,8 +55,6 @@
 
     <bean id="shellInfo" class="org.apache.geronimo.gshell.wisdom.shell.ShellInfoImpl"/>
 
-    <!--
-    <bean id="shell" class="org.apache.geronimo.gshell.wisdom.shell.ShellImpl" lazy-init="true"/>
-    -->
+    <bean id="shell" class="org.apache.geronimo.gshell.wisdom.shell.ShellImpl"/>
 
 </beans>
\ No newline at end of file



Mime
View raw message