[jboss-svn-commits] JBL Code SVN: r14897 - in labs/jbossesb/trunk: product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/body/content and 36 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 5 08:26:48 EDT 2007


Author: mark.little at jboss.com
Date: 2007-09-05 08:26:47 -0400 (Wed, 05 Sep 2007)
New Revision: 14897

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/body/content/BytesBodyImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/MessageImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/body/content/BytesBodyImpl.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ActionUtils.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/Notifier.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LocalFileMessageComposer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageCounter.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Body.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Message.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/helper/content/ContentManager.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/CourierIntegrationTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/FileCourierUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessorUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.groovy
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFileReplyToEprUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultJdbcReplyToEprUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerBaseTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFTPIntegrationTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFileUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJDBCUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJMSXntegrationTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GatewayFilterUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContentsUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/MessageUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java
   labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
   labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java
   labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java
   labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java
   labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreUnitTest.java
   labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterUnitTest.java
   labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java
   labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
   labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java
   labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/JbpmTestUtil.java
   labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java
   labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
   labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java
   labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
   labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/collect.jsp
   labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java
   labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
   labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/MyAction.java
   labs/jbossesb/trunk/qa/junit/versioned-scoped-src/org/jboss/soa/esb/server/MyAction.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1001, http://jira.jboss.com/jira/browse/JBESB-853 and http://jira.jboss.com/jira/browse/JBESB-909

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -1,6 +1,7 @@
 package org.jboss.internal.soa.esb.message.format.serialized;
 
 import java.io.Serializable;
+import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.Set;
 
@@ -136,6 +137,15 @@
 		if (b == null)
 			throw new IllegalArgumentException();
 
+		BodyImpl toMerge = null;
+		
+		if (b instanceof BodyImpl)
+		    toMerge = (BodyImpl) b;
+		else
+		    throw new IllegalArgumentException();
+		
+		_objects.putAll(toMerge._objects);
+		
 		byte[] toAdd = b.getByteArray();
 
 		if ((toAdd != null) && (toAdd.length > 0))
@@ -176,6 +186,18 @@
 		return toReturn + " ]";
 	}
 
+	public boolean equals (Object o)
+	{
+	    if (o instanceof BodyImpl)
+	    {
+		BodyImpl toCompare = (BodyImpl) o;
+		
+		return Arrays.equals(_content, toCompare._content) && _objects.equals(toCompare._objects);
+	    }
+	    else
+		return false;
+	}
+	
 	// copy constructor.
 	
 	protected BodyImpl (BodyImpl orig)

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -35,153 +35,162 @@
 import org.jboss.soa.esb.message.Properties;
 import org.jboss.soa.esb.message.format.MessageType;
 
-
 /**
- * This is the basic internal core message abstraction. A message consists of the following
- * components:
+ * This is the basic internal core message abstraction. A message consists of
+ * the following components:
  * 
- * Header: the header information contains information such as the destination EPR, the
- * sender EPR, where the reply goes etc, i.e., general message-level functional information.
- * Context: additional information to contextualise the message; for example, transaction or
- * security data, the identity of the ultimate receiver, or HTTP-cookie like information.
- * Body: the actual payload of the message.
- * Fault: any fault information associated with the message.
+ * Header: the header information contains information such as the destination
+ * EPR, the sender EPR, where the reply goes etc, i.e., general message-level
+ * functional information. Context: additional information to contextualise the
+ * message; for example, transaction or security data, the identity of the
+ * ultimate receiver, or HTTP-cookie like information. Body: the actual payload
+ * of the message. Fault: any fault information associated with the message.
  * Attachment: any attachments associated with the message.
  * 
- * Each message, once created, has a corresponding element for these 5 components. That element
- * may be empty (<b>NOT NULL</b>). The object representing the element can then be used to act
- * on the corresponding data item in the message.
+ * Each message, once created, has a corresponding element for these 5
+ * components. That element may be empty (<b>NOT NULL</b>). The object
+ * representing the element can then be used to act on the corresponding data
+ * item in the message.
  * 
  * @author Mark Little
- *
+ * 
  */
 
 public class MessageImpl implements Message, Externalizable
 {
-	private static final long serialVersionUID = 0x0;
-	
-	public MessageImpl ()
+    private static final long serialVersionUID = 0x0;
+
+    public MessageImpl()
+    {
+	_theHeader = new HeaderImpl();
+	_theContext = new ContextImpl();
+	_theBody = new BodyImpl();
+	_theFault = new FaultImpl(_theBody);
+	_theAttachment = new AttachmentImpl();
+	_theProperties = new PropertiesImpl();
+    }
+
+    /**
+         * @return get the header component of the message.
+         */
+
+    public Header getHeader ()
+    {
+	return _theHeader;
+    }
+
+    /**
+         * @return get the context component of the message.
+         */
+
+    public Context getContext ()
+    {
+	return _theContext;
+    }
+
+    /**
+         * @return get the body component of the message.
+         */
+
+    public Body getBody ()
+    {
+	return _theBody;
+    }
+
+    /**
+         * @return get any faults associated with the message. These should not
+         *         be application level faults, but comms level.
+         */
+
+    public Fault getFault ()
+    {
+	return _theFault;
+    }
+
+    /**
+         * @return get any message attachments.
+         */
+
+    public Attachment getAttachment ()
+    {
+	return _theAttachment;
+    }
+
+    /**
+         * @return the type of this message format.
+         */
+
+    public URI getType ()
+    {
+	return MessageType.JAVA_SERIALIZED;
+    }
+
+    /**
+         * @return Map&lt;String,Object&gt; - any message properties.
+         */
+    public Properties getProperties ()
+    {
+	return _theProperties;
+    }
+
+    public String toString ()
+    {
+	return "message: [ JAVA_SERIALIZED ]\n[ " + _theHeader.toString()
+		+ "\n" + _theContext.toString() + "\n" + _theBody.toString()
+		+ "\n" + _theFault.toString() + "\n"
+		+ _theAttachment.toString() + "\n" + _theProperties.toString()
+		+ " ]";
+    }
+
+    public void writeExternal (ObjectOutput out) throws IOException
+    {
+	out.writeObject(_theHeader);
+	out.writeObject(_theContext);
+	out.writeObject(_theBody);
+	out.writeObject(_theFault);
+	out.writeObject(_theAttachment);
+	out.writeObject(_theProperties);
+    }
+
+    public void readExternal (ObjectInput in) throws IOException
+    {
+	try
 	{
-		_theHeader = new HeaderImpl();
-		_theContext = new ContextImpl();
-		_theBody = new BodyImpl();
-		_theFault = new FaultImpl(_theBody);
-		_theAttachment = new AttachmentImpl();
-		_theProperties = new PropertiesImpl();
+	    _theHeader = (HeaderImpl) in.readObject();
+	    _theContext = (ContextImpl) in.readObject();
+	    _theBody = (BodyImpl) in.readObject();
+	    _theFault = (FaultImpl) in.readObject();
+	    _theAttachment = (AttachmentImpl) in.readObject();
+	    _theProperties = (PropertiesImpl) in.readObject();
+
+	    _theFault.setBody(_theBody);
 	}
-	
-	/**
-	 * @return get the header component of the message.
-	 */
-	
-	public Header getHeader ()
+	catch (Exception ex)
 	{
-		return _theHeader;
+	    throw new IOException(ex.toString());
 	}
-	
-	/**
-	 * @return get the context component of the message.
-	 */
-	
-	public Context getContext ()
-	{
-		return _theContext;
-	}
-	
-	/**
-	 * @return get the body component of the message.
-	 */
-	
-	public Body getBody ()
-	{
-		return _theBody;
-	}
-	
-	/**
-	 * @return get any faults associated with the message. These should not
-	 * be application level faults, but comms level.
-	 */
-	
-	public Fault getFault ()
-	{
-		return _theFault;
-	}
-	
-	/**
-	 * @return get any message attachments.
-	 */
-	
-	public Attachment getAttachment ()
-	{
-		return _theAttachment;
-	}
-	
-	/**
-	 * @return the type of this message format.
-	 */
-	
-	public URI getType ()
-	{
-		return MessageType.JAVA_SERIALIZED;
-	}
+    }
 
-	/**
-	 * @return Map&lt;String,Object&gt; - any message properties.
-	 */
-	public Properties getProperties() 
-	{
-		return _theProperties;
-	}
+    // should be a capability on the base interface, but no changes for 4.2
+        // ...
 
-	public String toString ()
-	{
-		return "message: [ JAVA_SERIALIZED ]\n[ "+_theHeader.toString()+"\n"+_theContext.toString()+"\n"+_theBody.toString()
-		+"\n"+_theFault.toString()+"\n"+_theAttachment.toString()+"\n"+_theProperties.toString()+" ]";
-	}
-	
-	public void writeExternal (ObjectOutput out) throws IOException
-	{
-		out.writeObject(_theHeader);
-		out.writeObject(_theContext);
-		out.writeObject(_theBody);
-		out.writeObject(_theFault);
-		out.writeObject(_theAttachment);
-		out.writeObject(_theProperties);
-	}
-	
-	public void readExternal (ObjectInput in) throws IOException
-	{
-		try
-		{
-			_theHeader = (HeaderImpl) in.readObject();
-			_theContext = (ContextImpl) in.readObject();
-			_theBody = (BodyImpl) in.readObject();
-			_theFault = (FaultImpl) in.readObject();
-			_theAttachment = (AttachmentImpl) in.readObject();
-			_theProperties = (PropertiesImpl) in.readObject();
-			
-			_theFault.setBody(_theBody);
-		}
-		catch (Exception ex)
-		{
-			throw new IOException(ex.toString());
-		}
-	}
-	
-	// should be a capability on the base interface, but no changes for 4.2 ...
-	
-	void replaceBody (BodyImpl body)
-	{
-		if (body == null)
-			throw new IllegalArgumentException();
-		
-		_theBody = body;
-	}
-	
-	private HeaderImpl _theHeader;
-	private ContextImpl _theContext;
-	private BodyImpl _theBody;
-	private FaultImpl _theFault;
-	private AttachmentImpl _theAttachment;
-	private Properties _theProperties;
+    void replaceBody (BodyImpl body)
+    {
+	if (body == null)
+	    throw new IllegalArgumentException();
+
+	_theBody = body;
+    }
+
+    private HeaderImpl _theHeader;
+
+    private ContextImpl _theContext;
+
+    private BodyImpl _theBody;
+
+    private FaultImpl _theFault;
+
+    private AttachmentImpl _theAttachment;
+
+    private Properties _theProperties;
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/body/content/BytesBodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/body/content/BytesBodyImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/body/content/BytesBodyImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -226,12 +226,12 @@
 
 	public void readMode() throws IOException
 	{
-		if (super.getByteArray() == null)
+		if (super.get(BytesBody.BYTES_LOCATION) == null)
 			throw new IOException();
 		
 		_mode = READ_MODE;
-		_inputStream = new ObjectInputStream(new ByteArrayInputStream(super
-				.getByteArray()));
+		_inputStream = new ObjectInputStream(new ByteArrayInputStream((byte[]) super
+				.get(BytesBody.BYTES_LOCATION)));
 		_outputStream = null;
 		_byteStream = null;
 	}
@@ -281,7 +281,7 @@
 			_outputStream.flush();
 			_outputStream.close();
 
-			super.setByteArray(_byteStream.toByteArray());
+			super.add(BytesBody.BYTES_LOCATION, _byteStream.toByteArray());
 		}
 		else
 		{

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -1,5 +1,6 @@
 package org.jboss.internal.soa.esb.message.format.xml;
 
+import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Set;
@@ -59,6 +60,18 @@
 		_objects = new Hashtable<String, Object>();
 	}
 
