geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r662702 - in /geronimo/gshell/trunk: gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ gshell-core/src/main/java/org/apache/geronimo/gshell/ gshell-plugin/src/main/java/org/apache/geronimo/gshell/ap...
Date Tue, 03 Jun 2008 08:49:17 GMT
Author: jdillon
Date: Tue Jun  3 01:49:16 2008
New Revision: 662702

URL: http://svn.apache.org/viewvc?rev=662702&view=rev
Log:
(GSHELL-89) Hijack system in/out streams
Moved all io related bits from common into io

Added:
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/NestedIOException.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/StreamPair.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/SystemOutputHijacker.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
  (contents, props changed)
      - copied, changed from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/test/java/org/apache/geronimo/gshell/common/SystemOutputHijackerTest.java
Removed:
    geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/NestedIOException.java
    geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/StreamPair.java
    geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/SystemOutputHijacker.java
    geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/
    geronimo/gshell/trunk/gshell-support/gshell-common/src/test/java/org/apache/geronimo/gshell/common/SystemOutputHijackerTest.java
Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ExecuteCommand.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultCommandExecutor.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationSecurityManager.java
    geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/builder/ShellBuilder.java
    geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/IO.java
    geronimo/gshell/trunk/gshell-whisper/pom.xml
    geronimo/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/SessionInputStream.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ExecuteCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ExecuteCommand.java?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ExecuteCommand.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-optional/src/main/java/org/apache/geronimo/gshell/commands/optional/ExecuteCommand.java
Tue Jun  3 01:49:16 2008
@@ -24,7 +24,7 @@
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
 import org.apache.geronimo.gshell.command.CommandSupport;
-import org.apache.geronimo.gshell.common.io.PumpStreamHandler;
+import org.apache.geronimo.gshell.io.PumpStreamHandler;
 
 /**
  * Execute system processes.

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=662702&r1=662701&r2=662702&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
Tue Jun  3 01:49:16 2008
@@ -27,6 +27,7 @@
 import org.apache.geronimo.gshell.common.Arguments;
 import org.apache.geronimo.gshell.common.StopWatch;
 import org.apache.geronimo.gshell.common.Notification;
+import org.apache.geronimo.gshell.io.SystemOutputHijacker;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.layout.LayoutManager;
 import org.apache.geronimo.gshell.layout.NotFoundException;
@@ -50,6 +51,7 @@
 import java.io.OutputStream;
 import java.io.PipedInputStream;
 import java.io.PipedOutputStream;
+import java.io.PrintStream;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.atomic.AtomicReference;
@@ -162,7 +164,7 @@
                 os = pos = new PipedOutputStream();
             }
 
-            ios[i] = new IO(is, os, env.getIO().errorStream);
+            ios[i] = new IO(is, new PrintStream(os), env.getIO().errorStream);
         }
 
         Thread[] threads = new Thread[commands.length];
@@ -297,6 +299,9 @@
         // Setup command timings
         StopWatch watch = new StopWatch(true);
 
+        // Hijack the system streams in the current thread's context
+        SystemOutputHijacker.register(io.outputStream, io.errorStream);
+
         Object result;
         try {
             result = command.execute(context, args);
@@ -304,9 +309,12 @@
             log.debug("Command completed with result: {}, after: {}", result, watch);
         }
         finally {
+            // Restore hijacked streams
+            SystemOutputHijacker.deregister();
+
             // Make sure that the commands output has been flushed
             try {
-                env.getIO().flush();
+                io.flush();
             }
             catch (Exception ignore) {}
         }

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationSecurityManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationSecurityManager.java?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationSecurityManager.java
(original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/application/ApplicationSecurityManager.java
Tue Jun  3 01:49:16 2008
@@ -60,4 +60,7 @@
     // TODO: Never allow application to change ${gshell.home}
     //
 
+    //
+    // TODO: Add check for RuntimePermission("setIO"), to prevent unhijacking of the system
streams
+
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/builder/ShellBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/builder/ShellBuilder.java?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/builder/ShellBuilder.java
(original)
+++ geronimo/gshell/trunk/gshell-plugin/src/main/java/org/apache/geronimo/gshell/builder/ShellBuilder.java
Tue Jun  3 01:49:16 2008
@@ -32,6 +32,7 @@
 import org.apache.geronimo.gshell.settings.SettingsManager;
 import org.apache.geronimo.gshell.shell.Environment;
 import org.apache.geronimo.gshell.shell.Shell;
+import org.apache.geronimo.gshell.io.SystemOutputHijacker;
 import org.codehaus.plexus.ContainerConfiguration;
 import org.codehaus.plexus.DefaultContainerConfiguration;
 import org.codehaus.plexus.PlexusContainerException;
@@ -193,6 +194,15 @@
     public Shell build() throws Exception {
         log.debug("Building");
 
+        // Hijack the system output streams
+        if (!SystemOutputHijacker.isInstalled()) {
+            SystemOutputHijacker.install();
+        }
+
+        // Register the application IO streams
+        IO io = getIo();
+        SystemOutputHijacker.register(io.outputStream, io.errorStream);
+
         // Initialize the container
         getContainer();
 

Modified: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/IO.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/IO.java?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/IO.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/IO.java
Tue Jun  3 01:49:16 2008
@@ -19,18 +19,19 @@
 
 package org.apache.geronimo.gshell.io;
 
+import jline.Terminal;
+import org.apache.geronimo.gshell.ansi.RenderWriter;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.codehaus.plexus.util.IOUtil;
+import org.slf4j.helpers.MessageFormatter;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.OutputStream;
+import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.Reader;
-
-import org.apache.geronimo.gshell.ansi.RenderWriter;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.codehaus.plexus.util.IOUtil;
-import org.slf4j.helpers.MessageFormatter;
-import jline.Terminal;
+import java.io.OutputStream;
 
 /**
  * Container for input/output handles.
@@ -51,14 +52,14 @@
      *
      * @see #out    For general usage, please use the writer.
      */
