geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r447058 [1/4] - in /geronimo/sandbox/gcache/openwire: ./ src/main/java/org/apache/geronimo/openwire/command/ src/main/java/org/apache/geronimo/openwire/state/ src/main/java/org/apache/geronimo/openwire/thread/ src/main/java/org/apache/geron...
Date Sun, 17 Sep 2006 12:35:47 GMT
Author: jgenender
Date: Sun Sep 17 05:35:45 2006
New Revision: 447058

URL: http://svn.apache.org/viewvc?view=rev&rev=447058
Log:
GERONIMO-2410 - patch to add discovery

Added:
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DestinationInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DiscoveryEvent.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Message.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageAck.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageDispatch.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/RemoveInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/SessionId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/SessionInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/TransactionId.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/TransactionInfo.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/ConnectionState.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/ConnectionStateTracker.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/ConsumerState.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/ProducerState.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/SessionState.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/Tracked.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/TransactionState.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/DedicatedTaskRunner.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/DefaultThreadPools.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/PooledTaskRunner.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Task.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/TaskRunner.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/TaskRunnerFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/thread/Valve.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MutexTransport.java.orig   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/DiscoveryAgent.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/DiscoveryAgentFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/DiscoveryListener.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/DiscoveryTransport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/DiscoveryTransportFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/multicast/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/multicast/MulticastDiscoveryAgent.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/multicast/MulticastDiscoveryAgentFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/package.html   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/simple/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/simple/SimpleDiscoveryAgent.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/simple/SimpleDiscoveryAgentFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/discovery/simple/package.html   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/failover/
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/failover/FailoverTransport.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/failover/FailoverTransportFactory.java   (with props)
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/failover/package.html   (with props)
Modified:
    geronimo/sandbox/gcache/openwire/pom.xml
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/state/CommandVisitor.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/InactivityMonitor.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MarshallingTransportFilter.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/MutexTransport.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/ResponseCorrelator.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/Transport.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportFactory.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportFilter.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportLogger.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServerSupport.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportServerThreadSupport.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/TransportSupport.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/WireFormatNegotiator.java
    geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/transport/tcp/TcpTransportServer.java

Modified: geronimo/sandbox/gcache/openwire/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/pom.xml?view=diff&rev=447058&r1=447057&r2=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/pom.xml (original)
+++ geronimo/sandbox/gcache/openwire/pom.xml Sun Sep 17 05:35:45 2006
@@ -31,6 +31,11 @@
             <artifactId>junit</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.gcache</groupId>
