[jboss-svn-commits] JBL Code SVN: r15667 - in labs/jbossesb/trunk/product/rosetta/src/org/jboss: internal/soa/esb/message/format/xml and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 8 19:24:51 EDT 2007
Author: mark.little at jboss.com
Date: 2007-10-08 19:24:51 -0400 (Mon, 08 Oct 2007)
New Revision: 15667
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/xml/MessageImpl.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1146
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-10-08 21:24:48 UTC (rev 15666)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java 2007-10-08 23:24:51 UTC (rev 15667)
@@ -135,11 +135,10 @@
public String toString ()
{
- return "message: [ JAVA_SERIALIZED ]\n[ " + _theHeader.toString()
+ return "message: [ JAVA_SERIALIZED ]\n" + _theHeader.toString()
+ "\n" + _theContext.toString() + "\n" + _theBody.toString()
+ "\n" + _theFault.toString() + "\n"
- + _theAttachment.toString() + "\n" + _theProperties.toString()
- + " ]";
+ + _theAttachment.toString() + "\n" + _theProperties.toString();
}
public void writeExternal (ObjectOutput out) throws IOException
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-10-08 21:24:48 UTC (rev 15666)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/MessageImpl.java 2007-10-08 23:24:51 UTC (rev 15667)
@@ -64,213 +64,212 @@
public class MessageImpl implements Message
{
- private static final long serialVersionUID = 0x0;
+ private static final long serialVersionUID = 0x0;
- public static final String ENVELOPE_TAG = "Envelope";
+ public static final String ENVELOPE_TAG = "Envelope";
- public MessageImpl()
- {
- _theHeader = new HeaderImpl();
- _theContext = new ContextImpl();
- _theBody = new BodyImpl();
- _theFault = new FaultImpl(_theBody);
- _theAttachment = new AttachmentImpl();
- _theProperties = new PropertiesImpl();
- }
+ 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.
- */
+ /**
+ * @return get the header component of the message.
+ */
- public Header getHeader ()
- {
- return _theHeader;
- }
+ public Header getHeader()
+ {
+ return _theHeader;
+ }
- /**
- * @return get the context component of the message.
- */
+ /**
+ * @return get the context component of the message.
+ */
- public Context getContext ()
- {
- return _theContext;
- }
+ public Context getContext()
+ {
+ return _theContext;
+ }
- /**
- * @return get the body component of the message.
- */
+ /**
+ * @return get the body component of the message.
+ */
- public Body getBody ()
- {
- return _theBody;
- }
+ public Body getBody()
+ {
+ return _theBody;
+ }
- /**
- * @return get any faults associated with the message. These should not
- * be application level faults, but comms level.
- */
+ /**
+ * @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 _theFault;
+ }
- /**
- * @return get any message attachments.
- */
+ /**
+ * @return get any message attachments.
+ */
- public Attachment getAttachment ()
- {
- return _theAttachment;
- }
+ public Attachment getAttachment()
+ {
+ return _theAttachment;
+ }
- /**
- * @return the type of this message format.
- */
+ /**
+ * @return the type of this message format.
+ */
- public URI getType ()
- {
- return MessageType.JBOSS_XML;
- }
+ public URI getType()
+ {
+ return MessageType.JBOSS_XML;
+ }
- /**
- * getProperties()
- *
- * @return org.jboss.soa.esb.message.Properties - any message
- * properties.
- */
- public Properties getProperties ()
- {
- return _theProperties;
- }
+ /**
+ * 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() + " ]";
- }
+ 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
+ // to/from XML here, rather than on individual elements
- public Document toXML (Document doc) throws MarshalException
- {
- try
+ public Document toXML(Document doc) throws MarshalException
{
- // TODO remove magic strings!
+ try
+ {
+ // TODO remove magic strings!
- Element envelope = doc.createElement(ENVELOPE_TAG);
+ Element envelope = doc.createElement(ENVELOPE_TAG);
- doc.appendChild(envelope);
+ doc.appendChild(envelope);
- _theHeader.toXML(envelope);
- _theContext.toXML(envelope);
- _theBody.toXML(envelope);
- _theFault.toXML(envelope);
- _theAttachment.toXML(envelope);
- _theProperties.toXML(envelope);
+ _theHeader.toXML(envelope);
+ _theContext.toXML(envelope);
+ _theBody.toXML(envelope);
+ _theFault.toXML(envelope);
+ _theAttachment.toXML(envelope);
+ _theProperties.toXML(envelope);
- return doc;
- }
- catch (MarshalException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- LOGGER.warn("MessageImpl.toXML caught unexpected exception:", ex);
+ return doc;
+ }
+ catch (MarshalException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ LOGGER.warn("MessageImpl.toXML caught unexpected exception:", ex);
- throw new MarshalException(ex);
+ throw new MarshalException(ex);
+ }
}
- }
- public void fromXML (Document doc) throws UnmarshalException
- {
- try
+ public void fromXML(Document doc) throws UnmarshalException
{
- NodeList nl = doc.getChildNodes();
- Element envelope = null;
+ try
+ {
+ NodeList nl = doc.getChildNodes();
+ Element envelope = null;
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
- if (n.getNodeName().equals(ENVELOPE_TAG))
- {
- envelope = (Element) n;
- break;
- }
- }
+ 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);
+ _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.
- */
+ /*
+ * 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);
+ String payloadType = Payload.bodyType(this);
- if ((payloadType != null)
- && (!payloadType.equals(Payload.RAW_BODY)))
- {
- try
+ if ((payloadType != null)
+ && (!payloadType.equals(Payload.RAW_BODY)))
+ {
+ try
+ {
+ _theBody = (BodyImpl) MessageFactory.getInstance()
+ .createBodyType(this, payloadType);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ catch (UnmarshalException ex)
{
- _theBody = (BodyImpl) MessageFactory.getInstance()
- .createBodyType(this, payloadType);
+ throw ex;
}
catch (Exception ex)
{
- ex.printStackTrace();
+ LOGGER.warn("MessageImpl.fromXML caught unexpected exception:", ex);
+
+ throw new UnmarshalException(ex);
}
- }
}
- catch (UnmarshalException ex)
+
+ // should be a capability on the base interface, but no changes for 4.2
+ // ...
+
+ void replaceBody(BodyImpl body)
{
- throw ex;
- }
- catch (Exception ex)
- {
- LOGGER.warn("MessageImpl.fromXML caught unexpected exception:", ex);
+ if (body == null)
+ throw new IllegalArgumentException();
- throw new UnmarshalException(ex);
+ _theBody = body;
}
- }
- // should be a capability on the base interface, but no changes for 4.2
- // ...
+ private HeaderImpl _theHeader;
- void replaceBody (BodyImpl body)
- {
- if (body == null)
- throw new IllegalArgumentException();
+ private ContextImpl _theContext;
- _theBody = body;
- }
+ private BodyImpl _theBody;
- private HeaderImpl _theHeader;
+ private FaultImpl _theFault;
- private ContextImpl _theContext;
+ private AttachmentImpl _theAttachment;
- private BodyImpl _theBody;
+ private PropertiesImpl _theProperties;
- private FaultImpl _theFault;
-
- private AttachmentImpl _theAttachment;
-
- private PropertiesImpl _theProperties;
-
- /**
- * The logger for this class.
- */
- private static final Logger LOGGER = Logger.getLogger(MessageImpl.class);
+ /**
+ * The logger for this class.
+ */
+ private static final Logger LOGGER = Logger.getLogger(MessageImpl.class);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2007-10-08 21:24:48 UTC (rev 15666)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2007-10-08 23:24:51 UTC (rev 15667)
@@ -246,12 +246,42 @@
// public MetaData getMetaData ();
// public void addReferenceParameter (...);
- public String toString ()
+ /**
+ * Prints the entire contents of the Call, even if most of the fields are null.
+ */
+
+ public String stringForm ()
{
return "To: "+_to+", From: "+_from+", ReplyTo: "+_replyTo+", FaultTo: "+_faultTo+", Action: "+_action+", MessageID: "+_messageID+", RelatesTo: "+_relatesTo;
}
/**
+ * Print the content of this header, ignoring all null fields.
+ */
+
+ public String toString ()
+ {
+ String result = "";
+
+ if (_to != null)
+ result = "To: "+_to;
+ if (_from != null)
+ result = result + " From: "+_from;
+ if (_replyTo != null)
+ result = result + " ReplyTo: "+_replyTo;
+ if (_faultTo != null)
+ result = result + " FaultTo: "+_faultTo;
+ if (_action != null)
+ result = result + " Action: "+_action;
+ if (_messageID != null)
+ result = result + " MessageID: "+_messageID;
+ if (_relatesTo != null)
+ result = result + " RelatesTo: "+_relatesTo;
+
+ return result;
+ }
+
+ /**
* This instance is valid if all mandatory elements are set.
*
* @return <code>true</code> if all mandatory elements are set, <code>false</code> otherwise.
More information about the jboss-svn-commits
mailing list