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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequiredKey
(String key) Add a key to theList
.protected void
void
doService
(AdaptrisMessage msg) Apply the service to the message.Returns theList
of keys which must be present and have non empty values.protected void
void
prepare()
Prepare for initialisation.void
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
-
Constructor Details
-
ValidateMetadataService
public ValidateMetadataService()Creates a new instance.
-
ValidateMetadataService
-
-
Method Details
-
doService
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
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
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
Add a key to the
List
.- Parameters:
key
- the key to add
-
initService
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()- Specified by:
closeService
in classServiceImp
-
prepare
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-