Class PayloadHashingService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.PayloadHashingService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Hash the payload and store the hash against a metadata key", tag="service,metadata") public class PayloadHashingService extends ServiceImp
Create a hash of the payload based on the configurable algorithm and stores it as metadata.In the adapter configuration file this class is aliased as payload-hashing-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 PayloadHashingService()
PayloadHashingService(java.lang.String hash, java.lang.String metadataKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.ByteTranslator
getByteTranslator()
java.lang.String
getHashAlgorithm()
java.lang.String
getMetadataKey()
protected void
initService()
void
prepare()
Prepare for initialisation.void
setByteTranslator(ByteTranslator t)
void
setHashAlgorithm(java.lang.String hashAlgorithm)
Set the hashing algorithm to use.void
setMetadataKey(java.lang.String metadataKey)
Set the metadata key against which the one way hash is stored.-
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:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
getHashAlgorithm
public java.lang.String getHashAlgorithm()
-
setHashAlgorithm
public void setHashAlgorithm(java.lang.String hashAlgorithm)
Set the hashing algorithm to use.- Parameters:
hashAlgorithm
- the algorithm, for example SHA256
-
getMetadataKey
public java.lang.String getMetadataKey()
-
setMetadataKey
public void setMetadataKey(java.lang.String metadataKey)
Set the metadata key against which the one way hash is stored.- Parameters:
metadataKey
- the metadata key
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
getByteTranslator
public ByteTranslator getByteTranslator()
-
setByteTranslator
public void setByteTranslator(ByteTranslator t)
-
-