@ComponentProfile(summary="Extract data via XPath and store it as object metadata", tag="service,metadata,xml,xpath") public class XpathObjectMetadataService extends ServiceImp
XpathQuery
as object metadata.
If the DocumentBuilderFactoryBuilder
has been explicitly set to be not namespace aware and the document does in fact
contain namespaces, then Saxon can cause merry havoc in the sense that //NonNamespaceXpath
doesn't work if the document
has namespaces in it. We have included a shim so that behaviour can be toggled based on what you have configured.
XPath.newXPathInstance(DocumentBuilderFactoryBuilder, NamespaceContext)
In the adapter configuration file this class is aliased as xpath-object-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
XpathObjectMetadataService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addXpathQuery(XpathQuery query) |
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
KeyValuePairSet |
getNamespaceContext() |
DocumentBuilderFactoryBuilder |
getXmlDocumentFactoryConfig() |
java.util.List<XpathObjectQuery> |
getXpathQueries() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setNamespaceContext(KeyValuePairSet namespaceContext)
Set the namespace context for resolving namespaces.
|
void |
setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml) |
void |
setXpathQueries(java.util.List<XpathObjectQuery> xql)
Set the list of XpathQuery instances that will be executed.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsConfirmation, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isConfirmation, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, rethrowServiceException, retrieveComponentState, setContinueOnFail, setIsConfirmation, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public XpathObjectMetadataService()
Creates a new instance.
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic KeyValuePairSet getNamespaceContext()
public void setNamespaceContext(KeyValuePairSet namespaceContext)
namespaceContext
- public java.util.List<XpathObjectQuery> getXpathQueries()
public void setXpathQueries(java.util.List<XpathObjectQuery> xql)
xql
- public void addXpathQuery(XpathQuery query)
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig()
public void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml)