|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.protocol.xml.XSLTTransformer
public class XSLTTransformer
This is the base class for all transformation between
XMLMessages
with XSLT stylesheets.
The transformation is done in two steps:
XBUS_Stylets:
XSLT stylesheets lack the possibilty to fill in data to the transformed XML data which cannot be extracted out of the source XML. To fill this gap some defined tags can be included in the transformed XML when the XSLT transformation is done. These tags are replaced in the second step with defined data. The format for XBUS_Stylets is:
<XBUS_Stylet Name="xxx" Tag="yyy" Key="zzz">The XSLT code to achieve this looks like:
<xsl:element name="XBUS_Stylet"> <xsl:attribute name="Name">xxx</xsl:attribute> <xsl:attribute name="Tag">yyy</xsl:attribute> <xsl:attribute name="Key">zzz</xsl:attribute> </xsl:element>The meaning of the attributes is:
Name="Value"
or
Name="FormatDate"
. In this case only a text node for the
value is inserted.Value
.
Specifies the name of the mapping to get a value from.Value
,
CDATA
and FormatDate
. Values come from two
different sources depending on the section attribute.putStyletValue
). The value for the
given key is inserted.getMapping
operation of the Configuration.FormatDate
. Describes the actual format of the date given in
Key
.FormatDate
. Describes the format to apply to the date given
in Key
.Name
are defined as follows:
Message
is
inserted.Message
is inserted.key
(see above) is
inserted.key
(see above) is
inserted as a CDATA section.key
(see above) is changed. SourceFormat
describes the original
and DestinationFormat
the new format.XMLMessages
can be done directly
via a XSLT stylesheet and XBUS_Stylet processing, this class can be used.
When extra code is needed for the transformation, it has to be subclassed.
Field Summary | |
---|---|
protected static java.lang.String |
XSL_LOCATION
|
Constructor Summary | |
---|---|
XSLTTransformer()
|
Method Summary | |
---|---|
protected XMLMessageAbstract |
createMessage(XBUSSystem destination,
XMLMessageAbstract source)
Creates an object which is suitable for sending data to the given system . |
protected javax.xml.transform.Transformer |
getXSLTransformer(java.lang.String xslFile)
Returns a Transformer object needed for the XSLT
processing. |
void |
putStyletValue(java.lang.Object key,
java.lang.Object value)
Stores a key/value pair which is used later in the processing of the XBUS_Stylets. |
java.lang.Object |
transform(java.lang.Object inObject,
XBUSSystem source,
XBUSSystem destination,
Message destinationMessage)
The transform method is automatically called by the xBus
during the routing of messages. |
protected org.w3c.dom.Document |
transformXML(org.w3c.dom.Document xmlOld,
java.lang.String xslFile,
Message message)
Transforms the given XML-data with the given XSL-stylesheet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String XSL_LOCATION
Constructor Detail |
---|
public XSLTTransformer()
Method Detail |
---|
public java.lang.Object transform(java.lang.Object inObject, XBUSSystem source, XBUSSystem destination, Message destinationMessage) throws XException
transform
method is automatically called by the xBus
during the routing of messages.
transform
in interface Transformer
inObject
- either the request or response that shall be transformed
to another formatsource
- the XBUSSystem
of the message of the
inObject
destination
- the XBUSSystem
of the target messagedestinationMessage
- the target message eventually contains more
information necessary for transforming
Object
, written to either the
request or response of the target message
XException
public void putStyletValue(java.lang.Object key, java.lang.Object value)
protected org.w3c.dom.Document transformXML(org.w3c.dom.Document xmlOld, java.lang.String xslFile, Message message) throws XException
xmlOld
- the source XML-dataxslFile
- the name of the XSL-stylesheetmessage
- the destination message
XException
- if something goes wrongprotected javax.xml.transform.Transformer getXSLTransformer(java.lang.String xslFile) throws XException
Transformer
object needed for the XSLT
processing. The Transformers
are cached for every thread
and every XSLT stylesheet.
XException
protected XMLMessageAbstract createMessage(XBUSSystem destination, XMLMessageAbstract source) throws XException
system
. The name of the class is read in the <@link
net.sf.xbus.base.core.Configuration>. The returned class must be a
subclass of XMLMessage
.
XException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |