|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.protocol.Message net.sf.xbus.protocol.xml.XMLMessageAbstract
public abstract class XMLMessageAbstract
XMLMessage
is the base class for all messages in the XML
format.
It holds the XML data internally as an org.w3c.dom.Document
.
Therefore it is more efficient to work with the Document
representation than with the String
representation. When
working with String
representation, parsing and serializing is
done internally.
Constructor Summary | |
---|---|
XMLMessageAbstract(java.lang.String function,
XBUSSystem source,
java.lang.String id)
This constructor initializes the new XMLMessage with the
given parameters. |
|
XMLMessageAbstract(XBUSSystem source)
This constructor stores the source , creates an unique
identifier for the message and initializes the requestTimestamp. |
Method Summary | |
---|---|
protected javax.xml.parsers.DocumentBuilder |
getDocumentBuilder(XBUSSystem system)
Returns an adequate DocumentBuilder for this message |
org.w3c.dom.Document |
getRequestDocument(XBUSSystem system)
Returns the request XML data as a org.w3c.dom.Document . |
java.lang.Object |
getRequestObject(XBUSSystem system)
Gets the object from an incomimg message. |
java.lang.String |
getRequestText(XBUSSystem source)
Gets the text of the incoming message. |
org.w3c.dom.Document |
getResponseDocument()
Returns the response XML data as a org.w3c.dom.Document . |
java.lang.Object |
getResponseObject()
Gets the object of the outgoing message. |
java.lang.String |
getResponseText()
Gets the text of the outgoing message. |
protected org.w3c.dom.Document |
parseXML(java.lang.String xml,
XBUSSystem system)
Parses the given XML string. |
protected static java.lang.String |
serializeXML(org.w3c.dom.Document doc,
java.lang.String systemID)
Serializes the given org.w3c.dom.Document . |
void |
setRequestDocument(org.w3c.dom.Document doc,
XBUSSystem source)
Sets the request XML data as a org.w3c.dom.Document . |
void |
setRequestObject(java.lang.Object object,
XBUSSystem source)
Sets the object from an incomimg message. |
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 XML data as a org.w3c.dom.Document . |
void |
setResponseObject(java.lang.Object object,
XBUSSystem destination)
Sets the object of the outgoing message. |
void |
setResponseText(java.lang.String text,
XBUSSystem destination)
Sets the text of the outgoing message. |
protected abstract void |
synchronizeRequestFields(XBUSSystem system)
After setting the request data, both setRequestText and
setRequestDocument , some fields of the
Message must be synchronized with the request data. |
protected abstract void |
synchronizeResponseFields(XBUSSystem system)
After setting the response data, both setResponseText and
setResponseDocument , some fields of the
Message must be synchronized with the response data. |
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 |
Constructor Detail |
---|
public XMLMessageAbstract(XBUSSystem source)
source
, creates an unique
identifier for the message and initializes the requestTimestamp. It is
used when constructing a new XMLMessage
from the data of a
receiver.
source
- the system where the message is coming frompublic XMLMessageAbstract(java.lang.String function, XBUSSystem source, java.lang.String id)
XMLMessage
with the
given parameters. It is used when constructing a new
XMLMessage
by converting it from another
Message
.
function
- the function of the other Message
source
- the source of the other Message
id
- the id of the other Message
Method Detail |
---|
public java.lang.String getRequestText(XBUSSystem source) throws XException
org.w3c.dom.Document
.
getRequestText
in interface TextMessage
source
- ignored
String
XException
public void setRequestText(java.lang.String text, XBUSSystem source) throws XException
org.w3c.dom.Document
.
setRequestText
in interface TextMessage
text
- a XML document from the requestsource
- system where the request is coming from
XException
public java.lang.String getResponseText() throws XException
org.w3c.dom.Document
.
getResponseText
in interface TextMessage
String
XException
public void setResponseText(java.lang.String text, XBUSSystem destination) throws XException
org.w3c.dom.Document
.
setResponseText
in interface TextMessage
text
- a XML document from the responsedestination
- system where the response is coming from
XException
public org.w3c.dom.Document getRequestDocument(XBUSSystem system)
org.w3c.dom.Document
.
getRequestDocument
in interface XMLMessage
system
- reference to the system for which the message is meant
public void setRequestDocument(org.w3c.dom.Document doc, XBUSSystem source) throws XException
org.w3c.dom.Document
.
setRequestDocument
in interface XMLMessage
doc
- the content of the requestsource
- system where the request is coming from
XException
public org.w3c.dom.Document getResponseDocument()
org.w3c.dom.Document
.
getResponseDocument
in interface XMLMessage
public void setResponseDocument(org.w3c.dom.Document doc, XBUSSystem destination) throws XException
org.w3c.dom.Document
.
setResponseDocument
in interface XMLMessage
doc
- the content of the responsedestination
- system where the response is coming from
XException
public java.lang.Object getRequestObject(XBUSSystem system) throws XException
ObjectMessage
getRequestObject
in interface ObjectMessage
system
- reference to the system for which the message is meant
XException
ObjectMessage.getRequestObject(net.sf.xbus.base.xbussystem.XBUSSystem)
public void setRequestObject(java.lang.Object object, XBUSSystem source) throws XException
ObjectMessage
setRequestObject
in interface ObjectMessage
object
- the content of the requestsource
- system where the request is coming from
XException
ObjectMessage.setRequestObject(java.lang.Object,
net.sf.xbus.base.xbussystem.XBUSSystem)
public java.lang.Object getResponseObject() throws XException
ObjectMessage
getResponseObject
in interface ObjectMessage
XException
ObjectMessage.getResponseObject()
public void setResponseObject(java.lang.Object object, XBUSSystem destination) throws XException
ObjectMessage
setResponseObject
in interface ObjectMessage
object
- the content of the responsedestination
- system where the response is coming from
XException
ObjectMessage.setResponseObject(java.lang.Object,
net.sf.xbus.base.xbussystem.XBUSSystem)
protected abstract void synchronizeRequestFields(XBUSSystem system) throws XException
setRequestText
and
setRequestDocument
, some fields of the
Message
must be synchronized with the request data.
Message
. When it is not found, the value
from the Message
must be copied to the request data.
Message
.
Message
object
to the request data, to be sure that it is set correct.
Message
object to the request data.
XException
protected abstract void synchronizeResponseFields(XBUSSystem system) throws XException
setResponseText
and
setResponseDocument
, some fields of the
Message
must be synchronized with the response data.
XException
protected org.w3c.dom.Document parseXML(java.lang.String xml, XBUSSystem system) throws XException
XException
protected javax.xml.parsers.DocumentBuilder getDocumentBuilder(XBUSSystem system) throws XException
DocumentBuilder
for this message
XException
protected static java.lang.String serializeXML(org.w3c.dom.Document doc, java.lang.String systemID) throws XException
org.w3c.dom.Document
.
XException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |