com.ibm.websphere.sca.soap.attachments
Interface Attachments


public interface Attachments


Field Summary
static Attachments INSTANCE
          Attachments interface instance.
 
Method Summary
 AttachmentMetaData addAttachmentContent(java.lang.String contextID, java.io.InputStream attachment)
          Adds Attachment content to the context ID.
 AttachmentMetaData addExistingAttachmentContent(java.lang.String contextID, java.lang.String attachmentID)
          This adds existing attachment content to the specified context ID.
 void deleteAttachmentContent(java.lang.String contextID, java.lang.String attachmentID)
          Deletes the attachment content specified by the attachment context ID and attachment ID.
 java.util.Iterator getAllMetaData(java.lang.String contextID)
          Returns an Iterator of attachment metadata objects associated with the specified attachment context ID.
 java.io.InputStream getAttachmentContent(java.lang.String contextID, java.lang.String attachmentID)
          Returns an InputStream of the attachment content.
 java.lang.String getAttachmentContextIDForSCAMessage(com.ibm.wsspi.sca.message.Message message, boolean create)
          Gets an attachment context ID for an SCA message, with an option to create the attachment context ID during the method call.
 java.lang.String getAttachmentContextIDForSMO(com.ibm.websphere.sibx.smobo.ServiceMessageObject smo, boolean create)
          Gets an attachment context ID for an SMO, with an option to create the attachment context ID during the method call.
 int getAttachmentCount(java.lang.String contextID)
          Returns the number of attachments for the specified attachment context ID.
 int getContentSize(java.lang.String contextID, java.lang.String attachmentID)
          Returns the number of bytes in this Attachment object.
 ExpirationPolicy getExpirationPolicy(java.lang.String contextID)
          Returns the ExpirationPolicy for the specified attachment context ID.
 AttachmentMetaData getMetaDataForAttachment(java.lang.String contextID, java.lang.String attachmentID)
          Returns an attachment metadata object for the attachment associated with the attachment context ID and attachment unique ID.
 void removeAttachmentContextForSCAMessage(com.ibm.wsspi.sca.message.Message message)
          Explicitly removes the attachment context ID for an SCA message.
 void removeAttachmentContextForSMO(com.ibm.websphere.sibx.smobo.ServiceMessageObject message)
          Explicitly removes the attachment context ID for an SMO.
 void setExpirationPolicy(java.lang.String contextID, ExpirationPolicy policy)
          Sets the ExpirationPolicy for the specified attachment context ID.
 void setShouldPropagateAtImport(java.lang.String contextID, boolean val)
          Sets the flag controlling whether attachments are propagated through Web Service imports.
 boolean shouldPropagateAtImport(java.lang.String contextID)
          Returns true if attachments should be propagated through Web Service import.
 

Field Detail

INSTANCE

static final Attachments INSTANCE
Attachments interface instance.

Method Detail

getAttachmentContextIDForSMO

java.lang.String getAttachmentContextIDForSMO(com.ibm.websphere.sibx.smobo.ServiceMessageObject smo,
                                              boolean create)
Gets an attachment context ID for an SMO, with an option to create the attachment context ID during the method call. If create is set to true and an attachment context ID for the message already exists, then it is returned. SMO headers are copied into SCA headers when leaving the ESB container.

Parameters:
message - The SMO to get a context ID for. May not be null
create - Set to true if an ID should be created if it does not exist.
Returns:
An attachment context ID. If create is set to false and there is no existing context ID, then null will be returned.
Throws:
java.lang.IllegalArgumentException - Thrown if the provided SMO is null.

removeAttachmentContextForSMO

void removeAttachmentContextForSMO(com.ibm.websphere.sibx.smobo.ServiceMessageObject message)
                                   throws AttachmentProcessingException,
                                          NoSuchAttachmentContextException
Explicitly removes the attachment context ID for an SMO. This removes all attachments associated with this SMO message.

Parameters:
message - The SMO whose attachment context ID is to be removed. May not be null
Throws:
AttachmentProcessingException - Thrown if an error occurs while removing the attachments. If a message references an invalid attachment (because it was removed previously), this exception will not be thrown.
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied message is null.

