Class MetadataHashingService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.MetadataServiceImpl
-
- com.adaptris.core.services.metadata.ReformatMetadata
-
- com.adaptris.core.services.metadata.MetadataHashingService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,MetadataReformatter
,StateManagedComponent
@ComponentProfile(summary="Hash a metadata value, and store it", tag="service,metadata") public class MetadataHashingService extends ReformatMetadata
Hashes the metadata value stored against a metadata key.Each matching metadata key from
ReformatMetadata.getMetadataKeyRegexp()
will be hashed, and the value overwitten with the hash after translating it into a String with the specifiedByteTranslator
In the adapter configuration file this class is aliased as metadata-hashing-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
MetadataServiceImpl.LogWrapper
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
DEBUG, ERROR, INFO, TRACE, WARN
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description MetadataHashingService()
MetadataHashingService(java.lang.String regexp)
MetadataHashingService(java.lang.String regexp, java.lang.String hash, ByteTranslator translator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteTranslator
getByteTranslator()
java.lang.String
getHashAlgorithm()
protected void
initService()
java.lang.String
reformat(java.lang.String s, java.lang.String charEncoding)
Reformat a metadata valuevoid
setByteTranslator(ByteTranslator translator)
Specify how to translate the resulting byte array from the hash into a String.void
setHashAlgorithm(java.lang.String hashAlg)
-
Methods inherited from class com.adaptris.core.services.metadata.ReformatMetadata
doService, getMetadataKeyRegexp, setMetadataKeyRegexp
-
Methods inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
closeService, getMetadataLogger, logMetadata, logMetadata, logMetadata, logMetadata, prepare, setMetadataLogger, withMetadataLogger
-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.services.metadata.MetadataReformatter
reformat
-
-
-
-
Constructor Detail
-
MetadataHashingService
public MetadataHashingService()
-
MetadataHashingService
public MetadataHashingService(java.lang.String regexp)
-
MetadataHashingService
public MetadataHashingService(java.lang.String regexp, java.lang.String hash, ByteTranslator translator)
-
-
Method Detail
-
initService
protected void initService() throws CoreException
- Overrides:
initService
in classMetadataServiceImpl
- Throws:
CoreException
-
reformat
public java.lang.String reformat(java.lang.String s, java.lang.String charEncoding) throws java.lang.Exception
Description copied from interface:MetadataReformatter
Reformat a metadata value- Parameters:
s
- the string to reformatcharEncoding
- the charset of the message- Returns:
- the replacment string.
- Throws:
java.lang.Exception
-
getHashAlgorithm
public final java.lang.String getHashAlgorithm()
-
setHashAlgorithm
public final void setHashAlgorithm(java.lang.String hashAlg)
-
getByteTranslator
public final ByteTranslator getByteTranslator()
-
setByteTranslator
public final void setByteTranslator(ByteTranslator translator)
Specify how to translate the resulting byte array from the hash into a String.- Parameters:
translator
- the translator;
-
-