[jboss-svn-commits] JBL Code SVN: r6218 - in labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss: internal/soa/esb internal/soa/esb/addressing internal/soa/esb/message internal/soa/esb/message/adapters internal/soa/esb/message/adapters/xml soa/esb/message soa/esb/message/adapters soa/esb/notification

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 14 08:39:10 EDT 2006


Author: mark.little at jboss.com
Date: 2006-09-14 08:39:01 -0400 (Thu, 14 Sep 2006)
New Revision: 6218

Added:
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/addressing/
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/MessageFactoryImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/AttachmentImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/BodyImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/ContextImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/FaultImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/HeaderImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/MessageImpl.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageFactory.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageType.java
Removed:
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/PortReferenceHelper.java
Modified:
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Attachment.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Body.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Context.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Fault.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Header.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Message.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyJMS.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyQueues.java
   labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyTopics.java
Log:
message structure

Deleted: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/PortReferenceHelper.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/PortReferenceHelper.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/PortReferenceHelper.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,373 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2006,
- * @author mark.little at jboss.com
- */
-
-/*
- * Copyright (c) 2002, 2003, Arjuna Technologies Limited.
- *
- * PortReferenceHelper.java
- */
-
-package org.jboss.internal.soa.esb.addressing;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-import org.jboss.soa.esbcore.addressing.PortReference;
-import org.jboss.soa.esbcore.addressing.XMLUtil;
-import org.jboss.soa.esbcore.addressing.PortReference.Extension;
-import org.jboss.soa.esbcore.exceptions.MarshalException;
-
-/*
- * This should pack the PortReference into an ERP.
- * 
- * It would be better if PortReference had a packToXML and unpackFromXML.
- * 
- * This needs rewriting after the interoperability workshop!
- */
-
-public class PortReferenceHelper {
-	/**
-	 * WS-Addressing is broken in that the To field is a URI, even if the From
-	 * field was an EPR! You have to use the EPR bits separately. So, the
-	 * toField is used to indicate whether we are packing this address as a To
-	 * field (when we need to treat it differently) or as an EPR.
-	 */
-
-	/** ************************************************** */
-	public static void toXML(org.w3c.dom.Element header,
-			org.w3c.dom.Document document,
-			org.w3c.dom.Element portReferenceElement,
-			PortReference portReference, boolean toField)
-			throws MarshalException {
-		try {
-			if (!toField) {
-				Element addressElement = document.createElementNS(
-						XMLUtil.WSA_NAMESPACE_URI, XMLUtil.ADDRESS_TAG);
-				addressElement.setPrefix(XMLUtil.WSA_PREFIX);
-				addressElement.appendChild(document
-						.createTextNode(portReference.getAddress()));
-				portReferenceElement.appendChild(addressElement);
-			} else {
-				portReferenceElement.appendChild(document
-						.createTextNode(portReference.getAddress()));
-			}
-
-			Iterator extensions = portReference.getExtensions();
-			Element referenceProperties = null;
-
-			while (extensions.hasNext()) {
-				PortReference.Extension extension = (PortReference.Extension) extensions
-						.next();
-
-				/*
-				 * WS-Addressing is broken in that the To field is a URI, even
-				 * if the From field was an EPR! You have to use the EPR bits
-				 * separately. Doh!
-				 */
-
-				if (!toField) {
-					if (referenceProperties == null) {
-						referenceProperties = document.createElementNS(
-								XMLUtil.WSA_NAMESPACE_URI,
-								XMLUtil.REFERENCE_PROPERTIES_TAG);
-						referenceProperties.setPrefix(XMLUtil.WSA_PREFIX);
-						portReferenceElement.appendChild(referenceProperties);
-					}
-				} else
-					referenceProperties = header;
-
-				extensionToXML(referenceProperties, document, extension);
-			}
-		} catch (Exception exception) {
-			exception.printStackTrace();
-			throw new MarshalException("Marshal failure: " + exception);
-		}
-	}
-
-	/** **************************** */
-	public static PortReference fromXML(org.w3c.dom.Element portReferenceElement, boolean toField)
-			throws MarshalException {
-		PortReference portReference = new PortReference();;
-		
-		if (toField)
-			portReference.setAddress(portReferenceElement.getTextContent());
-		
-		org.w3c.dom.NodeList elements = portReferenceElement.getChildNodes();
-
-		for (int i = 1; i < elements.getLength(); i++) {
-			final Object extensionObject = elements.item(i);
-			
-			if (extensionObject instanceof Element) {
-				int parentNodeType = PortReference.Extension.NEITHER;
-				Element extensionElement = (Element) extensionObject;
-				NodeList children = extensionElement.getChildNodes();
-				String parentName = extensionElement.getNodeName();
-				boolean haveChildren = false;
-
-				if (parentName.equals(XMLUtil.REFERENCE_PROPERTIES_TAG))
-					parentNodeType = PortReference.Extension.REFERENCE_PROPERTIES;
-				else {
-					if (parentName.equals(XMLUtil.REFERENCE_PARAMETERS_TAG))
-						parentNodeType = PortReference.Extension.REFERENCE_PARAMETERS;
-					else
-					{
-						if (!toField && parentName.equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ADDRESS_TAG))
-						{
-							portReference.setAddress(extensionElement.getTextContent());
-						}
-					}
-				}
-
-				final int numChildren = children.getLength();
-				for (int count = 0; count < numChildren; count++) {
-					final Object childObject = children.item(count);
-
-					if (childObject instanceof Element) {
-						Element childElement = (Element) childObject;
-						portReference
-								.addExtension(childrenFromXML(childElement));
-						haveChildren = true;
-					}
-				}
-
-				if (!haveChildren) {
-					PortReference.Extension ext = new PortReference.Extension(
-							extensionElement.getNodeName(), null, null,
-							extensionElement.getNodeValue(), parentNodeType);
-
-					portReference.addExtension(ext);
-
-					final NamedNodeMap attrs = extensionElement.getAttributes();
-					final int numAttrs = attrs.getLength();
-					if (numAttrs > 0) {
-						final HashMap p = new HashMap();
-						for (int count = 0; count < numAttrs; count++) {
-							final Attr attr = (Attr) attrs.item(count);
-							if (!"http://www.w3.org/2000/xmlns/".equals(attr
-									.getNamespaceURI())) {
-								final ArjunaName name = generateName(attr);
-								p.put(name, attr.getValue());
-							}
-						}
-
-						ext.addAttributes(p);
-					}
-				}
-			}
-		}
-
-		return portReference;
-	}
-
-	private final static PortReference.Extension childrenFromXML(
-			Element childRoot) {
-		final NodeList children = childRoot.getChildNodes();
-		final int numChildNodes = children.getLength();
-
-		final PortReference.Extension extension;
-		if (numChildNodes > 0) {
-			Object childObject = children.item(0);
-			if (childObject instanceof Element) {
-				extension = new PortReference.Extension(childRoot
-						.getNodeName(), childRoot.getPrefix(), childRoot
-						.getNamespaceURI());
-				for (int count = 1; count < numChildNodes; count++) {
-					extension.addChild(childrenFromXML((Element) childObject));
-					childObject = children.item(count);
-				}
-			} else {
-				extension = new PortReference.Extension(childRoot
-						.getNodeName(), childRoot.getPrefix(), childRoot
-						.getNamespaceURI(), ((Node) childObject).getNodeValue());
-			}
-		} else {
-			extension = new PortReference.Extension(childRoot.getNodeName(),
-					childRoot.getPrefix(), childRoot.getNamespaceURI(),
-					childRoot.getNodeValue());
-		}
-
-		final NamedNodeMap attrs = childRoot.getAttributes();
-		final int numAttrs = attrs.getLength();
-		if (numAttrs > 0) {
-			final HashMap p = new HashMap();
-			for (int count = 0; count < numAttrs; count++) {
-				final Attr attr = (Attr) attrs.item(count);
-				if (!"http://www.w3.org/2000/xmlns/".equals(attr
-						.getNamespaceURI())) {
-					final ArjunaName name = generateName(attr);
-					p.put(name, attr.getValue());
-				}
-			}
-
-			extension.addAttributes(p);
-		}
-		return extension;
-	}
-
-	private final static Element extensionToXML(Element packInto,
-			org.w3c.dom.Document document, PortReference.Extension toPack)
-			throws MarshalException {
-		final String uri = toPack.getURI();
-		final Element element;
-		if (uri == null) {
-			element = document.createElement(toPack.getTag());
-		} else {
-			final String prefix = toPack.getPrefix();
-			element = document.createElementNS(uri, toPack.getTag());
-			element.setPrefix(prefix);
-			element.setAttributeNS(XMLUtil.XMLNS_URI, XMLUtil.XMLNS_PREFIX
-					+ toPack.getPrefix(), uri);
-		}
-		packInto.appendChild(element);
-
-		if (toPack.getValue() != null) {
-			final Text text = document.createTextNode(toPack.getValue());
-			element.appendChild(text);
-		}
-
-		LinkedList extensions = toPack.getChildren();
-
-		if (extensions != null) {
-			for (int i = 0; i < extensions.size(); i++) {
-				PortReference.Extension ext = (PortReference.Extension) extensions
-						.get(i);
-
-				extensionToXML(element, document, ext);
-			}
-		}
-
-		HashMap attrs = toPack.getAttributes();
-
-		if (attrs != null) {
-			Iterator names = attrs.entrySet().iterator();
-
-			while (names.hasNext()) {
-				Map.Entry entry = (Map.Entry) names.next();
-				ArjunaName name = (ArjunaName) entry.getKey();
-				final String value = (String) entry.getValue();
-				final String attrURI = name.toString();
-				if (attrURI != null) {
-					element.setAttributeNS(attrURI, name.getQualifiedName(),
-							value);
-				} else {
-					element.setAttribute(name.getQualifiedName(), value);
-				}
-			}
-		}
-
-		return element;
-	}
-
-	/**
-	 * Generate a name based on the attribute.
-	 * 
-	 * @param attr
-	 *            The current attribute.
-	 * @return The name
-	 */
-	private static ArjunaName generateName(final Attr attr) {
-		final String localName = attr.getNodeName();
-		final String uri = attr.getNamespaceURI();
-		final String prefix = attr.getPrefix();
-
-		return new ArjunaName(uri, prefix, localName);
-	}
-
-	private static class ArjunaName
-	{
-		/**
-		 * The uri.
-		 */
-		private final String uri;
-
-		/**
-		 * The prefix.
-		 */
-		private final String prefix;
-
-		/**
-		 * The local name.
-		 */
-		private final String localName;
-
-		/**
-		 * Construct the name.
-		 * 
-		 * @param uri
-		 *            The uri.
-		 * @param prefix
-		 *            The prefix.
-		 * @param localName
-		 *            The local name.
-		 */
-		public ArjunaName(final String uri, final String prefix,
-				final String localName) {
-			this.uri = uri;
-			this.prefix = prefix;
-			this.localName = localName;
-		}
-
-		/**
-		 * Get the uri.
-		 * 
-		 * @return the uri.
-		 */
-		public String getURI() {
-			return uri;
-		}
-
-		/**
-		 * Get the prefix.
-		 * 
-		 * @return the prefix.
-		 */
-		public String getPrefix() {
-			return prefix;
-		}
-
-		/**
-		 * Get the local name.
-		 * 
-		 * @return the local name.
-		 */
-		public String getLocalName() {
-			return localName;
-		}
-
-		/**
-		 * Get the qualified name.
-		 * 
-		 * @return the qualified name.
-		 */
-		public String getQualifiedName() {
-			return (prefix == null ? localName : prefix + ":" + localName);
-		}
-	}
-}

