net.sf.xbus.protocol.csv
Class CSVMessage

java.lang.Object
  extended by net.sf.xbus.protocol.Message
      extended by net.sf.xbus.protocol.xml.XMLMessageAbstract
          extended by net.sf.xbus.protocol.csv.CSVMessage
All Implemented Interfaces:
ObjectMessage, TextMessage, XMLMessage

public class CSVMessage
extends XMLMessageAbstract
implements TextMessage, XMLMessage

CSVMessage is helping the xBus transporting and converting data structured in CSV format

As CSV is not a standardized, the authors have decided to base the implementation on an existing definition (@see -> CSV Definition).

The entries are internally stored in a DOM tree. Thus CSVMessage extends XMLMessageAbstract to use some of its xml features.

Author:
Duewel, Köppl

Constructor Summary
CSVMessage(java.lang.String function, XBUSSystem source, java.lang.String id)
          This constructor initializes the new CSVMessage with the given parameters.
CSVMessage(XBUSSystem source)
          This constructor stores the source, creates an unique identifier for the message and initializes the requestTimestamp.
 
Method Summary
 java.lang.String getRequestText(XBUSSystem system)
          Returns the request text as String.
 java.lang.String getResponseText()
          Returns the response text as String.
 void setRequestText(java.lang.String text, XBUSSystem source)
          Sets the text of the incoming message.
 void setResponseDocument(org.w3c.dom.Document doc, XBUSSystem destination)
          Sets the response data by passing a DOM tree
 void setResponseText(java.lang.String text, XBUSSystem destination)
          Sets the response data
protected  void synchronizeRequestFields(XBUSSystem system)
          Empty method.
protected  void synchronizeResponseFields(XBUSSystem system)
          Empty method.
 
Methods inherited from class net.sf.xbus.protocol.xml.XMLMessageAbstract
getDocumentBuilder, getRequestDocument, getRequestObject, getResponseDocument, getResponseObject, parseXML, serializeXML, setRequestDocument, setRequestObject, setResponseObject
 
Methods inherited from class net.sf.xbus.protocol.Message
getErrorcode, getErrortext, getFunction, getId, getRequestTimestamp, getResponseTimestamp, getReturncode, getShortname, getSource, setErrorcode, setErrortext, setFunction, setId, setResponseTimestamp, setReturncode, setShortname
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.xbus.protocol.XMLMessage
getRequestDocument, getResponseDocument, setRequestDocument
 

Constructor Detail

CSVMessage

public CSVMessage(XBUSSystem source)
This constructor stores the source, creates an unique identifier for the message and initializes the requestTimestamp. It is used when constructing a new CSVMessage from the data of a receiver.

Parameters:
source - the source of the data

CSVMessage

public CSVMessage(java.lang.String function,
                  XBUSSystem source,
                  java.lang.String id)
This constructor initializes the new CSVMessage with the given parameters. It is used when constructing a new CSVMessage by converting it from another Message.

Parameters:
function - the function to be executed by the destination system
source - the source of the data
id - the message id
Method Detail

getRequestText

public java.lang.String getRequestText(XBUSSystem system)
                                throws XException
Returns the request text as String.

Specified by:
getRequestText in interface TextMessage
Overrides:
getRequestText in class XMLMessageAbstract
Parameters:
system - the name of the process
Returns:
the request text in String format.
Throws:
XException

setRequestText

public void setRequestText(java.lang.String text,
                           XBUSSystem source)
                    throws XException
Description copied from class: XMLMessageAbstract
Sets the text of the incoming message. After parsing the XML string, the information is internally stored in a org.w3c.dom.Document.

Specified by:
setRequestText in interface TextMessage
Overrides:
setRequestText in class XMLMessageAbstract
Parameters:
text - a XML document from the request
source - system where the request is coming from
Throws:
XException

getResponseText

public java.lang.String getResponseText()
                                 throws XException
Returns the response text as String.

Specified by:
getResponseText in interface TextMessage
Overrides:
getResponseText in class XMLMessageAbstract
Returns:
the response text as String
Throws:
XException

setResponseText

public void setResponseText(java.lang.String text,
                            XBUSSystem destination)
                     throws XException
Sets the response data

Specified by:
setResponseText in interface TextMessage
Overrides:
setResponseText in class XMLMessageAbstract
Parameters:
text - the new response text as String
destination - the destination process
Throws:
XException

setResponseDocument

public void setResponseDocument(org.w3c.dom.Document doc,
                                XBUSSystem destination)
                         throws XException
Sets the response data by passing a DOM tree

Specified by:
setResponseDocument in interface XMLMessage
Overrides:
setResponseDocument in class XMLMessageAbstract
Parameters:
doc - the DOM tree
destination - the destination process
Throws:
XException

synchronizeRequestFields

protected void synchronizeRequestFields(XBUSSystem system)
Empty method.

Specified by:
synchronizeRequestFields in class XMLMessageAbstract

synchronizeResponseFields

protected void synchronizeResponseFields(XBUSSystem system)
Empty method.

Specified by:
synchronizeResponseFields in class XMLMessageAbstract