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/10/15 19:00:06 UTC
git commit: Clean up comments and API documentation.
Repository: qpid-jms
Updated Branches:
refs/heads/master a088d9980 -> c6618625d
Clean up comments and API documentation.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/c6618625
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/c6618625
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/c6618625
Branch: refs/heads/master
Commit: c6618625d22927bd27902229ff6dccd8d6ff49e6
Parents: a088d99
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Oct 15 12:59:59 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Oct 15 12:59:59 2014 -0400
----------------------------------------------------------------------
.../jms/message/JmsMessageTransformation.java | 63 +++++++++++---------
1 file changed, 34 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/c6618625/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
index cb82492..9dfd85b 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/message/JmsMessageTransformation.java
@@ -97,12 +97,14 @@ public final class JmsMessageTransformation {
* provider.
*
* @param message
- * - Message to be converted into Jms's implementation.
+ * Message to be converted into Jms's implementation.
* @param connection
- * @return JmsMessage - Jms's implementation object of the
- * message.
- * @throws JMSException
- * if an error occurs
+ * The JmsConnection where this transformation is being initiated.
+ *
+ * @return JmsMessage
+ * The client's implementation object for the incoming message.
+ *
+ * @throws JMSException if an error occurs during the copy.
*/
public static JmsMessage transformMessage(JmsConnection connection, Message message) throws JMSException {
if (message instanceof JmsMessage) {
@@ -117,12 +119,11 @@ public final class JmsMessageTransformation {
JmsBytesMessage msg = factory.createBytesMessage();
try {
for (;;) {
- // Reads a byte from the message stream until the stream
- // is empty
+ // Reads a byte from the message stream until the stream is empty
msg.writeByte(bytesMsg.readByte());
}
} catch (MessageEOFException e) {
- // if an end of message stream as expected
+ // Indicates all the bytes have been read from the source.
} catch (JMSException e) {
}
@@ -154,7 +155,7 @@ public final class JmsMessageTransformation {
msg.writeObject(obj);
}
} catch (MessageEOFException e) {
- // if an end of message stream as expected
+ // Indicates all the stream values have been read from the source.
} catch (JMSException e) {
}
@@ -175,33 +176,37 @@ public final class JmsMessageTransformation {
}
/**
- * Copies the standard JMS and user defined properties from the givem
- * message to the specified message
+ * Copies the standard JMS and user defined properties from the given source
+ * message to the specified target message. The copy can only handle the JMS
+ * specific message properties and known JMS Headers, any headers that are
+ * specific to the foreign message may be lost if not returned directly via
+ * the <code>propertyNames</code> method.
*
- * @param fromMessage
+ * @param source
* the message to take the properties from
- * @param toMessage
+ * @param target
* the message to add the properties to
- * @throws JMSException
+ *
+ * @throws JMSException if an error occurs during the copy of message properties.
*/
- public static void copyProperties(JmsConnection connection, Message fromMessage, Message toMessage) throws JMSException {
- toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
- toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
- toMessage.setJMSReplyTo(transformDestination(connection, fromMessage.getJMSReplyTo()));
- toMessage.setJMSDestination(transformDestination(connection, fromMessage.getJMSDestination()));
- toMessage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode());
- toMessage.setJMSRedelivered(fromMessage.getJMSRedelivered());
- toMessage.setJMSType(fromMessage.getJMSType());
- toMessage.setJMSExpiration(fromMessage.getJMSExpiration());
- toMessage.setJMSPriority(fromMessage.getJMSPriority());
- toMessage.setJMSTimestamp(fromMessage.getJMSTimestamp());
-
- Enumeration<?> propertyNames = fromMessage.getPropertyNames();
+ public static void copyProperties(JmsConnection connection, Message source, Message target) throws JMSException {
+ target.setJMSMessageID(source.getJMSMessageID());
+ target.setJMSCorrelationID(source.getJMSCorrelationID());
+ target.setJMSReplyTo(transformDestination(connection, source.getJMSReplyTo()));
+ target.setJMSDestination(transformDestination(connection, source.getJMSDestination()));
+ target.setJMSDeliveryMode(source.getJMSDeliveryMode());
+ target.setJMSRedelivered(source.getJMSRedelivered());
+ target.setJMSType(source.getJMSType());
+ target.setJMSExpiration(source.getJMSExpiration());
+ target.setJMSPriority(source.getJMSPriority());
+ target.setJMSTimestamp(source.getJMSTimestamp());
+
+ Enumeration<?> propertyNames = source.getPropertyNames();
while (propertyNames.hasMoreElements()) {
String name = propertyNames.nextElement().toString();
- Object obj = fromMessage.getObjectProperty(name);
- toMessage.setObjectProperty(name, obj);
+ Object obj = source.getObjectProperty(name);
+ target.setObjectProperty(name, obj);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org