geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r446519 [1/4] - in /geronimo/sandbox/gcache: ./ openwire/ openwire/src/ openwire/src/main/ openwire/src/main/java/ openwire/src/main/java/org/ openwire/src/main/java/org/apache/ openwire/src/main/java/org/apache/geronimo/ openwire/src/main/...
Date Fri, 15 Sep 2006 04:57:27 GMT
Author: jgenender
Date: Thu Sep 14 21:57:24 2006
New Revision: 446519

URL: http://svn.apache.org/viewvc?view=rev&rev=446519
Log:
OpenWire protocol added


Added:
    geronimo/sandbox/gcache/openwire/
    geronimo/sandbox/gcache/openwire/openwire.iml
    geronimo/sandbox/gcache/openwire/pom.xml   (with props)
    geronimo/sandbox/gcache/openwire/src/
    geronimo/sandbox/gcache/openwire/src/main/
    geronimo/sandbox/gcache/openwire/src/main/java/
    geronimo/sandbox/gcache/openwire/src/main/java/org/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MutexTransport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/ResponseCallback.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/ResponseCorrelator.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/Transport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportAcceptListener.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportDisposedIOException.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportFilter.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportListener.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportLogger.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServer.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServerFilter.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServerSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServerThreadSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportThreadSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/WireFormatNegotiator.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/ResponseHolder.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/SslTransportFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpBufferedInputStream.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpBufferedOutputStream.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpTransport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportServer.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ByteArrayInputStream.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ByteArrayOutputStream.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ByteSequence.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/Callback.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ClassLoading.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ClassLoadingAwareObjectInputStream.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/FactoryFinder.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/IOExceptionSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/IntSequenceGenerator.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/IntrospectionSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/MarshallingSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ServiceStopper.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/ServiceSupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/util/URISupport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/wireformat/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/wireformat/ObjectStreamWireFormat.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/wireformat/WireFormat.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/wireformat/WireFormatFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/test/
Modified:
    geronimo/sandbox/gcache/pom.xml

Added: geronimo/sandbox/gcache/openwire/openwire.iml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/openwire.iml?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/openwire.iml (added)
+++ geronimo/sandbox/gcache/openwire/openwire.iml Thu Sep 14 21:57:24 2006
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="false" type="JAVA_MODULE">
+  <component name="ModuleRootManager" />
+  <component name="NewModuleRootManager">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <exclude-output />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar:///Users/jeffgenender/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar:///Users/jeffgenender/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar:///Users/jeffgenender/.m2/repository/backport-util-concurrent/backport-util-concurrent/2.0_01_pd/backport-util-concurrent-2.0_01_pd.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntryProperties />
+  </component>
+</module>
+

Added: geronimo/sandbox/gcache/openwire/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/pom.xml?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/pom.xml (added)
+++ geronimo/sandbox/gcache/openwire/pom.xml Thu Sep 14 21:57:24 2006
@@ -0,0 +1,36 @@
+<project>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.gcache</groupId>
+        <artifactId>gcache</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>openwire</artifactId>
+    <packaging>jar</packaging>
+    <version>${gcacheVersion}</version>
+
+    <name>GCache :: OpenWire</name>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