getAttachmentContextIDForSCAMessage

java.lang.String getAttachmentContextIDForSCAMessage(com.ibm.wsspi.sca.message.Message message,
                                                     boolean create)
Gets an attachment context ID for an SCA message, with an option to create the attachment context ID during the method call. If create is set to true and an attachment context ID for the message already exists, then it is returned.

Parameters:
message - The SCA message to get a context ID for. May not be null
create - Set to true if an ID should be created if it does not exist.
Returns:
An attachment context ID. If create is set to false and there is no existing context ID, then null will be returned.
Throws:
java.lang.IllegalArgumentException - Thrown if the provided message is null.

removeAttachmentContextForSCAMessage

void removeAttachmentContextForSCAMessage(com.ibm.wsspi.sca.message.Message message)
                                          throws AttachmentProcessingException,
                                                 NoSuchAttachmentContextException
Explicitly removes the attachment context ID for an SCA message. This removes all attachments associated with this message.

Parameters:
message - The SCA message whose attachment context ID is to be removed. May not be null
Throws:
AttachmentProcessingException - Thrown if an error occurs while removing the attachments. If a message references an invalid attachment (because it was removed previously), this exception will not be thrown.
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied message is null.

getExpirationPolicy

ExpirationPolicy getExpirationPolicy(java.lang.String contextID)
                                     throws NoSuchAttachmentContextException,
                                            AttachmentProcessingException
Returns the ExpirationPolicy for the specified attachment context ID.

Parameters:
contextID - The attachment context ID. May not be null
Returns:
An expiration policy object. Will not be null
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied context ID is null.
AttachmentProcessingException

setExpirationPolicy

void setExpirationPolicy(java.lang.String contextID,
                         ExpirationPolicy policy)
                         throws NoSuchAttachmentContextException,
                                AttachmentProcessingException
Sets the ExpirationPolicy for the specified attachment context ID.

Parameters:
contextID - The attachment context ID. May not be null
policy - The expiration policy object to set for the ID. This object should not be modified once set. May not be null
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments is null.
AttachmentProcessingException

shouldPropagateAtImport

boolean shouldPropagateAtImport(java.lang.String contextID)
                                throws NoSuchAttachmentContextException,
                                       AttachmentProcessingException
Returns true if attachments should be propagated through Web Service import.

Parameters:
contextID - The attachment context ID. May not be null
Returns:
The current value of the propagate flag.
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied context ID is null.
AttachmentProcessingException

setShouldPropagateAtImport

void setShouldPropagateAtImport(java.lang.String contextID,
                                boolean val)
                                throws NoSuchAttachmentContextException,
                                       AttachmentProcessingException
Sets the flag controlling whether attachments are propagated through Web Service imports.

Parameters:
contextID - The attachment context ID. May not be null
val - The value of the flag to set.
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied context ID is null.
AttachmentProcessingException

getAttachmentCount

int getAttachmentCount(java.lang.String contextID)
                       throws NoSuchAttachmentContextException,
                              AttachmentProcessingException
Returns the number of attachments for the specified attachment context ID.

Parameters:
contextID - The attachment context ID. May not be null
Returns:
The number of attachments associated with context ID message. Will be >= 0
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied context ID is null.
AttachmentProcessingException

getAttachmentContent

java.io.InputStream getAttachmentContent(java.lang.String contextID,
                                         java.lang.String attachmentID)
                                         throws AttachmentProcessingException,
                                                NoSuchAttachmentContextException,
                                                NoSuchAttachmentException
Returns an InputStream of the attachment content. The content is identified by the attachment context ID and the attachment unique ID.

Parameters:
contextID - The attachment context ID. May not be null
attachmentID - the attachment unique ID. May not be null
Returns:
An input stream containing the attachment content. Will not be null
Throws:
AttachmentProcessingException - Thrown if an error occurs while opening the attachment stream.
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
NoSuchAttachmentException - Thrown if an invalid attachment ID is provided.
java.lang.IllegalArgumentException - Thrown if either of the supplied IDs are null.

addAttachmentContent

AttachmentMetaData addAttachmentContent(java.lang.String contextID,
                                        java.io.InputStream attachment)
                                        throws AttachmentProcessingException,
                                               NoSuchAttachmentContextException
