Class AddMetadataService

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Add Static Metadata to a Message",
                      tag="service,metadata")
    public class AddMetadataService
    extends MetadataServiceImpl

    Implementation of Service that adds static metadata to be added to a message.

    Each metadata-element is added in sequence to the message, overwriting any existing metadata.

    Additional behaviour is possible based on the value portion of the metadata-element.

    • $UNIQUE_ID$ - add the messages unique id as metadata
    • $MSG_SIZE$ - add the messages current size as metadata

    In the adapter configuration file this class is aliased as add-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • AddMetadataService

        public AddMetadataService()

        Creates a new instance.

      • AddMetadataService

        public AddMetadataService​(java.util.Collection<MetadataElement> elements)
      • AddMetadataService

        public AddMetadataService​(MetadataElement... elements)
    • Method Detail

      • getMetadataElements

        public java.util.Set<MetadataElement> getMetadataElements()

        Returns the MetadataElements that will be added to the AdaptrisMessage.

        Returns:
        the MetadataElements that will be added to the AdaptrisMessage
      • setMetadataElements

        public void setMetadataElements​(java.util.Set<MetadataElement> s)

        Sets the MetadataElements that will be added to the AdaptrisMessage.

        Parameters:
        s - the MetadataElements that will be added to the AdaptrisMessage
      • addMetadataElement

        public void addMetadataElement​(MetadataElement element)

        Adds a MetadataElements to the Set that will be added to the AdaptrisMessage.

        Parameters:
        element - a MetadataElements to add to the AdaptrisMessage
      • addMetadataElement

        public void addMetadataElement​(java.lang.String key,
                                       java.lang.String value)

        Adds a MetadataElements made up of the passed key and value to the Set that will be added to the AdaptrisMessage .

        Parameters:
        key - the metadata key, may not be null or empty
        value - the metadata value
      • getOverwrite

        public java.lang.Boolean getOverwrite()
        Returns:
        the overwrite
      • setOverwrite

        public void setOverwrite​(java.lang.Boolean b)
        Whether or not to always overwrite metadata with the values configured.
        Parameters:
        b - the overwrite to set, default is true.
      • overwrite

        protected boolean overwrite​(AdaptrisMessage msg,
                                    java.lang.String key)