+            <artifactId>gcache-server</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionId.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionId.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionId.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionId.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,89 @@
+/**
+ *
+ * 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.command;
+
+
+/**
+ * 
+ * @openwire:marshaller code="120"
+ * @version $Revision$
+ */
+public class ConnectionId implements DataStructure {
+    
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONNECTION_ID;
+    
+    protected String value;
+    
+    public ConnectionId() {        
+    }
+    
+    public ConnectionId(String connectionId) {
+        this.value = connectionId;
+    }
+    
+    public ConnectionId(ConnectionId id) {
+        this.value = id.getValue();
+    }
+
+    public ConnectionId(SessionId id) {
+        this.value = id.getConnectionId();
+    }
+
+//    public ConnectionId(ProducerId id) {
+//        this.value = id.getConnectionId();
+//    }
+//    
+//    public ConnectionId(ConsumerId id) {
+//        this.value = id.getConnectionId();
+//    }
+
+    public int hashCode() {
+        return value.hashCode();
+    }
+    
+    public boolean equals(Object o) {
+        if( this == o )
+            return true;
+        if( o == null || o.getClass()!=ConnectionId.class )
+            return false;
+        ConnectionId id = (ConnectionId) o;
+        return value.equals(id.value);
+    }
+    
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public String toString() {
+        return value;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getValue() {
+        return value;
+    }
+    public void setValue(String connectionId) {
+        this.value = connectionId;
+    }
+    
+    public boolean isMarshallAware() {
+        return false;
+    }
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionInfo.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConnectionInfo.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,169 @@
+/**
+ *
+ * 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.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+
+/**
+ * 
+ * @openwire:marshaller code="3"
+ * @version $Revision$
+ */
+public class ConnectionInfo extends BaseCommand {
+    
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONNECTION_INFO;
+    
+    protected ConnectionId connectionId;
+    protected String clientId;
+    protected String userName;
+    protected String password;
+    protected NodeId[] nodePath;
+    protected boolean brokerMasterConnector;
+    protected boolean manageable;
+    protected transient Object transportContext; 
+    
+    public ConnectionInfo() {        
+    }    
+    public ConnectionInfo(ConnectionId connectionId) {
+        this.connectionId=connectionId;
+    }
+    
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    public void copy(ConnectionInfo copy) {
+        super.copy(copy);
+        copy.clientId = clientId;
+        copy.userName = userName;
+        copy.password = password;
+        copy.nodePath = nodePath;
+        copy.brokerMasterConnector = brokerMasterConnector;
+        copy.manageable = manageable;
+    } 
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ConnectionId getConnectionId() {
+        return connectionId;
+    }
+    public void setConnectionId(ConnectionId connectionId) {
+        this.connectionId = connectionId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public String getClientId() {
+        return clientId;
+    }
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+    
+//    public RemoveInfo createRemoveCommand() {
+//        RemoveInfo command = new RemoveInfo(getConnectionId());
+//        command.setResponseRequired(isResponseRequired());
+//        return command;
+//    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getPassword() {
+        return password;
+    }
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getUserName() {
+        return userName;
+    }
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    /**
+     * The route of brokers the command has moved through. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public NodeId[] getNodePath() {
+        return nodePath;
+    }
+    public void setBrokerPath(NodeId[] brokerPath) {
+        this.nodePath = brokerPath;
+    }
+    
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processAddConnection( this );
+    }
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isBrokerMasterConnector(){
+        return brokerMasterConnector;
+    }
+    /**
+     * @param brokerMasterConnector The brokerMasterConnector to set.
+     */
+    public void setBrokerMasterConnector(boolean slaveBroker){
+        this.brokerMasterConnector=slaveBroker;
+    }
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isManageable(){
+        return manageable;
+    }
+    /**
+     * @param manageable The manageable to set.
+     */
+    public void setManageable(boolean manageable){
+        this.manageable=manageable;
+    }
+    
+    /**
+	 * Transports may wish to associate additional data with the connection.  For
+	 * example, an SSL transport may use this field to attach the client certificates
+	 * used when the conection was established.
+     * 
+     * @return the transport context.
+     */
+	public Object getTransportContext() {
+		return transportContext;
+	}
+	
+	/**
+	 * Transports may wish to associate additional data with the connection.  For
+	 * example, an SSL transport may use this field to attach the client certificates
+	 * used when the conection was established.
+	 *  
+	 * @param transportContext value used to set the transport context
+	 */
+	public void setTransportContext(Object transportContext) {
+		this.transportContext = transportContext;
+	}
+
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerId.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerId.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerId.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerId.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,123 @@
+/**
+ *
+ * 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.command;
+
+
+/**
+ * 
+ * @openwire:marshaller code="122"
+ * @version $Revision$
+ */
+public class ConsumerId implements DataStructure {
+    
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONSUMER_ID;
+    
+    protected String connectionId;
+    protected long sessionId;
+    protected long value;
+
+    protected transient int hashCode;
+    protected transient String key;
+    protected transient SessionId parentId;
+    
+    public ConsumerId() {        
+    }
+    
+    public ConsumerId(SessionId sessionId, long consumerId) {
+        this.connectionId = sessionId.getConnectionId();
+        this.sessionId = sessionId.getValue();
+        this.value=consumerId;
+    }
+    
+    public ConsumerId(ConsumerId id) {
+        this.connectionId = id.getConnectionId();
+        this.sessionId = id.getSessionId();
+        this.value=id.getValue();
+    }
+    
+    public SessionId getParentId() {
+        if( parentId == null ) {
+            parentId = new SessionId(this);
+        }
+        return parentId;
+    }
+
+    public int hashCode() {
+        if( hashCode == 0 ) {
+            hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+        }
+        return hashCode;
+    }
+    
+    public boolean equals(Object o) {
+        if( this == o )
+            return true;
+        if( o == null || o.getClass()!=ConsumerId.class )
+            return false;
+        ConsumerId id = (ConsumerId) o;
+        return sessionId==id.sessionId 
+               && value==id.value
+               && connectionId.equals(id.connectionId);
+    }
+    
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public String toString() {
+        if( key==null ) {
+            key = connectionId+":"+sessionId+":"+value;
+        }
+        return key;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getConnectionId() {
+        return connectionId;
+    }
+    public void setConnectionId(String connectionId) {
+        this.connectionId = connectionId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public long getSessionId() {
+        return sessionId;
+    }    
+    public void setSessionId(long sessionId) {
+        this.sessionId = sessionId;
+    }
+    
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getValue() {
+        return value;
+    }
+    public void setValue(long consumerId) {
+        this.value = consumerId;
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerInfo.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ConsumerInfo.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,344 @@
+/**
+ *
+ * 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.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+import sun.tools.tree.BooleanExpression;
+
+
+/**
+ * 
+ * @openwire:marshaller code="5"
+ * @version $Revision$
+ */
+public class ConsumerInfo extends BaseCommand {
+    
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.CONSUMER_INFO;
+    
+    public static final byte HIGH_PRIORITY                = 10;
+    public static final byte NORMAL_PRIORITY              = 0;
+    public static final byte NETWORK_CONSUMER_PRIORITY    = -5;
+    public static final byte LOW_PRIORITY                 = -10;
+    
+    
+    protected ConsumerId consumerId;
+    protected int prefetchSize;
+    protected int maximumPendingMessageLimit;
+    protected boolean browser;
+    protected boolean dispatchAsync;
+    protected String selector;
+    protected String subcriptionName;
+    protected boolean noLocal;
+    protected boolean exclusive;
+    protected boolean retroactive;
+    protected byte priority;
+    protected NodeId[] nodePath;
+    protected boolean optimizedAcknowledge;
+    protected transient int currentPrefetchSize;//used by the broker
+    protected boolean noRangeAcks;  // if true, the consumer will not send range acks.
+    
+    protected BooleanExpression additionalPredicate;
+    protected transient boolean networkSubscription; //this subscription originated from a network connection
+    
+    public ConsumerInfo() {
+    }
+    
+    public ConsumerInfo(ConsumerId consumerId) {
+        this.consumerId=consumerId;
+    }
+    
+    public ConsumerInfo(SessionInfo sessionInfo, long consumerId) {
+        this.consumerId = new ConsumerId(sessionInfo.getSessionId(), consumerId);
+    }
+
+    public ConsumerInfo copy() {
+        ConsumerInfo info = new ConsumerInfo();
+        copy(info);
+        return info;
+    }
+
+    public void copy(ConsumerInfo info) {
+        super.copy(info);
+        info.consumerId = consumerId;
+        info.prefetchSize = prefetchSize;
+        info.maximumPendingMessageLimit = maximumPendingMessageLimit;
+        info.browser = browser;
+        info.dispatchAsync = dispatchAsync;
+        info.selector = selector;
+        info.subcriptionName=subcriptionName;
+        info.noLocal = noLocal;
+        info.exclusive = exclusive;
+        info.retroactive = retroactive;
+        info.priority = priority;
+        info.nodePath=nodePath;
+    }
+    
+    public boolean isDurable() {
+        return subcriptionName!=null;
+    }
+ 
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    /**
+     * Is used to uniquely identify the consumer to the broker.
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public ConsumerId getConsumerId() {
+        return consumerId;
+    }
+    public void setConsumerId(ConsumerId consumerId) {
+        this.consumerId = consumerId;
+    }
+
+    /**
+     * Is this consumer a queue browser?
+     * 
+     * @openwire:property version=1
+     */
+    public boolean isBrowser() {
+        return browser;
+    }
+    public void setBrowser(boolean browser) {
+        this.browser = browser;
+    }
+       
+    /**
+     * How many messages a broker will send to the client without receiving an ack before
+     * he stops dispatching messages to the client.
+     * 
+     * @openwire:property version=1
+     */
+    public int getPrefetchSize() {
+        return prefetchSize;
+    }
+
+    public void setPrefetchSize(int prefetchSize) {
+        this.prefetchSize = prefetchSize;
+        this.currentPrefetchSize = prefetchSize;
+    }
+
+    /**
+     * How many messages a broker will keep around, above the prefetch limit, for non-durable
+     * topics before starting to discard older messages.
+     * 
+     * @openwire:property version=1
+     */
+    public int getMaximumPendingMessageLimit() {
+        return maximumPendingMessageLimit;
+    }
+
+    public void setMaximumPendingMessageLimit(int maximumPendingMessageLimit) {
+        this.maximumPendingMessageLimit = maximumPendingMessageLimit;
+    }
+
+    /**
+     * Should the broker dispatch a message to the consumer async?  If he does it async, then 
+     * he uses a more SEDA style of processing while if it is not done async, then he broker 
+     * use a STP style of processing.  STP is more appropriate in high bandwidth situations or when
+     * being used by and in vm transport.
+     * 
+     * @openwire:property version=1
+     */
+    public boolean isDispatchAsync() {
+        return dispatchAsync;
+    }
+    public void setDispatchAsync(boolean dispatchAsync) {
+        this.dispatchAsync = dispatchAsync;
+    }
+
+    /**
+     * The JMS selector used to filter out messages that this consumer
+     * is interested in.
+     * 
+     * @openwire:property version=1
+     */
+    public String getSelector() {
+        return selector;
+    }
+    public void setSelector(String selector) {
+        this.selector = selector;
+    }
+
+    /**
+     * Used to identify the name of a durable subscription.
+     * 
+     * @openwire:property version=1
+     */
+    public String getSubcriptionName() {
+        return subcriptionName;
+    }
+    public void setSubcriptionName(String durableSubscriptionId) {
+        this.subcriptionName = durableSubscriptionId;
+    }
+
+    /**
+     * Set noLocal to true to avoid receiving messages that were published locally on the same connection.
+     * 
+     * @openwire:property version=1
+     */
+    public boolean isNoLocal() {
+        return noLocal;
+    }
+    public void setNoLocal(boolean noLocal) {
+        this.noLocal = noLocal;
+    }
+
+    /**
+     * An exclusive consumer locks out other consumers from being able to receive messages
+     * from the destination.  If there are multiple exclusive consumers for a destination, the first one
+     * created will be the exclusive consumer of the destination.
+     * 
+     * @openwire:property version=1
+     */
+    public boolean isExclusive() {
+        return exclusive;
+    }
+    public void setExclusive(boolean exclusive) {
+        this.exclusive = exclusive;
+    }
+
+    /**
+     * A retroactive consumer only has meaning for Topics.  It allows a consumer
+     * to retroactively see messages sent prior to the consumer being created.  If the 
+     * consumer is not durable, it will be delivered the last message published to the topic.
+     * If the consumer is durable then it will receive all persistent messages that are 
+     * still stored in persistent storage for that topic.
+     * 
+     * @openwire:property version=1
+     */
+    public boolean isRetroactive() {
+        return retroactive;
+    }
+    public void setRetroactive(boolean retroactive) {
+        this.retroactive = retroactive;
+    }
+
+    public RemoveInfo createRemoveCommand() {
+        RemoveInfo command = new RemoveInfo(getConsumerId());
+        command.setResponseRequired(isResponseRequired());
+        return command;
+    }
+
+    /**
+     * The broker will avoid dispatching to a lower priority consumer if there are other higher priority 
+     * consumers available to dispatch to.  This allows letting the broker to have an affinity to 
+     * higher priority consumers.  Default priority is 0.
+     * 
+     * @openwire:property version=1
+     */
+    public byte getPriority() {
+        return priority;
+    }
+    public void setPriority(byte priority) {
+        this.priority = priority;
+    }
+
+    /**
+     * The route of brokers the command has moved through. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public NodeId[] getNodePath() {
+        return nodePath;
+    }
+    public void setNodePath(NodeId[] nodePath) {
+        this.nodePath = nodePath;
+    }
+
+    /**
+     * A transient additional predicate that can be used it inject additional predicates
+     * into the selector on the fly.  Handy if if say a Security Broker interceptor wants to 
+     * filter out messages based on security level of the consumer.
+     * 
+     * @openwire:property version=1
+     */
+    public BooleanExpression getAdditionalPredicate() {
+        return additionalPredicate;
+    }
+    public void setAdditionalPredicate(BooleanExpression additionalPredicate) {
+        this.additionalPredicate = additionalPredicate;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processAddConsumer( this );
+    }
+
+    /**
+     * @openwire:property version=1
+     * @return Returns the networkSubscription.
+     */
+    public boolean isNetworkSubscription(){
+        return networkSubscription;
+    }
+
+    /**
+     * @param networkSubscription The networkSubscription to set.
+     */
+    public void setNetworkSubscription(boolean networkSubscription){
+        this.networkSubscription=networkSubscription;
+    }
+
+    /**
+     *  @openwire:property version=1
+     * @return Returns the optimizedAcknowledge.
+     */
+    public boolean isOptimizedAcknowledge(){
+        return optimizedAcknowledge;
+    }
+
+    /**
+     * @param optimizedAcknowledge The optimizedAcknowledge to set.
+     */
+    public void setOptimizedAcknowledge(boolean optimizedAcknowledge){
+        this.optimizedAcknowledge=optimizedAcknowledge;
+    }
+
+    /**
+     * @return Returns the currentPrefetchSize.
+     */
+    public int getCurrentPrefetchSize(){
+        return currentPrefetchSize;
+    }
+
+    /**
+     * @param currentPrefetchSize The currentPrefetchSize to set.
+     */
+    public void setCurrentPrefetchSize(int currentPrefetchSize){
+        this.currentPrefetchSize=currentPrefetchSize;
+    }
+
+    /**
+     * The broker may be able to optimize it's processing or provides better
+     * QOS if it knows the consumer will not be sending ranged acks.
+     * 
+     * @return true if the consumer will not send range acks.
+     * @openwire:property version=1
+     */
+    public boolean isNoRangeAcks() {
+        return noRangeAcks;
+    }
+
+    public void setNoRangeAcks(boolean noRangeAcks) {
+        this.noRangeAcks = noRangeAcks;
+    }
+
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DestinationInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DestinationInfo.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DestinationInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DestinationInfo.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,115 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.openwire.command;
+
+import java.io.IOException;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+/**
+ * Used to create and destroy destinations on the broker.
+ * 
+ * @openwire:marshaller code="8"
+ * @version $Revision$
+ */
+public class DestinationInfo extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.DESTINATION_INFO;
+
+    public static final byte ADD_OPERATION_TYPE=0;
+    public static final byte REMOVE_OPERATION_TYPE=1;
+    
+    protected ConnectionId connectionId;
+    protected byte operationType;
+    protected long timeout;
+    protected NodeId[] nodePath;
+    
+    public DestinationInfo() {
+    }
+
+    public DestinationInfo(ConnectionId connectionId, byte operationType) {
+        this.connectionId=connectionId;
+        this.operationType=operationType;
+    }
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    public boolean isAddOperation() {
+        return operationType == ADD_OPERATION_TYPE;
+    }
+    
+    public boolean isRemoveOperation() {
+        return operationType == REMOVE_OPERATION_TYPE;
+    }
+    
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ConnectionId getConnectionId() {
+        return connectionId;
+    }
+    public void setConnectionId(ConnectionId connectionId) {
+        this.connectionId = connectionId;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public byte getOperationType() {
+        return operationType;
+    }
+
+    public void setOperationType(byte operationType) {
+        this.operationType = operationType;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getTimeout() {
+        return timeout;
+    }
+
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+    
+    /**
+     * The route of brokers the command has moved through. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public NodeId[] getNodePath() {
+        return nodePath;
+    }
+    public void setNodePath(NodeId[] nodePath) {
+        this.nodePath = nodePath;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        if( isAddOperation() ) {
+            return visitor.processAddDestination( this );
+        } else if( isRemoveOperation() ) {
+            return visitor.processRemoveDestination( this );
+        }
+        throw new IOException("Unknown operation type: "+getOperationType());
+    }
+    
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DiscoveryEvent.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DiscoveryEvent.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DiscoveryEvent.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/DiscoveryEvent.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,67 @@
+/*
+ * 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.command;
+
+
+/**
+ * Represents a discovery event containing the details of the service
+ *
+ * @openwire:marshaller code="40"
+ * @version $Revision:$
+ */
+public class DiscoveryEvent implements DataStructure {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.DISCOVERY_EVENT;
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    protected String serviceName;
+    protected String brokerName;
+
+    public DiscoveryEvent() {        
+    }
+    
+    public DiscoveryEvent(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getServiceName() {
+        return serviceName;
+    }
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public String getBrokerName(){
+        return brokerName;
+    }
+    public void setBrokerName(String name){
+        this.brokerName = name;
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }    
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Message.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Message.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Message.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/Message.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,631 @@
+/**
+ *
+ * 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.command;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.geronimo.openwire.util.ByteArrayInputStream;
+import org.apache.geronimo.openwire.util.ByteArrayOutputStream;
+import org.apache.geronimo.openwire.util.ByteSequence;
+import org.apache.geronimo.openwire.util.MarshallingSupport;
+import org.apache.geronimo.openwire.wireformat.WireFormat;
+
+/**
+ * Represents an ActiveMQ message
+ * 
+ * @openwire:marshaller
+ * @version $Revision$
+ */
+abstract public class Message extends BaseCommand implements MarshallAware /*, MessageReference */ {
+
+    public static final int AVERAGE_MESSAGE_SIZE_OVERHEAD = 300;
+    
+    protected MessageId messageId;
+//  TODO: need a destination alternative that is not AMQDestination        
+    //protected ActiveMQDestination originalDestination;
+    protected TransactionId originalTransactionId;
+
+    protected ProducerId producerId;
+//  TODO: need a destination alternative that is not AMQDestination        
+    //protected ActiveMQDestination destination;
+    protected TransactionId transactionId;
+    
+    protected long expiration;
+    protected long timestamp;
+    protected long arrival;
+    protected String correlationId;
+//  TODO: need a destination alternative that is not AMQDestination        
+    //protected ActiveMQDestination replyTo;
+    protected boolean persistent;
+    protected String type;
+    protected byte priority;
+    protected String groupID;
+    protected int groupSequence;
+    protected ConsumerId targetConsumerId;
+    protected boolean compressed = false;
+    protected String userID;
+
+    protected ByteSequence content;
+    protected ByteSequence marshalledProperties;
+    protected DataStructure dataStructure;
+    protected int redeliveryCounter;
+
+    protected int size;
+    protected Map properties;
+    protected boolean readOnlyProperties = false;
+    protected boolean readOnlyBody = false;
+    protected transient boolean recievedByDFBridge = false;
+
+    private transient short referenceCount;
+    //private transient ActiveMQConnection connection;
+    //private transient org.apache.activemq.broker.region.Destination regionDestination;
+    private transient WireFormat cachedWireFormat;
+    private transient ByteSequence cachedWireFormatData;
+
+    private NodeId [] nodePath;
+
+    abstract public Message copy();
+    
+    protected void copy(Message copy) {
+        super.copy(copy);
+        copy.producerId = producerId;
+        copy.transactionId = transactionId;
+        //copy.destination = destination;
+        copy.messageId = messageId;
+        //copy.originalDestination = originalDestination;
+        copy.originalTransactionId = originalTransactionId;
+        copy.expiration = expiration;
+        copy.timestamp = timestamp;
+        copy.correlationId = correlationId;
+        //copy.replyTo = replyTo;
+        copy.persistent = persistent;
+        copy.redeliveryCounter = redeliveryCounter;
+        copy.type = type;
+        copy.priority = priority;
+        copy.size = size;
+        copy.groupID = groupID;
+        copy.userID = userID;
+        copy.groupSequence = groupSequence;
+
+        if( properties!=null )
+            copy.properties = new HashMap(properties);
+        else
+            copy.properties = properties;
+
+        copy.content = content;
+        copy.marshalledProperties = marshalledProperties;
+        copy.dataStructure = dataStructure;
+        copy.readOnlyProperties = readOnlyProperties;
+        copy.readOnlyBody = readOnlyBody;
+        copy.compressed = compressed;
+        copy.recievedByDFBridge = recievedByDFBridge;
+        
+        copy.arrival = arrival;
+        //copy.connection = connection;
+        //copy.regionDestination = regionDestination;
+        copy.cachedWireFormat = cachedWireFormat;
+        copy.cachedWireFormatData = cachedWireFormatData;
+    }
+        
+    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)));
+    }
+
+    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 {
+    }
+
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // Simple Field accessors
+    //
+    ///////////////////////////////////////////////////////////////////
+    
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ProducerId getProducerId() {
+        return producerId;
+    }
+    public void setProducerId(ProducerId producerId) {
+        this.producerId = producerId;
+    }
+    
+    /**
+     * @-openwire:property version=1 cache=true
+     */
+//    public ActiveMQDestination getDestination() {
+//        return destination;
+//    }
+//    public void setDestination(ActiveMQDestination destination) {
+//        this.destination = destination;
+//    }
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public TransactionId getTransactionId() {
+        return transactionId;
+    }
+    public void setTransactionId(TransactionId transactionId) {
+        this.transactionId = transactionId;
+    }
+
+    public boolean isInTransaction() {
+        return transactionId!=null;
+    }
+
+     
+    /**
+     * @-openwire:property version=1 cache=true
+     */
+//    public ActiveMQDestination getOriginalDestination() {
+//        return originalDestination;
+//    }
+//    public void setOriginalDestination(ActiveMQDestination destination) {
+//        this.originalDestination = destination;
+//    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public MessageId getMessageId() {
+        return messageId;
+    }    
+       
+    public void setMessageId(MessageId messageId) {
+        this.messageId = messageId;
+    }
+    
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public TransactionId getOriginalTransactionId() {
+        return originalTransactionId;
+    }    
+    public void setOriginalTransactionId(TransactionId transactionId) {
+        this.originalTransactionId = transactionId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public String getGroupID() {
+        return groupID;
+    }
+    public void setGroupID(String groupID) {
+        this.groupID = groupID;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public int getGroupSequence() {
+        return groupSequence;
+    }
+    public void setGroupSequence(int groupSequence) {
+        this.groupSequence = groupSequence;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getCorrelationId() {
+        return correlationId;
+    }
+    public void setCorrelationId(String correlationId) {
+        this.correlationId = correlationId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isPersistent() {
+        return persistent;
+    }
+    public void setPersistent(boolean deliveryMode) {
+        this.persistent = deliveryMode;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getExpiration() {
+        return expiration;
+    }
+    public void setExpiration(long expiration) {
+        this.expiration = expiration;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public byte getPriority() {
+        return priority;
+    }
+    public void setPriority(byte priority) {
+        this.priority = priority;
+    }
+
+    /**
+     * @-openwire:property version=1
+     */
+//    public ActiveMQDestination getReplyTo() {
+//        return replyTo;
+//    }
+//    public void setReplyTo(ActiveMQDestination replyTo) {
+//        this.replyTo = replyTo;
+//    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getTimestamp() {
+        return timestamp;
+    }
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public String getType() {
+        return type;
+    }
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public ByteSequence getContent() {
+        return content;
+    }
+    public void setContent(ByteSequence content) {
+        this.content = content;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public ByteSequence getMarshalledProperties() {
+        return marshalledProperties;
+    }
+    public void setMarshalledProperties(ByteSequence marshalledProperties) {
+        this.marshalledProperties = marshalledProperties;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public DataStructure getDataStructure() {
+        return dataStructure;
+    }
+    public void setDataStructure(DataStructure data) {
+        this.dataStructure = data;
+    }
+
+    /**
+     * Can be used to route the message to a specific consumer.  Should
+     * be null to allow the broker use normal JMS routing semantics.  If 
+     * the target consumer id is an active consumer on the broker, the message 
+     * is dropped.  Used by the AdvisoryBroker to replay advisory messages
+     * to a specific consumer. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public ConsumerId getTargetConsumerId() {
+        return targetConsumerId;
+    }
+    public void setTargetConsumerId(ConsumerId targetConsumerId) {
+        this.targetConsumerId = targetConsumerId;
+    }
+
+    public boolean isExpired() {
+        // TODO: need to be implemented. 
+        return false;
+    }
+    
+//    public boolean isAdvisory(){
+//        return type != null && type.equals(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
+//    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public boolean isCompressed() {
+        return compressed;
+    }
+    public void setCompressed(boolean compressed) {
+        this.compressed = compressed;
+    }
+    
+    public boolean isRedelivered() {
+        return redeliveryCounter>0;
+    }
+    
+    public void setRedelivered(boolean redelivered) {
+        if( redelivered ) {
+            if( !isRedelivered() ) {
+                setRedeliveryCounter(1);
+            }                
+        } else {
+            if( isRedelivered() ) {
+                setRedeliveryCounter(0);
+            }
+        }
+    }
+
+    public void incrementRedeliveryCounter() {
+        redeliveryCounter++;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public int getRedeliveryCounter() {
+        return redeliveryCounter;
+    }
+    public void setRedeliveryCounter(int deliveryCounter) {
+        this.redeliveryCounter = deliveryCounter;
+    }
+
+    /**
+     * The route of nodes the command has moved through. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public NodeId[] getNodePath() {
+        return nodePath;
+    }
+    public void setNodePath(NodeId[] nodePath) {
+        this.nodePath = nodePath;
+    }
+    
+    public boolean isReadOnlyProperties() {
+        return readOnlyProperties;
+    }
+    public void setReadOnlyProperties(boolean readOnlyProperties) {
+        this.readOnlyProperties = readOnlyProperties;
+    }
+    public boolean isReadOnlyBody() {
+        return readOnlyBody;
+    }
+    public void setReadOnlyBody(boolean readOnlyBody) {
+        this.readOnlyBody = readOnlyBody;
+    }
+
+//    public ActiveMQConnection getConnection() {
+//        return this.connection;
+//    }
+//    public void setConnection(ActiveMQConnection connection) {
+//        this.connection = connection;
+//    }
+
+    /**
+     * Used to schedule the arrival time of a message to a broker.  The broker will 
+     * not dispatch a message to a consumer until it's arrival time has elapsed. 
+     *  
+     * @openwire:property version=1
+     */
+    public long getArrival() {
+        return arrival;
+    }
+    public void setArrival(long arrival) {
+        this.arrival = arrival;
+    }
+
+    
+    /**
+     * Only set by the broker and defines the userID of the producer connection who
+     * sent this message. This is an optional field, it needs to be enabled on the
+     * broker to have this field populated.
+     *  
+     * @openwire:property version=1
+     */
+    public String getUserID() {
+        return userID;
+    }
+
+    public void setUserID(String jmsxUserID) {
+        this.userID = jmsxUserID;
+    }
+
+    public int getReferenceCount() {
+        return referenceCount;
+    }
+    
+    public Message getMessageHardRef() {
+        return this;
+    }
+
+    public Message getMessage() throws IOException {
+        return this;
+    }
+
+//    public org.apache.activemq.broker.region.Destination getRegionDestination() {
+//        return regionDestination;
+//    }
+//
+//    public void setRegionDestination(org.apache.activemq.broker.region.Destination destination) {
+//        this.regionDestination = destination;
+//    }
+
+    public boolean isMarshallAware() {
+        return true;
+    }
+
+    synchronized public ByteSequence getCachedMarshalledForm(WireFormat wireFormat) {
+        if( cachedWireFormat == null || !cachedWireFormat.equals(wireFormat) ) {
+            return null;
+        }
+        return cachedWireFormatData;
+    }
+    
+    synchronized public void evictMarshlledForm() {
+        cachedWireFormat = null;
+        cachedWireFormatData = null;
+    }
+
+    synchronized public void setCachedMarshalledForm(WireFormat wireFormat, ByteSequence data) {
+        cachedWireFormat = wireFormat;
+        cachedWireFormatData = data;
+
+        int sizeChange=0;
+        synchronized (this) {
+            if( referenceCount > 0 ) {
+                sizeChange = getSize();
+                this.size=0;
+                sizeChange -= getSize();
+            }
+        }
+        
+//      TODO: need a destination alternative that is not AMQDestination        
+//        if( sizeChange!=0 && regionDestination!=null )
+//            regionDestination.getUsageManager().decreaseUsage(sizeChange);
+        
+    }
+        
+    public int incrementReferenceCount() {
+        int rc;
+        int size;
+        synchronized (this) {
+            rc = ++referenceCount;
+            size = getSize();
+        }
+
+// TODO: need a destination alternative that is not AMQDestination        
+//        if( rc==1 && regionDestination!=null )
+//            regionDestination.getUsageManager().increaseUsage(size);
+        
+        return rc;
+    }
+    
+    synchronized public int decrementReferenceCount() {
+        int rc;
+        int size;
+        synchronized (this) {
+            rc = --referenceCount;
+            size = getSize();
+        }
+        
+//      TODO: need a destination alternative that is not AMQDestination        
+//        if( rc==0 && regionDestination!=null )
+//            regionDestination.getUsageManager().decreaseUsage(size);
+        
+        return rc;
+    }
+
+    public int getSize() {
+        if( size == 0 ) {
+            size = AVERAGE_MESSAGE_SIZE_OVERHEAD;
+            if( marshalledProperties!=null )
+                size += marshalledProperties.getLength();
+            if( content!=null )
+                size += content.getLength();
+            if( cachedWireFormatData !=null )
+                size += cachedWireFormatData.getLength() + 12;
+            else 
+                size *= 2; // Estimate what the cached data will add.   
+        }
+        return size;
+    }
+
+    /**
+     * @openwire:property version=1
+     * @return Returns the recievedByDFBridge.
+     */
+    public boolean isRecievedByDFBridge(){
+        return recievedByDFBridge;
+    }
+
+    /**
+     * @param recievedByDFBridge The recievedByDFBridge to set.
+     */
+    public void setRecievedByDFBridge(boolean recievedByDFBridge){
+        this.recievedByDFBridge=recievedByDFBridge;
+    }
+
+    public void onMessageRolledBack() {
+        incrementRedeliveryCounter();
+    }
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageAck.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageAck.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageAck.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageAck.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,191 @@
+/**
+ *
+ * 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.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+
+/**
+ * 
+ * @openwire:marshaller code="22"
+ * @version $Revision$
+ */
+public class MessageAck extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.MESSAGE_ACK;
+
+    /**
+     * Used to let the broker know that the message has been delivered to the 
+     * client.  Message will still be retained until an standard ack is received.
+     * This is used get the broker to send more messages past prefetch limits when
+     * an standard ack has not been sent.
+     */
+    public static final byte DELIVERED_ACK_TYPE=0;
+    
+    /**
+     * The standard ack case where a client wants the message to be discarded.
+     */
+    public static final byte STANDARD_ACK_TYPE=2;
+
+    /**
+     * In case the client want's to explicitly let the broker know that a 
+     * message was not processed and the message was considered a poison message.
+     */
+    public static final byte POSION_ACK_TYPE=1;
+    
+    protected byte ackType;
+    protected ConsumerId consumerId;
+    protected MessageId firstMessageId;
+    protected MessageId lastMessageId;
+//    protected ActiveMQDestination destination;
+    protected TransactionId transactionId;
+    protected int messageCount;
+    
+    protected transient String consumerKey;
+    
+    public MessageAck() {
+    }
+
+    public MessageAck(MessageDispatch md, byte ackType, int messageCount) {
+        this.ackType = ackType;
+        this.consumerId = md.getConsumerId();
+//        this.destination = md.getDestination();
+        this.lastMessageId = md.getMessage().getMessageId();
+        this.messageCount=messageCount;
+    }
+    
+    public void copy(MessageAck copy) {
+        super.copy(copy);
+        copy.firstMessageId = firstMessageId;
+        copy.lastMessageId = lastMessageId;
+//        copy.destination = destination;
+        copy.transactionId = transactionId;
+        copy.ackType = ackType;
+        copy.consumerId = consumerId;
+    }
+
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    public boolean isMessageAck() {
+        return true;
+    }
+
+    public boolean isPoisonAck() {
+        return ackType==POSION_ACK_TYPE;
+    }
+
+    public boolean isStandardAck() {
+        return ackType==STANDARD_ACK_TYPE;
+    }
+    
+    public boolean isDeliveredAck() {
+        return ackType==DELIVERED_ACK_TYPE;
+    }
+     
+    /**
+     * @openwire:property version=1 cache=true
+     */
+//    public ActiveMQDestination getDestination() {
+//        return destination;
+//    }
+//    public void setDestination(ActiveMQDestination destination) {
+//        this.destination = destination;
+//    }
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public TransactionId getTransactionId() {
+        return transactionId;
+    }    
+    public void setTransactionId(TransactionId transactionId) {
+        this.transactionId = transactionId;
+    }
+    
+    public boolean isInTransaction() {
+        return transactionId!=null;
+    }
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ConsumerId getConsumerId() {
+        return consumerId;
+    }
+    public void setConsumerId(ConsumerId consumerId) {
+        this.consumerId = consumerId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public byte getAckType() {
+        return ackType;
+    }
+    public void setAckType(byte ackType) {
+        this.ackType = ackType;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public MessageId getFirstMessageId() {
+        return firstMessageId;
+    }
+    public void setFirstMessageId(MessageId firstMessageId) {
+        this.firstMessageId = firstMessageId;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public MessageId getLastMessageId() {
+        return lastMessageId;
+    }
+    public void setLastMessageId(MessageId lastMessageId) {
+        this.lastMessageId = lastMessageId;
+    }
+
+    /**
+     * The number of messages being acknowledged in the range.
+     * @openwire:property version=1
+     */
+    public int getMessageCount() {
+        return messageCount;
+    }
+    public void setMessageCount(int messageCount) {
+        this.messageCount = messageCount;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processMessageAck( this );
+    }
+
+    /**
+     * A helper method to allow a single message ID to be acknowledged
+     */
+    public void setMessageID(MessageId messageID) {
+        setFirstMessageId(messageID);
+        setLastMessageId(messageID);
+        setMessageCount(1);
+    }
+
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageDispatch.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageDispatch.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageDispatch.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageDispatch.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,107 @@
+/**
+ *
+ * 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.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+
+/**
+ * 
+ * @openwire:marshaller code="21"
+ * @version $Revision$
+ */
+public class MessageDispatch extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.MESSAGE_DISPATCH;
+
+    protected ConsumerId consumerId;
+    //protected ActiveMQDestination destination;
+    protected Message message;
+    protected int redeliveryCounter;
+
+    transient protected long deliverySequenceId;
+    transient protected Object consumer;
+    
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    public boolean isMessageDispatch() {
+        return true;
+    }
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ConsumerId getConsumerId() {
+        return consumerId;
+    }
+    public void setConsumerId(ConsumerId consumerId) {
+        this.consumerId = consumerId;
+    }
+
+    /**
+     * @-openwire:property version=1 cache=true
+     */
+//    public ActiveMQDestination getDestination() {
+//        return destination;
+//    }
+//    public void setDestination(ActiveMQDestination destination) {
+//        this.destination = destination;
+//    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public Message getMessage() {
+        return message;
+    }
+    public void setMessage(Message message) {
+        this.message = message;
+    }
+
+    public long getDeliverySequenceId() {
+        return deliverySequenceId;
+    }
+    public void setDeliverySequenceId(long deliverySequenceId) {
+        this.deliverySequenceId = deliverySequenceId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public int getRedeliveryCounter() {
+        return redeliveryCounter;
+    }
+    public void setRedeliveryCounter(int deliveryCounter) {
+        this.redeliveryCounter = deliveryCounter;
+    }
+
+    public Object getConsumer() {
+        return consumer;
+    }
+
+    public void setConsumer(Object consumer) {
+        this.consumer = consumer;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return null;
+    }
+    
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageId.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageId.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageId.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/MessageId.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,142 @@
+/**
+ *
+ * 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.command;
+
+
+/**
+ * @openwire:marshaller code="110"
+ * @version $Revision$
+ */
+public class MessageId implements DataStructure {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.MESSAGE_ID;
+    
+    protected ProducerId producerId;    
+    protected long producerSequenceId;
+    protected long brokerSequenceId;
+    
+    transient private String key;    
+    transient private int hashCode;    
+
+    public MessageId() {
+        this.producerId = new ProducerId();
+    }
+    
+    public MessageId(ProducerInfo producerInfo, long producerSequenceId) {
+        this.producerId = producerInfo.getProducerId();
+        this.producerSequenceId = producerSequenceId;
+    }
+
+    public MessageId(String messageKey) {
+        setValue(messageKey);
+    }
+    
+    public MessageId(String producerId, long producerSequenceId) {
+        this( new ProducerId(producerId), producerSequenceId);
+    }
+    
+    public MessageId(ProducerId producerId, long producerSequenceId) {
+        this.producerId=producerId;
+        this.producerSequenceId = producerSequenceId;        
+    }
+    
+    /**
+     * Sets the value as a String
+     */
+    public void setValue(String messageKey) {
+        key = messageKey;
+            // Parse off the sequenceId
+            int p = messageKey.lastIndexOf(":");
+            if( p >= 0 ) {
+                producerSequenceId = Long.parseLong(messageKey.substring(p+1));
+                messageKey = messageKey.substring(0,p);
+            }
+            producerId = new ProducerId(messageKey);
+    }
+    
+    /**
+     * Sets the transient text view of the message which will be ignored
+     * if the message is marshaled on a transport; so is only for in-JVM changes
+     * to accommodate foreign JMS message IDs
+     */
+    public void setTextView(String key) {
+        this.key = key;
+    }
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+
+    public boolean equals(Object o) {        
+        if( this == o )
+            return true;
+        if( o==null || o.getClass() != getClass() )
+            return false;
+        
+        MessageId id = (MessageId) o;
+        return producerSequenceId==id.producerSequenceId && producerId.equals(id.producerId);
+    }
+    
+    public int hashCode() {
+        if( hashCode == 0 ) {
+            hashCode = producerId.hashCode() ^ (int)producerSequenceId;
+        }
+        return hashCode;
+    }
+    
+    public String toString() {
+        if(key==null) {
+            key = producerId.toString()+":"+producerSequenceId;
+        }
+        return key;
+    }
+
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ProducerId getProducerId() {
+        return producerId;
+    }
+    public void setProducerId(ProducerId producerId) {
+        this.producerId = producerId;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getProducerSequenceId() {
+        return producerSequenceId;
+    }
+    public void setProducerSequenceId(long producerSequenceId) {
+        this.producerSequenceId = producerSequenceId;
+    }
+
+    /**
+     * @openwire:property version=1
+     */
+    public long getBrokerSequenceId() {
+        return brokerSequenceId;
+    }    
+    public void setBrokerSequenceId(long brokerSequenceId) {
+        this.brokerSequenceId = brokerSequenceId;
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerId.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerId.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerId.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerId.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,144 @@
+/**
+ *
+ * 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.command;
+
+/**
+ * 
+ * @openwire:marshaller code="123"
+ * @version $Revision$
+ */
+public class ProducerId implements DataStructure {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.PRODUCER_ID;
+
+    protected String connectionId;
+    protected long sessionId;
+    protected long value;
+
+    protected transient int hashCode;
+    protected transient String key;
+    protected transient SessionId parentId;
+    
+    public ProducerId() {
+    }   
+    
+    public ProducerId(SessionId sessionId, long producerId) {
+        this.connectionId = sessionId.getConnectionId();
+        this.sessionId = sessionId.getValue();
+        this.value=producerId;
+    }
+
+    public ProducerId(ProducerId id) {
+        this.connectionId = id.getConnectionId();
+        this.sessionId = id.getSessionId();
+        this.value=id.getValue();
+    }
+
+    public ProducerId(String producerKey) {
+        // Parse off the producerId
+        int p = producerKey.lastIndexOf(":");
+        if( p >= 0 ) {
+            value = Long.parseLong(producerKey.substring(p+1));
+            producerKey = producerKey.substring(0,p);
+        }
+        setProducerSessionKey(producerKey);
+    }
+    
+    public SessionId getParentId() {
+        if( parentId == null ) {
+            parentId = new SessionId(this);
+        }
+        return parentId;
+    }
+
+    public int hashCode() {
+        if( hashCode == 0 ) {
+            hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+        }
+        return hashCode;
+    }
+    
+    public boolean equals(Object o) {
+        if( this == o )
+            return true;
+        if( o == null || o.getClass()!=ProducerId.class )
+            return false;
+        ProducerId id = (ProducerId) o;
+        return sessionId==id.sessionId 
+               && value==id.value
+               && connectionId.equals(id.connectionId);
+    }
+
+    
+    /**
+     * @param sessionKey
+     */
+    private void setProducerSessionKey(String sessionKey) {
+        // Parse off the value
+        int p = sessionKey.lastIndexOf(":");
+        if( p >= 0 ) {
+            sessionId = Long.parseLong(sessionKey.substring(p+1));
+            sessionKey = sessionKey.substring(0,p);
+        }        
+        // The rest is the value
+        connectionId = sessionKey;
+    }
+
+    public String toString() {
+        if( key == null ) {
+            key=connectionId+":"+sessionId+":"+value;
+        }
+        return key;
+    }
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    /**
+     * @openwire:property version=1 cache=true
+     */    
+    public String getConnectionId() {
+        return connectionId;
+    }
+    public void setConnectionId(String connectionId) {
+        this.connectionId = connectionId;
+    }
+    /**
+     * @openwire:property version=1
+     */
+    public long getValue() {
+        return value;
+    }
+    public void setValue(long producerId) {
+        this.value = producerId;
+    }
+    
+    /**
+     * @openwire:property version=1
+     */
+    public long getSessionId() {
+        return sessionId;
+    }
+    public void setSessionId(long sessionId) {
+        this.sessionId = sessionId;
+    }
+
+    public boolean isMarshallAware() {
+        return false;
+    }
+}

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

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

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

Added: geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerInfo.java?view=auto&rev=447058
==============================================================================
--- geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerInfo.java (added)
+++ geronimo/sandbox/gcache/openwire/src/main/java/org/apache/geronimo/openwire/command/ProducerInfo.java Sun Sep 17 05:35:45 2006
@@ -0,0 +1,92 @@
+/**
+ *
+ * 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.command;
+
+import org.apache.geronimo.openwire.state.CommandVisitor;
+
+/**
+ * 
+ * @openwire:marshaller code="6"
+ * @version $Revision$
+ */
+public class ProducerInfo extends BaseCommand {
+
+    public static final byte DATA_STRUCTURE_TYPE=CommandTypes.PRODUCER_INFO;
+
+    protected ProducerId producerId;
+    protected NodeId[] nodePath;
+    
+    public ProducerInfo() {
+    }
+
+    public ProducerInfo(ProducerId producerId) {
+        this.producerId = producerId;
+    }
+
+    public ProducerInfo(SessionInfo sessionInfo, long producerId) {
+        this.producerId = new ProducerId(sessionInfo.getSessionId(), producerId);
+    }
+
+    public ProducerInfo copy() {
+        ProducerInfo info = new ProducerInfo();
+        copy(info);
+        return info;
+    }
+
+    public void copy(ProducerInfo info) {
+        super.copy(info);
+        info.producerId = producerId;
+    }
+
+    public byte getDataStructureType() {
+        return DATA_STRUCTURE_TYPE;
+    }
+    
+    /**
+     * @openwire:property version=1 cache=true
+     */
+    public ProducerId getProducerId() {
+        return producerId;
+    }
+    public void setProducerId(ProducerId producerId) {
+        this.producerId = producerId;
+    }
+        
+//    public RemoveInfo createRemoveCommand() {
+//        RemoveInfo command = new RemoveInfo(getProducerId());
+//        command.setResponseRequired(isResponseRequired());
+//        return command;
+//    }
+    
+    /**
+     * The route of brokers the command has moved through. 
+     * 
+     * @openwire:property version=1 cache=true
+     */
+    public NodeId[] getNodePath() {
+        return nodePath;
+    }
+    public void setNodePath(NodeId[] brokerPath) {
+        this.nodePath = brokerPath;
+    }
+
+    public Response visit(CommandVisitor visitor) throws Exception {
+        return visitor.processAddProducer( this );
+    }
+
+}



Mime
View raw message