You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2014/09/23 20:20:45 UTC

[21/27] Initial drop of donated AMQP Client Code.

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsBytesMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsBytesMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsBytesMessageFacade.java
new file mode 100644
index 0000000..b2428eb
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsBytesMessageFacade.java
@@ -0,0 +1,54 @@
+/**
+ * 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.qpid.jms.message.facade;
+
+import javax.jms.JMSException;
+
+import org.fusesource.hawtbuf.Buffer;
+
+/**
+ * Interface for a Message Facade that wraps a BytesMessage based message
+ * instance.
+ */
+public interface JmsBytesMessageFacade extends JmsMessageFacade {
+
+    /**
+     * @returns a deep copy of this Message Facade including a complete copy
+     * of the byte contents of the wrapped message.
+     */
+    @Override
+    JmsBytesMessageFacade copy() throws JMSException;
+
+    /**
+     * Retrieves the contents of this message either wrapped in or copied
+     * into a Buffer instance.  If the message contents are empty a null
+     * Buffer instance may be returned.
+     *
+     * @returns a new Buffer that contains the contents of this message.
+     */
+    Buffer getContent();
+
+    /**
+     * Sets the contents of the message to the new value based on the bytes
+     * stored in the passed in Buffer.
+     *
+     * @param contents
+     *        the new bytes to store in this message.
+     */
+    void setContent(Buffer content);
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMapMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMapMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMapMessageFacade.java
new file mode 100644
index 0000000..6ef28c4
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMapMessageFacade.java
@@ -0,0 +1,90 @@
+/**
+ * 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.qpid.jms.message.facade;
+
+import java.util.Enumeration;
+
+import javax.jms.JMSException;
+
+/**
+ * Interface for a message Facade that wraps a MapMessage style provider
+ * message.
+ */
+public interface JmsMapMessageFacade extends JmsMessageFacade {
+
+    /**
+     * @returns a deep copy of this Message Facade including a complete copy
+     * of the byte contents of the wrapped message.
+     *
+     * @throws JMSException if an error occurs while copying this message.
+     */
+    @Override
+    JmsMapMessageFacade copy() throws JMSException;
+
+    /**
+     * Returns an Enumeration of all the names in the MapMessage object.
+     *
+     * @return an enumeration of all the names in this MapMessage
+     */
+    Enumeration<String> getMapNames();
+
+    /**
+     * Determines whether an item exists in this Map based message.
+     *
+     * @returns true if the item exists in the Map, false otherwise.
+     */
+    boolean itemExists(String key);
+
+    /**
+     * Gets the value stored in the Map at the specified key.
+     *
+     * @param key
+     *        the key to use to access a value in the Map.
+     *
+     * @returns the item associated with the given key, or null if not present.
+     */
+    Object get(String key);
+
+    /**
+     * Sets an object value with the specified name into the Map.
+     *
+     * If a previous mapping for the key exists, the old value is replaced by the
+     * specified value.
+     *
+     * If the value provided is a byte[] its entry then it is assumed that it was
+     * copied by the caller and its value will not be altered by the provider.
+     *
+     * @param key
+     *        the key to use to store the value into the Map.
+     * @param value
+     *        the new value to store in the element defined by the key.
+     */
+    void put(String key, Object value);
+
+    /**
+     * Remove the mapping for this key from the map if present.  If the value is not
+     * present in the map then this method should return without error or modification
+     * to the underlying map.
+     *
+     * @param key
+     *        the key to be removed from the map if present.
+     *
+     * @returns the object previously stored in the Map or null if none present.
+     */
+    Object remove(String key);
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMessageFacade.java
new file mode 100644
index 0000000..c8ab9ce
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsMessageFacade.java
@@ -0,0 +1,357 @@
+/**
+ * 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.qpid.jms.message.facade;
+
+import java.util.Map;
+
+import javax.jms.JMSException;
+
+import org.apache.qpid.jms.JmsDestination;
+import org.apache.qpid.jms.meta.JmsMessageId;
+
+/**
+ * The Message Facade interface defines the required mapping between a Provider's
+ * own Message type and the JMS Message types.  A Provider can implement the Facade
+ * interface and offer direct access to its message types without the need to
+ * copy to / from a more generic JMS message instance.
+ *
+ * TODO - What exceptions if any do we really need to be throwing here.  For get methods
+ *        we should synthesize an answer regardless and for set most of the checking for
+ *        JMS compliance happens in the JMS message level.  Methods like setMessageId and
+ *        setCorrelationId might need to although we should try and validate some at the
+ *        upper level.
+ */
+public interface JmsMessageFacade {
+
+    /**
+     * Returns the Message properties contained within this Message instance in
+     * a new Unmodifiable Map instance.
+     *
+     * @return a Map containing the properties of this Message that cannot be modified.
+     *
+     * @throws JMSException if an error occurs while accessing the Message properties.
+     */
+    public Map<String, Object> getProperties() throws JMSException;
+
+    /**
+     * @returns true if the given property exists within the message.
+     *
+     * @throws JMSException if an error occurs while accessing the Message properties.
+     */
+    boolean propertyExists(String key) throws JMSException;
+
+    /**
+     * Returns the property stored in the message accessed via the given key/
+     *
+     * @param key
+     *        the key used to access the given property.
+     *
+     * @throws JMSException if an error occurs while accessing the Message properties.
+     */
+    Object getProperty(String key) throws JMSException;
+
+    /**
+     * Sets the message property value using the supplied key to identify the value
+     * that should be set or updated.
+     *
+     * @param key
+     *        the key that identifies the message property.
+     * @param value
+     *        the value that is to be stored in the message.
+     *
+     * @throws JMSException if an error occurs while accessing the Message properties.
+     */
+    void setProperty(String key, Object value) throws JMSException;
+
+    /**
+     * Called when a message is sent to allow a Message instance to move the
+     * contents from a logical data structure to a binary form for transmission.
+     *
+     * @throws JMSException if an error occurs while preparing the message for send.
+     */
+    void onSend() throws JMSException;
+
+    /**
+     * This method should provide a quick check on the message to determine if
+     * there is any content actually contained within.
+     *
+     * @return true if the message content is non-empty.
+     */
+    boolean isEmpty();
+
+    /**
+     * Clears the contents of this Message.
+     */
+    void clearBody();
+
+    /**
+     * Clears any Message properties that exist for this Message instance.
+     *
+     * @throws JMSException if an error occurs while accessing the message properties.
+     */
+    void clearProperties();
+
+    /**
+     * Create a new instance and perform a deep copy of this object's
+     * contents.
+     *
+     * @throws JMSException if an error occurs while copying the message.
+     */
+    JmsMessageFacade copy() throws JMSException;
+
+    /**
+     * Return the internal message Id as a JmsMessageId wrapped value.
+     *
+     * @return a JmsMessageId that wraps the internal message Id.
+     */
+    JmsMessageId getMessageId();
+
+    /**
+     * Updates the message Id using the value of the given JmsMessageId.
+     *
+     * @param messageId
+     *        the new JmsMessageId value to assign as the message Id.
+     */
+    void setMessageId(JmsMessageId messageId);
+
+    /**
+     * Gets the timestamp assigned to the message when it was sent.
+     *
+     * @return the message timestamp value.
+     */
+    long getTimestamp();
+
+    /**
+     * Sets the timestamp value of this message.
+     *
+     * @param timestamp
+     *        the time that the message was sent by the provider.
+     */
+    void setTimestamp(long timestamp);
+
+    /**
+     * Returns the correlation ID set on this message if one exists, null otherwise.
+     *
+     * @return the set correlation ID or null if not set.
+     */
+    String getCorrelationId();
+
+    /**
+     * Sets the correlation ID for this message.
+     *
+     * @param correlationId
+     *        The correlation ID to set on this message, or null to clear.
+     */
+    void setCorrelationId(String correlationId);
+
+    /**
+     * Gets the set correlation ID of the message in raw bytes form.  If no ID was
+     * set then this method may return null or an empty byte array.
+     *
+     * @return a byte array containing the correlation ID value in raw form.
+     *
+     * @throws JMSException if an error occurs while accessing the property.
+     */
+    byte[] getCorrelationIdBytes() throws JMSException;
+
+    /**
+     * Sets the correlation ID of the message in raw byte form.  Setting the value
+     * as null or an empty byte array will clear any previously set value.  If the
+     * underlying protocol cannot convert or map the given byte value to it's own
+     * internal representation it should throw a JMSException indicating the error.
+     *
+     * @param correlationId
+     *        the byte array to use to set the message correlation ID.
+     */
+    void setCorrelationIdBytes(byte[] correlationId);
+
+    /**
+     * @return true if this message is tagged as being persistent.
+     */
+    boolean isPersistent();
+
+    /**
+     * Sets the persistent flag on this message.
+     *
+     * @param value
+     *        true if the message is to be marked as persistent.
+     */
+    void setPersistent(boolean value);
+
+    /**
+     * Returns the current redelivery count of the Message as set in the underlying
+     * message instance.
+     *
+     * @return the current redelivery count.
+     */
+    int getRedeliveryCounter();
+
+    /**
+     * Used to update the message redelivery after a local redelivery of the Message
+     * has been performed.
+     *
+     * @param redeliveryCount
+     *        the new redelivery count to assign the Message.
+     */
+    void setRedeliveryCounter(int redeliveryCount);
+
+    /**
+     * Used to quickly check if a message has been redelivered.
+     *
+     * @returns true if the message was redelivered, false otherwise.
+     */
+    boolean isRedelivered();
+
+    /**
+     * Used to set the redelivered state of a message.  This can serve to clear
+     * the redelivery counter or set its initial value to one.
+     *
+     * @param redelivered
+     *        true if the message is to be marked as redelivered, false otherwise.
+     */
+    void setRedelivered(boolean redelivered);
+
+    /**
+     * Returns the Type values as defined by the provider or set by the sending client.
+     *
+     * @return a String value that defines the message type.
+     */
+    String getType();
+
+    /**
+     * Sets the String value used to define the Message type by the client.
+     *
+     * @param type
+     *        the type value the client assigns to this message.
+     */
+    void setType(String type);
+
+    /**
+     * Returns the assigned priority value of this message in JMS ranged scoping.
+     *
+     * If the provider does not define a message priority value in its message objects
+     * or the value is not set in the message this method should return the JMS default
+     * value of 4.
+     *
+     * @return the priority value assigned to this message.
+     */
+    byte getPriority();
+
+    /**
+     * Sets the message priority for this message using a JMS priority scoped value.
+     *
+     * @param priority
+     *        the new priority value to set on this message.
+     */
+    void setPriority(byte priority);
+
+    /**
+     * Returns the set expiration time for this message.
+     *
+     * The value should be returned as an absolute time given in GMT time.
+     *
+     * @return the time that this message expires or zero if it never expires.
+     */
+    long getExpiration();
+
+    /**
+     * Sets an expiration time on this message.
+     *
+     * The expiration time will be given as an absolute time in GMT time.
+     *
+     * @param expiration
+     *        the time that this message should be considered as expired.
+     */
+    void setExpiration(long expiration);
+
+    /**
+     * Gets the Destination value that was assigned to this message at the time it was
+     * sent.
+     *
+     * @return the destination to which this message was originally sent.
+     */
+    JmsDestination getDestination();
+
+    /**
+     * Sets the Destination that this message is being sent to.
+     *
+     * @param destination
+     *        the destination that this message is being sent to.
+     */
+    void setDestination(JmsDestination destination);
+
+    /**
+     * Gets the Destination where replies for this Message are to be sent to.
+     *
+     * @return the reply to destination for this message or null if none set.
+     */
+    JmsDestination getReplyTo();
+
+    /**
+     * Sets the Destination where replies to this Message are to be sent.
+     *
+     * @param replyTo
+     *        the Destination where replies should be sent, or null to clear.
+     */
+    void setReplyTo(JmsDestination replyTo);
+
+    /**
+     * Returns the ID of the user that sent this message if available.
+     *
+     * @return the user ID that was in use when this message was sent or null if not set.
+     */
+    String getUserId();
+
+    /**
+     * Sets the User ID for the connection that is being used to send this message.
+     *
+     * @param userId
+     *        the user ID that sent this message or null to clear.
+     */
+    void setUserId(String userId);
+
+    /**
+     * Gets the Group ID that this message is assigned to.
+     *
+     * @return the Group ID this message was sent in.
+     */
+    String getGroupId();
+
+    /**
+     * Sets the Group ID to use for this message.
+     *
+     * @param groupId
+     *        the Group ID that this message is assigned to.
+     */
+    void setGroupId(String groupId);
+
+    /**
+     * Gets the assigned group sequence of this message.
+     *
+     * @return the assigned group sequence of this message.
+     */
+    int getGroupSequence();
+
+    /**
+     * Sets the group sequence value for this message.
+     *
+     * @param groupSequence
+     *        the group sequence value to assign this message.
+     */
+    void setGroupSequence(int groupSequence);
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsObjectMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsObjectMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsObjectMessageFacade.java
new file mode 100644
index 0000000..337c427
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsObjectMessageFacade.java
@@ -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.qpid.jms.message.facade;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+
+/**
+ * Interface for a message Facade that wraps an ObjectMessage based
+ * provider message.
+ */
+public interface JmsObjectMessageFacade extends JmsMessageFacade {
+
+    /**
+     * @returns a deep copy of this Message Facade including a complete copy
+     * of the byte contents of the wrapped message.
+     *
+     * @throws JMSException if an error occurs while copying this message.
+     */
+    @Override
+    JmsObjectMessageFacade copy() throws JMSException;
+
+    /**
+     * Gets the Object value that is contained in the provider message.
+     *
+     * If the Object is stored in some serialized form then the Provider must
+     * de-serialize the object prior to returning it.
+     *
+     * @return the de-serialized version of the contained object.
+     *
+     * @throws IOException if the provider fails to get the object due to some internal error.
+     * @throws ClassNotFoundException if object de-serialization fails because the ClassLoader
+     *                                cannot find the Class locally.
+     */
+    Serializable getObject() throws IOException, ClassNotFoundException;
+
+    /**
+     * Stores the given object into the provider Message.
+     *
+     * In order for the provider to be fully JMS compliant the set Object should be
+     * immediately serialized and stored so that future modifications to the object
+     * are not reflected in the stored version of the object.
+     *
+     * @param value
+     *        the new value to write to the provider message.
+     *
+     * @throws IOException if the provider fails to store the object due to some internal error.
+     */
+    void setObject(Serializable value) throws IOException;
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsStreamMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsStreamMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsStreamMessageFacade.java
new file mode 100644
index 0000000..4e3468e
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsStreamMessageFacade.java
@@ -0,0 +1,76 @@
+/**
+ * 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.qpid.jms.message.facade;
+
+import javax.jms.JMSException;
+import javax.jms.MessageEOFException;
+
+/**
+ * Interface for a Message Facade that wraps a stream or list based provider
+ * message instance.  The interface provides the basic entry points into a
+ * stream style message where primitive values are read and written as opaque
+ * objects.
+ */
+public interface JmsStreamMessageFacade extends JmsMessageFacade {
+
+    /**
+     * @returns a deep copy of this Message Facade including a complete copy
+     * of the byte contents of the wrapped message.
+     */
+    @Override
+    JmsStreamMessageFacade copy() throws JMSException;
+
+    /**
+     * @returns true if the stream contains another element beyond the current.
+     */
+    boolean hasNext();
+
+    /**
+     * Peek and return the next element in the stream.  If the stream has been fully read
+     * then this method should throw a MessageEOFException.  Multiple calls to peek should
+     * return the same element.
+     *
+     * @returns the next value in the stream without removing it.
+     *
+     * @throws MessageEOFException if end of message stream has been reached.
+     */
+    Object peek() throws MessageEOFException;
+
+    /**
+     * Pops the next element in the stream.
+     *
+     * @throws MessageEOFException if end of message stream has been reached.
+     */
+    void pop() throws MessageEOFException;
+
+    /**
+     * Writes a new object value to the stream.
+     *
+     * If the value provided is a byte[] its entry then it is assumed that it was
+     * copied by the caller and its value will not be altered by the provider.
+     *
+     * @param value
+     *        The object value to be written to the stream.
+     */
+    void put(Object value);
+
+    /**
+     * Reset the position of the stream to the beginning.
+     */
+    void reset();
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsTextMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsTextMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsTextMessageFacade.java
new file mode 100644
index 0000000..5fc320b
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/JmsTextMessageFacade.java
@@ -0,0 +1,53 @@
+/**
+ * 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.qpid.jms.message.facade;
+
+import javax.jms.JMSException;
+
+/**
+ * A Facade around a provider message that behaves like a TextMessage instance.
+ */
+public interface JmsTextMessageFacade extends JmsMessageFacade {
+
+    /**
+     * Creates a copy of this JmsTextMessageFacade and its underlying
+     * provider message instance.
+     *
+     * @returns a new JmsTextMessageFacade that wraps a duplicate message.
+     */
+    @Override
+    JmsTextMessageFacade copy() throws JMSException;
+
+    /**
+     * Returns the String payload of the Message or null if none set.
+     *
+     * @return the String value contained in the message.
+     *
+     * @throws JMSException if an error occurs while decoding text payload.
+     */
+    String getText() throws JMSException;
+
+    /**
+     * Sets the new String payload of the wrapped message, or clears the old value
+     * if the given value is null.
+     *
+     * @param value
+     *        the new String payload, or null to clear the contents.
+     */
+    void setText(String value);
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultBytesMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultBytesMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultBytesMessageFacade.java
new file mode 100644
index 0000000..6870eb6
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultBytesMessageFacade.java
@@ -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.qpid.jms.message.facade.defaults;
+
+import org.apache.qpid.jms.message.facade.JmsBytesMessageFacade;
+import org.fusesource.hawtbuf.Buffer;
+
+/**
+ * A default implementation of the JmsBytesMessageFacade that simply holds a raw Buffer
+ */
+public final class JmsDefaultBytesMessageFacade extends JmsDefaultMessageFacade implements JmsBytesMessageFacade {
+
+    private Buffer content;
+
+    @Override
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.BYTES;
+    }
+
+    @Override
+    public JmsDefaultBytesMessageFacade copy() {
+        JmsDefaultBytesMessageFacade copy = new JmsDefaultBytesMessageFacade();
+        copyInto(copy);
+        if (this.content != null) {
+            copy.setContent(this.content.deepCopy());
+        }
+
+        return copy;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        if (content == null || content.length() == 0) {
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public void clearBody() {
+        this.content = null;
+    }
+
+    @Override
+    public Buffer getContent() {
+        return content;
+    }
+
+    @Override
+    public void setContent(Buffer content) {
+        this.content = content;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMapMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMapMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMapMessageFacade.java
new file mode 100644
index 0000000..33da603
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMapMessageFacade.java
@@ -0,0 +1,75 @@
+/**
+ * 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.qpid.jms.message.facade.defaults;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.qpid.jms.message.facade.JmsMapMessageFacade;
+
+/**
+ * Simple implementation of the JmsMapMessageFacade used for testing.
+ */
+public class JmsDefaultMapMessageFacade extends JmsDefaultMessageFacade implements JmsMapMessageFacade {
+
+    protected final Map<String, Object> map = new HashMap<String, Object>();
+
+    @Override
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.MAP;
+    }
+
+    @Override
+    public JmsDefaultMapMessageFacade copy() {
+        JmsDefaultMapMessageFacade copy = new JmsDefaultMapMessageFacade();
+        copyInto(copy);
+        copy.map.putAll(map);
+        return copy;
+    }
+
+    @Override
+    public Enumeration<String> getMapNames() {
+        return Collections.enumeration(map.keySet());
+    }
+
+    @Override
+    public boolean itemExists(String key) {
+        return map.containsKey(key);
+    }
+
+    @Override
+    public Object get(String key) {
+        return map.get(key);
+    }
+
+    @Override
+    public void put(String key, Object value) {
+        map.put(key, value);
+    }
+
+    @Override
+    public Object remove(String key) {
+        return map.remove(key);
+    }
+
+    @Override
+    public void clearBody() {
+        map.clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMessageFacade.java
new file mode 100644
index 0000000..8a501cc
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultMessageFacade.java
@@ -0,0 +1,316 @@
+/**
+ * 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.qpid.jms.message.facade.defaults;
+
+import static org.fusesource.hawtbuf.Buffer.ascii;
+
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jms.JMSException;
+
+import org.apache.qpid.jms.JmsDestination;
+import org.apache.qpid.jms.message.facade.JmsMessageFacade;
+import org.apache.qpid.jms.meta.JmsMessageId;
+import org.fusesource.hawtbuf.AsciiBuffer;
+
+/**
+ * A default implementation of the JmsMessageFaceade that provides a generic
+ * message instance which can be used instead of implemented in Provider specific
+ * version that maps to a Provider message object.
+ */
+public class JmsDefaultMessageFacade implements JmsMessageFacade {
+
+    private static final Charset UTF8 = Charset.forName("UTF-8");
+
+    public static enum JmsMsgType {
+        MESSAGE("jms/message"),
+        BYTES("jms/bytes-message"),
+        MAP("jms/map-message"),
+        OBJECT("jms/object-message"),
+        STREAM("jms/stream-message"),
+        TEXT("jms/text-message"),
+        TEXT_NULL("jms/text-message-null");
+
+        public final AsciiBuffer buffer = new AsciiBuffer(this.name());
+        public final AsciiBuffer mime;
+
+        JmsMsgType(String mime) {
+            this.mime = (ascii(mime));
+        }
+    }
+
+    protected Map<String, Object> properties = new HashMap<String, Object>();
+
+    protected byte priority = javax.jms.Message.DEFAULT_PRIORITY;
+    protected String groupId;
+    protected int groupSequence;
+    protected JmsMessageId messageId;
+    protected long expiration;
+    protected long timestamp;
+    protected String correlationId;
+    protected boolean persistent;
+    protected int redeliveryCount;
+    protected String type;
+    protected JmsDestination destination;
+    protected JmsDestination replyTo;
+    protected String userId;
+
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.MESSAGE;
+    }
+
+    @Override
+    public JmsDefaultMessageFacade copy() {
+        JmsDefaultMessageFacade copy = new JmsDefaultMessageFacade();
+        copyInto(copy);
+        return copy;
+    }
+
+    protected void copyInto(JmsDefaultMessageFacade target) {
+        target.priority = this.priority;
+        target.groupSequence = this.groupSequence;
+        target.groupId = this.groupId;
+        target.expiration = this.expiration;
+        target.timestamp = this.timestamp;
+        target.correlationId = this.correlationId;
+        target.persistent = this.persistent;
+        target.redeliveryCount = this.redeliveryCount;
+        target.type = this.type;
+        target.destination = this.destination;
+        target.replyTo = this.replyTo;
+        target.userId = this.userId;
+
+        if (this.messageId != null) {
+            target.messageId = this.messageId.copy();
+        }
+
+        if (this.properties != null) {
+            target.properties = new HashMap<String, Object>(this.properties);
+        } else {
+            target.properties = null;
+        }
+    }
+
+    @Override
+    public Map<String, Object> getProperties() throws JMSException {
+        lazyCreateProperties();
+        return properties;
+    }
+
+    @Override
+    public boolean propertyExists(String key) throws JMSException {
+        return this.properties.containsKey(key);
+    }
+
+    @Override
+    public Object getProperty(String key) throws JMSException {
+        return this.properties.get(key);
+    }
+
+    @Override
+    public void setProperty(String key, Object value) throws JMSException {
+        this.properties.put(key, value);
+    }
+
+    @Override
+    public void onSend() throws JMSException {
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return true;
+    }
+
+    @Override
+    public void clearBody() {
+    }
+
+    @Override
+    public void clearProperties() {
+        properties.clear();
+    }
+
+    @Override
+    public JmsMessageId getMessageId() {
+        return this.messageId;
+    }
+
+    @Override
+    public void setMessageId(JmsMessageId messageId) {
+        this.messageId = messageId;
+    }
+
+    @Override
+    public long getTimestamp() {
+        return this.timestamp;
+    }
+
+    @Override
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    @Override
+    public String getCorrelationId() {
+        return correlationId;
+    }
+
+    @Override
+    public void setCorrelationId(String correlationId) {
+        this.correlationId = correlationId;
+    }
+
+    @Override
+    public byte[] getCorrelationIdBytes() {
+        return correlationId.getBytes(UTF8);
+    }
+
+    @Override
+    public void setCorrelationIdBytes(byte[] correlationId) {
+        if (correlationId != null && correlationId.length > 0) {
+            this.correlationId = new String(correlationId, UTF8);
+        } else {
+            this.correlationId = null;
+        }
+    }
+
+    @Override
+    public boolean isPersistent() {
+        return this.persistent;
+    }
+
+    @Override
+    public void setPersistent(boolean value) {
+        this.persistent = value;
+    }
+
+    @Override
+    public int getRedeliveryCounter() {
+        return this.redeliveryCount;
+    }
+
+    @Override
+    public void setRedeliveryCounter(int redeliveryCount) {
+        this.redeliveryCount = redeliveryCount;
+    }
+
+    @Override
+    public boolean isRedelivered() {
+        return redeliveryCount > 0;
+    }
+
+    @Override
+    public void setRedelivered(boolean redelivered) {
+        if (redelivered) {
+            if (!isRedelivered()) {
+                setRedeliveryCounter(1);
+            }
+        } else {
+            if (isRedelivered()) {
+                setRedeliveryCounter(0);
+            }
+        }
+    }
+
+    @Override
+    public String getType() {
+        return type;
+    }
+
+    @Override
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    @Override
+    public byte getPriority() {
+        return priority;
+    }
+
+    @Override
+    public void setPriority(byte priority) {
+        this.priority = priority;
+    }
+
+    @Override
+    public long getExpiration() {
+        return expiration;
+    }
+
+    @Override
+    public void setExpiration(long expiration) {
+        this.expiration = expiration;
+    }
+
+    @Override
+    public JmsDestination getDestination() {
+        return this.destination;
+    }
+
+    @Override
+    public void setDestination(JmsDestination destination) {
+        this.destination = destination;
+    }
+
+    @Override
+    public JmsDestination getReplyTo() {
+        return this.replyTo;
+    }
+
+    @Override
+    public void setReplyTo(JmsDestination replyTo) {
+        this.replyTo = replyTo;
+    }
+
+    @Override
+    public String getUserId() {
+        return this.userId;
+    }
+
+    @Override
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    @Override
+    public String getGroupId() {
+        return this.groupId;
+    }
+
+    @Override
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    @Override
+    public int getGroupSequence() {
+        return this.groupSequence;
+    }
+
+    @Override
+    public void setGroupSequence(int groupSequence) {
+        this.groupSequence = groupSequence;
+    }
+
+    private void lazyCreateProperties() {
+        if (properties == null) {
+            properties = new HashMap<String, Object>();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultObjectMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultObjectMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultObjectMessageFacade.java
new file mode 100644
index 0000000..89442b9
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultObjectMessageFacade.java
@@ -0,0 +1,105 @@
+/**
+ * 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.qpid.jms.message.facade.defaults;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.apache.qpid.jms.message.facade.JmsObjectMessageFacade;
+import org.apache.qpid.jms.util.ClassLoadingAwareObjectInputStream;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+
+/**
+ * Default implementation for a JMS Object Message Facade.
+ */
+public class JmsDefaultObjectMessageFacade extends JmsDefaultMessageFacade implements JmsObjectMessageFacade {
+
+    private Buffer object;
+
+    public Buffer getSerializedObject() {
+        return object;
+    }
+
+    public void setSerializedObject(Buffer object) {
+        this.object = object;
+    }
+
+    @Override
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.OBJECT;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return object == null || object.isEmpty();
+    }
+
+    @Override
+    public JmsDefaultObjectMessageFacade copy() {
+        JmsDefaultObjectMessageFacade copy = new JmsDefaultObjectMessageFacade();
+        copyInto(copy);
+        if (!isEmpty()) {
+            copy.object = object.deepCopy();
+        }
+
+        return copy;
+    }
+
+    @Override
+    public void clearBody() {
+        this.object = null;
+    }
+
+    @Override
+    public Serializable getObject() throws IOException, ClassNotFoundException {
+
+        if (isEmpty()) {
+            return null;
+        }
+
+        Serializable serialized = null;
+
+        try (DataByteArrayInputStream dataIn = new DataByteArrayInputStream(object);
+             ClassLoadingAwareObjectInputStream objIn = new ClassLoadingAwareObjectInputStream(dataIn)) {
+
+            serialized = (Serializable) objIn.readObject();
+        }
+
+        return serialized;
+    }
+
+    @Override
+    public void setObject(Serializable value) throws IOException {
+        Buffer serialized = null;
+        if (value != null) {
+            try (DataByteArrayOutputStream baos = new DataByteArrayOutputStream();
+                 ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+
+                oos.writeObject(value);
+                oos.flush();
+                oos.close();
+
+                serialized = baos.toBuffer();
+            }
+        }
+
+        this.object = serialized;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultStreamMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultStreamMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultStreamMessageFacade.java
new file mode 100644
index 0000000..1a0a17a
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultStreamMessageFacade.java
@@ -0,0 +1,85 @@
+/**
+ * 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.qpid.jms.message.facade.defaults;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.MessageEOFException;
+
+import org.apache.qpid.jms.message.facade.JmsStreamMessageFacade;
+
+/**
+ * Default implementation of the JmsStreamMessageFacade
+ */
+public class JmsDefaultStreamMessageFacade extends JmsDefaultMessageFacade implements JmsStreamMessageFacade {
+
+    private final List<Object> stream = new ArrayList<Object>();
+    private int index = -1;
+
+    @Override
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.STREAM;
+    }
+
+    @Override
+    public JmsDefaultStreamMessageFacade copy() {
+        JmsDefaultStreamMessageFacade copy = new JmsDefaultStreamMessageFacade();
+        copyInto(copy);
+        copy.stream.addAll(stream);
+        return copy;
+    }
+
+    @Override
+    public boolean hasNext() {
+        return !stream.isEmpty() && index < stream.size();
+    }
+
+    @Override
+    public Object peek() throws MessageEOFException {
+        if (stream.isEmpty() || index + 1 >= stream.size()) {
+            throw new MessageEOFException("Attempted to read past the end of the stream");
+        }
+
+        return stream.get(index + 1);
+    }
+
+    @Override
+    public void pop() throws MessageEOFException {
+        if (stream.isEmpty() || index + 1 >= stream.size()) {
+            throw new MessageEOFException("Attempted to read past the end of the stream");
+        }
+
+        index++;
+    }
+
+    @Override
+    public void put(Object value) {
+        stream.add(value);
+    }
+
+    @Override
+    public void clearBody() {
+        stream.clear();
+        index = -1;
+    }
+
+    @Override
+    public void reset() {
+        index = -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultTextMessageFacade.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultTextMessageFacade.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultTextMessageFacade.java
new file mode 100644
index 0000000..c21d5c1
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/facade/defaults/JmsDefaultTextMessageFacade.java
@@ -0,0 +1,62 @@
+/**
+ * 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.qpid.jms.message.facade.defaults;
+
+import org.apache.qpid.jms.message.facade.JmsTextMessageFacade;
+
+/**
+ * Default implementation of the JmsTextMessageFacade.
+ */
+public final class JmsDefaultTextMessageFacade extends JmsDefaultMessageFacade implements JmsTextMessageFacade {
+
+    private String text;
+
+    @Override
+    public JmsMsgType getMsgType() {
+        return JmsMsgType.TEXT;
+    }
+
+    @Override
+    public boolean isEmpty() {
+        return text != null && !text.isEmpty();
+    }
+
+    @Override
+    public JmsDefaultTextMessageFacade copy() {
+        JmsDefaultTextMessageFacade copy = new JmsDefaultTextMessageFacade();
+        copyInto(copy);
+        if (text != null) {
+            copy.setText(text);
+        }
+        return copy;
+    }
+
+    @Override
+    public void clearBody() {
+        this.text = null;
+    }
+
+    @Override
+    public String getText() {
+        return text;
+    }
+
+    @Override
+    public void setText(String text) {
+        this.text = text;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsAbstractResourceId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsAbstractResourceId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsAbstractResourceId.java
new file mode 100644
index 0000000..93248dd
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsAbstractResourceId.java
@@ -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.qpid.jms.meta;
+
+/**
+ * Base class for all JmsResourceId instances.
+ */
+public abstract class JmsAbstractResourceId implements JmsResourceId {
+
+    protected transient Object providerHint;
+    protected transient Object providerId;
+    protected transient int hashCode;
+
+    @Override
+    public void setProviderHint(Object hint) {
+        this.providerHint = hint;
+    }
+
+    @Override
+    public Object getProviderHint() {
+        return providerHint;
+    }
+
+    @Override
+    public void setProviderId(Object id) {
+        this.providerId = id;
+    }
+
+    @Override
+    public Object getProviderId() {
+        return providerId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
new file mode 100644
index 0000000..05cda08
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionId.java
@@ -0,0 +1,76 @@
+/**
+ * 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.qpid.jms.meta;
+
+public class JmsConnectionId extends JmsAbstractResourceId implements Comparable<JmsConnectionId> {
+
+    private final String value;
+
+    public JmsConnectionId(String connectionId) {
+        this.value = connectionId;
+    }
+
+    public JmsConnectionId(JmsConnectionId id) {
+        this.value = id.getValue();
+    }
+
+    public JmsConnectionId(JmsSessionId id) {
+        this.value = id.getConnectionId();
+    }
+
+    public JmsConnectionId(JmsProducerId id) {
+        this.value = id.getConnectionId();
+    }
+
+    public JmsConnectionId(JmsConsumerId id) {
+        this.value = id.getConnectionId();
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public int hashCode() {
+        if (hashCode == 0) {
+            hashCode = value.hashCode();
+        }
+        return hashCode;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || o.getClass() != JmsConnectionId.class) {
+            return false;
+        }
+        JmsConnectionId id = (JmsConnectionId) o;
+        return value.equals(id.value);
+    }
+
+    @Override
+    public String toString() {
+        return value;
+    }
+
+    @Override
+    public int compareTo(JmsConnectionId o) {
+        return value.compareTo(o.value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
new file mode 100644
index 0000000..efdc6eb
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConnectionInfo.java
@@ -0,0 +1,251 @@
+/**
+ * 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.qpid.jms.meta;
+
+import org.apache.qpid.jms.util.ToStringSupport;
+
+/**
+ * Meta object that contains the JmsConnection identification and configuration
+ * options.  Providers can extend this to add Provider specific data as needed.
+ */
+public final class JmsConnectionInfo implements JmsResource, Comparable<JmsConnectionInfo> {
+
+    public static final long INFINITE = -1;
+    public static final long DEFAULT_CONNECT_TIMEOUT = 15000;
+    public static final long DEFAULT_CLOSE_TIMEOUT = 15000;
+    public static final long DEFAULT_SEND_TIMEOUT = INFINITE;
+    public static final long DEFAULT_REQUEST_TIMEOUT = INFINITE;
+
+    private final JmsConnectionId connectionId;
+    private String clientId;
+    private String clientIp;
+    private String username;
+    private String password;
+    private boolean forceAsyncSend;
+    private boolean alwaysSyncSend;
+    private boolean omitHost;
+    private boolean watchRemoteDestinations;
+    public long sendTimeout = DEFAULT_SEND_TIMEOUT;
+    public long requestTimeout = DEFAULT_REQUEST_TIMEOUT;
+    public long connectTimeout = DEFAULT_CONNECT_TIMEOUT;
+    public long closeTimeout = DEFAULT_CLOSE_TIMEOUT;
+    private String queuePrefix = "/queue/";
+    private String topicPrefix = "/topic/";
+    private String tempQueuePrefix = "/temp-queue/";
+    private String tempTopicPrefix = "/temp-topic/";
+
+    public JmsConnectionInfo(JmsConnectionId connectionId) {
+        this.connectionId = connectionId;
+    }
+
+    public JmsConnectionInfo copy() {
+        JmsConnectionInfo copy = new JmsConnectionInfo(connectionId);
+        copy(copy);
+        return copy;
+    }
+
+    private void copy(JmsConnectionInfo copy) {
+        copy.clientId = clientId;
+        copy.username = username;
+        copy.password = password;
+        copy.clientIp = clientIp;
+        copy.forceAsyncSend = forceAsyncSend;
+        copy.alwaysSyncSend = alwaysSyncSend;
+        copy.omitHost = omitHost;
+        copy.sendTimeout = sendTimeout;
+        copy.requestTimeout = requestTimeout;
+        copy.closeTimeout = closeTimeout;
+        copy.queuePrefix = queuePrefix;
+        copy.topicPrefix = topicPrefix;
+        copy.tempQueuePrefix = tempQueuePrefix;
+        copy.tempTopicPrefix = tempTopicPrefix;
+    }
+
+    public boolean isForceAsyncSend() {
+        return forceAsyncSend;
+    }
+
+    public void setForceAsyncSends(boolean forceAsyncSend) {
+        this.forceAsyncSend = forceAsyncSend;
+    }
+
+    public boolean isAlwaysSyncSend() {
+        return alwaysSyncSend;
+    }
+
+    public void setAlwaysSyncSend(boolean alwaysSyncSend) {
+        this.alwaysSyncSend = alwaysSyncSend;
+    }
+
+    public JmsConnectionId getConnectionId() {
+        return connectionId;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getClientIp() {
+        return clientIp;
+    }
+
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public boolean isOmitHost() {
+        return omitHost;
+    }
+
+    public void setOmitHost(boolean omitHost) {
+        this.omitHost = omitHost;
+    }
+
+    public String getQueuePrefix() {
+        return queuePrefix;
+    }
+
+    public void setQueuePrefix(String queuePrefix) {
+        this.queuePrefix = queuePrefix;
+    }
+
+    public String getTopicPrefix() {
+        return topicPrefix;
+    }
+
+    public void setTopicPrefix(String topicPrefix) {
+        this.topicPrefix = topicPrefix;
+    }
+
+    public String getTempQueuePrefix() {
+        return tempQueuePrefix;
+    }
+
+    public void setTempQueuePrefix(String tempQueuePrefix) {
+        this.tempQueuePrefix = tempQueuePrefix;
+    }
+
+    public String getTempTopicPrefix() {
+        return tempTopicPrefix;
+    }
+
+    public void setTempTopicPrefix(String tempTopicPrefix) {
+        this.tempTopicPrefix = tempTopicPrefix;
+    }
+
+    public long getCloseTimeout() {
+        return closeTimeout;
+    }
+
+    public void setCloseTimeout(long closeTimeout) {
+        this.closeTimeout = closeTimeout;
+    }
+
+    public long getConnectTimeout() {
+        return connectTimeout;
+    }
+
+    public void setConnectTimeout(long connectTimeout) {
+        this.connectTimeout = connectTimeout;
+    }
+
+    public long getSendTimeout() {
+        return sendTimeout;
+    }
+
+    public void setSendTimeout(long sendTimeout) {
+        this.sendTimeout = sendTimeout;
+    }
+
+    public long getRequestTimeout() {
+        return requestTimeout;
+    }
+
+    public void setRequestTimeout(long requestTimeout) {
+        this.requestTimeout = requestTimeout;
+    }
+
+    public boolean isWatchRemoteDestinations() {
+        return watchRemoteDestinations;
+    }
+
+    public void setWatchRemoteDestinations(boolean watchRemoteDestinations) {
+        this.watchRemoteDestinations = watchRemoteDestinations;
+    }
+
+    @Override
+    public String toString() {
+        return ToStringSupport.toString(this);
+    }
+
+    @Override
+    public int hashCode() {
+        return this.connectionId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        JmsConnectionInfo other = (JmsConnectionInfo) obj;
+
+        if (connectionId == null && other.connectionId != null) {
+            return false;
+        } else if (!connectionId.equals(other.connectionId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int compareTo(JmsConnectionInfo other) {
+        return this.connectionId.compareTo(other.connectionId);
+    }
+
+    @Override
+    public void visit(JmsResourceVistor vistor) throws Exception {
+        vistor.processConnectionInfo(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
new file mode 100644
index 0000000..2ea3d44
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerId.java
@@ -0,0 +1,121 @@
+/**
+ * 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.qpid.jms.meta;
+
+public final class JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> {
+
+    private String connectionId;
+    private long sessionId;
+    private long value;
+
+    private transient String key;
+    private transient JmsSessionId parentId;
+
+    public JmsConsumerId(String connectionId, long sessionId, long consumerId) {
+        this.connectionId = connectionId;
+        this.sessionId = sessionId;
+        this.value = consumerId;
+    }
+
+    public JmsConsumerId(JmsSessionId sessionId, long consumerId) {
+        this.connectionId = sessionId.getConnectionId();
+        this.sessionId = sessionId.getValue();
+        this.value = consumerId;
+        this.parentId = sessionId;
+    }
+
+    public JmsConsumerId(JmsConsumerId id) {
+        this.connectionId = id.getConnectionId();
+        this.sessionId = id.getSessionId();
+        this.value = id.getValue();
+        this.parentId = id.getParentId();
+    }
+
+    public JmsConsumerId(String consumerKey) throws IllegalArgumentException {
+        // Parse off the consumer Id value
+        int p = consumerKey.lastIndexOf(":");
+        if (p >= 0) {
+            value = Long.parseLong(consumerKey.substring(p + 1));
+            consumerKey = consumerKey.substring(0, p);
+        }
+        setConsumerSessionKey(consumerKey);
+    }
+
+    public JmsSessionId getParentId() {
+        if (parentId == null) {
+            parentId = new JmsSessionId(this);
+        }
+        return parentId;
+    }
+
+    public String getConnectionId() {
+        return connectionId;
+    }
+
+    public long getSessionId() {
+        return sessionId;
+    }
+
+    public long getValue() {
+        return value;
+    }
+
+    @Override
+    public int hashCode() {
+        if (hashCode == 0) {
+            hashCode = connectionId.hashCode() ^ (int) sessionId ^ (int) value;
+        }
+        return hashCode;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || o.getClass() != JmsConsumerId.class) {
+            return false;
+        }
+        JmsConsumerId id = (JmsConsumerId) o;
+        return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
+    }
+
+    @Override
+    public String toString() {
+        if (key == null) {
+            key = connectionId + ":" + sessionId + ":" + value;
+        }
+        return key;
+    }
+
+    @Override
+    public int compareTo(JmsConsumerId other) {
+        return toString().compareTo(other.toString());
+    }
+
+    private void setConsumerSessionKey(String sessionKey) {
+        // Parse off the value of the session Id
+        int p = sessionKey.lastIndexOf(":");
+        if (p >= 0) {
+            sessionId = Long.parseLong(sessionKey.substring(p + 1));
+            sessionKey = sessionKey.substring(0, p);
+        }
+
+        // The rest is the value of the connection Id.
+        connectionId = sessionKey;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
new file mode 100644
index 0000000..2747453
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsConsumerInfo.java
@@ -0,0 +1,187 @@
+/**
+ * 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.qpid.jms.meta;
+
+import org.apache.qpid.jms.JmsDestination;
+import org.apache.qpid.jms.util.ToStringSupport;
+
+public final class JmsConsumerInfo implements JmsResource, Comparable<JmsConsumerInfo> {
+
+    protected final JmsConsumerId consumerId;
+    protected JmsDestination destination;
+    protected int prefetchSize;
+    protected boolean browser;
+    protected String selector;
+    protected String clientId;
+    protected String subscriptionName;
+    protected boolean noLocal;
+    protected int acknowledgementMode;
+
+    // Can be used to track the last consumed message.
+    private transient long lastDeliveredSequenceId;
+
+    public JmsConsumerInfo(JmsConsumerId consumerId) {
+        this.consumerId = consumerId;
+    }
+
+    public JmsConsumerInfo(JmsSessionInfo sessionInfo, long consumerId) {
+        this.consumerId = new JmsConsumerId(sessionInfo.getSessionId(), consumerId);
+    }
+
+    public JmsConsumerInfo copy() {
+        JmsConsumerInfo info = new JmsConsumerInfo(consumerId);
+        copy(info);
+        return info;
+    }
+
+    private void copy(JmsConsumerInfo info) {
+        info.destination = destination;
+        info.prefetchSize = prefetchSize;
+        info.browser = browser;
+        info.selector = selector;
+        info.clientId = clientId;
+        info.subscriptionName = subscriptionName;
+        info.noLocal = noLocal;
+        info.acknowledgementMode = acknowledgementMode;
+    }
+
+    public boolean isDurable() {
+        return subscriptionName != null;
+    }
+
+    public JmsConsumerId getConsumerId() {
+        return consumerId;
+    }
+
+    public boolean isBrowser() {
+        return browser;
+    }
+
+    public void setBrowser(boolean browser) {
+        this.browser = browser;
+    }
+
+    public JmsDestination getDestination() {
+        return destination;
+    }
+
+    public void setDestination(JmsDestination destination) {
+        this.destination = destination;
+    }
+
+    public int getPrefetchSize() {
+        return prefetchSize;
+    }
+
+    public void setPrefetchSize(int prefetchSize) {
+        this.prefetchSize = prefetchSize;
+    }
+
+    public String getSelector() {
+        return selector;
+    }
+
+    public void setSelector(String selector) {
+        this.selector = selector;
+    }
+
+    public String getClientId() {
+        return clientId;
+    }
+
+    public void setClientId(String clientId) {
+        this.clientId = clientId;
+    }
+
+    public String getSubscriptionName() {
+        return subscriptionName;
+    }
+
+    public void setSubscriptionName(String durableSubscriptionId) {
+        this.subscriptionName = durableSubscriptionId;
+    }
+
+    public boolean isNoLocal() {
+        return noLocal;
+    }
+
+    public void setNoLocal(boolean noLocal) {
+        this.noLocal = noLocal;
+    }
+
+    public void setLastDeliveredSequenceId(long lastDeliveredSequenceId) {
+        this.lastDeliveredSequenceId  = lastDeliveredSequenceId;
+    }
+
+    public long getLastDeliveredSequenceId() {
+        return lastDeliveredSequenceId;
+    }
+
+    public JmsSessionId getParentId() {
+        return this.consumerId.getParentId();
+    }
+
+    public int getAcknowledgementMode() {
+        return acknowledgementMode;
+    }
+
+    public void setAcknowledgementMode(int acknowledgementMode) {
+        this.acknowledgementMode = acknowledgementMode;
+    }
+
+    @Override
+    public String toString() {
+        return ToStringSupport.toString(this);
+    }
+
+    @Override
+    public int hashCode() {
+        return (consumerId == null) ? 0 : consumerId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        JmsConsumerInfo other = (JmsConsumerInfo) obj;
+
+        if (consumerId == null && other.consumerId != null) {
+            return false;
+        } else if (!consumerId.equals(other.consumerId)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int compareTo(JmsConsumerInfo other) {
+        return this.consumerId.compareTo(other.consumerId);
+    }
+
+    @Override
+    public void visit(JmsResourceVistor vistor) throws Exception {
+        vistor.processConsumerInfo(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitor.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitor.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitor.java
new file mode 100644
index 0000000..ba2d3dc
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsDefaultResourceVisitor.java
@@ -0,0 +1,51 @@
+/**
+ * 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.qpid.jms.meta;
+
+import org.apache.qpid.jms.JmsDestination;
+
+/**
+ * Default Visitor implementation that does nothing in each method to
+ * make custom implementations simpler by only needing to override the
+ * visitation cases they need to handle.
+ */
+public class JmsDefaultResourceVisitor implements JmsResourceVistor{
+
+    @Override
+    public void processConnectionInfo(JmsConnectionInfo connectionInfo) throws Exception {
+    }
+
+    @Override
+    public void processSessionInfo(JmsSessionInfo sessionInfo) throws Exception {
+    }
+
+    @Override
+    public void processConsumerInfo(JmsConsumerInfo consumerInfo) throws Exception {
+    }
+
+    @Override
+    public void processProducerInfo(JmsProducerInfo producerInfo) throws Exception {
+    }
+
+    @Override
+    public void processDestination(JmsDestination destination) throws Exception {
+    }
+
+    @Override
+    public void processTransactionInfo(JmsTransactionInfo transactionInfo) throws Exception {
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsMessageId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsMessageId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsMessageId.java
new file mode 100644
index 0000000..0b1136b
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsMessageId.java
@@ -0,0 +1,109 @@
+/**
+ * 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.qpid.jms.meta;
+
+
+/**
+ * JMS Message Id class used to uniquely identify messages for the JMS Framework.
+ */
+public class JmsMessageId extends JmsAbstractResourceId implements Comparable<JmsMessageId> {
+
+    protected Object messageId;
+
+    public JmsMessageId(JmsProducerInfo producerInfo, long producerSequenceId) {
+        this(producerInfo.getProducerId(), producerSequenceId);
+    }
+
+    public JmsMessageId(JmsProducerId producerId, long producerSequenceId) {
+        this(producerId.toString(), producerSequenceId);
+    }
+
+    public JmsMessageId(String producerId, long producerSequenceId) {
+        this(producerId + "-" + producerSequenceId);
+    }
+
+    public JmsMessageId(Object messageId) {
+        setValue(messageId);
+    }
+
+    public JmsMessageId copy() {
+        JmsMessageId copy = new JmsMessageId(messageId);
+        return copy;
+    }
+
+    /**
+     * Sets the value as a opaque object
+     *
+     * @param messageId
+     *        The new message Id value for this instance.
+     */
+    public void setValue(Object messageId) {
+        this.messageId = messageId;
+    }
+
+    /**
+     * @return the set message ID value.
+     */
+    public Object getValue() {
+        return messageId;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        //TODO: handle messages with no messageId value
+        if (this == o) {
+            return true;
+        }
+        if (o == null || o.getClass() != getClass()) {
+            return false;
+        }
+
+        JmsMessageId id = (JmsMessageId) o;
+        return id.messageId.equals(this.messageId);
+    }
+
+    @Override
+    public int hashCode() {
+        //TODO: handle messages with no messageId value
+        if (hashCode == 0) {
+            hashCode = messageId.hashCode();
+        }
+        return hashCode;
+    }
+
+    @Override
+    public int compareTo(JmsMessageId other) {
+        //TODO: handle messages with no messageId value
+        int result = -1;
+        if (other != null) {
+            result = this.toString().compareTo(other.toString());
+        }
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        String result = messageId.toString();
+        if (result != null) {
+            if (!result.startsWith("ID:")) {
+                result = "ID:" + messageId;
+            }
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
new file mode 100644
index 0000000..501667a
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerId.java
@@ -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.qpid.jms.meta;
+
+public final class JmsProducerId extends JmsAbstractResourceId implements Comparable<JmsProducerId> {
+
+    private String connectionId;
+    private long sessionId;
+    private long value;
+
+    private transient String key;
+    private transient JmsSessionId parentId;
+
+    public JmsProducerId(JmsSessionId sessionId, long producerId) {
+        this.connectionId = sessionId.getConnectionId();
+        this.sessionId = sessionId.getValue();
+        this.value = producerId;
+        this.parentId = sessionId;
+    }
+
+    public JmsProducerId(JmsProducerId id) {
+        this.connectionId = id.getConnectionId();
+        this.sessionId = id.getSessionId();
+        this.value = id.getValue();
+        this.parentId = id.getParentId();
+    }
+
+    public JmsProducerId(String connectionId, long sessionId, long producerId) {
+        this.connectionId = connectionId;
+        this.sessionId = sessionId;
+        this.value = producerId;
+    }
+
+    public JmsProducerId(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 JmsSessionId getParentId() {
+        if (parentId == null) {
+            parentId = new JmsSessionId(this);
+        }
+        return parentId;
+    }
+
+    private void setProducerSessionKey(String sessionKey) {
+        // Parse off the value of the session Id
+        int p = sessionKey.lastIndexOf(":");
+        if (p >= 0) {
+            sessionId = Long.parseLong(sessionKey.substring(p + 1));
+            sessionKey = sessionKey.substring(0, p);
+        }
+
+        // The rest is the value of the connection Id.
+        connectionId = sessionKey;
+
+        parentId = new JmsSessionId(connectionId, sessionId);
+    }
+
+    public String getConnectionId() {
+        return connectionId;
+    }
+
+    public long getValue() {
+        return value;
+    }
+
+    public long getSessionId() {
+        return sessionId;
+    }
+
+    @Override
+    public String toString() {
+        if (key == null) {
+            key = connectionId + ":" + sessionId + ":" + value;
+        }
+        return key;
+    }
+
+    @Override
+    public int hashCode() {
+        if (hashCode == 0) {
+            hashCode = connectionId.hashCode() ^ (int)sessionId ^ (int)value;
+        }
+        return hashCode;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || o.getClass() != JmsProducerId.class) {
+            return false;
+        }
+        JmsProducerId id = (JmsProducerId)o;
+        return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId);
+    }
+
+    @Override
+    public int compareTo(JmsProducerId other) {
+        return toString().compareTo(other.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/e4decdc1/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
new file mode 100644
index 0000000..f9fd9b3
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/meta/JmsProducerInfo.java
@@ -0,0 +1,103 @@
+/**
+ * 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.qpid.jms.meta;
+
+import org.apache.qpid.jms.JmsDestination;
+import org.apache.qpid.jms.util.ToStringSupport;
+
+public final class JmsProducerInfo implements JmsResource, Comparable<JmsProducerInfo> {
+
+    protected final JmsProducerId producerId;
+    protected JmsDestination destination;
+
+    public JmsProducerInfo(JmsProducerId producerId) {
+        this.producerId = producerId;
+    }
+
+    public JmsProducerInfo(JmsSessionInfo sessionInfo, long producerId) {
+        this.producerId = new JmsProducerId(sessionInfo.getSessionId(), producerId);
+    }
+
+    public JmsProducerInfo copy() {
+        JmsProducerInfo info = new JmsProducerInfo(producerId);
+        copy(info);
+        return info;
+    }
+
+    public void copy(JmsProducerInfo info) {
+        info.destination = destination;
+    }
+
+    public JmsProducerId getProducerId() {
+        return producerId;
+    }
+
+    public JmsSessionId getParentId() {
+        return producerId.getParentId();
+    }
+
+    public JmsDestination getDestination() {
+        return destination;
+    }
+
+    public void setDestination(JmsDestination destination) {
+        this.destination = destination;
+    }
+
+    @Override
+    public String toString() {
+        return ToStringSupport.toString(this);
+    }
+
+    @Override
+    public int hashCode() {
+        return (producerId == null) ? 0 : producerId.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        JmsProducerInfo other = (JmsProducerInfo) obj;
+
+        if (producerId == null && other.producerId != null) {
+            return false;
+        } else if (!producerId.equals(other.producerId)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int compareTo(JmsProducerInfo other) {
+        return this.producerId.compareTo(other.producerId);
+    }
+
+    @Override
+    public void visit(JmsResourceVistor vistor) throws Exception {
+        vistor.processProducerInfo(this);
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org