[jboss-svn-commits] JBL Code SVN: r10926 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/properties.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Apr 12 11:49:52 EDT 2007


Author: derek.adams
Date: 2007-04-12 11:49:51 -0400 (Thu, 12 Apr 2007)
New Revision: 10926

Added:
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/properties/MessagePropertyFacade.java
Log:
Allows for standardized property names/types for commonly used message properties.

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/properties/MessagePropertyFacade.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/properties/MessagePropertyFacade.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/properties/MessagePropertyFacade.java	2007-04-12 15:49:51 UTC (rev 10926)
@@ -0,0 +1,109 @@
+package org.jboss.soa.esb.message.properties;
+
+import java.util.Calendar;
+
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * Allows for manipulation of message properties using well-known names.
+ * 
+ * @author Derek Adams
+ */
+public class MessagePropertyFacade {
+
+	/** Wrapped message instance */
+	protected Message message;
+
+	/** Constant for message id property name */
+	public static final String MESSAGE_ID = "jbossesb.message.id";
+
+	/** Constant for message category property name */
+	public static final String MESSAGE_CATEGORY = "jbossesb.message.category";
+
+	/** Constant for message category property name */
+	public static final String MESSAGE_CREATED_DATE = "jbossesb.message.created.date";
+
+	/** Constant for message delivered property name */
+	public static final String MESSAGE_DELIVERED = "jbossesb.message.delivered";
+
+	/**
+	 * Create a facade that wraps the given message.
+	 * 
+	 * @param message
+	 */
+	public MessagePropertyFacade(Message message) {
+		this.message = message;
+	}
+
+	/**
+	 * Get the message id.
+	 * 
+	 * @return
+	 */
+	public String getMessageId() {
+		return (String) message.getProperties().getProperty(MESSAGE_ID);
+	}
+
+	/**
+	 * Set the message id.
+	 * 
+	 * @param messageId
+	 */
+	public void setMessageId(String messageId) {
+		message.getProperties().setProperty(MESSAGE_ID, messageId);
+	}
+
+	/**
+	 * Get the message category.
+	 * 
+	 * @return
+	 */
+	public String getMessageCategory() {
+		return (String) message.getProperties().getProperty(MESSAGE_CATEGORY);
+	}
+
+	/**
+	 * Set the message category.
+	 * 
+	 * @param category
+	 */
+	public void setMessageCategory(String category) {
+		message.getProperties().setProperty(MESSAGE_CATEGORY, category);
+	}
+
+	/**
+	 * Get the message created date.
+	 * 
+	 * @return
+	 */
+	public Calendar getCreatedDate() {
+		return (Calendar) message.getProperties().getProperty(MESSAGE_CREATED_DATE);
+	}
+
+	/**
+	 * Set the message created date.
+	 * 
+	 * @param createdDate
+	 */
+	public void setCreatedDate(Calendar createdDate) {
+		message.getProperties().setProperty(MESSAGE_CREATED_DATE, createdDate);
+	}
+
+	/**
+	 * Indicates whether the message was delivered.
+	 * 
+	 * @return
+	 */
+	public Boolean wasDelivered() {
+		return (Boolean) message.getProperties().getProperty(MESSAGE_DELIVERED);
+	}
+
+	/**
+	 * Set the indicator for whether the message was delivered.
+	 * 
+	 * @param delivered
+	 */
+	public void setDelivered(Boolean delivered) {
+		message.getProperties().setProperty(MESSAGE_DELIVERED, delivered);
+	}
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list