geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r699733 - in /geronimo/gshell/trunk: gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/ gshell-support/gshell-console/src/main/java...
Date Sat, 27 Sep 2008 20:55:23 GMT
Author: jdillon
Date: Sat Sep 27 13:55:23 2008
New Revision: 699733

URL: http://svn.apache.org/viewvc?rev=699733&view=rev
Log:
Rename MuxCompleter -> AggregateCompleter
Added ConfigurationCommandCompleter to allow spring to be used to wire up the needed order
of completers
Added completion for commands: unalias, source, help
Dropped prototype for command/alias related completers, they are event driven and no need
to create more of these

Added:
    geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
  (contents, props changed)
      - copied, changed from r699716, geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/MuxCompleter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
  (contents, props changed)
      - copied, changed from r699716, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/NullCommandCompleter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
  (contents, props changed)
      - copied, changed from r699716, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasesCompleter.java
Removed:
    geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/MuxCompleter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasesCompleter.java
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/UnaliasAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
    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/java/org/apache/geronimo/gshell/wisdom/shell/completer/CommandsCompleter.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/resources/META-INF/spring/components.xml

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.java?rev=699733&r1=699732&r2=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.java
Sat Sep 27 13:55:23 2008
@@ -24,8 +24,8 @@
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
-import org.apache.geronimo.gshell.shell.ShellContext;
 import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.shell.ShellContext;
 import org.codehaus.plexus.util.IOUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/UnaliasAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/UnaliasAction.java?rev=699733&r1=699732&r2=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/UnaliasAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/UnaliasAction.java
Sat Sep 27 13:55:23 2008
@@ -19,21 +19,15 @@
 
 package org.apache.geronimo.gshell.commands.builtins;
 
+import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.CommandAction;
 import org.apache.geronimo.gshell.command.CommandContext;
-import org.apache.geronimo.gshell.command.CommandCompleter;
-import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.registry.AliasRegistry;
 import org.apache.geronimo.gshell.registry.NoSuchAliasException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import jline.Completor;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
 
 /**
  * Undefine an alias.
@@ -68,22 +62,4 @@
             return Result.FAILURE;
         }
     }
-
-    public static class Completer
-        implements CommandCompleter
-    {
-        // TODO: The AliasesCompleter class is not in scope, so have to inject it manually
me thinks, or use qualifiers?
-        // @Autowired
-        // private AliasesCompleter aliasesCompleter;
-
-        public Collection<Completor> createCompletors() {
-            List<Completor> completers = new ArrayList<Completor>(2);
-
-            // TODO: Hook up a *wired* AliasesCompleter instance
-            // completers.add(aliasesCompleter)
-            completers.add(null);
-
-            return completers;
-        }
-    }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml?rev=699733&r1=699732&r2=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/resources/META-INF/spring/components.xml
Sat Sep 27 13:55:23 2008
@@ -35,6 +35,21 @@
 
             <gshell:command name="help">
                 <gshell:action class="org.apache.geronimo.gshell.commands.builtins.HelpAction"/>
+                <gshell:completer class="org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter">
+                    <property name="completers">
+                        <list>
+                            <bean class="org.apache.geronimo.gshell.console.completer.AggregateCompleter">
+                                <constructor-arg>
+                                    <list>
+                                        <ref bean="aliasNameCompleter"/>
+                                        <ref bean="commandNameCompleter"/>
+                                    </list>
+                                </constructor-arg>
+                            </bean>
+                            <null/>
+                        </list>
+                    </property>
+                </gshell:completer>
             </gshell:command>
 
             <gshell:command name="exit">
@@ -55,6 +70,14 @@
 
             <gshell:command name="source">
                 <gshell:action class="org.apache.geronimo.gshell.commands.builtins.SourceAction"/>
+                <gshell:completer class="org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter">
+                    <property name="completers">
+                        <list>
+                            <bean class="jline.FileNameCompletor"/>
+                            <null/>
+                        </list>
+                    </property>
+                </gshell:completer>
             </gshell:command>
 
             <gshell:alias name="." alias="source"/>
@@ -73,10 +96,14 @@
 
             <gshell:command name="unalias">
                 <gshell:action class="org.apache.geronimo.gshell.commands.builtins.UnaliasAction"/>
-                <!--
-                FIXME: Need to resolve some binding issues...
-                <gshell:completer class="org.apache.geronimo.gshell.commands.builtins.UnaliasAction$Completer"/>
-                -->
+                <gshell:completer class="org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter">
+                    <property name="completers">
+                        <list>
+                            <ref bean="aliasNameCompleter"/>
+                            <null/>
+                        </list>
+                    </property>
+                </gshell:completer>
             </gshell:command>
             
             <gshell:command name="history">

Copied: geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
(from r699716, geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/MuxCompleter.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java?p2=geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java&p1=geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/MuxCompleter.java&r1=699716&r2=699733&rev=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/MuxCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
Sat Sep 27 13:55:23 2008
@@ -31,14 +31,14 @@
  *
  * @version $Rev$ $Date$
  */