Propchange: geronimo/sandbox/gcache/openwire/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,25 @@
+package org.apache.geronimo.openwire;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface Service {
+
+    public void start() throws Exception;
+
+    public void stop() throws Exception;
+
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/Service.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,25 @@
+package org.apache.geronimo.openwire;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface ThreadPriorities {
+    public static final int INBOUND_CONNECTION = 6;
+    public static final int OUT_BOUND_DISPATCH = 6;
+    public static final int INBOUND_CLIENT_CONNECTION = 7;
+    public static final int INBOUND_CLIENT_SESSION = 7;
+    public static final int MANAGEMENT = 9;
+}
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/ThreadPriorities.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,114 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.util.IntrospectionSupport;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+abstract public class BaseCommand implements Command {
+    //TODO - FIX THIS - REMOVE AMQ SPECIFIC STUFF
+
+    protected int commandId;
+    protected boolean responseRequired;
+
+    private transient Endpoint from;
+    private transient Endpoint to;
+
+    public void copy(BaseCommand copy) {
+        copy.commandId = commandId;
+        copy.responseRequired = responseRequired;
+    }
+
+    public int getCommandId() {
+        return commandId;
+    }
+
+    public void setCommandId(int commandId) {
+        this.commandId = commandId;
+    }
+
+    public boolean isResponseRequired() {
+        return responseRequired;
+    }
+
+    public void setResponseRequired(boolean responseRequired) {
+        this.responseRequired = responseRequired;
+    }
+
+    public String toString() {
+        return IntrospectionSupport.toString(this, BaseCommand.class);
+    }
+
+    public boolean isWireFormatInfo() {
+        return false;
+    }
+
+    public boolean isBrokerInfo() {
+        return false;
+    }
+
+    public boolean isResponse() {
+        return false;
+    }
+
+    public boolean isMessageDispatch() {
+        return false;
+    }
+
+    public boolean isMessage() {
+        return false;
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }
+
+    public boolean isMessageAck() {
+        return false;
+    }
+
+    public boolean isMessageDispatchNotification() {
+        return false;
+    }
+
+    public boolean isShutdownInfo() {
+        return false;
+    }
+
+    /**
+     * The endpoint within the transport where this message came from.
+     */
+    public Endpoint getFrom() {
+        return from;
+    }
+
+    public void setFrom(Endpoint from) {
+        this.from = from;
+    }
+
+    /**
+     * The endpoint within the transport where this message is going to - null means all endpoints.
+     */
+    public Endpoint getTo() {
+        return to;
+    }
+
+    public void setTo(Endpoint to) {
+        this.to = to;
+    }
+
+
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/BaseCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,59 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface Command extends DataStructure {
+    //TODO - FIX THIS - REMOVE AMQ SPECIFIC STUFF
+
+    void setCommandId(int value);
+
+    /**
+     * @return the unique ID of this request used to map responses to requests
+     */
+    int getCommandId();
+
+    void setResponseRequired(boolean responseRequired);
+    boolean isResponseRequired();
+
+    boolean isResponse();
+    boolean isMessageDispatch();
+    boolean isBrokerInfo();
+    boolean isWireFormatInfo();
+    boolean isMessage();
+    boolean isMessageAck();
+    boolean isMessageDispatchNotification();
+    boolean isShutdownInfo();
+
+    Response visit( CommandVisitor visitor) throws Exception;
+
+    /**
+     * The endpoint within the transport where this message came from which could be null if the
+     * transport only supports a single endpoint.
+     */
+    public Endpoint getFrom();
+
+    public void setFrom(Endpoint from);
+
+    /**
+     * The endpoint within the transport where this message is going to - null means all endpoints.
+     */
+    public Endpoint getTo();
+
+    public void setTo(Endpoint to);
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Command.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,153 @@
+package org.apache.geronimo.openwire.command;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface CommandTypes {
+    //TODO - FIX THIS - REMOVE AMQ SPECIFIC STUFF
+
+    // A marshaling layer can use this type to specify a null object.
+    byte  NULL                              = 0;
+
+    ///////////////////////////////////////////////////
+    //
+    // Info objects sent back and forth client/server when
+    // setting up a client connection.
+    //
+    ///////////////////////////////////////////////////
+    byte  WIREFORMAT_INFO                   = 1;
+    byte  BROKER_INFO                       = 2;
+    byte  CONNECTION_INFO                   = 3;
+    byte  SESSION_INFO                      = 4;
+    byte  CONSUMER_INFO                     = 5;
+    byte  PRODUCER_INFO                     = 6;
+    byte  TRANSACTION_INFO                  = 7;
+    byte  DESTINATION_INFO                  = 8;
+    byte  REMOVE_SUBSCRIPTION_INFO          = 9;
+    byte  KEEP_ALIVE_INFO                   = 10;
+    byte  SHUTDOWN_INFO                     = 11;
+    byte  REMOVE_INFO                       = 12;
+    byte  CONTROL_COMMAND                   = 14;
+    byte  FLUSH_COMMAND                     = 15;
+    byte  CONNECTION_ERROR                  = 16;
+    byte CONSUMER_CONTROL                   = 17;
+    byte CONNECTION_CONTROL                 = 18;
+
+    ///////////////////////////////////////////////////
+    //
+    // Messages that go back and forth between the client
+    // and the server.
+    //
+    ///////////////////////////////////////////////////
+    byte  MESSAGE_PULL                      = 20;
+    byte  MESSAGE_DISPATCH                  = 21;
+    byte  MESSAGE_ACK                       = 22;
+
+    byte  ACTIVEMQ_MESSAGE                  = 23;
+    byte  ACTIVEMQ_BYTES_MESSAGE            = 24;
+    byte  ACTIVEMQ_MAP_MESSAGE              = 25;
+    byte  ACTIVEMQ_OBJECT_MESSAGE           = 26;
+    byte  ACTIVEMQ_STREAM_MESSAGE           = 27;
+    byte  ACTIVEMQ_TEXT_MESSAGE             = 28;
+
+    ///////////////////////////////////////////////////
+    //
+    // Command Response messages
+    //
+    ///////////////////////////////////////////////////
+    byte  RESPONSE                          = 30;
+    byte  EXCEPTION_RESPONSE                = 31;
+    byte  DATA_RESPONSE                     = 32;
+    byte  DATA_ARRAY_RESPONSE               = 33;
+    byte  INTEGER_RESPONSE                  = 34;
+
+
+    ///////////////////////////////////////////////////
+    //
+    // Used by discovery
+    //
+    ///////////////////////////////////////////////////
+    byte  DISCOVERY_EVENT                   = 40;
+
+    ///////////////////////////////////////////////////
+    //
+    // Command object used by the Journal
+    //
+    ///////////////////////////////////////////////////
+    byte  JOURNAL_ACK                       = 50;
+    byte  JOURNAL_REMOVE                    = 52;
+    byte  JOURNAL_TRACE                     = 53;
+    byte  JOURNAL_TRANSACTION               = 54;
+    byte  DURABLE_SUBSCRIPTION_INFO         = 55;
+
+    ///////////////////////////////////////////////////
+    //
+    // Reliability and fragmentation
+    //
+    ///////////////////////////////////////////////////
+    byte  PARTIAL_COMMAND                   = 60;
+    byte  PARTIAL_LAST_COMMAND              = 61;
+
+    byte  REPLAY                            = 65;
+
+
+    ///////////////////////////////////////////////////
+    //
+    // Types used represent basic Java types.
+    //
+    ///////////////////////////////////////////////////
+    byte  BYTE_TYPE                         = 70;
+    byte  CHAR_TYPE                         = 71;
+    byte  SHORT_TYPE                        = 72;
+    byte  INTEGER_TYPE                      = 73;
+    byte  LONG_TYPE                         = 74;
+    byte  DOUBLE_TYPE                       = 75;
+    byte  FLOAT_TYPE                        = 76;
+    byte  STRING_TYPE                       = 77;
+    byte  BOOLEAN_TYPE                      = 78;
+    byte  BYTE_ARRAY_TYPE                   = 79;
+
+
+    ///////////////////////////////////////////////////
+    //
+    // Broker to Broker command objects
+    //
+    ///////////////////////////////////////////////////
+
+    byte  MESSAGE_DISPATCH_NOTIFICATION     = 90;
+    byte  NETWORK_BRIDGE_FILTER             = 91;
+
+
+    ///////////////////////////////////////////////////
+    //
+    // Data structures contained in the command objects.
+    //
+    ///////////////////////////////////////////////////
+    byte  ACTIVEMQ_QUEUE                    = 100;
+    byte  ACTIVEMQ_TOPIC                    = 101;
+    byte  ACTIVEMQ_TEMP_QUEUE               = 102;
+    byte  ACTIVEMQ_TEMP_TOPIC               = 103;
+
+    byte  MESSAGE_ID                        = 110;
+    byte  ACTIVEMQ_LOCAL_TRANSACTION_ID     = 111;
+    byte  ACTIVEMQ_XA_TRANSACTION_ID        = 112;
+
+    byte  CONNECTION_ID                     = 120;
+    byte  SESSION_ID                        = 121;
+    byte  CONSUMER_ID                       = 122;
+    byte  PRODUCER_ID                       = 123;
+    byte  BROKER_ID                         = 124;
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/CommandTypes.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,27 @@
+package org.apache.geronimo.openwire.command;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface DataStructure {
+
+    /**
+     * @return The type of the data structure
+     */
+    byte getDataStructureType();
+    boolean isMarshallAware();
+
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DataStructure.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,40 @@
+package org.apache.geronimo.openwire.command;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface Endpoint {
+
+    /**
+     * Returns the name of the endpoint.
+     */
+    public String getName();
+
+    /**
+     * Returns the broker ID for this endpoint, if the endpoint is a broker or
+     * null
+     */
+    public BrokerId getBrokerId();
+
+    /**
+     * Returns the broker information for this endpoint, if the endpoint is a
+     * broker or null
+     */
+    public BrokerInfo getBrokerInfo();
+
+    public void setBrokerInfo(BrokerInfo brokerInfo);
+
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Endpoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,46 @@
+package org.apache.geronimo.openwire.command;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class ExceptionResponse extends Response {
+
+    Throwable exception;
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.EXCEPTION_RESPONSE;
+
+    public ExceptionResponse() {
+    }
+    public ExceptionResponse(Throwable e) {
+        setException(e);
+    }
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public Throwable getException() {
+        return exception;
+    }
+
+    public void setException(Throwable exception) {
+        this.exception = exception;
+    }
+
+    public boolean isException() {
+        return true;
+    }
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ExceptionResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,99 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.util.IntrospectionSupport;
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class KeepAliveInfo extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.KEEP_ALIVE_INFO;
+
+    private transient Endpoint from;
+    private transient Endpoint to;
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public boolean isResponse() {
+        return false;
+    }
+
+    public boolean isMessageDispatch() {
+        return false;
+    }
+
+    public boolean isMessage() {
+        return false;
+    }
+
+    public boolean isMessageAck() {
+        return false;
+    }
+
+    public boolean isBrokerInfo() {
+        return false;
+    }
+
+    public boolean isWireFormatInfo() {
+        return false;
+    }
+
+    /**
+     * The endpoint within the transport where this message came from.
+     */
+    public Endpoint getFrom() {
+        return from;
+    }
+
+    public void setFrom(Endpoint from) {
+        this.from = from;
+    }
+
+    /**
+     * The endpoint within the transport where this message is going to - null means all endpoints.
+     */
+    public Endpoint getTo() {
+        return to;
+    }
+
+    public void setTo(Endpoint to) {
+        this.to = to;
+    }
+
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processKeepAlive( this );
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }
+
+    public boolean isMessageDispatchNotification(){
+        return false;
+    }
+
+    public boolean isShutdownInfo(){
+        return false;
+    }
+
+    public String toString() {
+        return IntrospectionSupport.toString(this, KeepAliveInfo.class);
+    }
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/KeepAliveInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,33 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.wireformat.WireFormat;
+import org.apache.geronimo.openwire.util.ByteSequence;
+
+import java.io.IOException;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface MarshallAware {
+
+    public void beforeMarshall(WireFormat wireFormat) throws IOException;
+    public void afterMarshall(WireFormat wireFormat) throws IOException;
+
+    public void beforeUnmarshall(WireFormat wireFormat) throws IOException;
+    public void afterUnmarshall(WireFormat wireFormat) throws IOException;
+
+    public void setCachedMarshalledForm(WireFormat wireFormat, ByteSequence data);
+    public ByteSequence getCachedMarshalledForm(WireFormat wireFormat);
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MarshallAware.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,48 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class Response extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.RESPONSE;
+    int correlationId;
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public int getCorrelationId() {
+        return correlationId;
+    }
+
+    public void setCorrelationId(int responseId) {
+        this.correlationId = responseId;
+    }
+
+    public boolean isResponse() {
+        return true;
+    }
+
+    public boolean isException() {
+        return false;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return null;
+    }
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Response.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,308 @@
+package org.apache.geronimo.openwire.command;
+
+import org.apache.geronimo.openwire.util.ByteSequence;
+import org.apache.geronimo.openwire.util.ByteArrayInputStream;
+import org.apache.geronimo.openwire.util.ByteArrayOutputStream;
+import org.apache.geronimo.openwire.util.MarshallingSupport;
+import org.apache.geronimo.openwire.state.CommandVisitor;
+import org.apache.geronimo.openwire.wireformat.WireFormat;
+
+import java.io.IOException;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Arrays;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class WireFormatInfo implements Command, MarshallAware {
+
+    private static final int MAX_PROPERTY_SIZE = 1024*4;
+    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.WIREFORMAT_INFO;
+    static final private byte MAGIC[] = new byte[] { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' };
+
+    protected byte magic[] = MAGIC;
+    protected int version;
+    protected ByteSequence marshalledProperties;
+
+    protected transient Map properties;
+    private transient Endpoint from;
+    private transient Endpoint to;
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public boolean isWireFormatInfo() {
+        return true;
+    }
+
+    public boolean isMarshallAware() {
+        return true;
+    }
+
+    public byte[] getMagic() {
+        return magic;
+    }
+    public void setMagic(byte[] magic) {
+        this.magic = magic;
+    }
+
+    public int getVersion() {
+        return version;
+    }
+    public void setVersion(int version) {
+        this.version = version;
+    }
+
+    public ByteSequence getMarshalledProperties() {
+        return marshalledProperties;
+    }
+    public void setMarshalledProperties(ByteSequence marshalledProperties) {
+        this.marshalledProperties = marshalledProperties;
+    }
+
+    /**
+     * The endpoint within the transport where this message came from.
+     */
+    public Endpoint getFrom() {
+        return from;
+    }
+
+    public void setFrom(Endpoint from) {
+        this.from = from;
+    }
+
+    /**
+     * The endpoint within the transport where this message is going to - null means all endpoints.
+     */
+    public Endpoint getTo() {
+        return to;
+    }
+
+    public void setTo(Endpoint to) {
+        this.to = to;
+    }
+
+    //////////////////////
+    //
+    // Implementation Methods.
+    //
+    //////////////////////
+
+    public Object getProperty(String name) throws IOException {
+        if( properties == null ) {
+            if( marshalledProperties ==null )
+                return null;
+            properties = unmarsallProperties(marshalledProperties);
+        }
+        return properties.get(name);
+    }
+
+    public Map getProperties() throws IOException {
+        if( properties == null ) {
+            if( marshalledProperties==null )
+                return Collections.EMPTY_MAP;
+            properties = unmarsallProperties(marshalledProperties);
+        }
+        return Collections.unmodifiableMap(properties);
+    }
+
+    public void clearProperties() {
+        marshalledProperties = null;
+        properties=null;
+    }
+
+    public void setProperty(String name, Object value) throws IOException {
+        lazyCreateProperties();
+        properties.put(name, value);
+    }
+
+    protected void lazyCreateProperties() throws IOException {
+        if( properties == null ) {
+            if( marshalledProperties == null ) {
+                properties = new HashMap();
+            } else {
+                properties = unmarsallProperties(marshalledProperties);
+                marshalledProperties = null;
+            }
+        }
+    }
+
+    private Map unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
+        return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)), MAX_PROPERTY_SIZE);
+    }
+
+    public void beforeMarshall(WireFormat wireFormat) throws IOException {
+        // Need to marshal the properties.
+        if( marshalledProperties==null && properties!=null ) {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            DataOutputStream os = new DataOutputStream(baos);
+            MarshallingSupport.marshalPrimitiveMap(properties, os);
+            os.close();
+            marshalledProperties = baos.toByteSequence();
+        }
+    }
+
+    public void afterMarshall(WireFormat wireFormat) throws IOException {
+    }
+
+    public void beforeUnmarshall(WireFormat wireFormat) throws IOException {
+    }
+
+    public void afterUnmarshall(WireFormat wireFormat) throws IOException {
+    }
+
+
+    public boolean isValid() {
+        return magic != null && Arrays.equals(magic, MAGIC);
+    }
+
+    public void setResponseRequired(boolean responseRequired) {
+    }
+
+    /**
+     * @throws IOException
+     */
+    public boolean isCacheEnabled() throws IOException {
+        return Boolean.TRUE == getProperty("CacheEnabled");
+    }
+    public void setCacheEnabled(boolean cacheEnabled) throws IOException {
+        setProperty("CacheEnabled", cacheEnabled ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @throws IOException
+     */
+    public boolean isStackTraceEnabled() throws IOException {
+        return Boolean.TRUE == getProperty("StackTraceEnabled");
+    }
+    public void setStackTraceEnabled(boolean stackTraceEnabled) throws IOException {
+        setProperty("StackTraceEnabled", stackTraceEnabled ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @throws IOException
+     */
+    public boolean isTcpNoDelayEnabled() throws IOException {
+        return Boolean.TRUE == getProperty("TcpNoDelayEnabled");
+    }
+    public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) throws IOException {
+        setProperty("TcpNoDelayEnabled", tcpNoDelayEnabled ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @throws IOException
+     */
+    public boolean isSizePrefixDisabled() throws IOException {
+        return Boolean.TRUE == getProperty("SizePrefixDisabled");
+    }
+    public void setSizePrefixDisabled(boolean prefixPacketSize) throws IOException {
+        setProperty("SizePrefixDisabled", prefixPacketSize ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @throws IOException
+     */
+    public boolean isTightEncodingEnabled() throws IOException {
+        return Boolean.TRUE == getProperty("TightEncodingEnabled");
+    }
+    public void setTightEncodingEnabled(boolean tightEncodingEnabled) throws IOException {
+        setProperty("TightEncodingEnabled", tightEncodingEnabled ? Boolean.TRUE : Boolean.FALSE);
+    }
+
+    /**
+     * @throws IOException
+     */
+    public long getMaxInactivityDuration() throws IOException {
+        Long l = (Long) getProperty("MaxInactivityDuration");
+        return l == null ? 0 : l.longValue();
+    }
+    public void seMaxInactivityDuration(long maxInactivityDuration) throws IOException {
+        setProperty("MaxInactivityDuration", new Long(maxInactivityDuration));
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processWireFormat(this);
+    }
+
+    public String toString() {
+        Map p=null;
+        try {
+            p = getProperties();
+        } catch (IOException e) {
+        }
+        return "WireFormatInfo { version="+version+", properties="+p+", magic="+toString(magic)+"}";
+    }
+
+    private String toString(byte []data) {
+        StringBuffer sb = new StringBuffer();
+        sb.append('[');
+        for (int i = 0; i < data.length; i++) {
+            if( i != 0 ) {
+                sb.append(',');
+            }
+            sb.append((char)data[i]);
+        }
+        sb.append(']');
+        return sb.toString();
+    }
+
+    ///////////////////////////////////////////////////////////////
+    //
+    // This are not implemented.
+    //
+    ///////////////////////////////////////////////////////////////
+
+    public void setCommandId(int value) {
+    }
+    public int getCommandId() {
+        return 0;
+    }
+    public boolean isResponseRequired() {
+        return false;
+    }
+    public boolean isResponse() {
+        return false;
+    }
+    public boolean isBrokerInfo() {
+        return false;
+    }
+    public boolean isMessageDispatch() {
+        return false;
+    }
+    public boolean isMessage() {
+        return false;
+    }
+    public boolean isMessageAck() {
+        return false;
+    }
+    public boolean isMessageDispatchNotification(){
+        return false;
+    }
+    public boolean isShutdownInfo(){
+        return false;
+    }
+    public void setCachedMarshalledForm(WireFormat wireFormat, ByteSequence data) {
+    }
+    public ByteSequence getCachedMarshalledForm(WireFormat wireFormat) {
+        return null;
+    }
+
+}
+

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/WireFormatInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,35 @@
+package org.apache.geronimo.openwire.state;
+
+import org.apache.geronimo.openwire.command.Response;
+import org.apache.geronimo.openwire.command.WireFormatInfo;
+import org.apache.geronimo.openwire.command.KeepAliveInfo;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public interface CommandVisitor {
+    //TODO - Fill out like below with new commands
+    /**
+    Response processAddConnection(ConnectionInfo info) throws Exception;
+    Response processAddSession(SessionInfo info) throws Exception;
+    Response processAddProducer(ProducerInfo info) throws Exception;
+    Response processAddConsumer(ConsumerInfo info) throws Exception;
+    **/
+
+    Response processWireFormat(WireFormatInfo info) throws Exception;
+    Response processKeepAlive(KeepAliveInfo info) throws Exception;
+
+
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,57 @@
+package org.apache.geronimo.openwire.thread;
+
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;
+import edu.emory.mathcs.backport.java.util.concurrent.ScheduledFuture;
+import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory;
+
+import java.util.HashMap;
+
+/**
+ * Copyright 2006 The Apache Software Foundation
+ * <p/>
+ * Licensed 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+public class Scheduler {
+
+    static public ScheduledThreadPoolExecutor clockDaemon = new ScheduledThreadPoolExecutor(5, new ThreadFactory(){
+            public Thread newThread(Runnable runnable) {
+                Thread thread = new Thread(runnable,"ActiveMQ Scheduler");
+                thread.setDaemon(true);
+                return thread;
+            }
+        });
+    static {
+        clockDaemon.setKeepAliveTime(5, TimeUnit.SECONDS);
+        clockDaemon.allowCoreThreadTimeOut(false);
+    }
+    static HashMap clockTickets = new HashMap();
+
+    synchronized static public void executePeriodically(final Runnable task, long period) {
+        ScheduledFuture ticket = clockDaemon.scheduleAtFixedRate(task, period, period, TimeUnit.MILLISECONDS);
+        clockTickets.put(task, ticket);
+    }
+
+    synchronized static public void cancel(Runnable task) {
+        ScheduledFuture ticket = (ScheduledFuture) clockTickets.remove(task);
+        if( ticket!=null ) {
+            ticket.cancel(true);
+            clockDaemon.remove(task);
+        }
+    }
+
+    public static void executeAfterDelay(final Runnable task, long redeliveryDelay) {
+        clockDaemon.schedule(task, redeliveryDelay, TimeUnit.MILLISECONDS);
+    }
+
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Scheduler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java Thu Sep 14 21:57:24 2006
@@ -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.
+ */
+package org.apache.geronimo.openwire.transport;
+
+import java.net.URI;
+
+public interface CompositeTransport extends Transport {
+    public void add(URI[] uris);
+    public void remove(URI[] uris);
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/CompositeTransport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,59 @@
+/**
+ *
+ * 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.openwire.transport;
+
+import java.io.IOException;
+
+import org.apache.geronimo.openwire.command.Command;
+
+/**
+ * An asynchronous listener of commands
+ *
+ * @version $Revision$
+ */
+public class DefaultTransportListener implements TransportListener {
+
+    /**
+     * called to process a command
+     * @param command
+     */
+    public void onCommand(Command command){
+    }
+    /**
+     * An unrecoverable exception has occured on the transport
+     * @param error
+     */
+    public void onException(IOException error){
+    }
+
+    /**
+     * The transport has suffered an interuption from which it hopes to recover
+     *
+     */
+    public void transportInterupted(){
+    }
+
+
+    /**
+     * The transport has resumed after an interuption
+     *
+     */
+    public void transportResumed(){
+    }
+
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/DefaultTransportListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,68 @@
+/**
+ *
+ * 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.openwire.transport;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.openwire.command.Response;
+
+import edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+
+public class FutureResponse {
+    private static final Log log = LogFactory.getLog(FutureResponse.class);
+           
+    private final ResponseCallback responseCallback;
+    private final ArrayBlockingQueue responseSlot = new ArrayBlockingQueue(1);
+    
+    public FutureResponse(ResponseCallback responseCallback) {
+        this.responseCallback = responseCallback;
+    }
+
+    public Response getResult() throws IOException {
+        try {
+            return (Response) responseSlot.take();
+        }
+        catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            if (log.isDebugEnabled()) {
+                log.debug("Operation interupted: " + e, e);
+            }
+            throw new InterruptedIOException("Interrupted.");
+        }
+    }
+    
+    public Response getResult(int timeout) throws IOException {
+        try {
+            return (Response) responseSlot.poll(timeout,TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {
+            throw new InterruptedIOException("Interrupted.");
+        }
+    }
+    
+    public void set(Response result) {
+        if( responseSlot.offer(result) ) {
+            if( responseCallback !=null ) {
+                responseCallback.onCompletion(this);
+            }        
+        }
+    }
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/FutureResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java Thu Sep 14 21:57:24 2006
@@ -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.openwire.transport;
+
+import java.io.IOException;
+
+/**
+ * This is exception is thrown when the transport layer detects that the underlying socket has been inactive for 
+ * too long.
+ * 
+ * @version $Revision$
+ */
+public class InactivityIOException extends IOException {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 5816001466763503220L;
+
+    public InactivityIOException() {
+        super();
+    }
+
+    /**
+     * @param message
+     */
+    public InactivityIOException(String message) {
+        super(message);
+    }
+
+
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityIOException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,182 @@
+/**
+ *
+ * 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.openwire.transport;
+
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.openwire.command.WireFormatInfo;
+import org.apache.geronimo.openwire.command.KeepAliveInfo;
+import org.apache.geronimo.openwire.command.Command;
+import org.apache.geronimo.openwire.thread.Scheduler;
+
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Used to make sure that commands are arriving periodically from the peer of the transport.  
+ * 
+ * @version $Revision$
+ */
+public class InactivityMonitor extends TransportFilter {
+
+    private final Log log = LogFactory.getLog(InactivityMonitor.class);
+    
+    private WireFormatInfo localWireFormatInfo;
+    private WireFormatInfo remoteWireFormatInfo;
+    private boolean monitorStarted=false;
+
+    private final AtomicBoolean commandSent=new AtomicBoolean(false);
+    private final AtomicBoolean inSend=new AtomicBoolean(false);
+
+    private final AtomicBoolean commandReceived=new AtomicBoolean(true);
+    private final AtomicBoolean inReceive=new AtomicBoolean(false);
+    
+    private final Runnable readChecker = new Runnable() {
+        public void run() {
+            readCheck();
+        }
+    };
+    
+    private final Runnable writeChecker = new Runnable() {
+        public void run() {
+            writeCheck();
+        }
+    };
+    
+    
+    public InactivityMonitor(Transport next) {
+        super(next);
+    }
+
+    public void stop() throws Exception {
+        stopMonitorThreads();
+        next.stop();
+    }
+
+        
+    private void writeCheck() {
+        if( inSend.get() ) {
+            log.trace("A send is in progress");
+            return;
+        }
+        
+        if( !commandSent.get() ) {
+            log.trace("No message sent since last write check, sending a KeepAliveInfo");
+            try {
+                next.oneway(new KeepAliveInfo());
+            } catch (IOException e) {
+                onException(e);
+            }
+        } else {
+            log.trace("Message sent since last write check, resetting flag");
+        }
+        
+        commandSent.set(false);
+        
+    }
+
+    private void readCheck() {
+        if( inReceive.get() ) {
+            log.trace("A receive is in progress");
+            return;
+        }
+        
+        if( !commandReceived.get() ) {
+            log.debug("No message received since last read check for " + toString() + "! Throwing InactivityIOException.");
+            onException(new InactivityIOException("Channel was inactive for too long."));           
+        } else {
+            log.trace("Message received since last read check, resetting flag: ");
+        }
+        
+        commandReceived.set(false);
+    }
+
+    public void onCommand(Command command) {
+        inReceive.set(true);
+        try {
+            if( command.isWireFormatInfo() ) {
+                synchronized( this ) {
+                    remoteWireFormatInfo = (WireFormatInfo) command;
+                    try {
+                        startMonitorThreads();
+                    } catch (IOException e) {
+                        onException(e);
+                    }
+                }
+            }
+            getTransportListener().onCommand(command);
+        } finally {
+            inReceive.set(false);
+            commandReceived.set(true);
+        }
+    }
+
+    
+    public void oneway(Command command) throws IOException {
+        // Disable inactivity monitoring while processing a command.
+        inSend.set(true);
+        commandSent.set(true);
+        try {
+            if( command.isWireFormatInfo() ) {
+                synchronized( this ) {
+                    localWireFormatInfo = (WireFormatInfo) command;
+                    startMonitorThreads();
+                }
+            }
+            next.oneway(command);
+        } finally {
+            inSend.set(false);
+        }
+    }
+    
+    public void onException(IOException error) {
+        stopMonitorThreads();
+        getTransportListener().onException(error);
+    }
+    
+    
+    synchronized private void startMonitorThreads() throws IOException {
+        if( monitorStarted ) 
+            return;
+        if( localWireFormatInfo == null )
+            return;
+        if( remoteWireFormatInfo == null )
+            return;
+        
+        long l = Math.min(localWireFormatInfo.getMaxInactivityDuration(), remoteWireFormatInfo.getMaxInactivityDuration());
+        if( l > 0 ) {
+            Scheduler.executePeriodically(writeChecker, l/2);
+            Scheduler.executePeriodically(readChecker, l);
+            monitorStarted=true;        
+        }
+    }
+    
+    /**
+     * 
+     */
+    synchronized private void stopMonitorThreads() {
+        if( monitorStarted ) {
+            Scheduler.cancel(readChecker);
+            Scheduler.cancel(writeChecker);
+            monitorStarted=false;
+        }
+    }
+    
+
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java?view=auto&rev=446519
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java Thu Sep 14 21:57:24 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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.openwire.transport;
+
+import java.io.IOException;
+
+import org.apache.activemq.command.Command;
+import org.apache.activemq.wireformat.WireFormat;
+
+public class MarshallingTransportFilter extends TransportFilter {
+
+    private final WireFormat localWireFormat;
+    private final WireFormat remoteWireFormat;
+
+    public MarshallingTransportFilter(Transport next, WireFormat localWireFormat, WireFormat remoteWireFormat) {
+        super(next);
+        this.localWireFormat = localWireFormat;
+        this.remoteWireFormat = remoteWireFormat;
+    }
+    
+    public void oneway(Command command) throws IOException {
+        next.oneway((Command) remoteWireFormat.unmarshal(localWireFormat.marshal(command)));
+    }
+    
+    public void onCommand(Command command) {
+        try {
+            getTransportListener().onCommand((Command)localWireFormat.unmarshal(remoteWireFormat.marshal(command)));
+        } catch (IOException e) {
+            getTransportListener().onException(e);
+        }
+    }
+    
+}

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message