geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r574492 - in /geronimo/sandbox/gshell/trunk: gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/ gshell-cli/src/main/resources/META-INF/plexus/ gshell-core/src/main/java/org/apache/geronimo/gshell/ gshell-core/src/main/java...
Date Tue, 11 Sep 2007 07:08:58 GMT
Author: jdillon
Date: Tue Sep 11 00:08:57 2007
New Revision: 574492

URL: http://svn.apache.org/viewvc?rev=574492&view=rev
Log:
Clean up

Modified:
    geronimo/sandbox/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java
    geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
    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/ShellSecurityManager.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
    geronimo/sandbox/gshell/trunk/gshell-parser/src/main/grammar/CommandLineParser.jjt

Modified: geronimo/sandbox/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java
Tue Sep 11 00:08:57 2007
@@ -39,15 +39,12 @@
         assert args != null;
 
         //
-        // FIXME: Maybe want to add some kinda of support to allow these "gshell.*" bits
to be named for custom branding?
+        // NOTE: Branding information is not available here, so we must use the basic GShell
properties to configure
+        //       the bootstrap loader.
         //
         
         programName = getProgramName();
         setProperty("program.name", programName);
-
-        //
-        // TODO: Use the Flavor to figure out what the property name to set is here... ?????
-        //
         
         homeDir = getHomeDir();
         setProperty("gshell.home", homeDir.getCanonicalPath());

Modified: geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-cli/src/main/resources/META-INF/plexus/plexus.xml
Tue Sep 11 00:08:57 2007
@@ -68,26 +68,11 @@
             <role-hint>default</role-hint>
             <implementation>org.apache.geronimo.gshell.plugin.PluginCollector</implementation>
         </component>
-
+        
         <!--
-        Hook up the branding to use.
-        -->
-        <component>
-            <role>org.apache.geronimo.gshell.branding.Branding</role>
-            <role-hint>default</role-hint>
-            <implementation>org.apache.geronimo.gshell.branding.DefaultBranding</implementation>
-            <requirements>
-                <requirement>
-                    <role>org.apache.geronimo.gshell.branding.VersionLoader</role>
-                </requirement>
-                <requirement>
-                    <role>jline.Terminal</role>
-                </requirement>
-            </requirements>
-        </component>
+        Add our instance lookup components
 
-        <!--
-        Add our instance lookup components.
+        TODO: Once the @Component anno supports component-factory we can drop these.
         -->
 
         <component>

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
Tue Sep 11 00:08:57 2007
@@ -35,24 +35,20 @@
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * ???
+ * The default command executor.
  *
  * @version $Rev$ $Date$
  */
 @Component(role=CommandExecutor.class, hint="default")
 public class DefaultCommandExecutor