+	public boolean equals (Object o)
+	{
+	    if (o instanceof BodyImpl)
+	    {
+		BodyImpl toCompare = (BodyImpl) o;
+		
+		return Arrays.equals(_content, toCompare._content) && _objects.equals(toCompare._objects);
+	    }
+	    else
+		return false;
+	}
+	
 	public void add(Object value)
 	{
 		add(Body.DEFAULT_LOCATION, value);
@@ -278,6 +291,15 @@
 		if (b == null)
 			throw new IllegalArgumentException();
 
+		BodyImpl toMerge = null;
+		
+		if (b instanceof BodyImpl)
+		    toMerge = (BodyImpl) b;
+		else
+		    throw new IllegalArgumentException();
+		
+		_objects.putAll(toMerge._objects);
+		
 		byte[] toAdd = b.getByteArray();
 
 		if ((toAdd != null) && (toAdd.length > 0))
@@ -298,8 +320,6 @@
 				_content = buffer;
 			}
 		}
-
-		_objects.putAll(((BodyImpl) b)._objects);
 	}
 
 	public String toString()

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/MessageImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/MessageImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/MessageImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -40,226 +40,237 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 /**
- * This is the basic internal core message abstraction. A message consists of the following
- * components:
+ * This is the basic internal core message abstraction. A message consists of
+ * the following components:
  * 
- * Header: the header information contains information such as the destination EPR, the
- * sender EPR, where the reply goes etc, i.e., general message-level functional information.
- * Context: additional information to contextualise the message; for example, transaction or
- * security data, the identity of the ultimate receiver, or HTTP-cookie like information.
- * Body: the actual payload of the message.
- * Fault: any fault information associated with the message.
- * Attachment: any attachments associated with the message.
- * Properties: any properties associated with the message.
+ * Header: the header information contains information such as the destination
+ * EPR, the sender EPR, where the reply goes etc, i.e., general message-level
+ * functional information. Context: additional information to contextualise the
+ * message; for example, transaction or security data, the identity of the
+ * ultimate receiver, or HTTP-cookie like information. Body: the actual payload
+ * of the message. Fault: any fault information associated with the message.
+ * Attachment: any attachments associated with the message. Properties: any
+ * properties associated with the message.
  * 
- * Each message, once created, has a corresponding element for these 5 components. That element
- * may be empty (<b>NOT NULL</b>). The object representing the element can then be used to act
- * on the corresponding data item in the message.
+ * Each message, once created, has a corresponding element for these 5
+ * components. That element may be empty (<b>NOT NULL</b>). The object
+ * representing the element can then be used to act on the corresponding data
+ * item in the message.
  * 
  * @author Mark Little
- *
+ * 
  */
 
