Class XmlPayloadTranslator
- java.lang.Object
-
- com.adaptris.core.services.jdbc.ResultSetTranslatorBase
-
- com.adaptris.core.services.jdbc.StyledResultTranslatorImp
-
- com.adaptris.core.services.jdbc.ResultSetTranslatorImp
-
- com.adaptris.core.services.jdbc.XmlPayloadTranslatorImpl
-
- com.adaptris.core.services.jdbc.XmlPayloadTranslator
-
- All Implemented Interfaces:
ComponentLifecycle
,ComponentLifecycleExtension
,ResultSetTranslator
public class XmlPayloadTranslator extends XmlPayloadTranslatorImpl
Translate the ResultSet contents into an XML Payload.The original message can be included in the output message in order to allow consolidation of XML data and SQL data in a subsequent XSLT step. The format of the returned message is as follows:
<Results> <OriginalMessage> ... </OriginalMessage> <Row> <column1>...</column1> <column2>...</column2> ... </Row> <Row> ... </Row> </Results>
Note that column1, column2, etc. is replaced by the actual column name as returned in the query. As such, the column name must be a valid XML element name. If the actual name (in the database table definition) is not valid, the query should specify an alias name in the query. E.g:
SELECT "col 1" AS "col1" FROM mytable;
If you want to see how many rows were processed you can set one/both of the following;
Item Description Value result-count-metadata-item If set to a String metadata item name will specify the metadata item to contain the number of rows returned by your query Metadata item name update-count-metadata-item If set to a String metadata item name will specify the metadata item to contain the number of rows updated by your SQL statement Metadata item name In the adapter configuration file this class is aliased as jdbc-xml-payload-translator which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.jdbc.XmlPayloadTranslatorImpl
XmlPayloadTranslatorImpl.DocumentWrapper
-
Nested classes/interfaces inherited from class com.adaptris.core.services.jdbc.StyledResultTranslatorImp
StyledResultTranslatorImp.ColumnStyle
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.jdbc.XmlPayloadTranslatorImpl
ELEMENT_NAME_COLUMN, ELEMENT_NAME_RESULTS, ELEMENT_NAME_ROW
-
Fields inherited from class com.adaptris.core.services.jdbc.ResultSetTranslatorBase
log
-
-
Constructor Summary
Constructors Constructor Description XmlPayloadTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getPreserveOriginalMessage()
void
setPreserveOriginalMessage(java.lang.Boolean b)
Sets whether to incorporate the original message in the output message bodylong
translateResult(JdbcResult source, AdaptrisMessage target)
Translate the result returning the number of rows translated.-
Methods inherited from class com.adaptris.core.services.jdbc.XmlPayloadTranslatorImpl
close, createInputSource, createListFromResultSet, createTextNode, createTransformer, createWrapper, createXmlUtils, getCdataColumnRegexp, getOutputMessageEncoding, getStripIllegalXmlChars, getXmlColumnPrefix, getXmlColumnRegexp, init, isCdataColumn, isXmlColumn, setCdataColumnRegexp, setOutputMessageEncoding, setStripIllegalXmlChars, setXmlColumnPrefix, setXmlColumnRegexp, stripIllegalXmlChars
-
Methods inherited from class com.adaptris.core.services.jdbc.ResultSetTranslatorImp
addColumnTranslator, getAttemptAutoConvert, getColumnTranslators, getDisplayColumnErrors, getResultCountMetadataItem, getUpdateCountMetadataItem, isDisplayColumnErrors, logColumnErrors, setAttemptAutoConvert, setColumnTranslators, setDisplayColumnErrors, setResultCountMetadataItem, setUpdateCountMetadataItem, toString, translate, updateMetadata, updateMetadataQueryCount, updateMetadataUpdateCount, withAttemptAutoConvert, withColumnTranslators, withColumnTranslators
-
Methods inherited from class com.adaptris.core.services.jdbc.StyledResultTranslatorImp
getColumnNameStyle, setColumnNameStyle, withColumnNameStyle
-
Methods inherited from class com.adaptris.core.services.jdbc.ResultSetTranslatorBase
prepare
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
start, stop
-
-
-
-
Method Detail
-
translateResult
public long translateResult(JdbcResult source, AdaptrisMessage target) throws java.sql.SQLException, ServiceException
Description copied from class:ResultSetTranslatorImp
Translate the result returning the number of rows translated.- Specified by:
translateResult
in classResultSetTranslatorImp
- Throws:
java.sql.SQLException
ServiceException
-
getPreserveOriginalMessage
public java.lang.Boolean getPreserveOriginalMessage()
- Returns:
- whether to incorporate the original message in the output message body
-
setPreserveOriginalMessage
public void setPreserveOriginalMessage(java.lang.Boolean b)
Sets whether to incorporate the original message in the output message body- Parameters:
b
- true or false, default is false.
-
-