geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r659766 - in /geronimo/gshell/trunk: gshell-cli/src/main/resources/ gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins...
Date Sat, 24 May 2008 08:12:38 GMT
Author: jdillon
Date: Sat May 24 01:12:36 2008
New Revision: 659766

URL: http://svn.apache.org/viewvc?rev=659766&view=rev
Log:
(GSHELL-116) Dropped the need for IOLookup, EnvironmentLookup and TerminalFactory bits, will
have some affect on the rsh stuff, which I'll fix up later

Removed:
    geronimo/gshell/trunk/gshell-cli/src/main/resources/
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalInfo.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ScriptCommand.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
    geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/DefaultRemoteShell.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PromptReader.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ScriptCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ScriptCommand.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ScriptCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-bsf/src/main/java/org/apache/geronimo/gshell/commands/bsf/ScriptCommand.java
Sat May 24 01:12:36 2008
@@ -19,12 +19,6 @@
 
 package org.apache.geronimo.gshell.commands.bsf;
 
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import jline.Terminal;
 import org.apache.bsf.BSFEngine;
 import org.apache.bsf.BSFManager;
 import org.apache.geronimo.gshell.clp.Argument;
@@ -32,10 +26,14 @@
 import org.apache.geronimo.gshell.command.CommandException;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.command.annotation.Requirement;
 import org.apache.geronimo.gshell.console.Console;
 import org.apache.geronimo.gshell.console.JLineConsole;
 
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
 /**
  * Provides generic scripting language integration via <a href="http://http://jakarta.apache.org/bsf">BSF</a>.
  *
@@ -45,9 +43,6 @@
 public class ScriptCommand
     extends CommandSupport
 {
-    @Requirement
-    private Terminal terminal;
-
     private String language;
 
     @Option(name="-l", aliases={"--language"}, description="Specify the scripting language")
@@ -136,7 +131,7 @@
                 }
             };
 
-            JLineConsole runner = new JLineConsole(executor, io, terminal);
+            JLineConsole runner = new JLineConsole(executor, io);
 
             runner.setErrorHandler(new Console.ErrorHandler() {
                 public Result handleError(final Throwable error) {

Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ClearCommand.java
Sat May 24 01:12:36 2008
@@ -19,16 +19,12 @@
 
 package org.apache.geronimo.gshell.commands.builtins;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-
 import jline.ConsoleReader;
-import jline.Terminal;
-
+import org.apache.geronimo.gshell.ansi.ANSI;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.command.annotation.Requirement;
-import org.apache.geronimo.gshell.ansi.ANSI;
+
+import java.io.PrintWriter;
 
 /**
  * Clear the terminal screen.
@@ -39,11 +35,8 @@
 public class ClearCommand
     extends CommandSupport
 {
-    @Requirement
-    private Terminal terminal;
-    
     protected Object doExecute() throws Exception {
-        ConsoleReader reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream,
true), /*bindings*/ null, terminal);
+        ConsoleReader reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream,
true), /*bindings*/ null, io.getTerminal());
         
         if (!ANSI.isEnabled()) {
         	io.out.println("ANSI is not enabled.  The clear command is not functional");

Modified: geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-repository/src/main/java/org/apache/geronimo/gshell/commands/repository/ResolveCommand.java
Sat May 24 01:12:36 2008
@@ -70,6 +70,14 @@
 
         ArtifactResolutionRequest request = new ArtifactResolutionRequest();
 
+        //
+        // TODO: Add support for --transitive
+        //
+
+        //
+        // TODO: Update the AM API to use this as originating when artifact == null and artifact
dependencies != null
+        //
+        
         Artifact originating = factory.createArtifact("dummy", "dummy", "dummy", null, "jar");
         request.setArtifact(originating);
 

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
Sat May 24 01:12:36 2008
@@ -35,9 +35,12 @@
 import org.apache.geronimo.gshell.registry.CommandRegistry;
 import org.apache.geronimo.gshell.registry.NotRegisteredException;
 import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.util.IOUtil;
+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;
 
@@ -56,9 +59,12 @@
  */
 @Component(role=CommandExecutor.class, hint="default")
 public class DefaultCommandExecutor
-    implements CommandExecutor
+    implements CommandExecutor, Initializable
 {
-    private Logger log = LoggerFactory.getLogger(getClass());
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Requirement
+    private ApplicationManager applicationManager;
 
     @Requirement
     private LayoutManager layoutManager;
@@ -69,19 +75,26 @@
     @Requirement
     private CommandLineBuilder commandLineBuilder;
 
-    @Requirement
     private Environment env;
 
     public DefaultCommandExecutor() {}
     
-    public DefaultCommandExecutor(final LayoutManager layoutManager,
-                                  final CommandRegistry commandRegistry,
-                                  final CommandLineBuilder commandLineBuilder,
-                                  final Environment env) {
+    public DefaultCommandExecutor(final ApplicationManager applicationManager, final LayoutManager
layoutManager, final CommandRegistry commandRegistry, final CommandLineBuilder commandLineBuilder)
{
+        assert applicationManager != null;
+        assert layoutManager != null;
+        assert commandRegistry != null;
+        assert commandLineBuilder != null;
+
+        this.applicationManager = applicationManager;
         this.layoutManager = layoutManager;
         this.commandRegistry = commandRegistry;
         this.commandLineBuilder = commandLineBuilder;
-        this.env = env;
+    }
+
+    public void initialize() throws InitializationException {
+        assert applicationManager != null;
+        
+        this.env = applicationManager.getContext().getEnvironment();
     }
 
     public Object execute(final String line) throws Exception {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandLineBuilder.java
Sat May 24 01:12:36 2008
@@ -19,6 +19,7 @@
 
 package org.apache.geronimo.gshell;
 
+import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.apache.geronimo.gshell.command.CommandExecutor;
 import org.apache.geronimo.gshell.logging.LoggingVisitor;
 import org.apache.geronimo.gshell.parser.ASTCommandLine;
@@ -41,19 +42,27 @@
  * @version $Rev$ $Date$
  */
 @Component(role=CommandLineBuilder.class)
-public class DefaultCommandLineBuilder implements CommandLineBuilder
+public class DefaultCommandLineBuilder
+    implements CommandLineBuilder
 {
-    private Logger log = LoggerFactory.getLogger(getClass());
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
     private PlexusContainer container;
 
-    private CommandLineParser parser = new CommandLineParser();
+    @Requirement
+    private ApplicationManager applicationManager;
+
+    private final CommandLineParser parser = new CommandLineParser();
 
     public DefaultCommandLineBuilder() {}
     
-    public DefaultCommandLineBuilder(final PlexusContainer container) {
+    public DefaultCommandLineBuilder(final PlexusContainer container, final ApplicationManager
applicationManager) {
+        assert container != null;
+        assert applicationManager != null;
+
         this.container = container;
+        this.applicationManager = applicationManager;
     }
 
     private ASTCommandLine parse(final String input) throws ParseException {
@@ -85,8 +94,11 @@
         }
 
         try {
+            assert container != null;
             CommandExecutor executor = (CommandExecutor) container.lookup(CommandExecutor.class);
-            Environment env = (Environment) container.lookup(Environment.class);
+
+            assert applicationManager != null;
+            Environment env = applicationManager.getContext().getEnvironment();
 
             final ExecutingVisitor visitor = new ExecutingVisitor(executor, env);
             final ASTCommandLine root = parse(commandLine);

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Sat May 24 01:12:36 2008
@@ -20,8 +20,9 @@
 package org.apache.geronimo.gshell;
 
 import jline.History;
-import jline.Terminal;
 import org.apache.geronimo.gshell.ansi.Renderer;
+import org.apache.geronimo.gshell.application.ApplicationContext;
+import org.apache.geronimo.gshell.application.ApplicationManager;
 import org.apache.geronimo.gshell.branding.Branding;
 import org.apache.geronimo.gshell.command.CommandExecutor;
 import org.apache.geronimo.gshell.console.Console;
@@ -29,7 +30,6 @@
 import org.apache.geronimo.gshell.console.Console.Prompter;
 import org.apache.geronimo.gshell.console.FileHistory;
 import org.apache.geronimo.gshell.console.JLineConsole;
-import org.apache.geronimo.gshell.console.TerminalInfo;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.InteractiveShell;
@@ -60,6 +60,9 @@
     private Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
+    private ApplicationManager applicationManager;
+
+    @Requirement
     private ShellInfo shellInfo;
 
     @Requirement
@@ -69,33 +72,29 @@
     private CommandExecutor executor;
 
     @Requirement
-    private TerminalInfo termInfo;
-
-    @Requirement
-    private Terminal terminal;
+    private History history;
 
-    @Requirement
     private Environment env;
 
-    @Requirement
     private IO io;
 
-    @Requirement
-    private History history;
-
-	private Prompter prompter;
+    private Prompter prompter;
 
     private ErrorHandler errorHandler;
 
     public DefaultShell() {}
     
-    public DefaultShell(final ShellInfo shellInfo, final Branding branding, final CommandExecutor
executor, final Terminal terminal, final Environment env, final IO io, final History history)
{
+    public DefaultShell(final ApplicationManager applicationManager, final ShellInfo shellInfo,
final Branding branding, final CommandExecutor executor, final History history) {
+        assert applicationManager != null;
+        assert shellInfo != null;
+        assert branding != null;
+        assert executor != null;
+        assert history != null;
+
+        this.applicationManager = applicationManager;
         this.shellInfo = shellInfo;
         this.branding = branding;
         this.executor = executor;
-        this.terminal = terminal;
-        this.env = env;
-        this.io = io;
         this.history = history;
     }
 
@@ -108,6 +107,13 @@
     }
 
     public void initialize() throws InitializationException {
+        assert applicationManager != null;
+        
+        // Get IO/Env from application context
+        ApplicationContext context = applicationManager.getContext();
+        this.io = context.getIo();
+        this.env = context.getEnvironment();
+        
         //
         // 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.
@@ -152,6 +158,7 @@
 
         log.debug("Starting interactive console; args: {}", args);
 
+        assert branding != null;
         loadUserScript(branding.getInteractiveScriptName());
 
         // Setup 2 final refs to allow our executor to pass stuff back to us
@@ -179,7 +186,7 @@
         };
 
         // Ya, bust out the sexy JLine console baby!
-        JLineConsole console = new JLineConsole(executor, io, terminal);
+        JLineConsole console = new JLineConsole(executor, io);
 
         // Setup the prompt
         console.setPrompter(getPrompter());
@@ -230,7 +237,10 @@
     protected Prompter createPrompter() {
         return new Prompter() {
             Renderer renderer = new Renderer();
+            
             public String prompt() {
+                assert shellInfo != null;
+
                 String userName = shellInfo.getUserName();
                 String hostName = shellInfo.getLocalHost().getHostName();
 
@@ -303,14 +313,14 @@
 
             for (StackTraceElement e : trace) {
                 buff.append("        @|bold at| ").
-                        append(e.getClassName()).
-                        append(".").
-                        append(e.getMethodName()).
-                        append(" (@|bold ");
+                    append(e.getClassName()).
+                    append(".").
+                    append(e.getMethodName()).
+                    append(" (@|bold ");
 
                 buff.append(e.isNativeMethod() ? "Native Method" :
-                            (e.getFileName() != null && e.getLineNumber() != -1 ?
e.getFileName() + ":" + e.getLineNumber() :
-                                (e.getFileName() != null ? e.getFileName() : "Unknown Source")));
+                        (e.getFileName() != null && e.getLineNumber() != -1 ? e.getFileName()
+ ":" + e.getLineNumber() :
+                            (e.getFileName() != null ? e.getFileName() : "Unknown Source")));
 
                 buff.append("|)");
 
@@ -326,6 +336,8 @@
     //
 
     private void loadProfileScripts() throws Exception {
+        assert branding != null;
+
         // Load profile scripts if they exist
         loadSharedScript(branding.getProfileScriptName());
         loadUserScript(branding.getProfileScriptName());

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/ExecutingVisitor.java
Sat May 24 01:12:36 2008
@@ -48,9 +48,9 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private Environment env;
+    private final Environment env;
     
-    private CommandExecutor executor;
+    private final CommandExecutor executor;
 
     public ExecutingVisitor(final CommandExecutor executor, final Environment env) {
         assert executor != null;
@@ -63,10 +63,7 @@
     public Object visit(final SimpleNode node, final Object data) {
         assert node != null;
 
-        //
         // It is an error if we forgot to implement a node handler
-        //
-
         throw new Error("Unhandled node type: " + node.getClass().getName());
     }
 
@@ -107,11 +104,12 @@
         return null;
     }
 
+    @SuppressWarnings({"unchecked"})
     private Object appendString(final String value, final Object data) {
         assert data != null;
         assert data instanceof List;
 
-        List args = (List)data;
+        List<Object> args = (List<Object>)data;
         args.add(value);
 
         return value;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
Sat May 24 01:12:36 2008
@@ -22,8 +22,6 @@
 import org.apache.geronimo.gshell.GShell;
 import org.apache.geronimo.gshell.artifact.ArtifactManager;
 import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
-import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.model.application.Application;
 import org.apache.geronimo.gshell.model.common.Dependency;
 import org.apache.geronimo.gshell.model.common.LocalRepository;
@@ -117,10 +115,6 @@
         // TODO: Configure other application bits (branding, etc) ?
         // TODO: May want to have those components pull from the application's context instead,
like we are doing for layout
 
-        // Install lookup intestances
-        IOLookup.set(container, config.getIo());
-        EnvironmentLookup.set(container, config.getEnvironment());
-
         // Create a new context
         applicationContext = new ApplicationContext() {
             public IO getIo() {

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/branding/DefaultBranding.java
Sat May 24 01:12:36 2008
@@ -42,14 +42,12 @@
     @Requirement
     private VersionLoader versionLoader;
 
-    @Requirement
-    private Terminal terminal;
-
     public DefaultBranding() {}
     
-    public DefaultBranding(final VersionLoader versionLoader, final Terminal terminal) {
+    public DefaultBranding(final VersionLoader versionLoader) {
+        assert versionLoader != null;
+
         this.versionLoader = versionLoader;
-        this.terminal = terminal;
     }
 
     public String getName() {
@@ -76,6 +74,8 @@
     }
 
     public String getVersion() {
+        assert versionLoader != null;
+
         return versionLoader.getVersion();
     }
 
@@ -132,8 +132,12 @@
         out.println();
         out.println("Type '@|bold help|' for more information.");
 
+        //
+        // HACK: Need a better way to abstract the terminal here
+        //
+        
         // If we can't tell, or have something bogus then use a reasonable default
-        int width = terminal.getTerminalWidth();
+        int width = Terminal.getTerminal().getTerminalWidth();
         if (width < 1) {
             width = 80;
         }

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/JLineConsole.java
Sat May 24 01:12:36 2008
@@ -21,7 +21,6 @@
 
 import jline.ConsoleReader;
 import jline.History;
-import jline.Terminal;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.shell.Shell;
 
@@ -40,12 +39,12 @@
 
     // final CommandsMultiCompletor completor
 
-    public JLineConsole(final Executor executor, final IO io, final Terminal terminal) throws
IOException {
+    public JLineConsole(final Executor executor, final IO io) throws IOException {
         super(executor);
 
         assert io != null;
 
-        reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream, true),
/*bindings*/null, terminal);
+        reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream, true),
/*bindings*/null, io.getTerminal());
         reader.setUsePagination(true);
         
         // this.completor = new CommandsMultiCompletor()

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
Sat May 24 01:12:36 2008
@@ -23,7 +23,6 @@
 import org.apache.geronimo.gshell.model.layout.GroupNode;
 import org.apache.geronimo.gshell.model.layout.Layout;
 import org.apache.geronimo.gshell.model.layout.Node;
-import org.apache.geronimo.gshell.shell.Environment;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.slf4j.Logger;
@@ -41,19 +40,16 @@
     private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
-    private Environment env;
-
-    @Requirement
     private ApplicationManager applicationManager;
     
     private Layout layout;
 
     public DefaultLayoutManager() {}
     
-    public DefaultLayoutManager(final Environment env) {
-        assert env != null;
-        
-        this.env = env;
+    public DefaultLayoutManager(final ApplicationManager applicationManager) {
+        assert applicationManager != null;
+
+        this.applicationManager = applicationManager;
     }
 
     private Layout lookupLayout() {
@@ -119,7 +115,9 @@
             return foundNode;
         }
         else {
-            start = (Node) env.getVariables().get(CURRENT_NODE);
+            assert applicationManager != null;
+            
+            start = (Node) applicationManager.getContext().getEnvironment().getVariables().get(CURRENT_NODE);
 
             if (start == null) {
                 start = layout;

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
Sat May 24 01:12:36 2008
@@ -19,20 +19,19 @@
 
 package org.apache.geronimo.gshell.remote.client;
 
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import jline.Terminal;
 import org.apache.geronimo.gshell.ExitNotification;
-import org.apache.geronimo.gshell.io.PromptReader;
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.annotation.Requirement;
+import org.apache.geronimo.gshell.io.PromptReader;
 import org.apache.geronimo.gshell.remote.client.proxy.RemoteShellProxy;
 
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Command to connect to a remote shell server.
  *
@@ -58,9 +57,6 @@
     private List<String> command = new ArrayList<String>();
 
     @Requirement
-    private Terminal terminal;
-
-    @Requirement
     private PromptReader prompter;
 
     @Requirement
@@ -93,7 +89,7 @@
         // client.echo("HELLO");
         // Thread.sleep(1 * 1000);
 
-        RemoteShellProxy shell = new RemoteShellProxy(client, io, terminal);
+        RemoteShellProxy shell = new RemoteShellProxy(client, io);
 
         Object rv = SUCCESS;
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteShellProxy.java
Sat May 24 01:12:36 2008
@@ -19,14 +19,11 @@
 
 package org.apache.geronimo.gshell.remote.client.proxy;
 
-import java.util.concurrent.atomic.AtomicReference;
-
-import jline.Terminal;
 import org.apache.geronimo.gshell.ExitNotification;
-import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.ansi.Renderer;
 import org.apache.geronimo.gshell.console.Console;
 import org.apache.geronimo.gshell.console.JLineConsole;
+import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.remote.RemoteShell;
 import org.apache.geronimo.gshell.remote.client.RshClient;
 import org.apache.geronimo.gshell.shell.Environment;
@@ -36,6 +33,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.concurrent.atomic.AtomicReference;
+
 /**
  * Provides a shell interface which will proxy to a remote shell instance.
  *
@@ -50,8 +49,6 @@
 
     private IO io;
 
-    private Terminal terminal;
-
     private StreamFeeder outputFeeder;
 
     private boolean opened;
@@ -64,14 +61,12 @@
 
     private RemoteBrandingProxy branding;
 
-    public RemoteShellProxy(final RshClient client, final IO io, final Terminal terminal)
throws Exception {
+    public RemoteShellProxy(final RshClient client, final IO io) throws Exception {
         assert client != null;
         assert io != null;
-        assert terminal != null;
 
         this.client = client;
         this.io = io;
-        this.terminal = terminal;
 
         //
         // TODO: send over some client-side details, like the terminal features, etc, as
well, verbosity too)
@@ -199,7 +194,7 @@
             }
         };
 
-        JLineConsole console = new JLineConsole(executor, io, terminal);
+        JLineConsole console = new JLineConsole(executor, io);
 
         console.setPrompter(new Console.Prompter() {
             Renderer renderer = new Renderer();

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/DefaultRemoteShell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/DefaultRemoteShell.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/DefaultRemoteShell.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/DefaultRemoteShell.java
Sat May 24 01:12:36 2008
@@ -45,6 +45,7 @@
     @Requirement
     private CommandExecutor executor;
 
+    // FIXME: Pull this from some manager's context
     @Requirement
     private Environment env;
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
Sat May 24 01:12:36 2008
@@ -20,8 +20,6 @@
 package org.apache.geronimo.gshell.remote.server.handler;
 
 import org.apache.geronimo.gshell.common.Notification;
-import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
-import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
 import org.apache.geronimo.gshell.whisper.transport.Session;
 import org.codehaus.plexus.component.annotations.Component;
@@ -41,8 +39,10 @@
 
     public void handle(final Session session, final ServerSessionContext context, final ExecuteMessage
message) throws Exception {
         // Need to make sure that the execuing thread has the right I/O and environment in
context
-        IOLookup.set(context.container, context.io);
-        EnvironmentLookup.set(context.container, context.env);
+        // FIXME: Need to find out what to do here, w/o this lookup
+        // IOLookup.set(context.container, context.io);
+        // FIXME: Need to find out what to do here, w/o this lookup
+        // EnvironmentLookup.set(context.container, context.env);
 
         ExecuteMessage.Result reply;
 

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
Sat May 24 01:12:36 2008
@@ -20,8 +20,6 @@
 package org.apache.geronimo.gshell.remote.server.handler;
 
 import org.apache.geronimo.gshell.DefaultEnvironment;
-import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
-import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.remote.RemoteShell;
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
 import org.apache.geronimo.gshell.remote.message.OpenShellMessage;
@@ -56,11 +54,13 @@
 
         // Setup the I/O context (w/o auto-flushing)
         context.io = new RemoteIO(session);
-        IOLookup.set(context.container, context.io);
+        // FIXME: Need to find out what to do here, w/o this lookup
+        // IOLookup.set(context.container, context.io);
 
         // Setup shell environemnt
         context.env = new DefaultEnvironment(context.io);
-        EnvironmentLookup.set(context.container, context.env);
+        // FIXME: Need to find out what to do here, w/o this lookup
+        // EnvironmentLookup.set(context.container, context.env);
 
         // Create a new shell instance
         context.shell = (RemoteShell) context.container.lookup(RemoteShell.class);

Modified: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PromptReader.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PromptReader.java?rev=659766&r1=659765&r2=659766&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PromptReader.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PromptReader.java
Sat May 24 01:12:36 2008
@@ -19,40 +19,26 @@
 
 package org.apache.geronimo.gshell.io;
 
-import java.io.PrintWriter;
-import java.io.IOException;
-
 import jline.ConsoleReader;
-import jline.Terminal;
-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 java.io.IOException;
+import java.io.PrintWriter;
 
 /**
  * Helper to prompt a user for information.
  *
  * @version $Rev$ $Date$
  */
-@Component(role=PromptReader.class, instantiationStrategy="per-lookup")
 public class PromptReader
-    implements Initializable
 {
-    @Requirement
-    private Terminal terminal;
-
-    @Requirement
-    private IO io;
-
     private char mask = '*';
 
-    private ConsoleReader reader;
+    private final ConsoleReader reader;
 
-    public PromptReader() {}
-    
-    public PromptReader(final Terminal terminal, final IO io) {
-        this.terminal = terminal;
-        this.io = io;
+    public PromptReader(final IO io) throws IOException {
+        assert io != null;
+        
+        this.reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream,
true), /*bindings*/ null, io.getTerminal());
     }
 
     public char getMask() {
@@ -63,15 +49,6 @@
         this.mask = mask;
     }
 
-    public void initialize() throws InitializationException {
-        try {
-            reader = new ConsoleReader(io.inputStream, new PrintWriter(io.outputStream, true),
/*bindings*/ null, terminal);
-        }
-        catch (IOException e) {
-            throw new InitializationException("Failed to create reader", e);
-        }
-    }
-
     public String readLine(final String prompt) throws IOException {
         assert prompt != null;
 



Mime
View raw message