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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 30 13:05:12 EDT 2007


Author: mark.little at jboss.com
Date: 2007-07-30 13:05:12 -0400 (Mon, 30 Jul 2007)
New Revision: 13865

Added:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java
Log:
http://jira.jboss.com/jira/browse/JBESB-761

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java	2007-07-30 17:05:12 UTC (rev 13865)
@@ -0,0 +1,80 @@
+package org.jboss.soa.esb.message.payload;
+
+import java.io.Serializable;
+
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.payload.InvalidPayloadException;
+import org.jboss.soa.esb.message.payload.ControlMessage;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Similar to JMS, the Message payload only contains a serializable Object.
+ */
+
+public class ControlMessage
+{
+    public static final String ELEMENT_NAME = "org.jboss.soa.esb.message.payload.control";
+    
+    private static final long serialVersionUID = 0xdeadbeef;
+    
+    /**
+     * Add the Object element to the Body.
+     * 
+     * @param value the Object to add.
+     */
+    
+    public void setObject (Serializable value)
+    {
+	if (value == null)
+	    throw new IllegalArgumentException();
+	else
+	    _payload.add(ELEMENT_NAME, value);
+    }
+
+    /**
+     * Obtain the Object from the Body.
+     * 
+     * @return the Object.
+     */
+    
+    public Serializable getObject () throws InvalidPayloadException
+    {
+	try
+	{
+	    return (Serializable) _payload.get(ELEMENT_NAME);
+	}
+	catch (ClassCastException ex)
+	{
+	    // not serializable
+	    
+	    throw new InvalidPayloadException(ex);
+	}
+    }
+
+    ControlMessage (Body payload)
+    {
+	_payload = payload;
+    }
+    
+    private Body _payload;
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list