Class ValidateMetadataService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.ValidateMetadataService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Verify a message has all the required metadata keys", tag="service,metadata") public class ValidateMetadataService extends ServiceImpVerify that a message has all the required metadata keys set.If any of the required keys does not have a values stored against it, a
ServiceExceptionis thrown.In the adapter configuration file this class is aliased as validate-metadata-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 ValidateMetadataService()Creates a new instance.ValidateMetadataService(java.util.List<java.lang.String> list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRequiredKey(java.lang.String key)Add a key to theList.protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.util.List<java.lang.String>getRequiredKeys()Returns theListof keys which must be present and have non empty values.protected voidinitService()voidprepare()Prepare for initialisation.voidsetRequiredKeys(java.util.List<java.lang.String> l)Sets theListof keys which must be present and have non empty values.-
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
-
getRequiredKeys
public java.util.List<java.lang.String> getRequiredKeys()
Returns the
Listof keys which must be present and have non empty values.- Returns:
- the
Listof keys which must be present and have non empty values
-
setRequiredKeys
public void setRequiredKeys(java.util.List<java.lang.String> l)
Sets the
Listof keys which must be present and have non empty values.- Parameters:
l- theListof keys which must be present and have non empty values
-
addRequiredKey
public void addRequiredKey(java.lang.String key)
Add a key to the
List.- Parameters:
key- the key to add
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
-