public class XpathProduceDestination extends java.lang.Object implements MessageDrivenDestination
Basic implementation of ProduceDestination
that uses an XPath to interrogate the Message.
Only the first match for the supplied xpath is used. If the xpath does not return any results, then the default destination is returned.
In the adapter configuration file this class is aliased as xpath-produce-destination which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
XpathProduceDestination()
Default Constructor.
|
XpathProduceDestination(java.lang.String xpath) |
XpathProduceDestination(java.lang.String xpath,
java.lang.String defaultDest) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDefaultDestination() |
java.lang.String |
getDestination(AdaptrisMessage msg)
Returns a
String destination name. |
KeyValuePairSet |
getNamespaceContext() |
DocumentBuilderFactoryBuilder |
getXmlDocumentFactoryConfig() |
java.lang.String |
getXpath()
Returns the name of the destination.
|
int |
hashCode() |
void |
setDefaultDestination(java.lang.String s)
The default destination to use if the configured xpath does not resolve to
any elements.
|
void |
setNamespaceContext(KeyValuePairSet kvps)
Set the namespace context for resolving namespaces.
|
void |
setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml) |
void |
setXpath(java.lang.String s)
Set the XPath that will be used to resolve the correct destination.
|
public XpathProduceDestination()
public XpathProduceDestination(java.lang.String xpath)
public XpathProduceDestination(java.lang.String xpath, java.lang.String defaultDest)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String getDestination(AdaptrisMessage msg)
ProduceDestination
Returns a String
destination name. Implementations may or may not use the AdaptrisMessage
to
dynamically generate the name.
getDestination
in interface ProduceDestination
msg
- the AdaptrisMessage
for which the name is being generatedProduceDestination.getDestination(com.adaptris.core.AdaptrisMessage)
public java.lang.String getXpath()
Returns the name of the destination.
public void setXpath(java.lang.String s)
s
- the xpathpublic java.lang.String getDefaultDestination()
public void setDefaultDestination(java.lang.String s)
s
- the defaultDestination to setpublic KeyValuePairSet getNamespaceContext()
public void setNamespaceContext(KeyValuePairSet kvps)
kvps
- the namespace contextSimpleNamespaceContext.create(KeyValuePairSet)
public DocumentBuilderFactoryBuilder getXmlDocumentFactoryConfig()
public void setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder xml)