-public class MuxCompleter
+public class AggregateCompleter
     implements Completor
 {
     private final List<Completor> completers = new ArrayList<Completor>();
 
-    public MuxCompleter() {}
+    public AggregateCompleter() {}
 
-    public MuxCompleter(final Collection<Completor> completers) {
+    public AggregateCompleter(final Collection<Completor> completers) {
         assert completers != null;
 
         getCompleters().addAll(completers);

Propchange: geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-console/src/main/java/org/apache/geronimo/gshell/console/completer/AggregateCompleter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
(from r699716, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/NullCommandCompleter.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/NullCommandCompleter.java&r1=699716&r2=699733&rev=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/NullCommandCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
Sat Sep 27 13:55:23 2008
@@ -23,16 +23,33 @@
 import org.apache.geronimo.gshell.command.CommandCompleter;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
- * A <em>null</em> {@link CommandCompleter}.
+ * A configurable command completer.
  *
  * @version $Rev$ $Date$
  */
-public class NullCommandCompleter
+public class ConfigurableCommandCompleter
     implements CommandCompleter
 {
+    private List<Completor> completers;
+
+    public ConfigurableCommandCompleter() {}
+    
+    public ConfigurableCommandCompleter(final List<Completor> completers) {
+        setCompleters(completers);
+    }
+
+    public List<Completor> getCompleters() {
+        return completers;
+    }
+
+    public void setCompleters(final List<Completor> completers) {
+        this.completers = completers;
+    }
+
     public Collection<Completor> createCompletors() {
-        return null;
+        return getCompleters();
     }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/ConfigurableCommandCompleter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=699733&r1=699732&r2=699733&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
Sat Sep 27 13:55:23 2008
@@ -30,7 +30,7 @@
 import org.apache.geronimo.gshell.console.Console.ErrorHandler;
 import org.apache.geronimo.gshell.console.Console.Prompter;
 import org.apache.geronimo.gshell.console.JLineConsole;
-import org.apache.geronimo.gshell.console.completer.MuxCompleter;
+import org.apache.geronimo.gshell.console.completer.AggregateCompleter;
 import org.apache.geronimo.gshell.event.Event;
 import org.apache.geronimo.gshell.event.EventListener;
 import org.apache.geronimo.gshell.event.EventManager;
@@ -201,8 +201,8 @@
 
         // Attach completers if there are any
         if (completers != null) {
-            // Have to use mux here to get the completion list to update properly
-            console.addCompleter(new MuxCompleter(completers));
+            // Have to use aggregate here to get the completion list to update properly
+            console.addCompleter(new AggregateCompleter(completers));
         }
 
         // Unless the user wants us to shut up, then display a nice welcome banner

Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
(from r699716, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasesCompleter.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasesCompleter.java&r1=699716&r2=699733&rev=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasesCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
Sat Sep 27 13:55:23 2008
@@ -41,7 +41,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class AliasesCompleter
+public class AliasNameCompleter
     implements Completor
 {
     private final Logger log = LoggerFactory.getLogger(getClass());

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/AliasNameCompleter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/CommandsCompleter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/CommandsCompleter.java?rev=699733&r1=699732&r2=699733&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/CommandsCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/completer/CommandsCompleter.java
Sat Sep 27 13:55:23 2008
@@ -23,7 +23,7 @@
 import jline.Completor;
 import jline.NullCompletor;
 import org.apache.geronimo.gshell.command.Command;
-import org.apache.geronimo.gshell.console.completer.MuxCompleter;
+import org.apache.geronimo.gshell.console.completer.AggregateCompleter;
 import org.apache.geronimo.gshell.console.completer.StringsCompleter;
 import org.apache.geronimo.gshell.event.Event;
 import org.apache.geronimo.gshell.event.EventListener;
@@ -60,7 +60,7 @@
 
     private final Map<String,Completor> completors = new HashMap<String,Completor>();
 
-    private final MuxCompleter delegate = new MuxCompleter();
+    private final AggregateCompleter delegate = new AggregateCompleter();
 
     @PostConstruct
     public void init() throws Exception {

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=699733&r1=699732&r2=699733&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
Sat Sep 27 13:55:23 2008
@@ -41,17 +41,17 @@
 
     <bean id="shellInfo" class="org.apache.geronimo.gshell.wisdom.shell.ShellInfoImpl"/>
 
-    <bean id="commandNameCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.CommandNameCompleter"
scope="prototype"/>
+    <bean id="commandNameCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.CommandNameCompleter"/>
 
-    <bean id="commandsCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.CommandsCompleter"
scope="prototype"/>
+    <bean id="aliasNameCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.AliasNameCompleter"/>
 
-    <bean id="aliasesCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.AliasesCompleter"
scope="prototype"/>
+    <bean id="commandsCompleter" class="org.apache.geronimo.gshell.wisdom.shell.completer.CommandsCompleter"/>
 
     <bean id="shell" class="org.apache.geronimo.gshell.wisdom.shell.ShellImpl">
         <property name="completers">
             <list>
                 <ref bean="commandsCompleter"/>
-                <ref bean="aliasesCompleter"/>
+                <ref bean="aliasNameCompleter"/>
             </list>
         </property>
     </bean>



Mime
View raw message