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 ServiceImp
Verify 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
ServiceException
is 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 void
addRequiredKey(java.lang.String key)
Add a key to theList
.protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.java.util.List<java.lang.String>
getRequiredKeys()
Returns theList
of keys which must be present and have non empty values.protected void
initService()
void
prepare()
Prepare for initialisation.void
setRequiredKeys(java.util.List<java.lang.String> l)
Sets theList
of 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:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
getRequiredKeys
public java.util.List<java.lang.String> getRequiredKeys()
Returns the
List
of keys which must be present and have non empty values.- Returns:
- the
List
of keys which must be present and have non empty values
-
setRequiredKeys
public void setRequiredKeys(java.util.List<java.lang.String> l)
Sets the
List
of keys which must be present and have non empty values.- Parameters:
l
- theList
of 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:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
-