geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r578510 - 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/message/ gshell-remote-common/src/m...
Date Sat, 22 Sep 2007 22:05:52 GMT
Author: jdillon
Date: Sat Sep 22 15:05:51 2007
New Revision: 578510

URL: http://svn.apache.org/viewvc?rev=578510&view=rev
Log:
Brought back client and server specific message handlers

Added:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageHandler.java
      - copied, changed from r578506, 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-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageHandler.java
      - copied, changed from r578506, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServer.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageVisitor.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/message/Message.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Response.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/session/ThreadPoolModel.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/Transport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseCommon.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageHandler.java
(from r578506, 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/RshClientMessageHandler.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageHandler.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientFactory.java&r1=578506&r2=578510&rev=578510&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/RshClientMessageHandler.java
Sat Sep 22 15:05:51 2007
@@ -19,31 +19,25 @@
 
 package org.apache.geronimo.gshell.remote.client;
 
-import java.net.URI;
-
-import org.apache.geronimo.gshell.remote.crypto.CryptoContext;
-import org.apache.geronimo.gshell.remote.transport.TransportFactory;
-import org.apache.geronimo.gshell.remote.transport.TransportFactoryLocator;
+import org.apache.geronimo.gshell.remote.message.MessageHandler;
+import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 
 /**
- * Factory to produce {@link RshClient} instances.
+ * ???
  *
  * @version $Rev$ $Date$
  */
-@Component(role=RshClientFactory.class)
-public class RshClientFactory
+@Component(role=MessageHandler.class, hint="client")
+public class RshClientMessageHandler
+    extends MessageHandler
 {
     @Requirement
-    private TransportFactoryLocator locator;
-
-    @Requirement
-    private CryptoContext crypto;
-    
-    public RshClient connect(final URI remote, final URI local) throws Exception {
-        TransportFactory factory = locator.locate(remote);
+    private RshClientMessageVisitor clientVisitor;
 
-        return new RshClient(crypto, remote, local, factory);
+    @Override
+    protected MessageVisitor getVisitor() {
+        return clientVisitor;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageVisitor.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/RshClientMessageVisitor.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientMessageVisitor.java
Sat Sep 22 15:05:51 2007
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.remote.client;
 
-import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.message.MessageVisitorSupport;
 import org.apache.geronimo.gshell.remote.message.rsh.EchoMessage;
 import org.codehaus.plexus.component.annotations.Component;
@@ -29,7 +28,7 @@
  *
  * @version $Rev$ $Date$
  */
-@Component(role=MessageVisitor.class, hint="client")
+@Component(role=RshClientMessageVisitor.class)
 public class RshClientMessageVisitor
     extends MessageVisitorSupport
 {

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=578510&r1=578509&r2=578510&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
Sat Sep 22 15:05:51 2007
@@ -29,8 +29,6 @@
 import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandSupport;
 import org.apache.geronimo.gshell.command.annotation.CommandComponent;
-import org.apache.geronimo.gshell.remote.message.Message;
-import org.apache.geronimo.gshell.remote.message.rsh.EchoMessage;
 import org.codehaus.plexus.component.annotations.Requirement;
 
 /**

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
Sat Sep 22 15:05:51 2007
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.remote.message;
 
-import java.io.IOException;
 import java.io.Serializable;
 
 import org.apache.geronimo.gshell.remote.marshall.MarshalAware;

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
Sat Sep 22 15:05:51 2007
@@ -21,7 +21,6 @@
 
 import org.apache.mina.common.IoHandlerAdapter;
 import org.apache.mina.common.IoSession;
-import org.codehaus.plexus.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,35 +29,32 @@
  *
  * @version $Rev$ $Date$
  */
-@Component(role=MessageHandler.class)
 public class MessageHandler
     extends IoHandlerAdapter
 {
-    //
-    // TODO: Shall we make this a filter?
-    //
-    
-    private final Logger log = LoggerFactory.getLogger(getClass());
+    protected final Logger log = LoggerFactory.getLogger(getClass());
 
-    public MessageHandler(final MessageVisitor visitor) {
-        assert visitor != null;
+    private MessageVisitor visitor;
+
+    protected MessageHandler() {}
 
+    public MessageHandler(final MessageVisitor visitor) {
         this.visitor = visitor;
     }
-    
-    private MessageVisitor visitor;
 
-    public void setVisitor(final MessageVisitor visitor) {
-        assert visitor != null;
-        
-        this.visitor = visitor;
+    protected MessageVisitor getVisitor() {
+        if (visitor == null) {
+            throw new IllegalStateException("Message visitor not bound");
+        }
+
+        return visitor;
     }
 
     @Override
     public void sessionCreated(final IoSession session) throws Exception {
         // log.debug("Session created: {}", session);
 
-        MessageVisitor.BINDER.bind(session, visitor);
+        MessageVisitor.BINDER.bind(session, getVisitor());
     }
 
     @Override
@@ -85,8 +81,8 @@
             msg.freeze();
 
             // Hand over to visitor for processing
-            MessageVisitor v = MessageVisitor.BINDER.lookup(session);
-            msg.process(v);
+            MessageVisitor visitor = MessageVisitor.BINDER.lookup(session);
+            msg.process(visitor);
         }
         else {
             throw new InvalidMessageException(obj);
@@ -96,7 +92,7 @@
     @Override
     public void exceptionCaught(final IoSession session, final Throwable cause) throws Exception
{
         //
-        // TODO: Need to handle Exception muck, and send faul messages back to clients ?
+        // TODO: Need to handle Exception muck, and send fault messages back to clients ?
         //
 
         log.error("Unhandled exception: " + cause, cause);

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
Sat Sep 22 15:05:51 2007
@@ -19,17 +19,15 @@
 
 package org.apache.geronimo.gshell.remote.message;
 
-import java.io.IOException;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.remote.marshall.Marshaller;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
-import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Support for {@link Message} implementations.

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Response.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Response.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Response.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Response.java
Sat Sep 22 15:05:51 2007
@@ -19,9 +19,8 @@
 
 package org.apache.geronimo.gshell.remote.request;
 
-import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.remote.message.Message;
 
 //

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/session/ThreadPoolModel.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/session/ThreadPoolModel.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/session/ThreadPoolModel.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/session/ThreadPoolModel.java
Sat Sep 22 15:05:51 2007
@@ -19,18 +19,15 @@
 
 package org.apache.geronimo.gshell.remote.session;
 
-import java.util.List;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.geronimo.gshell.remote.util.NamedThreadFactory;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.ThreadModel;
 import org.apache.mina.filter.executor.ExecutorFilter;
-import org.apache.geronimo.gshell.remote.util.NamedThreadFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/Transport.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/Transport.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/Transport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/Transport.java
Sat Sep 22 15:05:51 2007
@@ -25,9 +25,9 @@
 import java.util.concurrent.TimeUnit;
 
 import org.apache.geronimo.gshell.remote.message.Message;
-import org.apache.mina.common.WriteFuture;
 import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.common.WriteFuture;
 
 /**
  * Provides the client-side protocol interface.

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseCommon.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/base/BaseCommon.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseCommon.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseCommon.java
Sat Sep 22 15:05:51 2007
@@ -24,7 +24,6 @@
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
 import org.apache.geronimo.gshell.remote.message.MessageCodecFactory;
 import org.apache.geronimo.gshell.remote.message.MessageHandler;
-import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.request.RequestResponseFilter;
 import org.apache.geronimo.gshell.remote.stream.SessionStreamFilter;
 import org.apache.geronimo.gshell.remote.transport.Transport;
@@ -122,7 +121,7 @@
         });
 
         // Setup the io handler
-        handler = new MessageHandler(getMessageVisitor());
+        handler = getMessageHandler();
 
         // Install the default set of filters
         configure(service.getFilterChain());
@@ -196,26 +195,26 @@
 
     private PlexusContainer container;
 
-    private MessageVisitor messageVisitor;
+    private MessageHandler messageHandler;
 
     private MessageCodecFactory codecFactory;
 
-    public void setMessageVisitor(final MessageVisitor messageVisitor) {
-        assert messageVisitor != null;
+    public void setMessageHandler(final MessageHandler messageHandler) {
+        assert messageHandler != null;
 
-        log.trace("Using message visitor: {}", messageVisitor);
+        log.trace("Using message handler: {}", messageHandler);
 
-        this.messageVisitor = messageVisitor;
+        this.messageHandler = messageHandler;
     }
 
-    protected MessageVisitor getMessageVisitor() {
-        if (messageVisitor == null) {
-            throw new IllegalStateException("Message visitor not bound");
+    protected MessageHandler getMessageHandler() {
+        if (messageHandler == null) {
+            throw new IllegalStateException("Message handler not bound");
         }
 
-        return messageVisitor;
+        return messageHandler;
     }
-
+    
     public void setMessageCodecFactory(final MessageCodecFactory codecFactory) {
         assert codecFactory != null;
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransport.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/base/BaseTransport.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransport.java
Sat Sep 22 15:05:51 2007
@@ -27,6 +27,7 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.geronimo.gshell.remote.message.Message;
+import org.apache.geronimo.gshell.remote.message.MessageHandler;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.request.Requestor;
 import org.apache.geronimo.gshell.remote.session.ThreadPoolModel;
@@ -38,6 +39,7 @@
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
+import org.codehaus.plexus.component.annotations.Requirement;
 
 /**
  * Support for {@link Transport} implementations.
@@ -66,6 +68,9 @@
 
     protected boolean connected;
 
+    @Requirement(role=MessageVisitor.class, hint="client")
+    private MessageVisitor v;
+
     protected BaseTransport(final URI remoteLocation, final SocketAddress remoteAddress,
final URI localLocation, final SocketAddress localAddress) throws Exception {
         assert remoteLocation != null;
         assert remoteAddress != null;
@@ -80,18 +85,17 @@
     protected abstract IoConnector createConnector() throws Exception;
 
     protected synchronized void init() throws Exception {
+        // For now we must manually bind the message handler, plexus is unable to provide
injection for us
+        setMessageHandler((MessageHandler) getContainer().lookup(MessageHandler.class, "client"));
+
+        // Setup the connector service
         connector = createConnector();
 
         // Install the thread model
         threadModel = new ThreadPoolModel(getClass().getSimpleName() + "-" + COUNTER.getAndIncrement());
         connector.getDefaultConfig().setThreadModel(threadModel);
 
-        //
-        // HACK: Need to manually wire in the visitor impl for now... :-(
-        //
-
-        setMessageVisitor((MessageVisitor) getContainer().lookup(MessageVisitor.class, "client"));
-        
+        // Configure the connector
         configure(connector);
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransportServer.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/base/BaseTransportServer.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransportServer.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/base/BaseTransportServer.java
Sat Sep 22 15:05:51 2007
@@ -23,7 +23,7 @@
 import java.net.URI;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.geronimo.gshell.remote.message.MessageVisitor;
+import org.apache.geronimo.gshell.remote.message.MessageHandler;
 import org.apache.geronimo.gshell.remote.security.SecurityFilter;
 import org.apache.geronimo.gshell.remote.session.ThreadPoolModel;
 import org.apache.geronimo.gshell.remote.transport.TransportServer;
@@ -66,18 +66,17 @@
     protected abstract IoAcceptor createAcceptor() throws Exception;
 
     protected synchronized void init() throws Exception {
+        // For now we must manually bind the message handler, plexus is unable to provide
injection for us
+        setMessageHandler((MessageHandler) getContainer().lookup(MessageHandler.class, "server"));
+
+        // Setup the acceptor service
         acceptor = createAcceptor();
 
         // Install the thread model
         threadModel = new ThreadPoolModel(getClass().getSimpleName() + "-" + COUNTER.getAndIncrement());
         acceptor.getDefaultConfig().setThreadModel(threadModel);
 
-        //
-        // HACK: Need to manually wire in the visitor impl for now... :-(
-        //
-
-        setMessageVisitor((MessageVisitor) getContainer().lookup(MessageVisitor.class, "server"));
-
+        // Configure the acceptor
         configure(acceptor);
     }
 

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageHandler.java
(from r578506, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServer.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/RshServerMessageHandler.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageHandler.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServer.java&r1=578506&r2=578510&rev=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServer.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageHandler.java
Sat Sep 22 15:05:51 2007
@@ -19,36 +19,25 @@
 
 package org.apache.geronimo.gshell.remote.server;
 
-import java.net.URI;
-
-import org.apache.geronimo.gshell.remote.transport.TransportFactory;
-import org.apache.geronimo.gshell.remote.transport.TransportServer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.geronimo.gshell.remote.message.MessageHandler;
+import org.apache.geronimo.gshell.remote.message.MessageVisitor;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
 
 /**
- * Provides support for the server-side of the remote shell protocol.
+ * ???
  *
  * @version $Rev$ $Date$
  */
-public class RshServer
+@Component(role=MessageHandler.class, hint="server")
+public class RshServerMessageHandler
+    extends MessageHandler
 {
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
-    private final TransportServer server;
-
-    public RshServer(final URI location, final TransportFactory factory) throws Exception
{
-        assert location != null;
-        assert factory != null;
-
-        server = factory.bind(location);
-
-        log.debug("Bound to: {}", location);
-    }
-
-    public void close() {
-        server.close();
+    @Requirement
+    private RshServerMessageVisitor serverVisitor;
 
-        log.debug("Closed");
+    @Override
+    protected MessageVisitor getVisitor() {
+        return serverVisitor;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.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/RshServerMessageVisitor.java?rev=578510&r1=578509&r2=578510&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
Sat Sep 22 15:05:51 2007
@@ -29,7 +29,6 @@
 import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.remote.RemoteShell;
-import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.geronimo.gshell.remote.message.MessageVisitorSupport;
 import org.apache.geronimo.gshell.remote.message.rsh.CloseShellMessage;
 import org.apache.geronimo.gshell.remote.message.rsh.EchoMessage;
@@ -47,15 +46,13 @@
 import org.codehaus.plexus.PlexusContainerException;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 
 /**
  * Defines the logic for server-side message processing.
  *
  * @version $Rev$ $Date$
  */
-@Component(role=MessageVisitor.class, hint="server")
+@Component(role=RshServerMessageVisitor.class)
 public class RshServerMessageVisitor
     extends MessageVisitorSupport
 {



Mime
View raw message