Copied: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java (from rev 6201, labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/PortReferenceHelper.java)

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/MessageFactoryImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/MessageFactoryImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/MessageFactoryImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,54 @@
+package org.jboss.internal.soa.esb.message.adapters;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.adapters.MessageFactory;
+
+import org.jboss.internal.soa.esb.message.adapters.xml.MessageImpl;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Messages may contain attachments that do not appear in the main payload body.
+ * For example, binary document formats, zip files etc.
+ * 
+ * @author Mark Little
+ */
+
+public class MessageFactoryImpl extends MessageFactory
+{
+	Message getMessage () // returns some default implementation.
+	{
+		// this needs to be configurable at runtime so it can be replaced
+		
+		return new MessageImpl();
+	}
+	
+	Message getMessage (int type)  // returns a message of a specific type.
+	{
+		return null;
+	}
+	
+	Message getMessage (Message msg, int type)  // convert a message from one form to another.
+	{
+		return null;
+	}
+}

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/AttachmentImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/AttachmentImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/AttachmentImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,51 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+import org.jboss.soa.esb.message.Attachment;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Messages may contain attachments that do not appear in the main payload body.
+ * For example, binary document formats, zip files etc.
+ * 
+ * @author Mark Little
+ */
+
+public class AttachmentImpl implements Attachment
+{
+	public Element toXML (Document doc, Element envelope)
+	{
+		Element attachmentElement = doc.createElement("attachment");
+		
+		envelope.appendChild(attachmentElement);
+		
+		return attachmentElement;
+	}
+	
+	public void fromXML (Element envelope)
+	{
+	}
+	
+}

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/BodyImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/BodyImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/BodyImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,118 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+import java.security.InvalidParameterException;
+
+import org.jboss.soa.esb.message.Body;
+
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/*
+ * Placeholder class. Just enough to do the initial POC.
+ */
+
+public class BodyImpl implements Body
+{
+	public BodyImpl ()
+	{
+		_content = null;
+	}
+	
+	public Element toXML (Document doc, Element envelope)
+	{
+		Element bodyElement = doc.createElement("body");
+		
+		envelope.appendChild(bodyElement);
+		
+		bodyElement.appendChild(doc.createCDATASection(new String(_content)));
+		
+		return bodyElement;
+	}
+	
+	public void fromXML (Element envelope)
+	{
+		NodeList nl = envelope.getChildNodes();
+		
+		for (int i = 0; i < nl.getLength(); i++)
+		{
+			if (nl.item(i).getNodeName().equals("body"))
+			{
+				CDATASection cdata = (CDATASection) nl.item(i).getFirstChild();
+		
+				_content = cdata.getWholeText().getBytes();
+				
+				break;
+			}
+		}
+	}
+	
+	public void setContents (byte[] content)
+	{
+		_content = content;
+	}
+
+	public byte[] getContents ()
+	{
+		return _content;
+	}
+	
+	public void replace (Body b)
+	{
+		if (b == null)
+			throw new InvalidParameterException();
+		
+		setContents(b.getContents());
+	}
+	
+	public void merge (Body b)
+	{
+		if (b == null)
+			throw new InvalidParameterException();
+		
+		byte[] toAdd = b.getContents();
+		
+		if ((toAdd != null) && (toAdd.length > 0))
+		{
+			if ((_content == null) || (_content.length == 0))
+			{
+				_content = toAdd;
+			}
+			else
+			{
+				int newSize = _content.length + toAdd.length;
+				byte[] buffer = new byte[newSize];
+				
+				for (int i = 0; i < _content.length; i++)
+					buffer[i] = _content[i];
+				
+				for (int j = 0; j < toAdd.length; j++)
+					buffer[_content.length+j] = toAdd[j];
+			}
+		}
+	}
+	
+	private byte[] _content;
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/ContextImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/ContextImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/ContextImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,43 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+import org.jboss.soa.esb.message.Context;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+public class ContextImpl implements Context
+{
+	public Element toXML (Document doc, Element envelope)
+	{
+		Element contextElement = doc.createElement("context");
+		
+		envelope.appendChild(contextElement);
+		
+		return contextElement;
+	}
+	
+	public void fromXML (Element envelope)
+	{
+	}
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/FaultImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/FaultImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/FaultImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,44 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+import org.jboss.soa.esb.message.Fault;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+public class FaultImpl implements Fault
+{
+	public Element toXML (Document doc, Element envelope)
+	{
+		Element faultElement = doc.createElement("fault");
+		
+		envelope.appendChild(faultElement);
+		
+		return faultElement;
+	}
+	
+	public void fromXML (Element envelope)
+	{
+	}
+	
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/HeaderImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/HeaderImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/HeaderImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,91 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+import org.jboss.soa.esb.message.Header;
+import org.jboss.soa.esb.addressing.Call;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * The message header. Contains such things as routing information.
+ */
+
+public class HeaderImpl implements Header
+{
+	public HeaderImpl ()
+	{
+		_call = null;
+	}
+	
+	// TODO add other setters/getters for artibitrary attributes
+	
+	public Call getCall ()
+	{
+		return _call;
+	}
+	
+	public void setCall (Call call)
+	{
+		_call = call;
+	}
+	
+	public Element toXML (Document doc, Element envelope)
+	{
+		// TODO remove MAGIC strings!!
+		
+		Element headerElement = doc.createElement("header");
+		
+		envelope.appendChild(headerElement);
+		
+		return _call.toXML(doc, headerElement);
+	}
+	
+	public void fromXML (Element envelope)
+	{
+		_call = new Call();
+		
+		NodeList nl = envelope.getChildNodes();
+		Element headerElement = null;
+		
+		for (int i = 0; i < nl.getLength(); i++)
+		{
+			Node n = nl.item(i);
+			
+			if (n.getNodeName().equals("header"))
+			{
+				headerElement = (Element) n;
+				break;
+			}
+		}
+		
+		// TODO error handling!!
+		
+		if (headerElement != null)
+			_call.fromXML(headerElement);
+	}
+	
+	private Call _call;
+}
\ No newline at end of file

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/MessageImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/MessageImpl.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/internal/soa/esb/message/adapters/xml/MessageImpl.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,164 @@
+package org.jboss.internal.soa.esb.message.adapters.xml;
+
+import org.jboss.soa.esb.message.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * 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.
+ * 
+ * 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
+{
+	/**
+	 * @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;
+	}
+	
+	// to/from XML here, rather than on individual elements
+	
+	public Document toXML (Document doc)
+	{
+		try
+		{		
+			// TODO remove magic strings!
+			
+			Element envelope = doc.createElement("envelope");
+
+			doc.appendChild(envelope);
+			
+			_theHeader.toXML(doc, envelope);
+			_theContext.toXML(doc, envelope);
+			_theBody.toXML(doc, envelope);
+			_theFault.toXML(doc, envelope);
+			_theAttachment.toXML(doc, envelope);
+			
+			return doc;
+		}
+		catch (Exception ex)
+		{
+			// TODO error handling
+			
+			ex.printStackTrace();
+			
+			return null;
+		}
+	}
+	
+	public void fromXML (Document doc)
+	{
+		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"))
+				{
+					envelope = (Element) n;
+					break;
+				}
+			}
+
+			_theHeader.fromXML(envelope);
+			_theContext.fromXML(envelope);
+			_theBody.fromXML(envelope);
+			_theFault.fromXML(envelope);
+			_theAttachment.fromXML(envelope);			
+		}
+		catch (Exception ex)
+		{
+			ex.printStackTrace();
+		}
+	}
+	
+	private HeaderImpl _theHeader = new HeaderImpl();
+	private ContextImpl _theContext = new ContextImpl();
+	private BodyImpl _theBody = new BodyImpl();
+	private FaultImpl _theFault = new FaultImpl();
+	private AttachmentImpl _theAttachment = new AttachmentImpl();
+	
+}

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Attachment.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Attachment.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Attachment.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,9 +1,5 @@
 package org.jboss.soa.esb.message;
 
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -32,19 +28,7 @@
  * @author Mark Little
  */
 
-public class Attachment
+public interface Attachment
 {
-	public Element toXML (Document doc, Element envelope)
-	{
-		Element attachmentElement = doc.createElement("attachment");
-		
-		envelope.appendChild(attachmentElement);
-		
-		return attachmentElement;
-	}
-	
-	public void fromXML (Element envelope)
-	{
-	}
-	
+	// TODO
 }

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Body.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Body.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Body.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,13 +1,5 @@
 package org.jboss.soa.esb.message;
 
-import java.security.InvalidParameterException;
-
-import org.jboss.soa.esbcore.addressing.EPR;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -33,85 +25,13 @@
  * Placeholder class. Just enough to do the initial POC.
  */
 
-public class Body
+public interface Body
 {
-	public Body ()
-	{
-		_content = null;
-	}
-	
-	public Element toXML (Document doc, Element envelope)
-	{
-		Element bodyElement = doc.createElement("body");
-		
-		envelope.appendChild(bodyElement);
-		
-		bodyElement.appendChild(doc.createCDATASection(new String(_content)));
-		
-		return bodyElement;
-	}
-	
-	public void fromXML (Element envelope)
-	{
-		NodeList nl = envelope.getChildNodes();
-		
-		for (int i = 0; i < nl.getLength(); i++)
-		{
-			if (nl.item(i).getNodeName().equals("body"))
-			{
-				CDATASection cdata = (CDATASection) nl.item(i).getFirstChild();
-		
-				_content = cdata.getWholeText().getBytes();
-				
-				break;
-			}
-		}
-	}
-	
-	public void setContents (byte[] content)
-	{
-		_content = content;
-	}
 
-	public byte[] getContents ()
-	{
-		return _content;
-	}
-	
-	public void replace (Body b)
-	{
-		if (b == null)
-			throw new InvalidParameterException();
-		
-		setContents(b.getContents());
-	}
-	
-	public void merge (Body b)
-	{
-		if (b == null)
-			throw new InvalidParameterException();
-		
-		byte[] toAdd = b.getContents();
-		
-		if ((toAdd != null) && (toAdd.length > 0))
-		{
-			if ((_content == null) || (_content.length == 0))
-			{
-				_content = toAdd;
-			}
-			else
-			{
-				int newSize = _content.length + toAdd.length;
-				byte[] buffer = new byte[newSize];
-				
-				for (int i = 0; i < _content.length; i++)
-					buffer[i] = _content[i];
-				
-				for (int j = 0; j < toAdd.length; j++)
-					buffer[_content.length+j] = toAdd[j];
-			}
-		}
-	}
-	
-	private byte[] _content;
+	public void setContents (byte[] content);
+	public byte[] getContents ();
+
+	public void replace (Body b);
+	public void merge (Body b);
+
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Context.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Context.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Context.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,9 +1,5 @@
 package org.jboss.soa.esb.message;
 
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -25,18 +21,7 @@
  * @author mark.little at jboss.com
  */
 
-public class Context
+public interface Context
 {
-	public Element toXML (Document doc, Element envelope)
-	{
-		Element contextElement = doc.createElement("context");
-		
-		envelope.appendChild(contextElement);
-		
-		return contextElement;
-	}
-	
-	public void fromXML (Element envelope)
-	{
-	}
+	// TODO
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Fault.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Fault.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Fault.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,9 +1,5 @@
 package org.jboss.soa.esb.message;
 
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -25,19 +21,7 @@
  * @author mark.little at jboss.com
  */
 
-public class Fault
+public interface Fault
 {
-	public Element toXML (Document doc, Element envelope)
-	{
-		Element faultElement = doc.createElement("fault");
-		
-		envelope.appendChild(faultElement);
-		
-		return faultElement;
-	}
-	
-	public void fromXML (Element envelope)
-	{
-	}
-	
+	// TODO
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Header.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Header.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Header.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -21,69 +21,14 @@
  * @author mark.little at jboss.com
  */
 
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.jboss.soa.esb.addressing.Call;
 
 /**
  * The message header. Contains such things as routing information.
  */
 
-public class Header
+public interface Header
 {
-	public Header ()
-	{
-		_epr = null;
-	}
-	
-	// TODO add other setters/getters for artibitrary attributes
-	
-	public EPR getEPR ()
-	{
-		return _epr;
-	}
-	
-	public void setEPR (EPR addr)
-	{
-		_epr = addr;
-	}
-	
-	public Element toXML (Document doc, Element envelope)
-	{
-		// TODO remove MAGIC strings!!
-		
-		Element headerElement = doc.createElement("header");
-		
-		envelope.appendChild(headerElement);
-		
-		return _epr.toXML(doc, headerElement);
-	}
-	
-	public void fromXML (Element envelope)
-	{
-		_epr = new EPR();
-		
-		NodeList nl = envelope.getChildNodes();
-		Element headerElement = null;
-		
-		for (int i = 0; i < nl.getLength(); i++)
-		{
-			Node n = nl.item(i);
-			
-			if (n.getNodeName().equals("header"))
-			{
-				headerElement = (Element) n;
-				break;
-			}
-		}
-		
-		// TODO error handling!!
-		
-		if (headerElement != null)
-			_epr.fromXML(headerElement);
-	}
-	
-	private EPR _epr;
+	public Call getCall ();
+	public void setCall (Call call);
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Message.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Message.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/Message.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -1,17 +1,5 @@
 package org.jboss.soa.esb.message;
 
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSSerializer;
-
-import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
-
 /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and others contributors as indicated 
@@ -52,123 +40,38 @@
  * @author Mark Little
  *
  */
-public class Message
+
+public interface Message
 {
 	/**
 	 * @return get the header component of the message.
 	 */
 	
-	public Header getHeader ()
-	{
-		return _theHeader;
-	}
-	
+	public Header getHeader ();
+
 	/**
 	 * @return get the context component of the message.
 	 */
 	
-	public Context getContext ()
-	{
-		return _theContext;
-	}
+	public Context getContext ();
 	
 	/**
 	 * @return get the body component of the message.
 	 */
 	
-	public Body getBody ()
-	{
-		return _theBody;
-	}
-	
+	public Body getBody ();
+
 	/**
 	 * @return get any faults associated with the message. These should not
 	 * be application level faults, but comms level.
 	 */
 	
-	public Fault getFault ()
-	{
-		return _theFault;
-	}
+	public Fault getFault ();
 	
 	/**
 	 * @return get any message attachments.
 	 */
 	
-	public Attachment getAttachment ()
-	{
-		return _theAttachment;
-	}
+	public Attachment getAttachment ();
 	
-	/*
-	 * Should be to/from Normalized, where XML is just one of the possible
-	 * implementations.
-	 */
-	
-	// to/from XML here, rather than on individual elements
-	
-	public Document toXML (Document doc)
-	{
-		try
-		{		
-			// TODO remove magic strings!
-			
-			Element envelope = doc.createElement("envelope");
-
-			doc.appendChild(envelope);
-			
-			_theHeader.toXML(doc, envelope);
-			_theContext.toXML(doc, envelope);
-			_theBody.toXML(doc, envelope);
-			_theFault.toXML(doc, envelope);
-			_theAttachment.toXML(doc, envelope);
-			
-			return doc;
-		}
-		catch (Exception ex)
-		{
-			// TODO error handling
-			
-			ex.printStackTrace();
-			
-			return null;
-		}
-	}
-	
-	public void fromXML (Document doc)
-	{
-		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"))
-				{
-					envelope = (Element) n;
-					break;
-				}
-			}
-
-			_theHeader.fromXML(envelope);
-			_theContext.fromXML(envelope);
-			_theBody.fromXML(envelope);
-			_theFault.fromXML(envelope);
-			_theAttachment.fromXML(envelope);			
-		}
-		catch (Exception ex)
-		{
-			ex.printStackTrace();
-		}
-	}
-	
-	private Header _theHeader = new Header();
-	private Context _theContext = new Context();
-	private Body _theBody = new Body();
-	private Fault _theFault = new Fault();
-	private Attachment _theAttachment = new Attachment();
-	
 }

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageFactory.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageFactory.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageFactory.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,48 @@
+package org.jboss.soa.esb.message.adapters;
+
+import org.jboss.internal.soa.esb.message.adapters.MessageFactoryImpl;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * You get a message of a specific type when you need it. Obviously that type may not be
+ * suitable for the service (hopefully you've got that contractual information a priori, but
+ * maybe not) and in which case some translation/transformation may be necessary.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public abstract class MessageFactory
+{
+	Message getMessage (); // returns some default implementation.
+	Message getMessage (int type);  // returns a message of a specific type.
+	Message getMessage (Message msg, int type);  // convert a message from one form to another.
+	
+	public static MessageFactory getInstance ()
+	{
+		return theFactory;
+	}
+	
+	private static final theFactory = new MessageFactoryImpl();
+	
+}

Added: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageType.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageType.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/message/adapters/MessageType.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -0,0 +1,41 @@
+package org.jboss.soa.esb.message.adapters;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * You get a message of a specific type when you need it. Obviously that type may not be
+ * suitable for the service (hopefully you've got that contractual information a priori, but
+ * maybe not) and in which case some translation/transformation may be necessary.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public interface MessageType
+{
+	/*
+	 * DO NOT reorder this list. New types may be added as required.
+	 */
+	
+	public static final int JBOSS_XML = 0;
+	public static final int JAVA_SERIALIZED = 1;
+}

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyJMS.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyJMS.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyJMS.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -50,7 +50,7 @@
 	 * @param p_oMsg
 	 *            Message
 	 */
-	protected abstract void sendToAll(Message p_oMsg);
+	protected abstract void sendToAll(Normalized p_oMsg);
 
 	/**
 	 * Element name mnemonic to search for child elements in the DomElement at
@@ -161,7 +161,7 @@
 	 * @see NotifyJMS#CHILD_MSG_PROP
 	 */
 	public void sendNotification(Serializable p_o) throws Exception {
-		Message oMsg = null;
+		Normalized oMsg = null;
 		
 		if (p_o instanceof String) {
 			oMsg = m_oSess.createTextMessage(p_o.toString());

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyQueues.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyQueues.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyQueues.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -91,7 +91,7 @@
 		return (QueueConnectionFactory) m_oCtx.lookup(CONNECTION_FACTORY);
 	}
 
-	protected void sendToAll(Message p_oMsg) {
+	protected void sendToAll(Normalized p_oMsg) {
 		for (int i1 = 0; i1 < m_oaMssProd.length; i1++) {
 			QueueSender oCurr = (QueueSender) m_oaMssProd[i1];
 			try {

Modified: labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyTopics.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyTopics.java	2006-09-14 03:26:56 UTC (rev 6217)
+++ labs/jbossesb/workspace/rearchitecture/product/core/babel/src/org/jboss/soa/esb/notification/NotifyTopics.java	2006-09-14 12:39:01 UTC (rev 6218)
@@ -59,7 +59,7 @@
 
 	} // __________________________________
 
-	protected void sendToAll(Message p_oMsg) {
+	protected void sendToAll(Normalized p_oMsg) {
 		for (int i1 = 0; i1 < m_oaMssProd.length; i1++) {
 			TopicPublisher oCurr = (TopicPublisher) m_oaMssProd[i1];
 			try {




More information about the jboss-svn-commits mailing list