-    public final OutputStream outputStream;
+    public final PrintStream outputStream;
 
     /**
      * Raw error output stream.
      *
      * @see #err    For general usage, please use the writer.
      */
-    public final OutputStream errorStream;
+    public final PrintStream errorStream;
 
     /**
      * Prefered input reader.
@@ -89,7 +90,7 @@
      * @param err           The error output stream; must not be null
      * @param autoFlush     True to enable auto-flushing off writers.
      */
-    public IO(final InputStream in, final OutputStream out, final OutputStream err, final
boolean autoFlush) {
+    public IO(final InputStream in, final PrintStream out, final PrintStream err, final boolean
autoFlush) {
         assert in != null;
         assert out != null;
         assert err != null;
@@ -120,6 +121,14 @@
         // this.err = new PrintWriter(err, autoFlush);
     }
 
+    public IO(final InputStream in, final OutputStream out, final OutputStream err, final
boolean autoFlush) {
+        this(in, new PrintStream(out, autoFlush), new PrintStream(err, autoFlush), autoFlush);
   
+    }
+
+    public IO(final InputStream in, final OutputStream out, final boolean autoFlush) {
+        this(in, new PrintStream(out, autoFlush), autoFlush);    
+    }
+
     /**
      * Construct a new IO container.
      *
@@ -127,7 +136,7 @@
      * @param out   The output stream; must not be null
      * @param err   The error output stream; must not be null
      */
-    public IO(final InputStream in, final OutputStream out, final OutputStream err) {
+    public IO(final InputStream in, final PrintStream out, final PrintStream err) {
         this(in, out, err, true);
     }
 
@@ -138,7 +147,7 @@
      * @param out           The output stream and error stream; must not be null
      * @param autoFlush     True to enable auto-flushing off writers.
      */
-    public IO(final InputStream in, final OutputStream out, final boolean autoFlush) {
+    public IO(final InputStream in, final PrintStream out, final boolean autoFlush) {
         this(in, out, out, autoFlush);
     }
 
@@ -148,7 +157,7 @@
      * @param in    The input steam; must not be null
      * @param out   The output stream and error stream; must not be null
      */
-    public IO(final InputStream in, final OutputStream out) {
+    public IO(final InputStream in, final PrintStream out) {
         this(in, out, out);
     }
 

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/NestedIOException.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/NestedIOException.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/NestedIOException.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java
Tue Jun  3 01:49:16 2008
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common;
+package org.apache.geronimo.gshell.io;
 
 import java.io.IOException;
 
 /**
  * Nested {@link IOException}.
  *
- * @version $Rev: 577545 $ $Date: 2007-09-19 21:55:19 -0700 (Wed, 19 Sep 2007) $
+ * @version $Rev$ $Date$
  */
 public class NestedIOException
     extends IOException

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/NestedIOException.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/PumpStreamHandler.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java
Tue Jun  3 01:49:16 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common.io;
+package org.apache.geronimo.gshell.io;
 
 import java.io.IOException;
 import java.io.InputStream;

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/PumpStreamHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/StreamPair.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/StreamPair.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/StreamPair.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java
Tue Jun  3 01:49:16 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common;
+package org.apache.geronimo.gshell.io;
 
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPair.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/io/StreamPumper.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java
Tue Jun  3 01:49:16 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common.io;
+package org.apache.geronimo.gshell.io;
 
 import java.io.InputStream;
 import java.io.OutputStream;

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/StreamPumper.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/SystemOutputHijacker.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/SystemOutputHijacker.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/main/java/org/apache/geronimo/gshell/common/SystemOutputHijacker.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java
Tue Jun  3 01:49:16 2008
@@ -17,12 +17,16 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common;
+package org.apache.geronimo.gshell.io;
 
 import java.io.PrintStream;
 import java.io.IOException;
 import java.io.ByteArrayOutputStream;
 
+//
+// FIXME: Probably need to add some support to hijack System.in too
+//
+
 /**
  * Hijacks the systems standard output and error streams on a per-thread basis
  * and redirects to given streams.
@@ -92,7 +96,15 @@
         install();
         register(out);
     }
-    
+
+    /**
+     * Install the hijacker and register streams for the current thread.
+     */
+    public static synchronized void install(final StreamPair pair) {
+        install();
+        register(pair);
+    }
+
     /**
      * Uninstall the hijacker.
      */

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/main/java/org/apache/geronimo/gshell/io/SystemOutputHijacker.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Copied: geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
(from r662686, geronimo/gshell/trunk/gshell-support/gshell-common/src/test/java/org/apache/geronimo/gshell/common/SystemOutputHijackerTest.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java?p2=geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java&p1=geronimo/gshell/trunk/gshell-support/gshell-common/src/test/java/org/apache/geronimo/gshell/common/SystemOutputHijackerTest.java&r1=662686&r2=662702&rev=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-common/src/test/java/org/apache/geronimo/gshell/common/SystemOutputHijackerTest.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
Tue Jun  3 01:49:16 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.common;
+package org.apache.geronimo.gshell.io;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-io/src/test/java/org/apache/geronimo/gshell/io/SystemOutputHijackerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-whisper/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-whisper/pom.xml?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-whisper/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-whisper/pom.xml Tue Jun  3 01:49:16 2008
@@ -42,7 +42,12 @@
             <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-common</artifactId>
         </dependency>
-        
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-io</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>

Modified: geronimo/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/SessionInputStream.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/SessionInputStream.java?rev=662702&r1=662701&r2=662702&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/SessionInputStream.java
(original)
+++ geronimo/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/SessionInputStream.java
Tue Jun  3 01:49:16 2008
@@ -26,7 +26,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.geronimo.gshell.common.NestedIOException;
+import org.apache.geronimo.gshell.io.NestedIOException;
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.whisper.util.SessionAttributeBinder;



Mime
View raw message