Class DefaultMessageFactory
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageFactory
-
- com.adaptris.core.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 Summary
Constructors Constructor Description DefaultMessageFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultCharEncoding()
Return the default character encoding for the message.AdaptrisMessage
newMessage()
Returns a newAdaptrisMessage
.AdaptrisMessage
newMessage(byte[] payload)
Returns a newAdaptrisMessage
with the specified payload and metadata.AdaptrisMessage
newMessage(byte[] payload, java.util.Set metadata)
Returns a newAdaptrisMessage
with the specified payload and metadata.AdaptrisMessage
newMessage(AdaptrisMessage source, java.util.Collection<java.lang.String> metadataKeysToPreserve)
Returns a newAdaptrisMessage
with an empty payload but with selected metadata from the source.AdaptrisMessage
newMessage(java.lang.String payload)
Returns a newAdaptrisMessage
with the specified payload and metadata.AdaptrisMessage
newMessage(java.lang.String payload, java.lang.String charEncoding)
Returns a newAdaptrisMessage
with the specified payload and metadata.AdaptrisMessage
newMessage(java.lang.String payload, java.lang.String charEncoding, java.util.Set metadata)
Returns a newAdaptrisMessage
with the specified payload and metadata.AdaptrisMessage
newMessage(java.lang.String payload, java.util.Set metadata)
Returns a newAdaptrisMessage
with the specified payload and metadata.void
setDefaultCharEncoding(java.lang.String s)
Set the default character encoding to be applied to the message upon creation.-
Methods inherited from class com.adaptris.core.AdaptrisMessageFactory
defaultIfNull, getDefaultInstance, getUniqueIdGenerator, setUniqueIdGenerator, uniqueIdGenerator
-
-
-
-
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 classAdaptrisMessageFactory
- Parameters:
payload
- thebyte[]
payloadmetadata
- aSet
ofMetadataElement
s- Returns:
- a new
AdaptrisMessage
-
newMessage
public AdaptrisMessage newMessage(byte[] payload)
Description copied from class:AdaptrisMessageFactory
Returns a new
AdaptrisMessage
with the specified payload and metadata.- Specified by:
newMessage
in classAdaptrisMessageFactory
- Parameters:
payload
- thebyte[]
payload- 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 classAdaptrisMessageFactory
- Parameters:
payload
- theString
payloadmetadata
- aSet
ofMetadataElement
s- 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 classAdaptrisMessageFactory
- Parameters:
payload
- theString
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 classAdaptrisMessageFactory
- Parameters:
payload
- theString
payloadcharEncoding
- theString
's character encodingmetadata
- aSet
ofMetadataElement
s- 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 classAdaptrisMessageFactory
- Parameters:
payload
- theString
payloadcharEncoding
- theString
'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 newAdaptrisMessage
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 classAdaptrisMessageFactory
- Parameters:
source
- the original AdaptrisMessagemetadataKeysToPreserve
- 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.
-
newMessage
public AdaptrisMessage newMessage()
Description copied from class:AdaptrisMessageFactory
Returns a new
AdaptrisMessage
. Payload and metadata are null.- Specified by:
newMessage
in classAdaptrisMessageFactory
- Returns:
- a new
AdaptrisMessage
with the specified payload and metadata
-
getDefaultCharEncoding
public java.lang.String getDefaultCharEncoding()
Description copied from class:AdaptrisMessageFactory
Return the default character encoding for the message.- Specified by:
getDefaultCharEncoding
in classAdaptrisMessageFactory
- Returns:
- the defaultCharEncoding
-
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 classAdaptrisMessageFactory
- Parameters:
s
- the defaultCharEncoding to set- See Also:
AdaptrisMessage.setCharEncoding(String)
-
-