geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r577074 - in /geronimo/sandbox/gshell/trunk/gshell-remote: gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/ gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ gshell-remote-common/src...
Date Tue, 18 Sep 2007 21:43:59 GMT
Author: jdillon
Date: Tue Sep 18 14:43:58 2007
New Revision: 577074

URL: http://svn.apache.org/viewvc?rev=577074&view=rev
Log:
Added --background to rsh-server
Added --bind to rsh
Adding vm transport

Added:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
  (contents, props changed)
      - copied, changed from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpProtocolHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/TransportSupport.java
      - copied, changed from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransport.java
      - copied, changed from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
  (contents, props changed)
      - copied, changed from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
  (with props)
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
  (with props)
Removed:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpProtocolHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportSupport.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ssl/SslTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
Tue Sep 18 14:43:58 2007
@@ -54,17 +54,18 @@
 
     private final Transport transport;
 
-    public RshClient(final CryptoContext crypto, final URI location, final TransportFactory
factory) throws Exception {
+    public RshClient(final CryptoContext crypto, final URI remote, final URI local, final
TransportFactory factory) throws Exception {
         assert crypto != null;
-        assert location != null;
+        assert remote != null;
+        // local may be null
         assert factory != null;
 
         this.crypto = crypto;
 
         // And then lets connect to the remote server
-        transport = factory.connect(location);
+        transport = factory.connect(remote, local);
 
-        log.debug("Connected to: {}", location);
+        log.debug("Connected to: {}", remote);
     }
 
     public void login(final String username, final String password) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java
Tue Sep 18 14:43:58 2007
@@ -41,9 +41,9 @@
     @Requirement
     private CryptoContext crypto;
     
-    public RshClient connect(final URI location) throws Exception {
-        TransportFactory factory = locator.locate(location);
+    public RshClient connect(final URI remote, final URI local) throws Exception {
+        TransportFactory factory = locator.locate(remote);
 
-        return new RshClient(crypto, location, factory);
+        return new RshClient(crypto, remote, local, factory);
     }
 }

Modified: geronimo/sandbox/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/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
Tue Sep 18 14:43:58 2007
@@ -25,6 +25,7 @@
 
 import jline.Terminal;
 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.codehaus.plexus.component.annotations.Requirement;
@@ -38,12 +39,11 @@
 public class RshCommand
     extends CommandSupport
 {
-    //
-    // TODO: Add support to bind to a local address, also look at man pages for rsh and ssh
for more options which might want to support.
-    //
-    
-    @Argument(metaVar="LOCATION", required=true, index=0)
-    private URI location;
+    @Option(name="-b", aliases={"--bind"}, metaVar="URI")
+    private URI local;
+
+    @Argument(metaVar="URI", required=true, index=0)
+    private URI remote;
 
     @Argument(metaVar="COMMAND", index=1)
     private List<String> command = new ArrayList<String>();
@@ -57,9 +57,9 @@
     private RshClient client;
 
     protected Object doExecute() throws Exception {
-        io.info("Connecting to: {}", location);
+        io.info("Connecting to: {}", remote);
 
-        client = factory.connect(location);
+        client = factory.connect(remote, local);
 
         io.info("Connected");
 

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
(from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpProtocolHandler.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpProtocolHandler.java&r1=577065&r2=577074&rev=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpProtocolHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
Tue Sep 18 14:43:58 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.remote.transport.tcp;
+package org.apache.geronimo.gshell.remote.transport;
 
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -40,12 +40,12 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Provides the basic protocol handling for TCP-oriented clients and servers.
+ * Provides the basic protocol handling for clients and servers.
  *
  * @version $Rev$ $Date$
  */
-@Component(role=TcpProtocolHandler.class)
-public class TcpProtocolHandler
+@Component(role=ProtocolHandler.class)
+public class ProtocolHandler
     implements IoHandler
 {
     protected Logger log = LoggerFactory.getLogger(getClass());

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ProtocolHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/TransportSupport.java
(from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportSupport.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/TransportSupport.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/TransportSupport.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportSupport.java&r1=577065&r2=577074&rev=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/TransportSupport.java
Tue Sep 18 14:43:58 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.remote.transport.tcp;
+package org.apache.geronimo.gshell.remote.transport;
 
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 
@@ -25,8 +25,6 @@
 import org.apache.geronimo.gshell.remote.logging.LoggingFilter;
 import org.apache.geronimo.gshell.remote.message.MessageCodecFactory;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
-import org.apache.geronimo.gshell.remote.transport.Transport;
-import org.apache.geronimo.gshell.remote.transport.TransportServer;
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.IoService;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
@@ -36,11 +34,11 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Support for TCP {@link Transport} and {@link TransportServer} instances.
+ * Support for {@link Transport} and {@link TransportServer} instances.
  *
  * @version $Rev$ $Date$
  */
-public class TcpTransportSupport
+public class TransportSupport
 {
     public static final String PROTOCOL_FILTER_NAME = "protocol";
 
@@ -52,7 +50,7 @@
 
     private MessageVisitor messageVisitor;
 
-    private TcpProtocolHandler protocolHandler;
+    private ProtocolHandler protocolHandler;
 
     private MessageCodecFactory codecFactory;
 
@@ -63,13 +61,13 @@
     protected void configure(final IoService service) throws Exception {
         assert service != null;
 
-        TcpProtocolHandler handler = getProtocolHandler();
+        ProtocolHandler handler = getProtocolHandler();
         MessageVisitor visitor = getMessageVisitor();
         handler.setVisitor(visitor);
         service.setHandler(handler);
 
         DefaultIoFilterChainBuilder filterChain = service.getFilterChain();
-        
+
         if (log.isDebugEnabled()) {
             filterChain.addLast(LoggingFilter.NAME, new LoggingFilter());
         }
@@ -101,7 +99,7 @@
         return messageVisitor;
     }
 
-    public void setProtocolHandler(final TcpProtocolHandler protocolHandler) {
+    public void setProtocolHandler(final ProtocolHandler protocolHandler) {
         assert protocolHandler != null;
 
         log.debug("Using protocol handler: {}", protocolHandler);
@@ -109,7 +107,7 @@
         this.protocolHandler = protocolHandler;
     }
 
-    protected TcpProtocolHandler getProtocolHandler() {
+    protected ProtocolHandler getProtocolHandler() {
         if (protocolHandler == null) {
             throw new IllegalStateException("Protocol handler not bound");
         }
@@ -119,7 +117,7 @@
 
     public void setMessageCodecFactory(final MessageCodecFactory codecFactory) {
         assert codecFactory != null;
-        
+
         log.debug("Using codec factory: {}", codecFactory);
 
         this.codecFactory = codecFactory;

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ssl/SslTransportFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ssl/SslTransportFactory.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ssl/SslTransportFactory.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/ssl/SslTransportFactory.java
Tue Sep 18 14:43:58 2007
@@ -36,7 +36,7 @@
 public class SslTransportFactory
     extends TcpTransportFactory
 {
-    protected TcpTransport createTcpTransport(final URI location) throws Exception {
+    protected TcpTransport createTransport(final URI location) throws Exception {
         return new SslTransport(location, null);
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
Tue Sep 18 14:43:58 2007
@@ -32,7 +32,7 @@
 import org.apache.geronimo.gshell.remote.message.Message;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.transport.Transport;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.remote.transport.TransportSupport;
 import org.apache.mina.common.CloseFuture;
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoSession;
@@ -47,7 +47,7 @@
  * @version $Rev$ $Date$
  */
 public class TcpTransport
-    extends TcpTransportSupport
+    extends TransportSupport
     implements Transport
 {
     private static final int CONNECT_TIMEOUT = 3000;

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
Tue Sep 18 14:43:58 2007
@@ -48,7 +48,7 @@
         assert remote != null;
         // local can be null
 
-        TcpTransport transport = createTcpTransport(remote, local);
+        TcpTransport transport = createTransport(remote, local);
 
         container.autowire(transport);
 
@@ -57,7 +57,7 @@
         return transport;
     }
 
-    protected TcpTransport createTcpTransport(final URI remote, final URI local) throws Exception
{
+    protected TcpTransport createTransport(final URI remote, final URI local) throws Exception
{
         assert remote != null;
         // local can be null
         

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportServer.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportServer.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportServer.java
Tue Sep 18 14:43:58 2007
@@ -28,6 +28,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.security.SecurityFilter;
 import org.apache.geronimo.gshell.remote.transport.TransportServer;
+import org.apache.geronimo.gshell.remote.transport.TransportSupport;
 import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.transport.socket.nio.SocketAcceptor;
 
@@ -37,7 +38,7 @@
  * @version $Rev$ $Date$
  */
 public class TcpTransportServer
-    extends TcpTransportSupport
+    extends TransportSupport
     implements TransportServer
 {
     protected final URI location;

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransport.java
(from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransport.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransport.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java&r1=577065&r2=577074&rev=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransport.java
Tue Sep 18 14:43:58 2007
@@ -17,65 +17,62 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.remote.transport.tcp;
+package org.apache.geronimo.gshell.remote.transport.vm;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
 import java.net.URI;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.geronimo.gshell.remote.message.Message;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.transport.Transport;
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.remote.transport.TransportSupport;
 import org.apache.mina.common.CloseFuture;
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
 import org.apache.mina.filter.reqres.Request;
 import org.apache.mina.filter.reqres.Response;
-import org.apache.mina.transport.socket.nio.SocketConnector;
+import org.apache.mina.transport.vmpipe.VmPipeAddress;
+import org.apache.mina.transport.vmpipe.VmPipeConnector;
 
 /**
- * Provides TCP client-side support.
+ * Provides in-VM client-side support.
  *
  * @version $Rev$ $Date$
  */
-public class TcpTransport
-    extends TcpTransportSupport
+public class VmTransport
+    extends TransportSupport
     implements Transport
 {
     private static final int CONNECT_TIMEOUT = 3000;
-
+    
     protected final URI remoteLocation;
 
-    protected final InetSocketAddress remoteAddress;
+    protected final VmPipeAddress remoteAddress;
 
     protected final URI localLocation;
 
-    protected final InetSocketAddress localAddress;
+    protected final VmPipeAddress localAddress;
 
-    protected SocketConnector connector;
+    protected VmPipeConnector connector;
 
     protected IoSession session;
 
     protected boolean connected;
 
-    public TcpTransport(final URI remote, final URI local) throws Exception {
+    public VmTransport(final URI remote, final URI local) throws Exception {
         assert remote != null;
         // local may be null
 
         this.remoteLocation = remote;
-        this.remoteAddress = new InetSocketAddress(InetAddress.getByName(remote.getHost()),
remote.getPort());
+        this.remoteAddress = new VmPipeAddress(remote.getPort());
 
         if (local != null) {
             this.localLocation = local;
-            this.localAddress = new InetSocketAddress(InetAddress.getByName(local.getHost()),
local.getPort());
+            this.localAddress = new VmPipeAddress(local.getPort());
         }
         else {
             // These are final, so make sure to mark them null if we have no local address
@@ -85,17 +82,14 @@
     }
 
     protected synchronized void init() throws Exception {
-        ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()
+ 1);
-
-        connector = new SocketConnector(Runtime.getRuntime().availableProcessors(), executor);
-        connector.setConnectTimeout(30);
+        connector = new VmPipeConnector();
 
         //
         // HACK: Need to manually wire in the visitor impl for now... :-(
         //
 
         setMessageVisitor((MessageVisitor) getContainer().lookup(MessageVisitor.class, "client"));
-        
+
         configure(connector);
     }
 
@@ -103,7 +97,7 @@
         if (connected) {
             throw new IllegalStateException("Already connected");
         }
-        
+
         init();
 
         log.info("Connecting to: {}", remoteAddress);
@@ -118,7 +112,7 @@
         }
 
         connected = true;
-        
+
         log.info("Connected");
     }
 
@@ -159,7 +153,7 @@
     public Message request(final Message msg) throws Exception {
         return request(msg, 5, TimeUnit.SECONDS);
     }
-    
+
     public Message request(final Message msg, final long timeout, final TimeUnit unit) throws
Exception {
         assert msg != null;
 

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
(from r577065, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java&r1=577065&r2=577074&rev=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpTransportFactory.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
Tue Sep 18 14:43:58 2007
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.remote.transport.tcp;
+package org.apache.geronimo.gshell.remote.transport.vm;
 
 import java.net.URI;
 
@@ -29,12 +29,12 @@
 import org.codehaus.plexus.component.annotations.Requirement;
 
 /**
- * Produces TCP transport instances.
+ * Produces in-VM transport instances.
  *
  * @version $Rev$ $Date$
  */
-@Component(role=TransportFactory.class, hint="tcp")
-public class TcpTransportFactory
+@Component(role=TransportFactory.class, hint="vm")
+public class VmTransportFactory
     implements TransportFactory
 {
     @Requirement
@@ -43,12 +43,12 @@
     //
     // NOTE: We use autowire() here to get a few components injected.  These are injected
via setters.
     //
-    
+
     public Transport connect(final URI remote, final URI local) throws Exception {
         assert remote != null;
         // local can be null
 
-        TcpTransport transport = createTcpTransport(remote, local);
+        VmTransport transport = createTransport(remote, local);
 
         container.autowire(transport);
 
@@ -57,11 +57,11 @@
         return transport;
     }
 
-    protected TcpTransport createTcpTransport(final URI remote, final URI local) throws Exception
{
+    protected VmTransport createTransport(final URI remote, final URI local) throws Exception
{
         assert remote != null;
         // local can be null
-        
-        return new TcpTransport(remote, local);
+
+        return new VmTransport(remote, local);
     }
 
     public Transport connect(final URI remote) throws Exception {
@@ -71,7 +71,7 @@
     public TransportServer bind(final URI location) throws Exception {
         assert location != null;
 
-        TcpTransportServer server = createTransportServer(location);
+        VmTransportServer server = createTransportServer(location);
 
         container.autowire(server);
 
@@ -80,7 +80,7 @@
         return server;
     }
 
-    protected TcpTransportServer createTransportServer(final URI location) throws Exception
{
-        return new TcpTransportServer(location);
+    protected VmTransportServer createTransportServer(final URI location) throws Exception
{
+        return new VmTransportServer(location);
     }
 }

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java?rev=577074&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
(added)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
Tue Sep 18 14:43:58 2007
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.remote.transport.vm;
+
+import java.net.URI;
+
+import org.apache.geronimo.gshell.remote.message.MessageVisitor;
+import org.apache.geronimo.gshell.remote.security.SecurityFilter;
+import org.apache.geronimo.gshell.remote.transport.TransportServer;
+import org.apache.geronimo.gshell.remote.transport.TransportSupport;
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
+import org.apache.mina.transport.vmpipe.VmPipeAcceptor;
+import org.apache.mina.transport.vmpipe.VmPipeAddress;
+
+/**
+ * Provides in-VM server-side support.
+ *
+ * @version $Rev$ $Date$
+ */
+public class VmTransportServer
+    extends TransportSupport
+    implements TransportServer
+{
+    protected final URI location;
+
+    protected final VmPipeAddress address;
+
+    protected VmPipeAcceptor acceptor;
+
+    protected boolean bound;
+
+    private SecurityFilter securityFilter;
+
+    public VmTransportServer(final URI location) throws Exception {
+        assert location != null;
+
+        this.location = location;
+        this.address = new VmPipeAddress(location.getPort());
+    }
+
+    public URI getLocation() {
+        return location;
+    }
+
+    //
+    // NOTE: Setters exposed to support Plexus autowire()  Getters exposed to handle state
checking.
+    //
+
+    public void setSecurityFilter(final SecurityFilter securityFilter) {
+        this.securityFilter = securityFilter;
+    }
+
+    protected SecurityFilter getSecurityFilter() {
+        if (securityFilter == null) {
+            throw new IllegalStateException("Security filter not bound");
+        }
+
+        return securityFilter;
+    }
+
+    protected synchronized void init() throws Exception {
+        acceptor = new VmPipeAcceptor();
+        acceptor.setLocalAddress(address);
+
+        //
+        // HACK: Need to manually wire in the visitor impl for now... :-(
+        //
+
+        setMessageVisitor((MessageVisitor) getContainer().lookup(MessageVisitor.class, "server"));
+
+        configure(acceptor);
+
+        DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain();
+
+        // Install the authentication filter right after the protocol filter
+        filterChain.addAfter(PROTOCOL_FILTER_NAME, SecurityFilter.NAME, getSecurityFilter());
+    }
+
+    public synchronized void bind() throws Exception {
+        if (bound) {
+            throw new IllegalStateException("Already bound");
+        }
+
+        init();
+
+        acceptor.bind();
+
+        bound = true;
+
+        log.info("Listening on: {}", address);
+    }
+
+    public synchronized void close() {
+        acceptor.unbind();
+
+        log.info("Closed");
+    }
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/VmTransportServer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java?rev=577074&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
(added)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
Tue Sep 18 14:43:58 2007
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Support for in-VM connections.
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.geronimo.gshell.remote.transport.vm;
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/vm/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java?rev=577074&r1=577073&r2=577074&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerCommand.java
Tue Sep 18 14:43:58 2007
@@ -22,6 +22,7 @@
 import java.net.URI;
 
 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.codehaus.plexus.component.annotations.Requirement;
@@ -35,7 +36,10 @@
 public class RshServerCommand
     extends CommandSupport
 {
-    @Argument(metaVar="LOCATION", required=true, index=0)
+    @Option(name="-b", aliases={ "--background" })
+    private boolean background;
+
+    @Argument(metaVar="URI", required=true, index=0)
     private URI location;
 
     @Requirement
@@ -48,12 +52,13 @@
 
         io.info("Listening on: {}", location);
 
-        // For now just wait...
-        synchronized (this) {
-            wait();
-        }
+        if (!background) {
+            synchronized (this) {
+                wait();
+            }
 
-        server.close();
+            server.close();
+        }
         
         return SUCCESS;
     }



Mime
View raw message