Class DefaultMessageFactory

  • Direct Known Subclasses:
    FileBackedMessageFactory

    public class DefaultMessageFactory
    extends AdaptrisMessageFactory

    The default factory which returns implementations of AdaptrisMessage.

    In the adapter configuration file this class is aliased as default-message-factory which is the preferred alternative to the fully qualified classname when building your configuration.

    • Constructor Detail

      • DefaultMessageFactory

        public DefaultMessageFactory()
    • Method Detail

      • newMessage

        public AdaptrisMessage newMessage​(byte[] payload,
                                          java.util.Set metadata)
        Description copied from class: AdaptrisMessageFactory

        Returns a new AdaptrisMessage with the specified payload and metadata.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        payload - the byte[] payload
        metadata - a Set of MetadataElements
        Returns:
        a new AdaptrisMessage
      • newMessage

        public AdaptrisMessage newMessage​(java.lang.String payload,
                                          java.util.Set metadata)
        Description copied from class: AdaptrisMessageFactory

        Returns a new AdaptrisMessage with the specified payload and metadata. Uses default platform character encoding.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        payload - the String payload
        metadata - a Set of MetadataElements
        Returns:
        a new AdaptrisMessage
      • newMessage

        public AdaptrisMessage newMessage​(java.lang.String payload)
        Description copied from class: AdaptrisMessageFactory

        Returns a new AdaptrisMessage with the specified payload and metadata. Uses default platform character encoding.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        payload - the String payload
        Returns:
        a new AdaptrisMessage
      • newMessage

        public AdaptrisMessage newMessage​(java.lang.String payload,
                                          java.lang.String charEncoding,
                                          java.util.Set metadata)
                                   throws java.io.UnsupportedEncodingException
        Description copied from class: AdaptrisMessageFactory

        Returns a new AdaptrisMessage with the specified payload and metadata. Uses default platform character encoding.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        payload - the String payload
        charEncoding - the String's character encoding
        metadata - a Set of MetadataElements
        Returns:
        a new AdaptrisMessage
        Throws:
        java.io.UnsupportedEncodingException - if the passed character encoding is not supported
      • newMessage

        public AdaptrisMessage newMessage​(java.lang.String payload,
                                          java.lang.String charEncoding)
                                   throws java.io.UnsupportedEncodingException
        Description copied from class: AdaptrisMessageFactory

        Returns a new AdaptrisMessage with the specified payload and metadata. Uses default platform character encoding.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        payload - the String payload
        charEncoding - the String's character encoding
        Returns:
        a new AdaptrisMessage
        Throws:
        java.io.UnsupportedEncodingException - if the passed character encoding is not supported
      • newMessage

        public AdaptrisMessage newMessage​(AdaptrisMessage source,
                                          java.util.Collection<java.lang.String> metadataKeysToPreserve)
                                   throws java.lang.CloneNotSupportedException
        Description copied from class: AdaptrisMessageFactory
        Returns a new AdaptrisMessage with an empty payload but with selected metadata from the source.

        The new AdaptrisMessage will have the same message id and MessageLifecycleEvent will be cloned from the original. Object metadata will also be preserved.

        Specified by:
        newMessage in class AdaptrisMessageFactory
        Parameters:
        source - the original AdaptrisMessage
        metadataKeysToPreserve - a list of keys to transfer to the new Message; if null, then all keys.
        Returns:
        a new AdaptrisMessage
        Throws:
        java.lang.CloneNotSupportedException - if the MleMarkers could not be cloned.
      • setDefaultCharEncoding

        public void setDefaultCharEncoding​(java.lang.String s)
        Set the default character encoding to be applied to the message upon creation.

        If not explicitly configured, then the platform default character encoding will be used.

        Specified by:
        setDefaultCharEncoding in class AdaptrisMessageFactory
        Parameters:
        s - the defaultCharEncoding to set
        See Also:
        AdaptrisMessage.setCharEncoding(String)