Adds Attachment content to the context ID. Returns an AttachmentMetaData object where the attachment ID is pre-set. The returned attachment metadata object may be used to manipulate content MIME headers.

Parameters:
contextID - The attachment context ID. May not be null
attachment - The attachment content stream. May not be null
Returns:
An attachment meta data object. Will not be null
Throws:
AttachmentProcessingException - Thrown if an error occurs while processing the attachment stream.
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments are null.

addExistingAttachmentContent

AttachmentMetaData addExistingAttachmentContent(java.lang.String contextID,
                                                java.lang.String attachmentID)
                                                throws AttachmentProcessingException,
                                                       NoSuchAttachmentContextException,
                                                       NoSuchAttachmentException
This adds existing attachment content to the specified context ID. This allows for reusing content that is in the cache without retrieving it. A new meta data object is returned referencing the supplied attachment ID. The meta data object will not contain any other header meta data.

Parameters:
contextID - The attachment context ID. May not be null
attachmentID - The unique attachment ID for the existing content. May not be null
Returns:
A meta data object referencing the existing content. The meta data object will only contain a reference to the attachment and not any other meta data headers. Will not be null
Throws:
AttachmentProcessingException - Thrown if an error occurs while processing the attachment.
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
NoSuchAttachmentException - Thrown if an invalid attachment ID is provided.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments are null.

deleteAttachmentContent

void deleteAttachmentContent(java.lang.String contextID,
                             java.lang.String attachmentID)
                             throws NoSuchAttachmentContextException,
                                    NoSuchAttachmentException,
                                    AttachmentProcessingException
Deletes the attachment content specified by the attachment context ID and attachment ID.

Parameters:
contextID - The attachment context ID. May not be null
attachmentID - The attachment unique ID. May not be null
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
NoSuchAttachmentException - Thrown if an invalid attachment ID is provided.
AttachmentProcessingException - Thrown if an error occurs while processing the attachment.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments are null.

getContentSize

int getContentSize(java.lang.String contextID,
                   java.lang.String attachmentID)
                   throws NoSuchAttachmentContextException,
                          NoSuchAttachmentException,
                          AttachmentProcessingException
Returns the number of bytes in this Attachment object. Returns the size of this Attachment content in bytes or -1 if the size cannot be determined.

Parameters:
contextID - The attachment context ID. May not be null
attachmentID - The attachment unique ID. May not be null
Returns:
The size of the attachment content in bytes. Will be >= -1
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
NoSuchAttachmentException - Thrown if an invalid attachment ID is provided.
AttachmentProcessingException - Thrown if an error occurs while processing the attachment.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments are null.

getAllMetaData

java.util.Iterator getAllMetaData(java.lang.String contextID)
                                  throws NoSuchAttachmentContextException
Returns an Iterator of attachment metadata objects associated with the specified attachment context ID. Attachment metadata contains information about the MIME headers for the the attachment and provides access to the unique attachment ID. Objects returned by this iterator may be safely cast to AttachmentMetaData.

Parameters:
contextID - The attachment context ID. May not be null
Returns:
An iterator for the attachment metadata. Will not be null
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
java.lang.IllegalArgumentException - Thrown if the supplied context ID is null.

getMetaDataForAttachment

AttachmentMetaData getMetaDataForAttachment(java.lang.String contextID,
                                            java.lang.String attachmentID)
                                            throws NoSuchAttachmentContextException,
                                                   NoSuchAttachmentException,
                                                   AttachmentProcessingException
Returns an attachment metadata object for the attachment associated with the attachment context ID and attachment unique ID.

Parameters:
contextID - The attachment context ID. May not be null
attachmentID - The attachment unique ID. May not be null
Returns:
The attachment metadata. Will not be null
Throws:
NoSuchAttachmentContextException - Thrown if an invalid context is referenced.
NoSuchAttachmentException - Thrown if an invalid attachment ID is provided.
java.lang.IllegalArgumentException - Thrown if either of the supplied arguments are null.
AttachmentProcessingException


Copyright © 2006 IBM Corp. All Rights Reserved.