@ComponentProfile(summary="Perform a find and replace on the message", tag="service") public class FindAndReplaceService extends ServiceImp
Service
which allows find and replace operations on the message payload.
You can specify one or more FindAndReplaceUnit
's, each of which defines the value
to "find" and the value to "replace" with. Each FindAndReplaceUnit
will be applied
in order and can be used to replace the first instance or all instances.
ConfiguredReplacementSource
,
MetadataReplacementSource
In the adapter configuration file this class is aliased as find-and-replace-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
FindAndReplaceService()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.util.List<FindAndReplaceUnit> |
getFindAndReplaceUnits() |
java.lang.Boolean |
getReplaceFirstOnly()
Returns replaceFirstOnly.
|
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit) |
void |
setReplaceFirstOnly(java.lang.Boolean b)
Sets replaceFirstOnly.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
s#doService(com.adaptris.core.AdaptrisMessage)
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public java.lang.Boolean getReplaceFirstOnly()
Returns replaceFirstOnly.
String
to replace will be replaced. If false all
instances will be replaced.public void setReplaceFirstOnly(java.lang.Boolean b)
Sets replaceFirstOnly.
b
- if true only the first instances of the String
to replace will be replaced. If false all instances will
be replaced; default is null (false)public java.util.List<FindAndReplaceUnit> getFindAndReplaceUnits()
public void setFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit)
public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException