Package com.adaptris.core
Interface MultiPayloadAdaptrisMessage
-
- All Superinterfaces:
AdaptrisMessage
,InterlokMessage
- All Known Implementing Classes:
MultiPayloadAdaptrisMessageImp
public interface MultiPayloadAdaptrisMessage extends AdaptrisMessage
Interface for Adaptris messages that support multiple payloads, referenced by an ID/key.- Since:
- 3.9.x
- See Also:
AdaptrisMessage
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_PAYLOAD_ID
The ID to use for the default payload.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addContent(@NotNull java.lang.String id, java.lang.String content)
Add a new payload to the message, with the given ID and content.void
addContent(@NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.void
addPayload(@NotNull java.lang.String id, byte[] payload)
Add a new payload to the message, with the given ID and data.void
addPayloadMessageHeader(java.lang.String key, java.lang.String value)
Add a metadata for the current payloadvoid
addPayloadMessageHeader(java.lang.String payloadId, java.lang.String key, java.lang.String value)
Add a metadata for the given payload idvoid
deletePayload(@NotNull java.lang.String id)
Delete an existing payload, with the given payload ID.java.lang.String
getContent(@NotNull java.lang.String id)
Get the payload content for the given ID.java.lang.String
getContentEncoding(@NotNull java.lang.String id)
Get the content encoding for the given payload ID.java.lang.String
getCurrentPayloadId()
Get the ID of the current payload.java.io.InputStream
getInputStream(@NotNull java.lang.String id)
Get the input stream for the given payload ID.java.io.OutputStream
getOutputStream(@NotNull java.lang.String id)
Get the output stream for the given payload ID.byte[]
getPayload(@NotNull java.lang.String id)
Get the payload data for the given ID.int
getPayloadCount()
Return the number of payloads contained within the message.java.util.Set<java.lang.String>
getPayloadIDs()
Get the payload IDs used within this message.java.util.Map<java.lang.String,java.lang.String>
getPayloadMessageHeaders()
Return all the metadata for the current payload removing the payload prefixes e.g.java.util.Map<java.lang.String,java.lang.String>
getPayloadMessageHeaders(java.lang.String payloadId)
Return all the metadata for a given payload id removing the payload prefixes e.g.java.lang.String
getPayloadMessageHeaderValue(java.lang.String key)
Return metadata value for the current payload and keyjava.lang.String
getPayloadMessageHeaderValue(java.lang.String payloadId, java.lang.String key)
Return metadata value for the given payload id and keylong
getSize(@NotNull java.lang.String id)
Get the size of the payload for the given ID.java.io.Writer
getWriter(@NotNull java.lang.String id)
Return a writer ready for writing the payload for the given payload ID.java.io.Writer
getWriter(@NotNull java.lang.String id, java.lang.String encoding)
Return a writer ready for writing the payload for the given payload ID.boolean
hasPayloadId(@NotNull java.lang.String id)
Indicates whether the given payload ID exists in the message.boolean
payloadHeadersContainsKey(java.lang.String key)
Check if the current payload contains a metadata with the give keyboolean
payloadHeadersContainsKey(java.lang.String payloadId, java.lang.String key)
Check if the payload with the given id contains a metadata with the give keyvoid
removePayloadMessageHeader(java.lang.String key)
Remove a metadata for the current payload and the given keyvoid
removePayloadMessageHeader(java.lang.String payloadId, java.lang.String key)
Remove a metadata for the given payload id and the given keyvoid
setContent(@NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.void
setContentEncoding(@NotNull java.lang.String id, java.lang.String encoding)
Set the payload content encoding for the given payload ID.void
setCurrentPayloadId(@NotNull java.lang.String id)
Update the ID of the current payload.void
switchPayload(@NotNull java.lang.String id)
Switch from one payload to another, given by the ID.-
Methods inherited from interface com.adaptris.core.AdaptrisMessage
addEvent, addMetadata, addMetadata, addMetadata, addObjectMetadata, clearMetadata, clone, containsKey, encode, equivalentForTracking, getCharEncoding, getFactory, getMessageLifecycleEvent, getMetadata, getMetadata, getMetadataValue, getMetadataValueIgnoreKeyCase, getNextServiceId, getObjectMetadata, getPayload, getPayloadForLogging, getSize, getStringPayload, removeMetadata, replaceAllMetadata, setCharEncoding, setMetadata, setNextServiceId, setPayload, setStringPayload, setStringPayload
-
Methods inherited from interface com.adaptris.interlok.types.InterlokMessage
addMessageHeader, addMessageHeaders, addObjectHeader, clearMessageHeaders, getContent, getContentEncoding, getInputStream, getMessageHeaders, getObjectHeaders, getOutputStream, getReader, getUniqueId, getWriter, headersContainsKey, removeMessageHeader, replaceAllMessageHeaders, resolve, resolve, resolveObject, setContent, setContentEncoding, setMessageHeaders, setUniqueId, wrap
-
-
-
-
Field Detail
-
DEFAULT_PAYLOAD_ID
static final java.lang.String DEFAULT_PAYLOAD_ID
The ID to use for the default payload.- See Also:
- Constant Field Values
-
-
Method Detail
-
switchPayload
void switchPayload(@NotNull @NotNull java.lang.String id)
Switch from one payload to another, given by the ID.- Parameters:
id
- The ID of the payload to switch to.
-
hasPayloadId
boolean hasPayloadId(@NotNull @NotNull java.lang.String id)
Indicates whether the given payload ID exists in the message.- Parameters:
id
- The payload ID to check.- Returns:
- True if there's a payload with the given ID, false otherwise.
-
getCurrentPayloadId
java.lang.String getCurrentPayloadId()
Get the ID of the current payload.- Returns:
- The payload ID.
-
getPayloadIDs
java.util.Set<java.lang.String> getPayloadIDs()
Get the payload IDs used within this message.- Returns:
- The payload IDs.
-
setCurrentPayloadId
void setCurrentPayloadId(@NotNull @NotNull java.lang.String id)
Update the ID of the current payload. This does not change the current working payload, rather updates the ID of the current working payload.- Parameters:
id
- The new payload ID.
-
addPayload
void addPayload(@NotNull @NotNull java.lang.String id, byte[] payload)
Add a new payload to the message, with the given ID and data.- Parameters:
id
- The new payload ID.payload
- The payload data.
-
deletePayload
void deletePayload(@NotNull @NotNull java.lang.String id)
Delete an existing payload, with the given payload ID.- Parameters:
id
- The payload ID.
-
getPayload
byte[] getPayload(@NotNull @NotNull java.lang.String id)
Get the payload data for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload data.
-
getSize
long getSize(@NotNull @NotNull java.lang.String id)
Get the size of the payload for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload size.
-
getPayloadCount
int getPayloadCount()
Return the number of payloads contained within the message.- Returns:
- The number of payloads.
-
addContent
void addContent(@NotNull @NotNull java.lang.String id, java.lang.String content)
Add a new payload to the message, with the given ID and content.- Parameters:
id
- The new payload ID.content
- The payload content.
-
addContent
void addContent(@NotNull @NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.- Parameters:
id
- The new payload ID.content
- The payload content.encoding
- The content encoding.
-
setContent
void setContent(@NotNull @NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.- Parameters:
id
- The new payload ID.content
- The payload content.encoding
- The content encoding.
-
getContent
java.lang.String getContent(@NotNull @NotNull java.lang.String id)
Get the payload content for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload content.
-
setContentEncoding
void setContentEncoding(@NotNull @NotNull java.lang.String id, java.lang.String encoding)
Set the payload content encoding for the given payload ID.- Parameters:
id
- The payload ID.encoding
- The content encoding.
-
getContentEncoding
java.lang.String getContentEncoding(@NotNull @NotNull java.lang.String id)
Get the content encoding for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The content encoding.
-
getInputStream
java.io.InputStream getInputStream(@NotNull @NotNull java.lang.String id)
Get the input stream for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The payload input stream.
-
getOutputStream
java.io.OutputStream getOutputStream(@NotNull @NotNull java.lang.String id)
Get the output stream for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The payload output stream.
-
getWriter
java.io.Writer getWriter(@NotNull @NotNull java.lang.String id) throws java.io.IOException
Return a writer ready for writing the payload for the given payload ID.- Specified by:
getWriter
in interfaceInterlokMessage
- Parameters:
id
- The payload ID.- Returns:
- an Writer that can be used to write the payload using the existing encoding.
- Throws:
java.io.IOException
- if the Writer could not be created.
-
getWriter
java.io.Writer getWriter(@NotNull @NotNull java.lang.String id, java.lang.String encoding) throws java.io.IOException
Return a writer ready for writing the payload for the given payload ID.- Parameters:
id
- The payload ID.encoding
- The payload encoding.- Returns:
- an Writer that can be used to write the payload using the existing encoding.
- Throws:
java.io.IOException
- if the Writer could not be created.
-
removePayloadMessageHeader
void removePayloadMessageHeader(java.lang.String payloadId, java.lang.String key)
Remove a metadata for the given payload id and the given key- Parameters:
payloadId
-key
-
-
removePayloadMessageHeader
void removePayloadMessageHeader(java.lang.String key)
Remove a metadata for the current payload and the given key- Parameters:
key
-
-
addPayloadMessageHeader
void addPayloadMessageHeader(java.lang.String payloadId, java.lang.String key, java.lang.String value)
Add a metadata for the given payload id- Parameters:
payloadId
-key
-value
-
-
addPayloadMessageHeader
void addPayloadMessageHeader(java.lang.String key, java.lang.String value)
Add a metadata for the current payload- Parameters:
key
-value
-
-
getPayloadMessageHeaders
java.util.Map<java.lang.String,java.lang.String> getPayloadMessageHeaders(java.lang.String payloadId)
Return all the metadata for a given payload id removing the payload prefixes e.g. 'PAYLOAD_payload-id_key' will become 'key'- Parameters:
payloadId
-- Returns:
- all the metadata for a given payload id removing the payload prefixes
-
getPayloadMessageHeaders
java.util.Map<java.lang.String,java.lang.String> getPayloadMessageHeaders()
Return all the metadata for the current payload removing the payload prefixes e.g. 'PAYLOAD_payload-id_key' will become 'key'- Returns:
- all the metadata for the given payload removing the payload prefixes
-
getPayloadMessageHeaderValue
java.lang.String getPayloadMessageHeaderValue(java.lang.String payloadId, java.lang.String key)
Return metadata value for the given payload id and key- Parameters:
payloadId
-key
-- Returns:
- metadata value for the given payload id and key
-
getPayloadMessageHeaderValue
java.lang.String getPayloadMessageHeaderValue(java.lang.String key)
Return metadata value for the current payload and key- Parameters:
key
-- Returns:
- metadata value for the current payload and key
-
payloadHeadersContainsKey
boolean payloadHeadersContainsKey(java.lang.String payloadId, java.lang.String key)
Check if the payload with the given id contains a metadata with the give key- Parameters:
payloadId
-key
-- Returns:
- true if the payload with the given id contains a metadata with the give key
-
payloadHeadersContainsKey
boolean payloadHeadersContainsKey(java.lang.String key)
Check if the current payload contains a metadata with the give key- Parameters:
key
-- Returns:
- true if the current payload contains a metadata with the give key
-
-