geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r579828 [1/2] - in /geronimo/sandbox/gshell/trunk/gshell-whisper: ./ src/main/java/org/apache/geronimo/gshell/whisper/crypto/ src/main/java/org/apache/geronimo/gshell/whisper/marshal/ src/main/java/org/apache/geronimo/gshell/whisper/message...
Date Wed, 26 Sep 2007 22:15:46 GMT
Author: jdillon
Date: Wed Sep 26 15:15:42 2007
New Revision: 579828

URL: http://svn.apache.org/viewvc?rev=579828&view=rev
Log:
Flurry of whisper stuff

Added:
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java   (contents, props changed)
      - copied, changed from r578596, geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageSupport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/InvalidLocationException.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportAdapter.java   (contents, props changed)
      - copied, changed from r578596, geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseConfiguration.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseService.java   (contents, props changed)
      - copied, changed from r578596, geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseCommon.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SslAddressFactory.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/TcpAddressFactory.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/VmAddressFactory.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/crypto/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/request/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/session/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/stream/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java   (with props)
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportTest.java   (with props)
Removed:
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/crypto/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/marshal/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/CryptoAwareMessage.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandler.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageID.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageSupport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageType.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageVisitor.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/spi/
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestEncoder.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseCommon.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-whisper/pom.xml
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageException.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Request.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestException.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestManager.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestResponseFilter.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestTimeoutException.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Requestor.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Response.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/session/ThreadPoolModel.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocator.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SslTransport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SslTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SslTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/TcpTransport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/TcpTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/TcpTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactory.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportServer.java

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/pom.xml?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/pom.xml (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/pom.xml Wed Sep 26 15:15:42 2007
@@ -73,7 +73,13 @@
             <groupId>org.apache.mina</groupId>
             <artifactId>mina-filter-ssl</artifactId>
         </dependency>
-        
+
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-container-default</artifactId>
+            <scope>test</scope>
+        </dependency>
+
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>

Copied: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java (from r578596, geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageSupport.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java?p2=geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java&p1=geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageSupport.java&r1=578596&r2=579828&rev=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageSupport.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java Wed Sep 26 15:15:42 2007
@@ -19,37 +19,32 @@
 
 package org.apache.geronimo.gshell.whisper.message;
 
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
-import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
-import org.apache.geronimo.gshell.whisper.marshal.Marshaller;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.common.WriteFuture;
 
 /**
  * Support for {@link Message} implementations.
  *
  * @version $Rev$ $Date$
  */
-public class MessageSupport
+public class BaseMessage
     implements Message
 {
-    private MessageType type;
+    private static final AtomicLong SEQUENCE_GENERATOR = new AtomicLong(0);
 
-    private MessageID id;
+    private Type type;
 
-    private MessageID cid;
+    private ID id = LongMessageID.generate();
 
-    private Long sequence;
+    private ID cid;
 
-    private long timestamp;
-    
-    private transient IoSession session;
+    private Long sequence = SEQUENCE_GENERATOR.getAndIncrement();
 
-    private transient boolean frozen;
+    private long timestamp = System.currentTimeMillis();
 
-    protected MessageSupport(final MessageType type) {
+    protected BaseMessage(final Type type) {
         assert type != null;
         
         this.type = type;
@@ -60,26 +55,26 @@
     public int hashCode() {
         return getId().hashCode();
     }
-    
-    public MessageType getType() {
+
+    public String toString() {
+        return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+    }
+
+    public Type getType() {
         return type;
     }
 
-    public MessageID getId() {
+    public ID getId() {
         return id;
     }
     
-    public MessageID getCorrelationId() {
+    public ID getCorrelationId() {
         return cid;
     }
 
-    public void setCorrelationId(final MessageID id) {
-        ensureWritable();
-
-        if (this.cid == null) {
-            throw new IllegalStateException("Correlation ID has already been set");
-        }
-
+    public void setCorrelationId(final ID id) {
+        assert cid != null;
+        
         this.cid = id;
     }
 
@@ -89,123 +84,5 @@
 
     public long getSequence() {
         return sequence;
-    }
-
-    public void setSession(final IoSession session) {
-        ensureWritable();
-        
-        this.session = session;
-    }
-
-    public IoSession getSession() {
-        if (session == null) {
-            throw new IllegalStateException("Session has not been attached");
-        }
-        
-        return session;
-    }
-
-    protected void ensureWritable() {
-        if (frozen) {
-            throw new IllegalStateException("Message is frozen");
-        }
-    }
-
-    public void freeze() {
-        frozen = true;
-    }
-
-    public boolean isFrozen() {
-        return frozen;
-    }
-
-    public void process(final IoSession session, final MessageVisitor visitor) throws Exception {
-        // Non-operation
-    }
-
-    public WriteFuture reply(final Message msg) {
-        assert msg != null;
-
-        IoSession session = getSession();
-
-        msg.setCorrelationId(getId());
-        msg.freeze();
-
-        return session.write(msg);
-    }
-
-    public void readExternal(final ByteBuffer in) throws Exception {
-        assert in != null;
-
-        id = (MessageID) Marshaller.unmarshal(in);
-
-        cid = (MessageID) Marshaller.unmarshal(in);
-
-        timestamp = in.getLong();
-
-        sequence = in.getLong();
-    }
-
-    public void writeExternal(final ByteBuffer out) throws Exception {
-        assert out != null;
-
-        Marshaller.marshal(out, getId());
-
-        Marshaller.marshal(out, getCorrelationId());
-
-        out.putLong(getTimestamp());
-
-        out.putLong(getSequence());
-    }
-
-    //
-    // ToString Muck
-    //
-
-    protected static final class MessageToStringStyle
-        extends ToStringStyle
-    {
-        private static final long serialVersionUID = 1L;
-
-        public static final String[] EXCLUDED_FIELDS = {
-            "type",
-            "session",
-            "frozen"
-        };
-
-        MessageToStringStyle() {
-            this.setUseShortClassName(true);
-            this.setUseIdentityHashCode(false);
-        }
-
-        protected void appendClassName(StringBuffer buffer, Object object) {
-            if (object instanceof Message) {
-                Message msg = (Message) object;
-
-                buffer.append(msg.getType());
-            }
-            else {
-                super.appendClassName(buffer, object);
-            }
-        }
-
-        private Object readResolve() {
-            return MESSAGE_STYLE;
-        }
-    }
-
-    private static final ToStringStyle MESSAGE_STYLE = new MessageToStringStyle();
-
-    protected ToStringBuilder createToStringBuilder() {
-        return new ToStringBuilder(this, MESSAGE_STYLE)
-                .append("id", getId())
-                .append("sequence", getSequence())
-                .append("timestamp", getTimestamp());
-    }
-
-    public String toString() {
-        return new ReflectionToStringBuilder(this, MESSAGE_STYLE)
-                .setExcludeFieldNames(MessageToStringStyle.EXCLUDED_FIELDS)
-                .toString();
     }
 }

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.whisper.message;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class LongMessageID
+    implements Message.ID
+{
+    private final Long value;
+
+    private LongMessageID(final long value) {
+        this.value = value;
+    }
+
+    public int hashCode() {
+        return value.hashCode();
+    }
+
+    public boolean equals(final Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        else if (obj == null) {
+            return false;
+        }
+        else if (!(obj instanceof LongMessageID)) {
+            return false;
+        }
+
+        return value.equals(((LongMessageID)obj).value);
+    }
+
+    public String toString() {
+        return value.toString();
+    }
+
+    private static final AtomicLong ID_COUNTER = new AtomicLong(0);
+
+    public static Message.ID generate() {
+        return new LongMessageID(ID_COUNTER.getAndIncrement());
+    }
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/LongMessageID.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java Wed Sep 26 15:15:42 2007
@@ -19,9 +19,7 @@
 
 package org.apache.geronimo.gshell.whisper.message;
 
-import org.apache.geronimo.gshell.whisper.marshal.MarshalAware;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.common.WriteFuture;
+import java.io.Serializable;
 
 /**
  * ???
@@ -29,29 +27,51 @@
  * @version $Rev$ $Date$
  */
 public interface Message
-    extends MarshalAware
+    extends Serializable
 {
-    MessageID getId();
+    ID getId();
 
-    MessageID getCorrelationId();
+    ID getCorrelationId();
 
-    void setCorrelationId(MessageID id);
+    //
+    // TODO: See if the higher-level bits can do this automatically
+    //
+    // void setCorrelationId(ID id);
 
-    MessageType getType();
+    Type getType();
 
     long getTimestamp();
 
     long getSequence();
 
-    void setSession(IoSession session);
-
-    IoSession getSession();
-
-    void freeze();
-
-    boolean isFrozen();
-
-    void process(IoSession session, MessageVisitor visitor) throws Exception;
-
-    WriteFuture reply(Message msg);
+    interface ID
+        extends Serializable
+    {
+        // Empty
+    }
+
+    //
+    // TODO: Make the Type an Enum using Generics
+    //
+
+    interface Type
+        extends Serializable
+    {
+        Class<? extends Message> getType();
+
+        //
+        // TODO: Just expose a byte index() and serialize that and leave the mapping up to the protocol implementation
+        //
+    }
+
+    interface Factory
+    {
+        Message create(Type type) throws Exception;
+
+        // TODO: ??
+        // Message create(byte index) throws Exception;
+        //
+        // Would still really like to use enums... but need to do some magic to marshal and unmarshal them...
+        //
+    }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageException.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageException.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageException.java Wed Sep 26 15:15:42 2007
@@ -45,8 +45,8 @@
         super();
     }
 
-    public MessageException(final MessageID id) {
-        super(String.valueOf(id));
+    public MessageException(final Message.ID id) {
+        this(String.valueOf(id));
     }
 
     public MessageException(final Message msg) {

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Protocol
+{
+    // How to read/write messages
+
+    // How to generate message ids
+
+    // What filters to use
+
+    // What handler to use
+
+    // Any other protocol specific config muck as well
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/Protocol.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolConfiguration
+{
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolDescriptor
+{
+    //
+    // TODO: Look at maybe using the chain handler as a base, so that we can easily get our logic abstractly?
+    //
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * Thrown to indicate a protocol problem has occured.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ProtocolException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1;
+
+    public ProtocolException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+
+    public ProtocolException(final String msg) {
+        super(msg);
+    }
+
+    public ProtocolException(final Throwable cause) {
+        super(cause);
+    }
+
+    public ProtocolException() {
+        super();
+    }
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolHeader
+{
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolHeader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolManager
+{
+    //
+    // TODO: Look at maybe using the chain handler as a base, so that we can easily get our logic abstractly?
+    //
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,29 @@
+/*
+ * 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.whisper.protocol;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolMetaData
+{
+}
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolMetaData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.whisper.protocol;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.geronimo.gshell.whisper.message.Message;
+import org.apache.mina.common.ByteBuffer;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProtocolWireFormat
+{
+    void setVersion(int version);
+
+    int getVersion();
+
+    void marshal(DataOutput out, Message message) throws IOException;
+
+    Message unmarshal(DataInput in) throws IOException;
+
+    ByteBuffer marshal(Message message) throws IOException;
+
+    Message unmarshal(ByteBuffer buffer) throws IOException;
+
+    //
+    // Factory
+    //
+
+    interface Factory
+    {
+        ProtocolWireFormat create();
+    }
+}

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/ProtocolWireFormat.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java Wed Sep 26 15:15:42 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.
+ */
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.geronimo.gshell.whisper.protocol;
\ No newline at end of file

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/protocol/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Request.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Request.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Request.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Request.java Wed Sep 26 15:15:42 2007
@@ -29,7 +29,6 @@
 import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.geronimo.gshell.whisper.message.MessageID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -98,7 +97,7 @@
         return message;
     }
 
-    public MessageID getId() {
+    public Message.ID getId() {
         return getMessage().getId();
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestException.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestException.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestException.java Wed Sep 26 15:15:42 2007
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.whisper.request;
 
-import org.apache.geronimo.gshell.whisper.message.MessageID;
+import org.apache.geronimo.gshell.whisper.message.Message;
 
 /**
  * ???
@@ -31,7 +31,7 @@
 {
     private static final long serialVersionUID = 1;
 
-    public RequestException(final MessageID id) {
+    public RequestException(final Message.ID id) {
         super(String.valueOf(id));
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestManager.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestManager.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestManager.java Wed Sep 26 15:15:42 2007
@@ -32,7 +32,7 @@
 import org.apache.geronimo.gshell.common.NamedThreadFactory;
 import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
-import org.apache.geronimo.gshell.whisper.message.MessageID;
+import org.apache.geronimo.gshell.whisper.message.Message;
 import org.apache.geronimo.gshell.whisper.session.SessionAttributeBinder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +48,7 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private final Map<MessageID,Registration> registrations = new HashMap<MessageID, Registration>();
+    private final Map<Message.ID,Registration> registrations = new HashMap<Message.ID, Registration>();
 
     private final ScheduledExecutorService scheduler;
 
@@ -64,7 +64,7 @@
         scheduler = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() + 1, tf);
     }
 
-    private Registration get(final MessageID id) {
+    private Registration get(final Message.ID id) {
         assert id != null;
 
         Registration reg = registrations.get(id);
@@ -76,7 +76,7 @@
         return reg;
     }
 
-    private Registration remove(final MessageID id) {
+    private Registration remove(final Message.ID id) {
         assert id != null;
 
         Registration reg = registrations.remove(id);
@@ -94,7 +94,7 @@
         lock.lock();
 
         try {
-            MessageID id = request.getId();
+            Message.ID id = request.getId();
 
             if (registrations.containsKey(id)) {
                 throw new DuplicateRegistrationException(id);
@@ -111,7 +111,7 @@
         }
     }
 
-    public Request lookup(final MessageID id) {
+    public Request lookup(final Message.ID id) {
         assert id != null;
 
         lock.lock();
@@ -126,7 +126,7 @@
         }
     }
 
-    public Request deregister(final MessageID id) {
+    public Request deregister(final Message.ID id) {
         assert id != null;
 
         lock.lock();
@@ -145,7 +145,7 @@
         }
     }
 
-    public void activate(final MessageID id) {
+    public void activate(final Message.ID id) {
         assert id != null;
 
         lock.lock();
@@ -165,7 +165,7 @@
         }
     }
 
-    public void deactivate(final MessageID id) {
+    public void deactivate(final Message.ID id) {
         assert id != null;
 
         lock.lock();
@@ -185,7 +185,7 @@
         }
     }
 
-    private void timeout(final MessageID id) {
+    private void timeout(final Message.ID id) {
         assert id != null;
 
         lock.lock();
@@ -290,7 +290,7 @@
         }
 
         public void timeout() {
-            MessageID id = request.getId();
+            Message.ID id = request.getId();
 
             if (timeoutFuture.isCancelled()) {
                 throw new TimeoutAbortedException("Timeout has been canceled: " + id);
@@ -316,7 +316,7 @@
     public class NotRegisteredException
         extends RequestException
     {
-        public NotRegisteredException(final MessageID id) {
+        public NotRegisteredException(final Message.ID id) {
             super(id);
         }
     }
@@ -324,7 +324,7 @@
     public class DuplicateRegistrationException
         extends RequestException
     {
-        public DuplicateRegistrationException(final MessageID id) {
+        public DuplicateRegistrationException(final Message.ID id) {
             super(id);
         }
     }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestResponseFilter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestResponseFilter.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestResponseFilter.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestResponseFilter.java Wed Sep 26 15:15:42 2007
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.whisper.request;
 
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.geronimo.gshell.whisper.message.MessageID;
 import org.apache.mina.common.IoFilterAdapter;
 import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
@@ -83,7 +82,7 @@
     public void messageReceived(final NextFilter nextFilter, final IoSession session, final Object message) throws Exception {
         Message msg = null;
 
-        MessageID id = null;
+        Message.ID id = null;
 
         if (message instanceof Message) {
             msg = (Message)message;

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestTimeoutException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestTimeoutException.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestTimeoutException.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/RequestTimeoutException.java Wed Sep 26 15:15:42 2007
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.whisper.request;
 
-import org.apache.geronimo.gshell.whisper.message.MessageID;
+import org.apache.geronimo.gshell.whisper.message.Message;
 
 /**
  * Thrown to indicate that a request has been timed out.
@@ -31,15 +31,15 @@
 {
     private static final long serialVersionUID = 1;
 
-    private final MessageID id;
+    private final Message.ID id;
 
-    public RequestTimeoutException(final MessageID id) {
+    public RequestTimeoutException(final Message.ID id) {
         super("Request timed out: " + id);
 
         this.id = id;
     }
 
-    public MessageID getId() {
+    public Message.ID getId() {
         return id;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Requestor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Requestor.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Requestor.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Requestor.java Wed Sep 26 15:15:42 2007
@@ -37,13 +37,13 @@
  */
 public class Requestor
 {
-    public static final Duration DEFAULT_TIMEOUT = new Duration(10, TimeUnit.SECONDS);
+    private static final Duration DEFAULT_TIMEOUT = new Duration(10, TimeUnit.SECONDS);
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     
     private final IoSession session;
 
-    private final Duration timeout;
+    private Duration timeout;
 
     public Requestor(final IoSession session, final Duration timeout) {
         this.session = session;
@@ -54,36 +54,37 @@
         this(session, DEFAULT_TIMEOUT);
     }
 
-    public Requestor(final Transport transport, final long timeout, final TimeUnit unit) {
-        this(transport.getSession(), new Duration(timeout, unit));
-    }
-
     public Requestor(final Transport transport) {
         this(transport.getSession(), DEFAULT_TIMEOUT);
     }
 
-    public RequestWriteFuture submit(final Message msg, final long timeout, final TimeUnit unit) throws Exception {
+    public Duration getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(final Duration timeout) {
+        assert timeout != null;
+        
+        this.timeout = timeout;
+    }
+
+    public RequestWriteFuture submit(final Message msg, final Duration timeout) throws Exception {
         assert msg != null;
+        assert timeout != null;
 
-        Request req = new Request(msg, timeout, unit);
+        Request req = new Request(msg, timeout.getValue(), timeout.getUnit());
 
         WriteFuture wf = session.write(req);
 
         return new RequestWriteFuture(wf, req);
     }
 
-    public RequestWriteFuture submit(final Message msg, final Duration timeout) throws Exception {
-        return submit(msg, timeout.getValue(), timeout.getUnit());
-    }
-
     public RequestWriteFuture submit(final Message msg) throws Exception {
-        return submit(msg, timeout.getValue(), timeout.getUnit());
+        return submit(msg, timeout);
     }
 
-    public Message request(final Message msg, final long timeout, final TimeUnit unit) throws Exception {
-        assert msg != null;
-
-        RequestWriteFuture wf = submit(msg, timeout, unit);
+    public Message request(final Message msg, final Duration timeout) throws Exception {
+        RequestWriteFuture wf = submit(msg, timeout);
 
         Request req = wf.getRequest();
 
@@ -92,12 +93,8 @@
         return resp.getMessage();
     }
 
-    public Message request(final Message msg, final Duration timeout) throws Exception {
-        return request(msg, timeout.getValue(), timeout.getUnit());
-    }
-
     public Message request(final Message msg) throws Exception {
-        return request(msg, timeout.getValue(), timeout.getUnit());
+        return request(msg, timeout);
     }
     
     //

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Response.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Response.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Response.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/request/Response.java Wed Sep 26 15:15:42 2007
@@ -22,7 +22,6 @@
 import org.apache.geronimo.gshell.common.tostring.ToStringBuilder;
 import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.geronimo.gshell.whisper.message.MessageID;
 
 //
 // NOTE: Snatched and massaged from Apache Mina
@@ -87,7 +86,7 @@
         return message;
     }
 
-    public MessageID getId() {
+    public Message.ID getId() {
         return getMessage().getId();
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/session/ThreadPoolModel.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/session/ThreadPoolModel.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/session/ThreadPoolModel.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/session/ThreadPoolModel.java Wed Sep 26 15:15:42 2007
@@ -23,6 +23,8 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.geronimo.gshell.common.NamedThreadFactory;
 import org.apache.mina.common.IoFilterChain;
@@ -69,25 +71,21 @@
         filter = new ExecutorFilter(threadPool);
     }
 
-    public void close() {
-        //
-        // FIXME: This causes some problems when a rsh client closes, like:
-        //
-        //        java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThread)
-        //
+    public ThreadPoolModel(final Class type, final Object suffix) {
+        this(type.getSimpleName() + "-" + suffix);
+    }
 
-        /*
-        List<Runnable> pending = threadPool.shutdownNow();
+    public ThreadPoolModel(final Class type, final AtomicLong counter) {
+        this(type.getSimpleName() + "-" + counter.getAndIncrement());
+    }
+
+    public ThreadPoolModel(final Class type, final AtomicInteger counter) {
+        this(type.getSimpleName() + "-" + counter.getAndIncrement());
+    }
 
-        if (!pending.isEmpty()) {
-            log.warn("There were {} pending tasks which have not been run", pending.size());
-        }
-        */
+    public void shutdown() {
+        threadPool.shutdown();
     }
-    
-    //
-    // ThreadModel
-    //
 
     public void buildFilterChain(final IoFilterChain chain) throws Exception {
         assert chain != null;

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java Wed Sep 26 15:15:42 2007
@@ -19,14 +19,9 @@
 
 package org.apache.geronimo.gshell.whisper.stream;
 
-import java.io.IOException;
-
-import org.apache.geronimo.gshell.whisper.marshal.Marshaller;
+import org.apache.geronimo.gshell.whisper.message.BaseMessage;
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.geronimo.gshell.whisper.message.MessageSupport;
-import org.apache.geronimo.gshell.whisper.message.MessageType;
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.RuntimeIOException;
 
 /**
  * Write a buffer to a stream.
@@ -34,7 +29,7 @@
  * @version $Rev$ $Date$
  */
 public class StreamMessage
-    extends MessageSupport
+    extends BaseMessage
 {
     private ByteBuffer buffer;
 
@@ -52,7 +47,7 @@
     }
 
     public StreamMessage(final ByteBuffer buffer) {
-        this(Type.IN, buffer);
+        this(StreamMessage.Type.IN, buffer);
     }
     
     public StreamMessage() {
@@ -67,20 +62,8 @@
         this.buffer = buffer;
     }
 
-    public void readExternal(final ByteBuffer in) throws Exception {
-        assert in != null;
-
-        buffer = Marshaller.readBuffer(in);
-    }
-
-    public void writeExternal(final ByteBuffer out) throws Exception {
-        assert out != null;
-
-        Marshaller.writeBuffer(out, buffer);
-    }
-
     public static enum Type
-        implements MessageType
+        implements Message.Type
     {
 
         IN,  // (local SYSOUT to remote SYSIN)
@@ -90,22 +73,6 @@
 
         public Class<? extends Message> getType() {
             return StreamMessage.class;
-        }
-
-        // Dynamically fitgure out how bit we are, assumes each enum is sized the same
-        private volatile Integer size;
-
-        public int size() {
-            if (size == null) {
-                try {
-                    size = Marshaller.marshall(IN).length;
-                }
-                catch (IOException e) {
-                    throw new RuntimeIOException(e);
-                }
-            }
-
-            return size;
         }
     }
 }

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/InvalidLocationException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/InvalidLocationException.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/InvalidLocationException.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/InvalidLocationException.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.whisper.transport;
+
+import java.net.URI;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidLocationException
+    extends TransportException
+{
+    public InvalidLocationException(final URI location) {
+        super("Invalid location: " + location);
+    }
+}

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

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

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

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java Wed Sep 26 15:15:42 2007
@@ -19,15 +19,18 @@
 
 package org.apache.geronimo.gshell.whisper.transport;
 
+import java.io.Closeable;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
-import java.util.concurrent.TimeUnit;
+import java.util.EventListener;
 
 import org.apache.geronimo.gshell.common.Duration;
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.mina.common.IoService;
+import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.common.ThreadModel;
 import org.apache.mina.common.WriteFuture;
 
 /**
@@ -35,31 +38,69 @@
  *
  * @version $Rev$ $Date$
  */
-public interface Transport
+public interface Transport<T extends IoConnector>
+    extends Closeable
 {
-    URI getRemoteLocation();
+    URI getRemote();
 
-    URI getLocalLocation();
+    URI getLocal();
 
-    IoService getService();
+    T getConnector();
 
     IoSession getSession();
 
-    void connect() throws Exception;
+    void close();
 
-    boolean isConnected();
+    // Messages
 
-    void close();
-    
     WriteFuture send(Object msg) throws Exception;
 
     Message request(Message msg, Duration timeout) throws Exception;
 
-    Message request(Message msg, long timeout, TimeUnit unit) throws Exception;
-
     Message request(Message msg) throws Exception;
 
+    //
+    // Streams
+    //
+
     InputStream getInputStream();
 
     OutputStream getOutputStream();
+
+    OutputStream getErrorStream();
+
+    //
+    // Listeners
+    //
+
+    void addListener(Listener listener);
+
+    void removeListener(Listener listener);
+
+    interface Listener
+        extends EventListener
+    {
+        //
+        // TODO:
+        //
+    }
+    
+    //
+    // Configuration
+    //
+
+    void setConfiguration(Configuration config);
+
+    Configuration getConfiguration();
+
+    interface Configuration
+    {
+        IoHandler getHandler();
+
+        void setHandler(IoHandler handler);
+
+        ThreadModel getThreadModel();
+
+        void setThreadModel(ThreadModel threadModel);
+    }
 }

Copied: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportAdapter.java (from r578596, geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportAdapter.java?p2=geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportAdapter.java&p1=geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java&r1=578596&r2=579828&rev=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/Transport.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportAdapter.java Wed Sep 26 15:15:42 2007
@@ -22,44 +22,162 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.geronimo.gshell.common.Duration;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
 import org.apache.geronimo.gshell.whisper.message.Message;
-import org.apache.mina.common.IoService;
+import org.apache.geronimo.gshell.whisper.request.Requestor;
+import org.apache.geronimo.gshell.whisper.stream.SessionInputStream;
+import org.apache.geronimo.gshell.whisper.stream.SessionOutputStream;
+import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
 
 /**
- * Provides the client-side protocol interface.
+ * ???
  *
  * @version $Rev$ $Date$
  */
-public interface Transport
+public class TransportAdapter
+    implements Transport
 {
-    URI getRemoteLocation();
+    private final IoSession session;
 
-    URI getLocalLocation();
+    public TransportAdapter(final IoSession session) {
+        assert session != null;
 
-    IoService getService();
+        this.session = session;
+    }
+    
+    public String toString() {
+        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+    }
 
-    IoSession getSession();
+    public URI getRemote() {
+        throw new UnsupportedOperationException();
+    }
 
-    void connect() throws Exception;
+    public URI getLocal() {
+        throw new UnsupportedOperationException();
+    }
 
-    boolean isConnected();
+    public IoConnector getConnector() {
+        throw new UnsupportedOperationException();
+    }
 
-    void close();
-    
-    WriteFuture send(Object msg) throws Exception;
+    public IoSession getSession() {
+        ensureOpened();
+
+        return session;
+    }
+
+    //
+    // Streams
+    //
+
+    public InputStream getInputStream() {
+        ensureOpened();
+
+        return SessionInputStream.BINDER.lookup(session);
+    }
+
+    public OutputStream getOutputStream() {
+        ensureOpened();
+
+        return SessionOutputStream.BINDER.lookup(session);
+    }
+
+    public OutputStream getErrorStream() {
+        ensureOpened();
+
+        throw new UnsupportedOperationException();
+    }
+
+    //
+    // Sending Messages
+    //
+
+    public WriteFuture send(final Object msg) throws Exception {
+        assert msg != null;
+
+        ensureOpened();
+
+        return session.write(msg);
+    }
+
+    public Message request(final Message msg) throws Exception {
+        assert msg != null;
+
+        ensureOpened();
+
+        Requestor requestor = new Requestor(this);
+
+        return requestor.request(msg);
+    }
+
+    public Message request(final Message msg, final Duration timeout) throws Exception {
+        assert msg != null;
+        assert timeout != null;
+
+        ensureOpened();
+
+        Requestor requestor = new Requestor(this);
+
+        return requestor.request(msg, timeout);
+    }
+
+    //
+    // Closeable
+    //
+
+    private boolean closed;
+
+    public synchronized boolean isClosed() {
+        return closed;
+    }
+
+    protected void ensureOpened() {
+        if (isClosed()) {
+            throw new IllegalStateException("Closed");
+        }
+    }
+
+    public synchronized void close() {
+        if (isClosed()) {
+            return;
+        }
+
+        session.close();
+        
+        closed = true;
+    }
+
+    //
+    // Listeners
+    //
+
+    public void addListener(final Listener listener) {
+        assert listener != null;
+
+        throw new UnsupportedOperationException();
+    }
 
-    Message request(Message msg, Duration timeout) throws Exception;
+    public void removeListener(final Listener listener) {
+        assert listener != null;
 
-    Message request(Message msg, long timeout, TimeUnit unit) throws Exception;
+        throw new UnsupportedOperationException();
+    }
 
-    Message request(Message msg) throws Exception;
+    //
+    // Configuration
+    //
 
-    InputStream getInputStream();
+    public void setConfiguration(final Configuration config) {
+        throw new UnsupportedOperationException();
+    }
 
-    OutputStream getOutputStream();
+    public Configuration getConfiguration() {
+        throw new UnsupportedOperationException();
+    }
 }

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

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

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

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactory.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactory.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactory.java Wed Sep 26 15:15:42 2007
@@ -21,16 +21,32 @@
 
 import java.net.URI;
 
+import org.apache.mina.common.IoHandler;
+
 /**
  * Factory for producing client and server transport implementations.
  *
  * @version $Rev$ $Date$
  */
-public interface TransportFactory
+public interface TransportFactory<T extends Transport, TC extends T.Configuration, S extends TransportServer, SC extends S.Configuration>
 {
-    Transport connect(final URI remote, final URI local) throws Exception;
+    String getScheme();
+    
+    T connect(URI remote, URI local, TC config) throws Exception;
+
+    T connect(URI remote, URI local, IoHandler handler) throws Exception;
+
+    /*
+    Transport connect(URI remote, URI local) throws Exception;
+
+    Transport connect(URI remote) throws Exception;
+    */
+    
+    S bind(URI location, SC config) throws Exception;
 
-    Transport connect(final URI remote) throws Exception;
+    S bind(URI location, IoHandler handler) throws Exception;
 
-    TransportServer bind(final URI location) throws Exception;
+    /*
+    TransportServer bind(URI location) throws Exception;
+    */
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocator.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocator.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocator.java Wed Sep 26 15:15:42 2007
@@ -32,28 +32,30 @@
  * @version $Rev$ $Date$
  */
 @Component(role=TransportFactoryLocator.class)
-public class TransportFactoryLocator
+public class TransportFactoryLocator<T extends TransportFactory>
 {
     @Requirement
     private PlexusContainer container;
 
-    public TransportFactory locate(final URI location) throws MissingSchemeException, ComponentLookupException {
+    public PlexusContainer getContainer() {
+        return container;
+    }
+
+    public void setContainer(final PlexusContainer container) {
+        this.container = container;
+    }
+
+    public T locate(final URI location) throws InvalidLocationException, ComponentLookupException {
         assert location != null;
 
         String scheme = location.getScheme();
 
         if (scheme == null) {
-            throw new MissingSchemeException(location);
+            throw new InvalidLocationException(location);
         }
 
-        return (TransportFactory) container.lookup(TransportFactory.class, scheme);
+        // noinspection unchecked
+        return (T) container.lookup(TransportFactory.class, scheme);
     }
 
-    public static class MissingSchemeException
-        extends TransportException
-    {
-        public MissingSchemeException(final URI location) {
-            super("Invalid location; missing scheme: " + location);
-        }
-    }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportServer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportServer.java?rev=579828&r1=579827&r2=579828&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportServer.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/TransportServer.java Wed Sep 26 15:15:42 2007
@@ -19,24 +19,60 @@
 
 package org.apache.geronimo.gshell.whisper.transport;
 
+import java.io.Closeable;
 import java.net.URI;
+import java.util.EventListener;
 
-import org.apache.mina.common.IoService;
+import org.apache.mina.common.IoAcceptor;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.ThreadModel;
 
 /**
  * Provides the server-side protocol interface.
  *
  * @version $Rev$ $Date$
  */
-public interface TransportServer
+public interface TransportServer<T extends IoAcceptor>
+    extends Closeable
 {
     URI getLocation();
 
-    IoService getService();
+    T getAcceptor();
 
-    void bind() throws Exception;
+    void close();
 
-    boolean isBound();
+    //
+    // Listeners
+    //
 
-    void close();
+    void addListener(Listener listener);
+
+    void removeListener(Listener listener);
+
+    interface Listener
+        extends EventListener
+    {
+        //
+        // TODO:
+        //
+    }
+
+    //
+    // Configuration
+    //
+
+    void setConfiguration(Configuration config);
+
+    Configuration getConfiguration();
+
+    interface Configuration
+    {
+        IoHandler getHandler();
+
+        void setHandler(IoHandler hanlder);
+
+        ThreadModel getThreadModel();
+
+        void setThreadModel(ThreadModel threadModel);
+    }
 }

Added: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java?rev=579828&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java Wed Sep 26 15:15:42 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.whisper.transport.base;
+
+import java.net.SocketAddress;
+import java.net.URI;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AddressFactory<T extends SocketAddress>
+{
+    T create(URI location) throws Exception;
+}

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/AddressFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message