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.

  • Constructor Details

    • ValidateMetadataService

      public ValidateMetadataService()

      Creates a new instance.

    • ValidateMetadataService

      public ValidateMetadataService(List<String> list)
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Description copied from interface: Service

      Apply the service to the message.

      Parameters:
      msg - the AdaptrisMessage to process
      Throws:
      ServiceException - wrapping any underlying Exceptions
    • getRequiredKeys

      public List<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(List<String> l)

      Sets the List of keys which must be present and have non empty values.

      Parameters:
      l - the List of keys which must be present and have non empty values
    • addRequiredKey

      public void addRequiredKey(String key)

      Add a key to the List.

      Parameters:
      key - the key to add
    • initService

      protected void initService() throws CoreException
      Specified by:
      initService in class ServiceImp
      Throws:
      CoreException
    • closeService

      protected void closeService()
      Specified by:
      closeService in class ServiceImp
    • prepare

      public void prepare() throws CoreException
      Description copied from interface: ComponentLifecycleExtension
      Prepare for initialisation.
      Throws:
      CoreException