[jboss-svn-commits] JBL Code SVN: r13966 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/message/payload and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Aug 2 10:21:55 EDT 2007
Author: mark.little at jboss.com
Date: 2007-08-02 10:21:54 -0400 (Thu, 02 Aug 2007)
New Revision: 13966
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/CommandMessage.java
Removed:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/Payload.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/payload/PayloadUnitTest.java
Log:
Changed name to CommandMessage.
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/CommandMessage.java (from rev 13954, 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/CommandMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/CommandMessage.java 2007-08-02 14:21:54 UTC (rev 13966)
@@ -0,0 +1,133 @@
+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.CommandMessage;
+
+/*
+ * 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 CommandMessage
+{
+ public static final String ELEMENT_NAME = "org.jboss.soa.esb.message.payload.command";
+
+ public static final String COMMAND_TYPE = "org.jboss.soa.esb.message.payload.command.type";
+
+ 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
+ {
+ Object ret = _payload.get(ELEMENT_NAME);
+
+ if (ret == null)
+ throw new InvalidPayloadException();
+
+ return (Serializable) ret;
+ }
+ catch (ClassCastException ex)
+ {
+ // not serializable
+
+ throw new InvalidPayloadException(ex);
+ }
+ }
+
+ /**
+ * Add the type element to the Body.
+ *
+ * @param value
+ * the String to add.
+ */
+
+ public void setType (String value)
+ {
+ if (value == null)
+ throw new IllegalArgumentException();
+
+ _payload.add(COMMAND_TYPE, value);
+ }
+
+ /**
+ * Obtain the Text from the Body.
+ *
+ * @return the String.
+ */
+
+ public String getType () throws InvalidPayloadException
+ {
+ try
+ {
+ return (String) _payload.get(COMMAND_TYPE);
+ }
+ catch (ClassCastException ex)
+ {
+ throw new InvalidPayloadException(ex);
+ }
+ }
+
+ public static final boolean isCommandMessage(Body payload)
+ {
+ try
+ {
+ return (payload.get(ELEMENT_NAME) != null);
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
+
+ CommandMessage(Body payload)
+ {
+ _payload = payload;
+ }
+
+ private Body _payload;
+}
\ No newline at end of file
Deleted: 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 2007-08-02 14:16:43 UTC (rev 13965)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/ControlMessage.java 2007-08-02 14:21:54 UTC (rev 13966)
@@ -1,97 +0,0 @@
-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
- {
- Object ret = _payload.get(ELEMENT_NAME);
-
- if (ret == null)
- throw new InvalidPayloadException();
-
- return (Serializable) ret;
- }
- catch (ClassCastException ex)
- {
- // not serializable
-
- throw new InvalidPayloadException(ex);
- }
- }
-
- public static final boolean isControlMessage (Body payload)
- {
- try
- {
- return (payload.get(ELEMENT_NAME) != null);
- }
- catch (Exception ex)
- {
- return false;
- }
- }
-
- ControlMessage (Body payload)
- {
- _payload = payload;
- }
-
- private Body _payload;
-}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/Payload.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/Payload.java 2007-08-02 14:16:43 UTC (rev 13965)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/payload/Payload.java 2007-08-02 14:21:54 UTC (rev 13966)
@@ -40,7 +40,7 @@
if ((msg == null) || (msg.getBody() == null))
return null;
- if (ControlMessage.isControlMessage(msg.getBody()))
+ if (CommandMessage.isCommandMessage(msg.getBody()))
return getAsControlMessage(msg);
if (MapMessage.isMapMessage(msg.getBody()))
@@ -74,12 +74,12 @@
* @return the Control view.
*/
- public static final ControlMessage getAsControlMessage (Message msg)
+ public static final CommandMessage getAsControlMessage (Message msg)
{
if ((msg == null) || (msg.getBody() == null))
return null;
else
- return new ControlMessage(msg.getBody());
+ return new CommandMessage(msg.getBody());
}
/**
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/payload/PayloadUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/payload/PayloadUnitTest.java 2007-08-02 14:16:43 UTC (rev 13965)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/payload/PayloadUnitTest.java 2007-08-02 14:21:54 UTC (rev 13966)
@@ -153,7 +153,7 @@
assertEquals(mapMessage.readBoolean(), true);
assertTrue(BytesMessage.isBytesMessage(msg.getBody()));
- assertFalse(ControlMessage.isControlMessage(msg.getBody()));
+ assertFalse(CommandMessage.isCommandMessage(msg.getBody()));
try
{
@@ -168,7 +168,7 @@
try
{
@SuppressWarnings("unused")
- ControlMessage payload = (ControlMessage) Payload.getPayload(msg);
+ CommandMessage payload = (CommandMessage) Payload.getPayload(msg);
fail();
}
More information about the jboss-svn-commits
mailing list