-public class MessageImpl implements Message//, Serializable
+public class MessageImpl implements Message
 {
     private static final long serialVersionUID = 0x0;
-    
+
     public static final String ENVELOPE_TAG = "Envelope";
-    
-    public MessageImpl ()
+
+    public MessageImpl()
     {
-    	_theHeader = new HeaderImpl();
-    	_theContext = new ContextImpl();
-    	_theBody = new BodyImpl();
-    	_theFault = new FaultImpl(_theBody);
-    	_theAttachment = new AttachmentImpl();
-    	_theProperties = new PropertiesImpl();
+	_theHeader = new HeaderImpl();
+	_theContext = new ContextImpl();
+	_theBody = new BodyImpl();
+	_theFault = new FaultImpl(_theBody);
+	_theAttachment = new AttachmentImpl();
+	_theProperties = new PropertiesImpl();
     }
-    
-	/**
-	 * @return get the header component of the message.
-	 */
-	
-	public Header getHeader ()
+
+    /**
+         * @return get the header component of the message.
+         */
+
+    public Header getHeader ()
+    {
+	return _theHeader;
+    }
+
+    /**
+         * @return get the context component of the message.
+         */
+
+    public Context getContext ()
+    {
+	return _theContext;
+    }
+
+    /**
+         * @return get the body component of the message.
+         */
+
+    public Body getBody ()
+    {
+	return _theBody;
+    }
+
+    /**
+         * @return get any faults associated with the message. These should not
+         *         be application level faults, but comms level.
+         */
+
+    public Fault getFault ()
+    {
+	return _theFault;
+    }
+
+    /**
+         * @return get any message attachments.
+         */
+
+    public Attachment getAttachment ()
+    {
+	return _theAttachment;
+    }
+
+    /**
+         * @return the type of this message format.
+         */
+
+    public URI getType ()
+    {
+	return MessageType.JBOSS_XML;
+    }
+
+    /**
+         * getProperties()
+         * 
+         * @return org.jboss.soa.esb.message.Properties - any message
+         *         properties.
+         */
+    public Properties getProperties ()
+    {
+	return _theProperties;
+    }
+
+    public String toString ()
+    {
+	return "message: [ JBOSS_XML ]\n[ " + _theHeader.toString() + "\n"
+		+ _theContext.toString() + "\n" + _theBody.toString() + "\n"
+		+ _theFault.toString() + "\n" + _theAttachment.toString()
+		+ "\n" + _theProperties.toString() + " ]";
+    }
+
+    // to/from XML here, rather than on individual elements
+
+    public Document toXML (Document doc) throws MarshalException
+    {
+	try
 	{
-		return _theHeader;
+	    // TODO remove magic strings!
+
+	    Element envelope = doc.createElement(ENVELOPE_TAG);
+
+	    doc.appendChild(envelope);
+
+	    _theHeader.toXML(envelope);
+	    _theContext.toXML(envelope);
+	    _theBody.toXML(envelope);
+	    _theFault.toXML(envelope);
+	    _theAttachment.toXML(envelope);
+	    _theProperties.toXML(envelope);
+
+	    return doc;
 	}
-	
-	/**
-	 * @return get the context component of the message.
-	 */
-	
-	public Context getContext ()
+	catch (MarshalException ex)
 	{
-		return _theContext;
+	    throw ex;
 	}
-	
-	/**
-	 * @return get the body component of the message.
-	 */
-	
-	public Body getBody ()
+	catch (Exception ex)
 	{
-		return _theBody;
+	    LOGGER.warn("MessageImpl.toXML caught unexpected exception:", ex);
+
+	    throw new MarshalException(ex);
 	}
-	
-	/**
-	 * @return get any faults associated with the message. These should not
-	 * be application level faults, but comms level.
-	 */
-	
-	public Fault getFault ()
+    }
+
+    public void fromXML (Document doc) throws UnmarshalException
+    {
+	try
 	{
-		return _theFault;
-	}
-	
-	/**
-	 * @return get any message attachments.
-	 */
-	
-	public Attachment getAttachment ()
-	{
-		return _theAttachment;
-	}
-	
-	/**
-	 * @return the type of this message format.
-	 */
-	
-	public URI getType ()
-	{
-		return MessageType.JBOSS_XML;
-	}
-	/**
-	 * getProperties()
-	 * @return org.jboss.soa.esb.message.Properties - any message properties.
-	 */
-	public Properties getProperties() 
-	{
-		return _theProperties;
-	}
-	
-	public String toString ()
-	{
-		return "message: [ JBOSS_XML ]\n[ "+_theHeader.toString()+"\n"+_theContext.toString()+"\n"+_theBody.toString()
-		+"\n"+_theFault.toString()+"\n"+_theAttachment.toString()+"\n"+_theProperties.toString()+" ]";
-	}
-	
-	// to/from XML here, rather than on individual elements
-	
-	public Document toXML (Document doc) throws MarshalException
-	{
-		try
-		{		
-			// TODO remove magic strings!
-			
-			Element envelope = doc.createElement(ENVELOPE_TAG);
+	    NodeList nl = doc.getChildNodes();
+	    Element envelope = null;
 
-			doc.appendChild(envelope);
-			
-			_theHeader.toXML(envelope);
-			_theContext.toXML(envelope);
-			_theBody.toXML(envelope);
-			_theFault.toXML(envelope);
-			_theAttachment.toXML(envelope);
-			_theProperties.toXML(envelope);
-			
-			return doc;
-		}
-		catch (MarshalException ex)
+	    for (int i = 0; i < nl.getLength(); i++)
+	    {
+		Node n = nl.item(i);
+
+		if (n.getNodeName().equals(ENVELOPE_TAG))
 		{
-			throw ex;
+		    envelope = (Element) n;
+		    break;
 		}
-		catch (Exception ex)
-		{
-		    LOGGER.warn("MessageImpl.toXML caught unexpected exception:", ex);
-			
-			throw new MarshalException(ex);
-		}
-	}
-	
-	public void fromXML (Document doc) throws UnmarshalException
-	{
+	    }
+
+	    _theHeader.fromXML(envelope);
+	    _theContext.fromXML(envelope);
+	    _theBody.fromXML(envelope);
+	    _theFault.fromXML(envelope);
+	    _theAttachment.fromXML(envelope);
+	    _theProperties.fromXML(envelope);
+
+	    /*
+                 * Disclaimer: You are not expected to understand this (tm).
+                 * Best way of achieving this without changing any of the public
+                 * interfaces that may already exist.
+                 * 
+                 * TODO: change public interfaces in subsequent major revision.
+                 */
+
+	    String payloadType = Payload.bodyType(this);
+
+	    if ((payloadType != null)
+		    && (!payloadType.equals(Payload.RAW_BODY)))
+	    {
 		try
 		{
-			NodeList nl = doc.getChildNodes();
-			Element envelope = null;
-			
-			for (int i = 0; i < nl.getLength(); i++)
-			{
-				Node n = nl.item(i);
-				
-				if (n.getNodeName().equals(ENVELOPE_TAG))
-				{
-					envelope = (Element) n;
-					break;
-				}
-			}
-
-			_theHeader.fromXML(envelope);
-			_theContext.fromXML(envelope);
-			_theBody.fromXML(envelope);
-			_theFault.fromXML(envelope);
-			_theAttachment.fromXML(envelope);
-			_theProperties.fromXML(envelope);
-			
-			/*
-			 * Disclaimer: You are not expected to understand this (tm).
-			 * Best way of achieving this without changing any of the public
-			 * interfaces that may already exist.
-			 * 
-			 * TODO: change public interfaces in subsequent major revision.
-			 */
-			
-			String payloadType = Payload.bodyType(this);
-			
-			if ((payloadType != null) && (!payloadType.equals(Payload.RAW_BODY)))
-			{
-				try
-				{
-					_theBody = (BodyImpl) MessageFactory.getInstance().createBodyType(this, payloadType);
-				}
-				catch (Exception ex)
-				{
-					ex.printStackTrace();
-				}
-			}
+		    _theBody = (BodyImpl) MessageFactory.getInstance()
+			    .createBodyType(this, payloadType);
 		}
-		catch (UnmarshalException ex)
-		{
-			throw ex;
-		}
 		catch (Exception ex)
 		{
-		    LOGGER.warn("MessageImpl.fromXML caught unexpected exception:", ex);
-			
-			throw new UnmarshalException(ex);
+		    ex.printStackTrace();
 		}
+	    }
 	}
-	
-	// should be a capability on the base interface, but no changes for 4.2 ...
-	
-	void replaceBody (BodyImpl body)
+	catch (UnmarshalException ex)
 	{
-		if (body == null)
-			throw new IllegalArgumentException();
-		
-		_theBody = body;
+	    throw ex;
 	}
-	
-	// TODO add equality operator(s)
-	
-	private HeaderImpl _theHeader;
-	private ContextImpl _theContext;
-	private BodyImpl _theBody;
-	private FaultImpl _theFault;
-	private AttachmentImpl _theAttachment;
-	private PropertiesImpl _theProperties;
-	
-	/**
-	 * The logger for this class.
-	 */
-	private static final Logger LOGGER = Logger.getLogger(MessageImpl.class);
+	catch (Exception ex)
+	{
+	    LOGGER.warn("MessageImpl.fromXML caught unexpected exception:", ex);
+
+	    throw new UnmarshalException(ex);
+	}
+    }
+
+    // should be a capability on the base interface, but no changes for 4.2
+        // ...
+
+    void replaceBody (BodyImpl body)
+    {
+	if (body == null)
+	    throw new IllegalArgumentException();
+
+	_theBody = body;
+    }
+
+    private HeaderImpl _theHeader;
+
+    private ContextImpl _theContext;
+
+    private BodyImpl _theBody;
+
+    private FaultImpl _theFault;
+
+    private AttachmentImpl _theAttachment;
+
+    private PropertiesImpl _theProperties;
+
+    /**
+         * The logger for this class.
+         */
+    private static final Logger LOGGER = Logger.getLogger(MessageImpl.class);
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/body/content/BytesBodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/body/content/BytesBodyImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/body/content/BytesBodyImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -224,12 +224,12 @@
 
 	public void readMode() throws IOException
 	{
-		if (super.getByteArray() == null)
+		if (super.get(BytesBody.BYTES_LOCATION) == null)
 			throw new IOException();
 		
 		_mode = READ_MODE;
-		_inputStream = new ObjectInputStream(new ByteArrayInputStream(super
-				.getByteArray()));
+		_inputStream = new ObjectInputStream(new ByteArrayInputStream((byte[]) super
+				.get(BytesBody.BYTES_LOCATION)));
 		_outputStream = null;
 		_byteStream = null;
 	}
@@ -279,7 +279,7 @@
 			_outputStream.flush();
 			_outputStream.close();
 
-			super.setByteArray(_byteStream.toByteArray());
+			super.add(BytesBody.BYTES_LOCATION, _byteStream.toByteArray());
 		}
 		else
 		{

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ActionUtils.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ActionUtils.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ActionUtils.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -25,6 +25,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Body;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.notification.NotificationList;
 
 /**
@@ -49,7 +50,7 @@
             payload = message.getBody().get(CURRENT_OBJECT);
             
             if(payload == null) {
-    		payload = message.getBody().getByteArray();
+    		payload = (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION);
             }
     	}
     	
@@ -91,7 +92,7 @@
     		message.getBody().add(CURRENT_OBJECT,obj);
     	}
     	if(obj instanceof byte[]) {
-    		message.getBody().setByteArray((byte[])obj);
+    		message.getBody().add(BytesBody.BYTES_LOCATION, (byte[])obj);
     	}
     	
     	return oRet;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/Notifier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/Notifier.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/Notifier.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.notification.NotificationList;
 
 /**
@@ -99,7 +100,7 @@
 	{ 
 		byte[] ba = null;
 		return (null==message) ? "<null message>"
-			:(null==(ba=message.getBody().getByteArray())) ? "<null body content>"
+			:(null==(ba=(byte[]) message.getBody().get(BytesBody.BYTES_LOCATION))) ? "<null body content>"
 			: new String(ba); 
 	} //________________________________
 	

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -26,6 +26,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.util.Util;
 
 /**
@@ -39,19 +40,23 @@
 	public static final String FULL_MESSAGE = "printfull";
 	public static final String PRINT_STREAM = "outputstream";
     public static final String TMP_FILE = "tmpFile";
+    	public static final String DEFAULT_PRE_MESSAGE = "Message structure";
     
     private Logger log = Logger.getLogger(this.getClass());
 	
 	/**
 	 * Public constructor.
 	 * 
+	 * If no PRE_MESSAGE data is provided within the supplied ConfigTree instance
+	 * then DEFAULT_PRE_MESSAGE is used.
+	 * 
 	 * @param config
 	 *            Configuration.
 	 */
 	public SystemPrintln(ConfigTree config)
 	{
 		printlnMessage = config.getAttribute(PRE_MESSAGE,
-				"** 'message' attribute not set **");
+				DEFAULT_PRE_MESSAGE);
 		
 		printFullMessage = (config.getAttribute(FULL_MESSAGE, "false").equalsIgnoreCase("true") ? true : false);
 		useOutputStream = (config.getAttribute(PRINT_STREAM, "true").equals("true") ? true : false);
@@ -96,7 +101,7 @@
 					Message attachedMessage = (Message) message.getAttachment()
 							.itemAt(i);
 					stream.println("attachment " + i + ": ["
-							+ new String(attachedMessage.getBody().getByteArray())
+							+ new String((byte[]) attachedMessage.getBody().get(BytesBody.BYTES_LOCATION))
 							+ "].");
 				}
 			}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListener.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -139,6 +139,9 @@
 
         while (isRunning()) {
             javax.jms.Message msgIn = receiveOne();
+            
+            System.err.println("**RUNNING JMS GATEWAY RECEIVED MESSAGE**");
+            
             if (null != msgIn) {
                 try {
                     Object obj = _processMethod.invoke(_composer, new Object[]

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LocalFileMessageComposer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LocalFileMessageComposer.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/LocalFileMessageComposer.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -20,6 +20,7 @@
 package org.jboss.soa.esb.listeners.gateway;
 
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.util.FileUtil;
@@ -56,7 +57,7 @@
 
         Message message = MessageFactory.getInstance().getMessage();
         try {
-            message.getBody().setByteArray(FileUtil.readFile(inputFile));
+            message.getBody().add(BytesBody.BYTES_LOCATION, FileUtil.readFile(inputFile));
         } catch (IOException e) {
             throw new MessageDeliverException("Error reading input file '" + inputFile.getAbsolutePath() + "'.", e);
         }
@@ -65,10 +66,10 @@
     }
 
     public Object decompose(Message message) throws MessageDeliverException {
-        byte[] payload = message.getBody().getByteArray();
+        byte[] payload = (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION);
 
         if(payload == null) {
-            throw new MessageDeliverException("No byte[] payload returned by 'Message.getBody().getByteArray()'.");
+            throw new MessageDeliverException("No byte[] payload returned by 'Message.getBody().get()'.");
         }
 
         return payload;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContents.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -29,6 +29,7 @@
 import javax.jms.TextMessage;
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 /**
@@ -70,7 +71,7 @@
 		
 		setESBMessageBody( jmsMessage, esbMessage );
 		
-		if ( esbMessage.getBody().getByteArray() == null )
+		if ( esbMessage.getBody().get(BytesBody.BYTES_LOCATION) == null )
 			return null;
 		
 		setPropertiesFromJMSMessage ( jmsMessage, esbMessage );
@@ -104,7 +105,7 @@
 	 * the JMS Message fromJMSMessage argument. 
 	 * <p>
 	 * TextMessage -> Body.add ( String ); 
-	 * BytesMessage -> Body.setByteArray ( byte[] ); 
+	 * BytesMessage -> Body.add ( byte[] ); 
 	 * ObjectMessage -> Body.add ( Object ); 
 	 * </p>
 	 * Note: this method will always set the bodies byte array
@@ -156,6 +157,6 @@
 	@Deprecated
 	private void setByteArrayOnBody( final Message esbMessage, final byte[] bytes )
 	{
-		esbMessage.getBody().setByteArray( bytes );
+		esbMessage.getBody().add(BytesBody.BYTES_LOCATION, bytes );
 	}
 } // ____________________________________________________

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/RemoteFileMessageComposer.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 import org.jboss.soa.esb.addressing.eprs.FTPEpr;
 import org.jboss.soa.esb.util.*;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.internal.soa.esb.assertion.AssertArgument;
 
@@ -69,7 +70,7 @@
 
         Message message = MessageFactory.getInstance().getMessage();
         try {
-            message.getBody().setByteArray(getFileContents(inputFile));
+            message.getBody().add(BytesBody.BYTES_LOCATION, getFileContents(inputFile));
         } catch (IOException e) {
             throw new MessageDeliverException("Error reading remote input file '" + inputFile.getAbsolutePath() + "'.", e);
         } catch (RemoteFileSystemException e) {
@@ -80,10 +81,10 @@
     }
 
     public Object decompose(Message message) throws MessageDeliverException {
-        byte[] payload = message.getBody().getByteArray();
+        byte[] payload = (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION);
 
         if(payload == null) {
-            throw new MessageDeliverException("No byte[] payload returned by 'Message.getBody().getByteArray()'.");
+            throw new MessageDeliverException("No byte[] payload returned by 'Message.getBody().get(BytesBody.BYTES_LOCATION)'.");
         }
 
         return payload;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageCounter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageCounter.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageCounter.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -24,6 +24,7 @@
 import java.util.Observable;
 import java.util.Observer;
 
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.system.ServiceMBeanSupport;
 
 /**
@@ -110,7 +111,7 @@
 		}
 		
 		totalProcessTime += msb.getProcessTime();
-        byte[] byteArray = msb.getMessage().getBody().getByteArray();
+        byte[] byteArray = (byte[]) msb.getMessage().getBody().get(BytesBody.BYTES_LOCATION);
         
         if(byteArray != null) {
             totalBytes += byteArray.length;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Body.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Body.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Body.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -130,14 +130,14 @@
 	 * 
 	 * @param content
 	 *            the message bytes
-	 * @deprecated As of 4.2 this has been replaced by setByteArray
+	 * @deprecated As of 4.2 this has been replaced by add(BytesBody.BYTES_LOCATION, content)
 	 */
 
 	public void setContents(byte[] content);
 
 	/**
 	 * @return the byte content of the body.
-	 * @deprecated As of 4.2 this has been replaced by getByteArray
+	 * @deprecated As of 4.2 this has been replaced by get(BytesBody.BYTES_LOCATION)
 	 */
 
 	public byte[] getContents();
@@ -148,12 +148,14 @@
 	 * 
 	 * @param content
 	 *            the message bytes
+	 * @deprecated As of 4.2 this has been replaced by add(BytesBody.BYTES_LOCATION, content)
 	 */
 
 	public void setByteArray(byte[] content);
 
 	/**
 	 * @return the byte content of the body.
+	 * @deprecated As of 4.2 this has been replaced by get(BytesBody.BYTES_LOCATION)
 	 */
 
 	public byte[] getByteArray();
@@ -168,7 +170,8 @@
 	public void replace(Body b);
 
 	/**
-	 * Merge two bodies.
+	 * Merge two bodies. Any duplicate entries in the current instance will be
+	 * lost in favour of the new instance.
 	 * 
 	 * @param b
 	 *            the body to be merged with.

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Message.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Message.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/Message.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -89,5 +89,5 @@
 	 */
 	
 	public Properties getProperties ();
-	
+
 }

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/body/content/BytesBody.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -40,6 +40,7 @@
 
 public interface BytesBody extends Body
 {
+    public static final String BYTES_LOCATION = "org.jboss.soa.esb.message.content.bytes";
 	
 	public boolean readBoolean() throws IncompatibleModeException, IOException,
 			InvalidPayloadException;

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/helper/content/ContentManager.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/helper/content/ContentManager.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/helper/content/ContentManager.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -123,7 +123,7 @@
 		{
 			BytesBody payload = (BytesBody) MessageFactory.getInstance().createBodyType(msg, Payload.BYTES_BODY);
 			
-			payload.setByteArray(initial);
+			payload.add(BytesBody.BYTES_LOCATION, initial);
 			
 			return msg;
 		}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/mapping/ObjectMapper.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.message.Body;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.mvel.MVEL;
 
 /**
@@ -164,7 +165,7 @@
             Body body   = message.getBody();
             object =
                 BODY_CONTENT.equals(name)
-                ? body.getByteArray()
+                ? body.get(BytesBody.BYTES_LOCATION)
                 : body.get(name);
         } else if ("properties".equalsIgnoreCase(location)) {
             object = message.getProperties().getProperty(name);
@@ -212,7 +213,7 @@
         if ("body".equalsIgnoreCase(location)) {
             Body body   = message.getBody();
             if (BODY_CONTENT.equals(name)) {
-                body.setByteArray(getBytes((Serializable) object));
+                body.add(BytesBody.BYTES_LOCATION, getBytes((Serializable) object));
             } else {
                 body.add(name, object);
             }
@@ -240,7 +241,6 @@
         }
     }
     
-    
     /**
      * Checks to see if parameter name is number.
      * 
@@ -260,12 +260,7 @@
      * @return byte[] representation of the object passed in
      * @throws ObjectMappingException
      */
-    /*
-     * This code is too good to loose, and besides if you fix it breaks a mirade
-     * of unittests. We should simple loose the byte[] in our Message. No sense
-     * in fixing up all this stuff. In java everything is an object, so there
-     * is NO need for a byteArray.
-     */
+
     public byte[] getBytes(Serializable object) throws ObjectMappingException
     {
         if (object instanceof byte[]) {

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyConsole.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -24,6 +24,7 @@
 
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.util.Util;
 
 public class NotifyConsole extends NotificationTarget 
@@ -38,8 +39,8 @@
 	public void sendNotification(Message message) throws NotificationException 
 	{
         String content=null;  
-        if (message.getBody().getByteArray()!=null) {
-            content = new String(message.getBody().getByteArray());
+        if (message.getBody().get(BytesBody.BYTES_LOCATION)!=null) {
+            content = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
         }
 		System.out.println
 			("ConsoleNotifier "+Util.getStamp()+"<"+content+">");

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.Email;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.util.Util;
 
 /**
@@ -92,8 +93,8 @@
 		try
 		{
             String content=null;
-            if (message.getBody().getByteArray()!=null) {
-                content = new String(message.getBody().getByteArray());
+            if (message.getBody().get(BytesBody.BYTES_LOCATION)!=null) {
+                content = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
             }
 			ConfigTree oP = m_oParms.cloneObj();
 			String sMsg = oP.getAttribute(Email.MESSAGE);

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -32,6 +32,7 @@
 import org.jboss.soa.esb.addressing.eprs.FTPEpr;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.util.RemoteFileSystem;
 import org.jboss.soa.esb.util.RemoteFileSystemException;
 import org.jboss.soa.esb.util.RemoteFileSystemFactory;
@@ -183,7 +184,7 @@
 		try {
 			tmpFile = File.createTempFile(TEMP_FILE_BASE, null);
 			stream = new FileOutputStream(tmpFile);
-			IOUtils.write(message.getBody().getByteArray(), stream);
+			IOUtils.write((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION), stream);
 			stream.close();
 			rfs = RemoteFileSystemFactory.getRemoteFileSystem(getFtpEpr(), true);
 			rfs.uploadFile(tmpFile, getFileName(message));

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFiles.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -31,6 +31,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageType;
 
 /**
@@ -159,13 +160,13 @@
 						notificationFile.append);
 				if (MessageType.JAVA_SERIALIZED.equals(message.getType()))
 				{
-                    objectNotification(fileOutStream, message.getBody().getByteArray());
+                    objectNotification(fileOutStream, message.getBody().get(BytesBody.BYTES_LOCATION));
 				}
 				else
 				{
                     String content=null;
-                    if (message.getBody().getByteArray()!=null) {
-                        content = new String(message.getBody().getByteArray());
+                    if (message.getBody().get(BytesBody.BYTES_LOCATION)!=null) {
+                        content = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
                     }
                     stringNotification(fileOutStream, content);
 				}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyJMS.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -36,6 +36,7 @@
 import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.notification.jms.DefaultJMSPropertiesSetter;
 import org.jboss.soa.esb.notification.jms.JMSPropertiesSetter;
@@ -186,13 +187,13 @@
 	
 			if (MessageType.JAVA_SERIALIZED.equals(esbMessage.getType()))
 			{
-				jmsMessage = m_oSess[0].createObjectMessage(esbMessage.getBody().getByteArray());
+				jmsMessage = m_oSess[0].createObjectMessage((byte[]) esbMessage.getBody().get(BytesBody.BYTES_LOCATION));
 			}
 			else
 			{
                 String content=null;
-                if (esbMessage.getBody().getByteArray()!=null) {
-                    content = new String(esbMessage.getBody().getByteArray());
+                if (esbMessage.getBody().get(BytesBody.BYTES_LOCATION)!=null) {
+                    content = new String((byte[]) esbMessage.getBody().get(BytesBody.BYTES_LOCATION));
                 }
 				jmsMessage = m_oSess[0].createTextMessage(content);
 			}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifySqlTable.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -32,6 +32,7 @@
 import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
 import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 
 public class NotifySqlTable extends NotificationTarget
 {
@@ -128,8 +129,8 @@
 	public void sendNotification (Message message) throws NotificationException
 	{
         String content=null;
-        if (message.getBody().getByteArray()!=null) {
-            content = new String(message.getBody().getByteArray());
+        if (message.getBody().get(BytesBody.BYTES_LOCATION)!=null) {
+            content = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
         }
 		m_oCols.setProperty(m_sDataCol, content);
 		JdbcCleanConn oConn = null;

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/CourierIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/CourierIntegrationTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/CourierIntegrationTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -35,6 +35,7 @@
 import org.jboss.soa.esb.couriers.CourierFactory;
 import org.jboss.soa.esb.couriers.TwoWayCourier;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 /**
@@ -114,7 +115,7 @@
 
 		Message message = MessageFactory.getInstance().getMessage();
 		message.getHeader().setCall(call);
-		message.getBody().setByteArray("Hello World".getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, "Hello World".getBytes());
 		Courier courier = CourierFactory.getCourier(call.getTo());
 
 		courier.deliver(message);

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/FileCourierUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/FileCourierUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/tests/FileCourierUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -43,6 +43,7 @@
 import org.jboss.soa.esb.couriers.FaultMessageException;
 import org.jboss.soa.esb.couriers.TwoWayCourier;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -118,7 +119,7 @@
 		toEpr.setInputSuffix(TEST_SUFFIX);
 		
 		Message msg = MessageFactory.getInstance().getMessage();
-		msg.getBody().setByteArray(contents.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, contents.getBytes());
 
 		Call call = new Call(toEpr);
 		String uid = UUID.randomUUID().toString();
@@ -142,7 +143,7 @@
 		Message retrieved = pickUp.pickup(1000);
 		Assert.assertFalse("Null message retrieved",null==retrieved);
 		
-		String back = new String(retrieved.getBody().getByteArray());
+		String back = new String((byte[]) retrieved.getBody().get(BytesBody.BYTES_LOCATION));
 		Assert.assertEquals(contents,back);
 		_logger.info("Contents of retrieved msg equal original text <"+back+">");
 		
@@ -219,7 +220,7 @@
 		toEpr.setInputSuffix(TEST_SUFFIX);
 		
 		Message msg = MessageFactory.getInstance().getMessage();
-		msg.getBody().setByteArray(contents.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, contents.getBytes());
 
 		Call call = new Call(toEpr);
 		String uid = UUID.randomUUID().toString();
@@ -239,7 +240,7 @@
 		Message retrieved = pickUp.pickup(1000);
 		Assert.assertFalse("Null message retrieved",null==retrieved);
 		
-		String back = new String(retrieved.getBody().getByteArray());
+		String back = new String((byte[]) retrieved.getBody().get(BytesBody.BYTES_LOCATION));
 		Assert.assertEquals(contents,back);
 		_logger.info("Contents of retrieved msg equal original text <"+back+">");
 		
@@ -260,7 +261,7 @@
 		toEpr.setInputSuffix(TEST_SUFFIX);
 		
 		Message msg = MessageFactory.getInstance().getMessage();
-		msg.getBody().setByteArray(contents.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, contents.getBytes());
 		msg.getBody().add(new ExampleObject("hello", 1234));
 		
 		Call call = new Call(toEpr);
@@ -282,7 +283,7 @@
 		Message retrieved = pickUp.pickup(1000);
 		Assert.assertFalse("Null message retrieved",null==retrieved);
 		
-		String back = new String(retrieved.getBody().getByteArray());
+		String back = new String((byte[]) retrieved.getBody().get(BytesBody.BYTES_LOCATION));
 		Assert.assertEquals(contents,back);
 		_logger.info("Contents of retrieved msg equal original text <"+back+">");
 		

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/EchoRouterUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -25,6 +25,7 @@
 import junit.framework.TestCase;
 
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class EchoRouterUnitTest extends TestCase
@@ -38,7 +39,7 @@
 		EchoRouter router = new EchoRouter(null);
 		Message msg = MessageFactory.getInstance().getMessage();
 		
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 		
 		router.process(msg);
 	}

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/HttpRouterUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.listeners.ListenerTagNames;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -45,7 +46,7 @@
 	@Before
 	public void setUp()
 	{
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 	}
 	
 	
@@ -71,7 +72,7 @@
 		
 		Message msg = MessageFactory.getInstance().getMessage();
 		
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 		
 		boolean exception = false;
 		

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/routing/JmsRouterIntegrationTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -49,6 +49,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.KeyValuePair;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -164,7 +165,7 @@
 		
 		Message msg = MessageFactory.getInstance().getMessage();
 		
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 		JMSRouter router = new JMSRouter( createConfigTree() );
 		try
 		{
@@ -257,7 +258,7 @@
 	{
 		Message msg = MessageFactory.getInstance().getMessage();
 		msg.getHeader().getCall().setMessageID( new URI ( "1234-junittest" ) );
-		msg.getBody().setByteArray( body.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, body.getBytes());
 		return msg;
 	}
 	

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessorUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessorUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -27,6 +27,7 @@
 import org.jboss.soa.esb.actions.ActionUtils;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 /**
@@ -58,7 +59,7 @@
 
         // Set the script as the message task object...
         ActionUtils.setTaskObject(message, "import org.jboss.soa.esb.message.*\n" +
-                "message.getBody().setByteArray(config.getAttribute(\"messageContents\").getBytes());");
+                "message.getBody().add(org.jboss.soa.esb.message.body.content.BytesBody.BYTES_LOCATION, config.getAttribute(\"messageContents\").getBytes());");
 
         assertProcessingOK(processor, message, messageContents);
     }
@@ -66,7 +67,7 @@
     private void assertProcessingOK(GroovyActionProcessor processor, Message message, String messageContents) throws ActionLifecycleException, ActionProcessingException {
         processor.initialise();
         processor.process(message);
-        byte[] bodyContents = message.getBody().getByteArray();
+        byte[] bodyContents = (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION);
         assertNotNull("Expected body contents to be set.", bodyContents);
         assertEquals(messageContents, new String(bodyContents));
     }

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.groovy
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.groovy	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.groovy	2007-09-05 12:26:47 UTC (rev 14897)
@@ -1,3 +1,3 @@
 import org.jboss.soa.esb.message.*
 
-message.getBody().setByteArray(config.getAttribute("messageContents").getBytes());
\ No newline at end of file
+message.getBody().add(org.jboss.soa.esb.message.body.content.BytesBody.BYTES_LOCATION, config.getAttribute("messageContents").getBytes());
\ No newline at end of file

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFileReplyToEprUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFileReplyToEprUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFileReplyToEprUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -34,6 +34,7 @@
 import org.jboss.soa.esb.couriers.CourierFactory;
 import org.jboss.soa.esb.couriers.CourierUtil;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -100,7 +101,7 @@
         	Message outgoingMsg = MessageFactory.getInstance().getMessage();
         	outgoingMsg.getHeader().getCall().setTo(toEpr);
         	outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
-        	outgoingMsg.getBody().setByteArray(text_1.getBytes());
+        	outgoingMsg.getBody().add(BytesBody.BYTES_LOCATION, text_1.getBytes());
         	CourierUtil.deliverMessage(outgoingMsg);
 
         	// Mock a service that picks up the original message and replies
@@ -109,7 +110,7 @@
         	serviceEpr.setPostDelete(true);
         	PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
         	Message received = listener.pickup(100);
-        	String text_2 = new String(received.getBody().getByteArray());
+        	String text_2 = new String((byte[]) received.getBody().get(BytesBody.BYTES_LOCATION));
         	assertTrue(text_1.equals(text_2));
         	assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
         	
@@ -117,13 +118,13 @@
         	text_2	+= " + processed by listener";
         	Message response = MessageFactory.getInstance().getMessage();
         	response.getHeader().getCall().setTo(received.getHeader().getCall().getReplyTo());
-        	response.getBody().setByteArray(text_2.getBytes());
+        	response.getBody().add(BytesBody.BYTES_LOCATION, text_2.getBytes());
         	CourierUtil.deliverMessage(response);
         	
         	// try to pick up reply
         	PickUpOnlyCourier waiter = CourierFactory.getPickupCourier(replyToEpr);
         	Message finalMsg = waiter.pickup(100);
-        	assertTrue(text_2.equals(new String(finalMsg.getBody().getByteArray())));
+        	assertTrue(text_2.equals(new String((byte[]) finalMsg.getBody().get(BytesBody.BYTES_LOCATION))));
         	
         	_logger.info(text_2+"... and back from local filesystem");
         	_logger.info("getDefaultReplyToEpr test succeeded for local file transport");

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultFtpReplyToEprIntegrationTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -31,6 +31,7 @@
 import org.jboss.soa.esb.couriers.CourierFactory;
 import org.jboss.soa.esb.couriers.CourierUtil;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -101,7 +102,7 @@
         	Message outgoingMsg = MessageFactory.getInstance().getMessage();
         	outgoingMsg.getHeader().getCall().setTo(toEpr);
         	outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
-        	outgoingMsg.getBody().setByteArray(text_1.getBytes());
+        	outgoingMsg.getBody().add(BytesBody.BYTES_LOCATION, text_1.getBytes());
         	CourierUtil.deliverMessage(outgoingMsg);
 
         	// Mock a service that picks up the original message and replies
@@ -110,7 +111,7 @@
         	serviceEpr.setPostDelete(true);
         	PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
         	Message received = listener.pickup(100);
-        	String text_2 = new String(received.getBody().getByteArray());
+        	String text_2 = new String((byte[]) received.getBody().get(BytesBody.BYTES_LOCATION));
         	assertTrue(text_1.equals(text_2));
         	assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
         	
@@ -118,13 +119,13 @@
         	text_2	+= " + processed by listener";
         	Message response = MessageFactory.getInstance().getMessage();
         	response.getHeader().getCall().setTo(received.getHeader().getCall().getReplyTo());
-        	response.getBody().setByteArray(text_2.getBytes());
+        	response.getBody().add(BytesBody.BYTES_LOCATION, text_2.getBytes());
         	CourierUtil.deliverMessage(response);
         	
         	// try to pick up reply
         	PickUpOnlyCourier waiter = CourierFactory.getPickupCourier(replyToEpr);
         	Message finalMsg = waiter.pickup(100);
-        	assertTrue(text_2.equals(new String(finalMsg.getBody().getByteArray())));
+        	assertTrue(text_2.equals(new String((byte[]) finalMsg.getBody().get(BytesBody.BYTES_LOCATION))));
         	
         	_logger.info(text_2+"... and back from FTP server");
         	_logger.info("getDefaultReplyToEpr test succeeded for FTP transport");

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultJdbcReplyToEprUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultJdbcReplyToEprUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/addressing/eprs/tests/DefaultJdbcReplyToEprUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -38,6 +38,7 @@
 import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
 import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.testutils.HsqldbUtil;
 import org.junit.AfterClass;
@@ -131,14 +132,14 @@
         	Message outgoingMsg = MessageFactory.getInstance().getMessage();
         	outgoingMsg.getHeader().getCall().setTo(toEpr);
         	outgoingMsg.getHeader().getCall().setReplyTo(replyToEpr);
-        	outgoingMsg.getBody().setByteArray(text_1.getBytes());
+        	outgoingMsg.getBody().add(BytesBody.BYTES_LOCATION, text_1.getBytes());
         	CourierUtil.deliverMessage(outgoingMsg);
 
         	// Mock a service that picks up the original message and replies
         	JDBCEpr serviceEpr = getEpr("foo");
         	PickUpOnlyCourier listener = CourierFactory.getPickupCourier(serviceEpr);
         	Message received = listener.pickup(100);
-        	String text_2 = new String(received.getBody().getByteArray());
+        	String text_2 = new String((byte[]) received.getBody().get(BytesBody.BYTES_LOCATION));
         	assertTrue(text_1.equals(text_2));
 //        	assertTrue(replyToEpr.equals(received.getHeader().getCall().getReplyTo()));
         	
@@ -146,13 +147,13 @@
         	text_2	+= " + processed by listener";
         	Message response = MessageFactory.getInstance().getMessage();
         	response.getHeader().getCall().setTo(received.getHeader().getCall().getReplyTo());
-        	response.getBody().setByteArray(text_2.getBytes());
+        	response.getBody().add(BytesBody.BYTES_LOCATION, text_2.getBytes());
         	CourierUtil.deliverMessage(response);
         	
         	// try to pick up reply
         	PickUpOnlyCourier waiter = CourierFactory.getPickupCourier(replyToEpr);
         	Message finalMsg = waiter.pickup(100);
-        	assertTrue(text_2.equals(new String(finalMsg.getBody().getByteArray())));
+        	assertTrue(text_2.equals(new String((byte[]) finalMsg.getBody().get(BytesBody.BYTES_LOCATION))));
         	
         	_logger.info(text_2+"... and back from jdbc ReplyTo EPR");
         	_logger.info("getDefaultReplyToEpr test succeeded for JDBC message transport");

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerBaseTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerBaseTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerBaseTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -40,6 +40,7 @@
 import org.jboss.soa.esb.common.tests.BaseTest;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.testutils.FileUtil;
 import org.jboss.soa.esb.testutils.HsqldbUtil;
 import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
@@ -252,7 +253,7 @@
 
 		public Message notifyTest(Message message) throws Exception
 		{
-			addMessage(message.getBody().getByteArray());
+			addMessage((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
 
 			return message;
 		}

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFTPIntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFTPIntegrationTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFTPIntegrationTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -39,6 +39,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class ListenerManagerFTPIntegrationTest extends ListenerManagerFileUnitTest
@@ -85,7 +86,7 @@
 		
 		Message message = MessageFactory.getInstance().getMessage();
 		message.getHeader().setCall(new Call(toEPR));
-		message.getBody().setByteArray(THE_TEXT.getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, THE_TEXT.getBytes());
 		
 		for (int i1 = 0; i1 < howMany; i1++)
 		{

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFileUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFileUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerFileUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -37,6 +37,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class ListenerManagerFileUnitTest extends ListenerManagerBaseTest
@@ -117,7 +118,7 @@
 		
 		Message message = MessageFactory.getInstance().getMessage();
 		message.getHeader().setCall(new Call(toEPR));
-		message.getBody().setByteArray(THE_TEXT.getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, THE_TEXT.getBytes());
 		
 		for (int i1 = 0; i1 < howMany; i1++)
 		{

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJDBCUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJDBCUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJDBCUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -38,6 +38,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class ListenerManagerJDBCUnitTest extends ListenerManagerFileUnitTest
@@ -111,7 +112,7 @@
 		
 		Message message = MessageFactory.getInstance().getMessage();
 		message.getHeader().setCall(new Call(toEPR));
-		message.getBody().setByteArray(THE_TEXT.getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, THE_TEXT.getBytes());
 		
 		for (int i1 = 0; i1 < howMany; i1++)
 		{

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJMSXntegrationTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJMSXntegrationTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ListenerManagerJMSXntegrationTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -38,6 +38,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 public class ListenerManagerJMSXntegrationTest extends ListenerManagerBaseTest
@@ -99,7 +100,7 @@
 		
 		Message message = MessageFactory.getInstance().getMessage();
 		message.getHeader().setCall(new Call(toEPR));
-		message.getBody().setByteArray(THE_TEXT.getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, THE_TEXT.getBytes());
 		
 		for (int i1 = 0; i1 < howMany; i1++)
 		{

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -34,6 +34,7 @@
 import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
 import org.jboss.soa.esb.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 
 public class FileGatewayListenerUnitTest extends BaseTest
 {
@@ -149,7 +150,7 @@
 			
 			try
 			{
-				byte[] content = message.getBody().getByteArray();
+				byte[] content = (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION);
 				String value = new String(content);
 				
 				if (!value.equals(testString))

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GatewayFilterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GatewayFilterUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/GatewayFilterUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -34,6 +34,7 @@
 import org.jboss.soa.esb.filter.FilterManager;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -71,7 +72,7 @@
     {
 	ConfigTree config = new ConfigTree("test");
 	Message msg = MessageFactory.getInstance().getMessage();
-	msg.getBody().setByteArray("Hello World".getBytes());
+	msg.getBody().add(BytesBody.BYTES_LOCATION, "Hello World".getBytes());
 
 	Map<String, Object> params = new HashMap<String, Object>();
 

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContentsUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContentsUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/gateway/PackageJmsMessageContentsUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -41,6 +41,7 @@
 import org.jboss.soa.esb.addressing.EPR;
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockejb.jms.MockQueue;
@@ -84,7 +85,7 @@
 		assertTrue ( object instanceof String );
 		assertEquals (  String.class.getName(), object.getClass().getName() );
 		
-		assertEquals ( messageContent, new String ( message.getBody().getByteArray() ) );
+		assertEquals ( messageContent, new String ( (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION) ) );
 	}
 	
 	@Test
@@ -141,7 +142,7 @@
 		
 		Message message = packer.process( objectMsg );
 		
-		final String actualContent = new String ( message.getBody().getByteArray() );
+		final String actualContent = new String ( (byte[]) message.getBody().get(BytesBody.BYTES_LOCATION) );
 		assertEquals ( messageContent, actualContent );
 		assertEquals ( new URI( jmsMessageID ), message.getHeader().getCall().getMessageID()  );
 	}
@@ -196,7 +197,7 @@
 	 */
 	private void assertThatByteArrayHasBeenSet( Message esbMessage )
 	{
-		assertNotNull ("byte array must always be set regardless of the type of JMS Message", esbMessage.getBody().getByteArray() );
+		assertNotNull ("byte array must always be set regardless of the type of JMS Message", esbMessage.getBody().get(BytesBody.BYTES_LOCATION) );
 	}
 	
 	/**

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/MessageUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/MessageUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/MessageUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 
 import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 
@@ -85,7 +86,7 @@
 		
 		msg.getBody().add("foobar");
 		msg.getBody().add("qwerty", "uiop");
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 		
 		msg.getFault().setCode(new URI("urn:because"));
 		msg.getFault().setReason("something bad happened");
@@ -108,7 +109,7 @@
 		
 		msg.getBody().add("foobar");
 		msg.getBody().add("qwerty", "uiop");
-		msg.getBody().setByteArray("hello world".getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, "hello world".getBytes());
 		
 		msg.getFault().setCode(new URI("urn:because"));
 		msg.getFault().setReason("something bad happened");

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/SerializedMessageUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -42,6 +42,7 @@
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 
@@ -169,7 +170,7 @@
 		
 		String testString = "test";
 		
-		msg.getBody().setByteArray(testString.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, testString.getBytes());
 		
 		try
 		{
@@ -186,7 +187,7 @@
 			
 			o.close();
 			
-			String val = new String(nImpl.getBody().getByteArray());
+			String val = new String((byte[]) nImpl.getBody().get(BytesBody.BYTES_LOCATION));
 			
 			assertEquals(val, testString);
 		}
@@ -212,12 +213,12 @@
 		
 		String bar = "bar";
 		
-		msg1.getBody().setByteArray(foo.getBytes());
-		msg2.getBody().setByteArray(bar.getBytes());
+		msg1.getBody().add(BytesBody.BYTES_LOCATION, foo.getBytes());
+		msg2.getBody().add(BytesBody.BYTES_LOCATION, bar.getBytes());
 		
 		msg1.getBody().replace(msg2.getBody());
 		
-		String foobar = new String(msg1.getBody().getByteArray());
+		String foobar = new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION));
 		
 		assertEquals(foobar.equals("bar"), true);
 	}
@@ -238,14 +239,17 @@
 		
 		String bar = "bar";
 		
-		msg1.getBody().setByteArray(foo.getBytes());
-		msg2.getBody().setByteArray(bar.getBytes());
+		msg1.getBody().add(BytesBody.BYTES_LOCATION, foo.getBytes());
 		
+		assertEquals(new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION)), "foo");
+		
+		msg2.getBody().add(BytesBody.BYTES_LOCATION, bar.getBytes());
+		
 		msg1.getBody().merge(msg2.getBody());
 		
-		String foobar = new String(msg1.getBody().getByteArray());
+		String foobar = new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION));
 		
-		assertEquals(foobar, "foobar");
+		assertEquals(foobar, "bar");
 	}
 	
 	public void testAddObjects ()

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/message/tests/XMLMessageUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -43,6 +43,7 @@
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.addressing.eprs.SFTPEpr;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.w3c.dom.Document;
@@ -164,7 +165,7 @@
 		
 		String testString = "test";
 		
-		msg.getBody().setByteArray(testString.getBytes());
+		msg.getBody().add(BytesBody.BYTES_LOCATION, testString.getBytes());
 		
 		try
 		{
@@ -173,7 +174,7 @@
 			
 			final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
 			
-			String val = new String(nImpl.getBody().getByteArray());
+			String val = new String((byte[]) nImpl.getBody().get(BytesBody.BYTES_LOCATION));
 			
 			assertEquals(val, testString);
 		}
@@ -199,12 +200,12 @@
 		
 		String bar = "bar";
 		
-		msg1.getBody().setByteArray(foo.getBytes());
-		msg2.getBody().setByteArray(bar.getBytes());
+		msg1.getBody().add(BytesBody.BYTES_LOCATION, foo.getBytes());
+		msg2.getBody().add(BytesBody.BYTES_LOCATION, bar.getBytes());
 		
 		msg1.getBody().replace(msg2.getBody());
 		
-		String foobar = new String(msg1.getBody().getByteArray());
+		String foobar = new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION));
 		
 		assertEquals(foobar, "bar");
 	}
@@ -225,14 +226,17 @@
 		
 		String bar = "bar";
 		
-		msg1.getBody().setByteArray(foo.getBytes());
-		msg2.getBody().setByteArray(bar.getBytes());
+		msg1.getBody().add(BytesBody.BYTES_LOCATION, foo.getBytes());
 		
+		assertEquals(new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION)), "foo");
+		
+		msg2.getBody().add(BytesBody.BYTES_LOCATION, bar.getBytes());
+		
 		msg1.getBody().merge(msg2.getBody());
 		
-		String foobar = new String(msg1.getBody().getByteArray());
+		String foobar = new String((byte[]) msg1.getBody().get(BytesBody.BYTES_LOCATION));
 		
-		assertEquals(foobar, "foobar");
+		assertEquals(foobar, "bar");
 	}
 	
 	public void testAddObjects ()

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotificationListUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 
@@ -46,7 +47,7 @@
 		TestNotificationTarget2.messageList = messageList;
 		
         Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
-        message.getBody().setByteArray("tom".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "tom".getBytes());
 		nList.sendNotification(message);
 		assertEquals(4, messageList.size());
 		assertEquals("message 1-tom", messageList.get(0));

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -29,6 +29,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.Email;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 
@@ -48,7 +49,7 @@
 		
 		NotifyEmail ne = new TestNotifyEmail(emailMessageEl);
         Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
-        message.getBody().setByteArray("Hello".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "Hello".getBytes());
 		ne.sendNotification(message);
 	}
 	

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyFilesUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 
@@ -81,7 +82,7 @@
 		// Create the class and call the sendNotification method twice...
 		notifyFiles = new NotifyFiles(rootEl);
         Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
-        message.getBody().setByteArray("object".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "object".getBytes());
 		notifyFiles.sendNotification(message);
 		notifyFiles.sendNotification(message);
 
@@ -104,7 +105,7 @@
 		addFileConfig(rootEl, "file2.notif", true);
 		final NotifyFiles notifyFiles = new MockNotifyFiles(rootEl);
         final Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
-        message.getBody().setByteArray("object".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "object".getBytes());
 		try
 		{
 			notifyFiles.sendNotification( message );

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyQueuesUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -63,6 +63,7 @@
 import org.jboss.internal.soa.esb.rosetta.pooling.JmsConnectionPool;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.junit.After;
@@ -119,7 +120,7 @@
 	@Test
 	public void test_StringObj() throws Exception {
         org.jboss.soa.esb.message.Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
-        message.getBody().setByteArray("Hello".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "Hello".getBytes());
 		notifyQueues.sendNotification(message);
 		
 		checkQueueTextMessage(mockQueue1, 0, "Hello");
@@ -129,7 +130,7 @@
 	@Test
 	public void test_NonStringObj() throws Exception {
         org.jboss.soa.esb.message.Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
-        message.getBody().setByteArray(((new Integer(123).toString().getBytes())));
+        message.getBody().add(BytesBody.BYTES_LOCATION, ((new Integer(123).toString().getBytes())));
 		notifyQueues.sendNotification(message);
 		
 		checkQueueObjectMessage(mockQueue1, 0, new Integer(123).toString().getBytes());

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifySqlTableUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -32,6 +32,7 @@
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.persist.JdbcCleanConn;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.xml.sax.SAXException;
@@ -66,7 +67,7 @@
 		ConfigTree domEl = ConfigTree.fromInputStream(getClass().getResourceAsStream("NotifySqlTable_testfile1.xml"));
 		NotifySqlTable nst = new MockNotifySqlTable(domEl);
         org.jboss.soa.esb.message.Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
-        message.getBody().setByteArray((new Integer(123).toString().getBytes()));
+        message.getBody().add(BytesBody.BYTES_LOCATION, (new Integer(123).toString().getBytes()));
         try
         {
 			nst.sendNotification( message );

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyTopicsUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -39,6 +39,7 @@
 import junit.framework.TestCase;
 
 import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.mockejb.jms.MockTopic;
@@ -78,7 +79,7 @@
 
 	public void test_StringObj() throws Exception {
         org.jboss.soa.esb.message.Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
-        message.getBody().setByteArray("Hello".getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, "Hello".getBytes());
 		notifyTopics.sendNotification(message);
 		
 		checkTopicTextMessage(mockTopic1, 0, "Hello");
@@ -87,7 +88,7 @@
 	
 	public void test_NonStringObj() throws Exception {
         org.jboss.soa.esb.message.Message message = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);
-        message.getBody().setByteArray((new Integer(123).toString().getBytes()));
+        message.getBody().add(BytesBody.BYTES_LOCATION, (new Integer(123).toString().getBytes()));
 		notifyTopics.sendNotification(message);
 		
 		checkTopicObjectMessage(mockTopic1, 0, new Integer(123).toString().getBytes());

Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/TestNotificationTarget1.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -4,6 +4,7 @@
 
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 
 public class TestNotificationTarget1 extends NotificationTarget
 {
@@ -22,7 +23,7 @@
 	public void sendNotification (Message message)
 			throws NotificationException
 	{
-        String content = new String(message.getBody().getByteArray());
+        String content = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
 		messageList.add(config.getAttribute("message") + "-" + content);
 	}
 }

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -23,6 +23,7 @@
 import org.jboss.soa.esb.actions.AbstractActionLifecycle;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.samples.quickstart.helloworld.test.SampleObject;
 
 public class MyJMSListenerAction extends AbstractActionLifecycle
 {
@@ -36,6 +37,7 @@
 		
 		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");		  		  
 		  System.out.println("Body: " + new String(message.getBody().getByteArray()));
+		  System.out.println("And: "+(SampleObject) message.getBody().get());
 		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
 		  return message; 
         		

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -55,6 +55,7 @@
     	Message esbMessage = MessageFactory.getInstance().getMessage();
 
     	esbMessage.getBody().setByteArray(args[2].getBytes());
+    	esbMessage.getBody().add(new SampleObject());
     	
         new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
     	

Modified: labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/samples/quickstarts/helloworld/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -69,6 +69,9 @@
     	
         QueueSender send = session.createSender(que);        
         ObjectMessage tm = session.createObjectMessage(msg);
+        
+        tm.setObject(new SampleObject());
+        
         send.send(tm);        
         send.close();
     }

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/jcr/JCRMessageStoreImpl.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -43,6 +43,7 @@
 import org.jboss.internal.soa.esb.message.urigen.JcrMessageURIGenerator;
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.properties.MessagePropertyFacade;
 import org.jboss.soa.esb.message.urigen.MessageURIGenerator;
@@ -129,9 +130,9 @@
 			msgProps.setMessageId(messageURI.toString());
 			Node messageNode = root.addNode(messageURI.toString());
 			Node bodyNode = messageNode.addNode(JCRNodeNames.BODY_NODE_NAME);
-			if (message.getBody().getByteArray() != null) {
+			if (message.getBody().get(BytesBody.BYTES_LOCATION) != null) {
 				ByteArrayInputStream stream = new ByteArrayInputStream(
-						message.getBody().getByteArray());
+						(byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
 				bodyNode.setProperty(JCRNodeNames.BODY_CONTENT_PROP_NAME, stream);
 			}
 			for (String propName : message.getProperties().getNames()) {
@@ -172,7 +173,7 @@
 			Message message = MessageFactory.getInstance().getMessage();
 			if (bodyContents != null) {
 				byte[] contentBytes = IOUtils.toByteArray(bodyContents.getStream());
-				message.getBody().setByteArray(contentBytes);
+				message.getBody().add(BytesBody.BYTES_LOCATION, contentBytes);
 			}
 			if (LOGGER.isInfoEnabled()) {
 				LOGGER.info("Loaded node from content repository:");

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreClient.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -28,6 +28,7 @@
 import org.apache.log4j.Logger;
 import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.services.persistence.MessageStore;
@@ -59,7 +60,7 @@
 		// set some content inside the Messages
 		for (int x = 0; x < msg.length; x++)
 		{
-			msg[x].getBody().setByteArray("TEST BODY".getBytes());
+			msg[x].getBody().add(BytesBody.BYTES_LOCATION, "TEST BODY".getBytes());
 			msg[x].getProperties().setProperty("prop" + x, "val" + x);
 			msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));
 		}

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/messagestore/MessageStoreUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -38,6 +38,7 @@
 import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.persistence.manager.ConnectionManager;
@@ -85,7 +86,7 @@
 						 MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED)};		
 		//set some content inside the Messages
 		for (int x=0; x<msg.length; x++) {
-			msg[x].getBody().setByteArray("TEST BODY".getBytes());
+			msg[x].getBody().add(BytesBody.BYTES_LOCATION, "TEST BODY".getBytes());
 			msg[x].getProperties().setProperty("prop"+x, "val"+x);
 			msg[x].getAttachment().addItem(new String("TEST ATTACHMENT"));						
 		}

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/actions/MessagePersisterUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -42,6 +42,7 @@
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.persistence.manager.ConnectionManager;
 import org.jboss.soa.esb.persistence.manager.ConnectionManagerFactory;
@@ -72,7 +73,7 @@
             Date now = new Date();
             String body = "<message>First Message " + now + " </message>";
             Message msg = MessageFactory.getInstance().getMessage();
-            msg.getBody().setByteArray(body.getBytes());
+            msg.getBody().add(BytesBody.BYTES_LOCATION, body.getBytes());
             
            
             InputStream inputStream = ClassUtil.getResourceAsStream("MessagePersisterTest.xml", this.getClass());
@@ -91,7 +92,7 @@
             Iterator<Message> iter=messages.values().iterator();
             while (iter.hasNext()) {
                 Message message=iter.next();
-                String bodyFromStore = new String(message.getBody().getByteArray());
+                String bodyFromStore = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
                 System.out.println("Body=" + bodyFromStore);
             }
             System.out.println("Getting message for classification TEST:" + messages);
@@ -99,7 +100,7 @@
             
             //Now check if it is the same message
             Message message=messages.values().iterator().next();
-            String bodyFromStore = new String(message.getBody().getByteArray());
+            String bodyFromStore = new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION));
             assertEquals(body, bodyFromStore);
 		}
 		catch (Exception re)

Modified: labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/test/java/org/jboss/soa/esb/persistence/tests/MessageStoreUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -45,6 +45,7 @@
 import org.jboss.internal.soa.esb.persistence.format.MessageStoreFactory;
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.persistence.manager.ConnectionManager;
@@ -166,8 +167,8 @@
 		msg2.getProperties().setProperty("prop2", "val2");
 
 		// set the body inside the Message
-		msg1.getBody().setByteArray(("TEST BODY").getBytes());
-		msg2.getBody().setByteArray(("TEST BODY").getBytes());
+		msg1.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
+		msg2.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
 
 		// set some object attachments inside the Message
 		msg1.getAttachment().addItem(new String("TEST ATTACHMENT1"));

Modified: labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/actionhandlers/EsbActionHandler.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -37,6 +37,7 @@
 import org.jboss.soa.esb.listeners.message.MessageDeliverException;
 import org.jboss.soa.esb.message.Body;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.mapping.ObjectMapper;
 import org.jboss.soa.esb.services.jbpm.Constants;
@@ -213,7 +214,7 @@
     	    boolean isPrcScope = (null == processScope) ? gblPrcScope : Boolean
     		    .parseBoolean(processScope);
     	    Object obj = (Constants.BODY_CONTENT_VARIABLE_NAME.equals(esbVar)) ? body
-    		    .getByteArray()
+    		    .get(BytesBody.BYTES_LOCATION)
     		    : body.get(esbVar);
     	    Object oldVal = (isPrcScope) ? ctxInstance.getVariable(jbpmVar)
     		    : ctxInstance.getVariable(jbpmVar, _token);

Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/BpmProcessorUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -32,6 +32,7 @@
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Body;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.services.jbpm.Constants;
 import org.jboss.soa.esb.services.jbpm.util.Helper;
 import org.jbpm.JbpmConfiguration;
@@ -169,7 +170,7 @@
 			request	= Helper.commandMessageTemplate();
 			Helper.setLongValue(request, Constants.TOKEN_ID, tokenId);
 			String myContent = "My content travels in the message";
-			request.getBody().setByteArray(myContent.getBytes());
+			request.getBody().add(BytesBody.BYTES_LOCATION, myContent.getBytes());
 			response	= command.process(request);
 			_logger.info(JbpmTestUtil.dumpResponse(response, command.getOpCode()));
 			ret = Helper.getStringValue(response, Constants.RETURN_CODE);

Modified: labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/JbpmTestUtil.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/JbpmTestUtil.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbpm/src/test/java/org/jboss/soa/esb/services/jbpm/actions/JbpmTestUtil.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 import java.io.PrintStream;
 
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.services.jbpm.Constants;
 import org.jboss.soa.esb.util.ClassUtil;
 
@@ -91,7 +92,7 @@
 		Object obj = null;
 		if(Constants.BODY_CONTENT_VARIABLE_NAME.equals(key))
 		{
-			obj = message.getBody().getByteArray();
+			obj = message.getBody().get(BytesBody.BYTES_LOCATION);
 			return "Message body content = "
 				+((null==obj) ? "<null>" : new String((byte[])obj))
 				+"\n";

Modified: labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbrules/src/main/java/org/jboss/internal/soa/esb/services/routing/cbr/DslHelper.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 
 import org.apache.log4j.Logger;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.xml.sax.InputSource;
 
 /**
@@ -58,7 +59,7 @@
 			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message);
 		}
 		XPath xpath = xpf.newXPath();
-		InputSource inputSource = new InputSource(new ByteArrayInputStream(message.getBody().getByteArray()));
+		InputSource inputSource = new InputSource(new ByteArrayInputStream((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));
 		Object node = xpath.evaluate(xpathExp, inputSource, XPathConstants.NODE);
 		if (log.isDebugEnabled()) {
 			log.debug("Found node=" + node);
@@ -77,10 +78,10 @@
 	public static boolean xmlContentEquals(Message message, String xpathExp, String value) throws XPathExpressionException 
 	{
 		if (log.isDebugEnabled()) {
-			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().getByteArray());
+			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().get(BytesBody.BYTES_LOCATION));
 		}
 		XPath xpath = xpf.newXPath();
-		InputSource inputSource = new InputSource(new ByteArrayInputStream(message.getBody().getByteArray()));
+		InputSource inputSource = new InputSource(new ByteArrayInputStream((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));
 		String nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);
 		if (log.isDebugEnabled()) {
 			log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
@@ -104,10 +105,10 @@
 		double doubleNodeValue=0;
 		
 		if (log.isDebugEnabled()) {
-			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().getByteArray());
+			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().get(BytesBody.BYTES_LOCATION));
 		}
 		XPath xpath = xpf.newXPath();
-		InputSource inputSource = new InputSource(new ByteArrayInputStream(message.getBody().getByteArray()));	
+		InputSource inputSource = new InputSource(new ByteArrayInputStream((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));	
 		nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);if (log.isDebugEnabled()) {
 			log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
 		}
@@ -146,10 +147,10 @@
 		double doubleNodeValue=0;
 		
 		if (log.isDebugEnabled()) {
-			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().getByteArray());
+			log.debug("Trying to match xpath: '" + xpathExp +  "' in message=" + message.getBody().get(BytesBody.BYTES_LOCATION));
 		}
 		XPath xpath = xpf.newXPath();
-		InputSource inputSource = new InputSource(new ByteArrayInputStream(message.getBody().getByteArray()));	
+		InputSource inputSource = new InputSource(new ByteArrayInputStream((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));	
 		nodeValue = (String) xpath.evaluate(xpathExp, inputSource, XPathConstants.STRING);if (log.isDebugEnabled()) {
 			log.debug("Found nodeValue=" + nodeValue + " which is matched to given value=" + value);
 		}

Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/internal/soa/esb/services/routing/cbr/JBossRulesRouterUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -29,6 +29,7 @@
 import junit.framework.JUnit4TestAdapter;
 
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.services.routing.MessageRouterException;
@@ -50,7 +51,7 @@
 		message.getProperties().setProperty("prop1", "val1");
 		message.getProperties().setProperty("prop2", "val2");
 		//set the body inside the Message
-		message.getBody().setByteArray(("TEST BODY").getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
 		//set some object attachments inside the Message
 		message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
 		message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
@@ -76,7 +77,7 @@
 		message.getProperties().setProperty("prop1", "val1");
 		message.getProperties().setProperty("prop2", "val2");
 		//set the body inside the Message
-		message.getBody().setByteArray(("TEST BODY").getBytes());
+		message.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
 		//set some object attachments inside the Message
 		message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
 		message.getAttachment().addItem(new String("TEST ATTACHMENT2"));

Modified: labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/jbrules/src/test/java/org/jboss/soa/esb/services/routing/cbr/ContentBasedRoutingUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -29,6 +29,7 @@
 import junit.framework.JUnit4TestAdapter;
 
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.message.format.MessageType;
 import org.jboss.soa.esb.services.routing.MessageRouterException;
@@ -52,7 +53,7 @@
 			message.getProperties().setProperty("prop1", "val1");
 			message.getProperties().setProperty("prop2", "val2");
 			//set the body inside the Message
-			message.getBody().setByteArray(("TEST BODY").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
 			//set some object attachments inside the Message
 			message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
 			message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
@@ -76,7 +77,7 @@
 			message.getProperties().setProperty("prop1", "val1");
 			message.getProperties().setProperty("prop2", "val2");
 			//set the body inside the Message
-			message.getBody().setByteArray(("TEST BODY").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("TEST BODY").getBytes());
 			//set some object attachments inside the Message
 			message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
 			message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
@@ -99,7 +100,7 @@
 			message.getProperties().setProperty("prop1", "val1");
 			message.getProperties().setProperty("prop2", "val2");
 			//set the body inside the Message
-			message.getBody().setByteArray(("<jbossesb>TEST BODY</jbossesb>").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("<jbossesb>TEST BODY</jbossesb>").getBytes());
 			//set some object attachments inside the Message
 			message.getAttachment().addItem(new String("TEST ATTACHMENT1"));
 			message.getAttachment().addItem(new String("TEST ATTACHMENT2"));
@@ -119,7 +120,7 @@
 			//add new messages
 			Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
 			//set the body inside the Message
-			message.getBody().setByteArray(("<Dave>rocks</Dave>").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("<Dave>rocks</Dave>").getBytes());
 		
 			ContentBasedRouter cbr = ContentBasedRouterFactory.getRouter(org.jboss.soa.esb.actions.ContentBasedRouter.DEFAULT_CBR_CLASS);
 			List<String> destinationServices = cbr.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
@@ -136,7 +137,7 @@
 			//add new messages
 			Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
 			//set the body inside the Message
-			message.getBody().setByteArray(("<price>1.55</price>").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("<price>1.55</price>").getBytes());
 			
 			ContentBasedRouter cbr = ContentBasedRouterFactory.getRouter(org.jboss.soa.esb.actions.ContentBasedRouter.DEFAULT_CBR_CLASS);
 			List<String> destinationServices = cbr.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);
@@ -153,7 +154,7 @@
 			//add new messages
 			Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
 			//set the body inside the Message
-			message.getBody().setByteArray(("<price>0.55</price>").getBytes());
+			message.getBody().add(BytesBody.BYTES_LOCATION, ("<price>0.55</price>").getBytes());
 			
 			ContentBasedRouter cbr = ContentBasedRouterFactory.getRouter(org.jboss.soa.esb.actions.ContentBasedRouter.DEFAULT_CBR_CLASS);
 			List<String> destinationServices = cbr.route("JBossESBRules-XPath.drl","XPathLanguage.dsl",false,message,null);

Modified: labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -33,6 +33,7 @@
 import org.jboss.soa.esb.actions.ActionUtils;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 
 /**
@@ -91,7 +92,7 @@
 
         // Perform the transformation by setting the payload on the body as bytes...
         message = createNewMessage(fromType, from, to, toType);
-        message.getBody().setByteArray(stringMessage.getBytes());
+        message.getBody().add(BytesBody.BYTES_LOCATION, stringMessage.getBytes());
         message = transformer.process(message);
         assertEquals(resultThroughTaskObj, message.getBody().get());
 

Modified: labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -34,6 +34,7 @@
 import org.jboss.soa.esb.couriers.CourierFactory;
 import org.jboss.soa.esb.listeners.RegistryUtil;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.body.content.MessageBodyTypeNames;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.services.registry.RegistryException;
@@ -68,7 +69,7 @@
 					Message esbMessage = MessageFactory.getInstance().getMessage();
 					sender = CourierFactory.getCourier(epr);
 					esbMessage.getProperties().setProperty(MessageBodyTypeNames.COMMAND_TYPE, MessageBodyTypeNames.STATISTICS_REQUEST); 
-					esbMessage.getBody().setByteArray("get statistics".getBytes());
+					esbMessage.getBody().add(BytesBody.BYTES_LOCATION, "get statistics".getBytes());
 					
 				    URI uri = new URI(UUID.randomUUID().toString());
 				    esbMessage.getHeader().getCall().setMessageID(uri);

Modified: labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/collect.jsp
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/collect.jsp	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/collect.jsp	2007-09-05 12:26:47 UTC (rev 14897)
@@ -1,3 +1,4 @@
+<%@page import="org.jboss.soa.esb.message.body.content.BytesBody"%>
 <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
 <%@ page session="true" %>
 <%@ page import="
@@ -21,7 +22,7 @@
 		DeliverOnlyCourier sender = CourierFactory.getCourier(epr);
 		esbMessage.getProperties().setProperty(MessageBodyTypeNames.COMMAND_TYPE, MessageBodyTypeNames.STATISTICS_REQUEST); 
 
-		esbMessage.getBody().setByteArray("get statistics".getBytes());
+		esbMessage.getBody().add(BytesBody.BYTES_LOCATION, "get statistics".getBytes());
 		
 	    URI uri = new URI(UUID.randomUUID().toString());
 	    esbMessage.getHeader().getCall().setMessageID(uri);

Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -23,6 +23,7 @@
 import org.jboss.soa.esb.actions.AbstractActionLifecycle;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 
 public class MyJMSListenerAction extends AbstractActionLifecycle
 {
@@ -35,7 +36,7 @@
   public Message displayMessage(Message message) throws Exception{
 		
 		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");		  		  
-		  System.out.println("Body: " + new String(message.getBody().getByteArray()));
+		  System.out.println("Body: " + new String(message.getBody().get(BytesBody.BYTES_LOCATION)));
 		  System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
 		  return message; 
         		

Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendEsbMessage.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -27,6 +27,7 @@
 
 import org.jboss.soa.esb.addressing.Call;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.message.format.MessageFactory;
 import org.jboss.soa.esb.client.ServiceInvoker;
 
@@ -55,7 +56,7 @@
     	esbMessage.getHeader().setCall(call);
     	
     	// set body contents with args[2], and send
-    	esbMessage.getBody().setByteArray(args[2].getBytes());
+    	esbMessage.getBody().add(BytesBody.BYTES_LOCATION, args[2].getBytes());
     	
         new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
 

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/MyAction.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/MyAction.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/MyAction.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -30,6 +30,7 @@
 import org.jboss.soa.esb.actions.ActionProcessingException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.soa.esb.server.StatsMBean;
 
 public class MyAction extends AbstractActionPipelineProcessor
@@ -49,7 +50,7 @@
    public Message process(Message message) throws ActionProcessingException
    {
       logHeader();
-      System.out.println("Body: " + new String(message.getBody().getByteArray()));
+      System.out.println("Body: " + new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));
       logFooter();
       MBeanServer server = MBeanServerLocator.locateJBoss();
       StatsMBean stats ;

Modified: labs/jbossesb/trunk/qa/junit/versioned-scoped-src/org/jboss/soa/esb/server/MyAction.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/versioned-scoped-src/org/jboss/soa/esb/server/MyAction.java	2007-09-05 11:57:15 UTC (rev 14896)
+++ labs/jbossesb/trunk/qa/junit/versioned-scoped-src/org/jboss/soa/esb/server/MyAction.java	2007-09-05 12:26:47 UTC (rev 14897)
@@ -23,6 +23,7 @@
 
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.body.content.BytesBody;
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.mx.util.MBeanProxyExt;
 
@@ -49,7 +50,7 @@
    public Message process(Message message) throws Exception
    {
       logHeader();
-      System.out.println("Body: " + new String(message.getBody().getByteArray()));
+      System.out.println("Body: " + new String((byte[]) message.getBody().get(BytesBody.BYTES_LOCATION)));
       logFooter();
       MBeanServer server = MBeanServerLocator.locateJBoss();
       StatsMBean stats = (StatsMBean) MBeanProxyExt.create(StatsMBean.class, StatsMBean.objectName, server);




More information about the jboss-svn-commits mailing list