-    implements CommandExecutor, Initializable
+    implements CommandExecutor
 {
     private Logger log = LoggerFactory.getLogger(getClass());
 
-    public DefaultCommandExecutor() {}
-
     @Requirement
     private PlexusContainer container;
 
@@ -62,15 +58,8 @@
     @Requirement
     private CommandLineBuilder commandLineBuilder;
 
-    public void initialize() throws InitializationException {
-        /*
-        assert evaluator != null;
-
-        System.err.println("ENV: " + env);
-        
-        commandLineBuilder = new CommandLineBuilder(this, env, evaluator);
-        */
-    }
+    @Requirement
+    private Environment env;
 
     public Object execute(final String line) throws Exception {
         assert line != null;
@@ -128,15 +117,9 @@
         final PlexusContainer childContainer = container.createChildContainer(realmId, container.getContainerRealm());
         final Command command = (Command)childContainer.lookup(desc.getRole(), desc.getRoleHint());
 
-        //
-        // NOTE: For now, until we can figure out a better way to have the container deal
with this stuff, pass in
-        //       the execution context manually
-        //
-        
-        final Environment env = (Environment) container.lookup(Environment.class);
-
         // Setup the command context and pass it to the command instance
         CommandContext context = new CommandContext() {
+            // Command instances get their own namespace with defaults from the current
             final Variables vars = new VariablesImpl(env.getVariables());
 
             public IO getIO() {

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Tue Sep 11 00:08:57 2007
@@ -27,13 +27,13 @@
 import jline.History;
 import jline.Terminal;
 import org.apache.geronimo.gshell.ansi.Renderer;
+import org.apache.geronimo.gshell.branding.Branding;
 import org.apache.geronimo.gshell.command.CommandExecutor;
 import org.apache.geronimo.gshell.command.IO;
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.console.Console;
 import org.apache.geronimo.gshell.console.JLineConsole;
 import org.apache.geronimo.gshell.console.TerminalInfo;
-import org.apache.geronimo.gshell.branding.Branding;
 import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
@@ -44,7 +44,6 @@
 import org.codehaus.plexus.component.factory.ComponentFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -73,20 +72,14 @@
 
     @Requirement
     private Terminal terminal;
-    
-    @Requirement(role=ComponentFactory.class, hint="EnvironmentLookup")
-    private EnvironmentLookup envLookup;
-    
+
+    @Requirement
     private Environment env;
 
     @Requirement
     private IO io;
 
     public Environment getEnvironment() {
-        if (env == null) {
-            throw new IllegalStateException();
-        }
-
         return env;
     }
 
@@ -96,26 +89,6 @@
 
     public void initialize() throws InitializationException {
         //
-        // FIXME: This is kinda icky IMO...
-        //
-        
-        // Setup our environment instance
-        env = new Environment() {
-            final Variables variables = new VariablesImpl();
-
-            public IO getIO() {
-                return io;
-            }
-
-            public Variables getVariables() {
-                return variables;
-            }
-        };
-
-        // And propagate it to others
-        envLookup.set(env);
-        
-        //
         // FIXME: This won't work as desired, as this shell instance is not yet registered,
so if a profile
         //        tries to run something that needs the shell instance... well, loopsvile.
         //
@@ -302,8 +275,7 @@
         assert file != null;
 
         //
-        // FIXME: Don't use 'source 'for right now, the shell spins out of control
-        //        from plexus component loading :-(
+        // FIXME: Don't use 'source 'for right now, the shell spins out of control from plexus
component loading :-(
         //
         // execute("source", file.toURI().toURL());
 

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=574492&r1=574491&r2=574492&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
Tue Sep 11 00:08:57 2007
@@ -22,7 +22,9 @@
 import java.util.Map;
 
 import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.common.StopWatch;
+import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
@@ -84,15 +86,30 @@
             container = new DefaultPlexusContainer(config);
 
             // We first need to stuff in the IO context for the new shell instance
-            IOLookup lookup = (IOLookup) container.lookup(ComponentFactory.class, IOLookup.class.getSimpleName());
-            lookup.set(io);
+            IOLookup ioLookup = (IOLookup) container.lookup(ComponentFactory.class, IOLookup.class.getSimpleName());
+            ioLookup.set(io);
+
+            // And then lets stuff in the environment too
+            Environment env = new Environment() {
+                final Variables vars = new VariablesImpl();
+
+                public IO getIO() {
+                    return io;
+                }
+
+                public Variables getVariables() {
+                    return vars;
+                }
+            };
+
+            EnvironmentLookup envLookup = (EnvironmentLookup) container.lookup(ComponentFactory.class,
EnvironmentLookup.class.getSimpleName());
+            envLookup.set(env);
+
+            // And then do some setup some default variables
+            env.getVariables().set("env", System.getenv());
 
             // Then look up the shell we are gonna delegate to
             shell = (InteractiveShell) container.lookup(InteractiveShell.class);
-
-            // And then do some setup ski
-            Map<String,String> env = System.getenv();
-            shell.getEnvironment().getVariables().set("env", env);
         }
         finally {
             System.setSecurityManager(psm);

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ShellSecurityManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ShellSecurityManager.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ShellSecurityManager.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ShellSecurityManager.java
Tue Sep 11 00:08:57 2007
@@ -47,6 +47,9 @@
         }
     }
 
+    /**
+     * Always throws {@link SecurityException}.
+     */
     public void checkExit(final int code) {
         throw new SecurityException("Use of System.exit() if forbidden!");
     }

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
Tue Sep 11 00:08:57 2007
@@ -82,18 +82,16 @@
 
     public String getAbout() {
         StringWriter writer = new StringWriter();
-        PrintWriter out = new PrintWriter(writer);
+        PrintWriter out = new RenderWriter(writer);
 
-        out.println("For information about GShell, visit:");
-        out.println("    http://geronimo.apache.org/gshell.html ");
+        out.println("For information about @|cyan GShell|, visit:");
+        out.println("    @|bold http://geronimo.apache.org/gshell.html| ");
         out.flush();
 
         return writer.toString();
     }
 
     public String getVersion() {
-        assert versionLoader != null;
-
         return versionLoader.getVersion();
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
Tue Sep 11 00:08:57 2007
@@ -25,6 +25,7 @@
 import org.apache.geronimo.gshell.layout.loader.LayoutLoader;
 import org.apache.geronimo.gshell.layout.model.Layout;
 import org.apache.geronimo.gshell.plugin.PluginCollector;
+import org.apache.geronimo.gshell.shell.Environment;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -48,6 +49,9 @@
 
     @Requirement
     private LayoutLoader loader;
+
+    @Requirement
+    private Environment env;
     
     private Layout layout;
     
@@ -74,11 +78,6 @@
         assert path != null;
 
         log.debug("Searching for command descriptor for path: {}", path);
-
-        //
-        // TODO: Need the current environment, so we can get the current group (pwd) and
search path, and then
-        //       use that to search the layout tree.
-        //
 
         //
         // HACK: For now, assume the path is just the id... should eventually change this

Modified: geronimo/sandbox/gshell/trunk/gshell-parser/src/main/grammar/CommandLineParser.jjt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-parser/src/main/grammar/CommandLineParser.jjt?rev=574492&r1=574491&r2=574492&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-parser/src/main/grammar/CommandLineParser.jjt (original)
+++ geronimo/sandbox/gshell/trunk/gshell-parser/src/main/grammar/CommandLineParser.jjt Tue
Sep 11 00:08:57 2007
@@ -27,6 +27,10 @@
     NODE_EXTENDS = "NodeSupport";
 }
 
+//
+// TODO: Look at including bits from the Jexl parser here
+//
+
 ///////////////////////////////////////////////////////////////////////////////
 
 PARSER_BEGIN(CommandLineParser)



Mime
View raw message