@ComponentProfile(summary="Conditionally map from one format to another on entry and exit via STaX", since="3.8.4", tag="xml,stax,json") public class ServiceListWithPlugin extends ServiceList
This allows you to transform the message payload from one format to another upon entry and exit
to this ServiceList
implementation. This means you that you can automatically convert
between JSON and XML (using com.adaptris.core.json.streaming.JsonStreamingInputFactory
and XmlOutputFactoryBuilder
; do your services treating the payload as XML, and render the
result as JSON automatically.
The standard implementation of Plugin
which is StaxTransformPlugin
allows you to specify a rule under which you perform the transforms (an expression based metadata
value against a regular expression). If the rule is true, then the transform is applied;
otherwise it is a no-op operation.
Note that this behaviour is achievable in a number of ways with Interlok itself already, most easily with
the interlok-config-conditional
package; this is simply a convenience. There will also be
situations where streaming from JSON to XML won't work, such as when the incoming message is a JSON
array (you may need to have additional post configuration) or when the XML has attributes.
In the adapter configuration file this class is aliased as stax-plugin-service-list which is the preferred alternative to the fully qualified classname when building your configuration.
eventHandler, log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
ServiceListWithPlugin() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyServices(AdaptrisMessage msg) |
protected void |
doClose() |
protected void |
doInit() |
protected void |
doStart() |
protected void |
doStop() |
Plugin |
getOnEntry() |
Plugin |
getOnExit() |
void |
setOnEntry(Plugin onEntry) |
void |
setOnExit(Plugin onExit) |
ServiceListWithPlugin |
withOnEntry(Plugin onEntry) |
ServiceListWithPlugin |
withOnExit(Plugin onEntry) |
getAllowForwardSearch, setAllowForwardSearch
haltProcessing
add, add, addAll, addAll, addService, changeState, clear, close, continueOnFailure, createName, createQualifier, doService, enforceRequirements, enforceRequirements, get, getComments, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getOutOfStateHandler, getRestartAffectedServiceOnException, getServices, getUniqueId, handleException, indexOf, init, isBranching, isTrackingEndpoint, iterator, lastIndexOf, listIterator, listIterator, prepare, registerEventHandler, remove, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, set, setComments, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setOutOfStateHandler, setRestartAffectedServiceOnException, setServices, setUniqueId, size, start, stop, subList, withServices
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected void applyServices(AdaptrisMessage msg) throws ServiceException
applyServices
in class ServiceList
ServiceException
protected void doInit() throws CoreException
doInit
in class ServiceList
CoreException
protected void doStart() throws CoreException
doStart
in class ServiceListBase
CoreException
protected void doStop()
doStop
in class ServiceListBase
protected void doClose()
doClose
in class ServiceListBase
public Plugin getOnEntry()
public void setOnEntry(Plugin onEntry)
public ServiceListWithPlugin withOnEntry(Plugin onEntry)
public Plugin getOnExit()
public void setOnExit(Plugin onExit)
public ServiceListWithPlugin withOnExit(Plugin onEntry)