geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r706889 - in /geronimo/gshell/trunk: gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/ gshell-remote/gshell-remote-client/src/main/java/org...
Date Wed, 22 Oct 2008 08:12:04 GMT
Author: jdillon
Date: Wed Oct 22 01:12:04 2008
New Revision: 706889

URL: http://svn.apache.org/viewvc?rev=706889&view=rev
Log:
Expose Shell in ShellContext
Added ShellContextHolder, dropped RemoteShellContextHolder

Added:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
  (contents, props changed)
      - copied, changed from r706683, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
Removed:
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellContextHolder.java
Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
    geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/SourceAction.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/RemoteShellImpl.java
    geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.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-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasCommand.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
Wed Oct 22 01:12:04 2008
@@ -29,6 +29,8 @@
  */
 public interface ShellContext
 {
+    Shell getShell();
+    
     IO getIo();
 
     Variables getVariables();

Copied: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
(from r706683, geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java?p2=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java&p1=geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java&r1=706683&r2=706889&rev=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContext.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
Wed Oct 22 01:12:04 2008
@@ -19,17 +19,39 @@
 
 package org.apache.geronimo.gshell.shell;
 
-import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.command.Variables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * Provides the execution context of a shell.
+ * {@link ShellContext} thread context holder.
  *
  * @version $Rev$ $Date$
  */
-public interface ShellContext
+public class ShellContextHolder
 {
-    IO getIo();
+    private static final Logger log = LoggerFactory.getLogger(ShellContextHolder.class);
 
-    Variables getVariables();
+    private static final InheritableThreadLocal<ShellContext> holder = new InheritableThreadLocal<ShellContext>();
+
+    public static void set(final ShellContext context) {
+        log.trace("Setting context: {}", context);
+
+        holder.set(context);
+    }
+
+    public static ShellContext get(final boolean allowNull) {
+        ShellContext context = holder.get();
+
+        log.trace("Getting context ({}): {}", allowNull, context);
+
+        if (!allowNull && context == null) {
+            throw new IllegalStateException("Shell context not initialized for thread: "
+ Thread.currentThread());
+        }
+
+        return context;
+    }
+
+    public static ShellContext get() {
+        return get(false);
+    }
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/shell/ShellContextHolder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=706889&r1=706888&r2=706889&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
Wed Oct 22 01:12:04 2008
@@ -23,10 +23,9 @@
 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.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.io.IO;
-import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.vfs.FileSystemAccess;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -88,18 +87,7 @@
                     continue;
                 }
 
-                // HACK: Need a shell context, but currently that muck is not exposed, so
make a new one
-                ShellContext ctx = new ShellContext() {
-                    public IO getIo() {
-                        return context.getIo();
-                    }
-
-                    public Variables getVariables() {
-                        return context.getVariables();
-                    }
-                };
-
-                executor.execute(ctx, line);
+                executor.execute(ShellContextHolder.get(), line);
             }
         }
         finally {

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=706889&r1=706888&r2=706889&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
Wed Oct 22 01:12:04 2008
@@ -78,6 +78,10 @@
         outputFeeder.createThread().start();
 
         context = new ShellContext() {
+            public Shell getShell() {
+                return RemoteShellProxy.this;
+            }
+            
             public IO getIo() {
                 return io;
             }

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellImpl.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RemoteShellImpl.java
Wed Oct 22 01:12:04 2008
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.shell.Shell;
 import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,13 +64,7 @@
     public ShellContext getContext() {
         ensureOpened();
 
-        ShellContext context = RemoteShellContextHolder.getContext();
-
-        if (context == null) {
-            throw new IllegalStateException("Shell context has not been initialized");
-        }
-
-        return context;
+        return ShellContextHolder.get();
     }
 
     public Object execute(final String line) throws Exception {

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.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/CloseShellHandler.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.java
Wed Oct 22 01:12:04 2008
@@ -19,11 +19,9 @@
 
 package org.apache.geronimo.gshell.remote.server.handler;
 
-import org.apache.geronimo.gshell.command.Variables;
-import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.remote.message.CloseShellMessage;
-import org.apache.geronimo.gshell.remote.server.RemoteShellContextHolder;
 import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.whisper.transport.Session;
 
 /**
@@ -43,23 +41,14 @@
         assert context != null;
         assert message != null;
 
-        ShellContext shellContext = new ShellContext() {
-            public IO getIo() {
-                return context.io;
-            }
-
-            public Variables getVariables() {
-                return context.variables;
-            }
-        };
-
-        RemoteShellContextHolder.setContext(shellContext);
+        ShellContext prevContext = ShellContextHolder.get(true);
+        ShellContextHolder.set(context.shellContext);
 
         try {
             context.close();
         }
         finally {
-            RemoteShellContextHolder.clearContext();
+            ShellContextHolder.set(prevContext);
         }
 
         CloseShellMessage.Result reply = new CloseShellMessage.Result();

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=706889&r1=706888&r2=706889&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
Wed Oct 22 01:12:04 2008
@@ -19,12 +19,10 @@
 
 package org.apache.geronimo.gshell.remote.server.handler;
 
-import org.apache.geronimo.gshell.command.Variables;
-import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.notification.Notification;
 import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
-import org.apache.geronimo.gshell.remote.server.RemoteShellContextHolder;
 import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.whisper.transport.Session;
 
 /**
@@ -44,19 +42,10 @@
         assert context != null;
         assert message != null;
 
-        ShellContext shellContext = new ShellContext() {
-            public IO getIo() {
-                return context.io;
-            }
-
-            public Variables getVariables() {
-                return context.variables;
-            }
-        };
-
         ExecuteMessage.Result reply;
-        
-        RemoteShellContextHolder.setContext(shellContext);
+
+        ShellContext prevContext = ShellContextHolder.get(true);
+        ShellContextHolder.set(context.shellContext);
 
         try {
             try {
@@ -78,7 +67,7 @@
             }
         }
         finally {
-            RemoteShellContextHolder.clearContext();
+            ShellContextHolder.set(prevContext);
         }
 
         reply.setCorrelationId(message.getId());

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=706889&r1=706888&r2=706889&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
Wed Oct 22 01:12:04 2008
@@ -23,12 +23,10 @@
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.remote.message.OpenShellMessage;
 import org.apache.geronimo.gshell.remote.server.RemoteIO;
-import org.apache.geronimo.gshell.remote.server.RemoteShellContextHolder;
 import org.apache.geronimo.gshell.shell.ShellContext;
 import org.apache.geronimo.gshell.shell.Shell;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
-import org.apache.geronimo.gshell.spring.BeanContainerImpl;
 import org.apache.geronimo.gshell.whisper.transport.Session;
 
 import java.util.UUID;
@@ -68,8 +66,14 @@
         context.io = new RemoteIO(session);
         context.variables = new Variables();
 
-        // HACK: Need a shell context, but currently that muck is not exposed, so make a
new one
-        ShellContext shellContext = new ShellContext() {
+        // Create a new shell instance
+        context.shell = context.container.getBean("remoteShell", Shell.class);
+
+        context.shellContext = new ShellContext() {
+            public Shell getShell() {
+                return context.shell;
+            }
+            
             public IO getIo() {
                 return context.io;
             }
@@ -79,16 +83,6 @@
             }
         };
 
-        RemoteShellContextHolder.setContext(shellContext);
-
-        try {
-            // Create a new shell instance
-            context.shell = context.container.getBean("remoteShell", Shell.class);
-        }
-        finally {
-            RemoteShellContextHolder.clearContext();
-        }
-
         OpenShellMessage.Result reply = new OpenShellMessage.Result();
         reply.setCorrelationId(message.getId());
         session.send(reply);

Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.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/ServerSessionContext.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
(original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
Wed Oct 22 01:12:04 2008
@@ -24,6 +24,7 @@
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.whisper.util.SessionAttributeBinder;
 import org.apache.geronimo.gshell.shell.Shell;
+import org.apache.geronimo.gshell.shell.ShellContext;
 
 import java.security.PublicKey;
 
@@ -46,6 +47,8 @@
 
     public Shell shell;
 
+    public ShellContext shellContext;
+
     public void close() {
         shell.close();
         shell = null;
@@ -53,6 +56,7 @@
         container = null;
         io = null;
         variables = null;
+        shellContext = null;
         pk = null;
     }
 }

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
Wed Oct 22 01:12:04 2008
@@ -30,6 +30,8 @@
 import org.apache.geronimo.gshell.chronos.StopWatch;
 import org.apache.geronimo.gshell.event.EventPublisher;
 import org.apache.geronimo.gshell.shell.Shell;
+import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
 import org.apache.ivy.Ivy;
@@ -239,6 +241,8 @@
 
         final Shell shell = applicationContainer.getBean(Shell.class);
 
+        final ShellContext context = shell.getContext();
+
         log.debug("Created shell instance: {}", shell);
 
         InvocationHandler handler = new InvocationHandler() {
@@ -259,12 +263,12 @@
                     return method.invoke(this, args);
                 }
 
-                //
-                // TODO: This would be a good place to inject the shell or the shell context
into a thread holder
-                //
-                
+                final ShellContext prevContext = ShellContextHolder.get(true);
+                ShellContextHolder.set(context);
+
                 final SecurityManager prevSM = System.getSecurityManager();
                 System.setSecurityManager(sm);
+                
                 try {
                     return method.invoke(shell, args);
                 }
@@ -273,6 +277,7 @@
                 }
                 finally {
                     System.setSecurityManager(prevSM);
+                    ShellContextHolder.set(prevContext);
                 }
             }
         };

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasCommand.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/AliasCommand.java
Wed Oct 22 01:12:04 2008
@@ -22,12 +22,11 @@
 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.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.i18n.MessageSource;
 import org.apache.geronimo.gshell.i18n.ResourceBundleMessageSource;
-import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
 import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
 
 import java.util.Iterator;
@@ -102,16 +101,6 @@
         public Object execute(final CommandContext context) throws Exception {
             assert context != null;
 
-            ShellContext shellContext = new ShellContext() {
-                public IO getIo() {
-                    return context.getIo();
-                }
-
-                public Variables getVariables() {
-                    return context.getVariables();
-                }
-            };
-
             StringBuilder buff = new StringBuilder();
             buff.append(getAlias());
 
@@ -135,7 +124,7 @@
 
             log.debug("Executing alias: {}", buff);
 
-            Object result = executor.execute(shellContext, buff.toString());
+            Object result = executor.execute(ShellContextHolder.get(), buff.toString());
 
             log.debug("Alias result: {}", result);
 

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java?rev=706889&r1=706888&r2=706889&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/CommandLineExecutorImpl.java
Wed Oct 22 01:12:04 2008
@@ -36,6 +36,7 @@
 import org.apache.geronimo.gshell.notification.Notification;
 import org.apache.geronimo.gshell.registry.CommandResolver;
 import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.Shell;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -155,6 +156,10 @@
                 public void run() {
                     try {
                         ShellContext pipedContext = new ShellContext() {
+                            public Shell getShell() {
+                                return context.getShell();
+                            }
+
                             public IO getIo() {
                                 return ios[idx];
                             }

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=706889&r1=706888&r2=706889&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
Wed Oct 22 01:12:04 2008
@@ -111,6 +111,11 @@
         final Variables vars = application.getVariables();
 
         context = new ShellContext() {
+
+            public Shell getShell() {
+                return ShellImpl.this;
+            }
+
             public IO getIo() {
                 return io;
             }



Mime
View raw message