Class FindAndReplaceService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.findreplace.FindAndReplaceService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Perform a find and replace on the message", tag="service") public class FindAndReplaceService extends ServiceImpImplementation ofServicewhich 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. EachFindAndReplaceUnitwill be applied in order and can be used to replace the first instance or all instances.- See Also:
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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description FindAndReplaceService()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.util.List<FindAndReplaceUnit>getFindAndReplaceUnits()java.lang.BooleangetReplaceFirstOnly()Returns replaceFirstOnly.protected voidinitService()voidprepare()Prepare for initialisation.voidsetFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit)voidsetReplaceFirstOnly(java.lang.Boolean b)Sets replaceFirstOnly.-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions- See Also:
#doService(com.adaptris.core.AdaptrisMessage)
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
getReplaceFirstOnly
public java.lang.Boolean getReplaceFirstOnly()
Returns replaceFirstOnly.
- Returns:
- replaceFirstOnly if true only the first instances of the
Stringto replace will be replaced. If false all instances will be replaced.
-
setReplaceFirstOnly
public void setReplaceFirstOnly(java.lang.Boolean b)
Sets replaceFirstOnly.
- Parameters:
b- if true only the first instances of theStringto replace will be replaced. If false all instances will be replaced; default is null (false)
-
getFindAndReplaceUnits
public java.util.List<FindAndReplaceUnit> getFindAndReplaceUnits()
-
setFindAndReplaceUnits
public void setFindAndReplaceUnits(java.util.List<FindAndReplaceUnit> findAndReplaceUnit)
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
-