SonicMQ API

progress.message.jclient
Interface MultipartMessage

All Superinterfaces:
Message

public interface MultipartMessage
extends Message

The MultipartMessage is a message that can contain one or more Parts. It provides methods to add, delete, and get the constituent parts. The Parts can be javax.jms.Message implementations in addition to primitive types such as xml, html, text, etc.

When a JMS client receives a MulitpartMessage, it is in read-only mode. If a client attempts to write to the message at this point, a javax.jms.MessageNotWriteableException is thrown. If clearBody is called, the message can now be both read from and written to.

The Parts of a MultipartMessage are accessible two ways. The accessor methods on Parts are accessible two ways:

  • By index (0-based)
  • By Content-Id (a String)

    Author:
    Jaime Meritt, Bill Wood
    See Also:
    Message

    Field Summary
     
    Fields inherited from interface javax.jms.Message
    DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
     
    Method Summary
     void addPart(Part part)
              Adds a part to the multipart.
     void clearReadOnly()
              Makes a message writable.
     Part createMessagePart(Message message)
              Creates a part whose content is a Message.
     Part createPart()
              Creates an empty part.
     Part createPart(javax.activation.DataHandler handler)
              Creates a Part from a DataHandler.
     Part createPart(java.lang.Object object, java.lang.String type)
              Creates a part.
     boolean doesPartExist(java.lang.String cid)
              Checks if a Part with the given content-id exists
     Message getMessageFromPart(int index)
              convenience method to retrieve a Message from the multipart
     Message getMessageFromPart(java.lang.String cid)
              Convenience method to retrieve a Message from the multipart
     Part getPart(int index)
              Gets the Part from the MultipartMessage by index
     Part getPart(java.lang.String cid)
              Gets an Part from the message based on the content-id property of the Part.
     int getPartCount()
              Gets the count of the number of Parts for the MultipartMessage.
     java.lang.String getProfileName()
              Return the name of the extended type, or profile, used to create this message.
     boolean isMessagePart(int index)
              Checks if the Part is a MessagePart
     boolean isMessagePart(java.lang.String cid)
              Checks if the Part is a MessagePart
     boolean isReadOnly()
              Checks if the message is in read-only mode.
     void removePart(int index)
              Removes a Part from the Multipart.
     void removePart(java.lang.String cid)
              Removes a Part from the Multipart.
     
    Methods inherited from interface progress.message.jclient.Message
    acknowledgeAndForward, acknowledgeAndForward, getBodySize, getChannel, getDestinationProperty, getProperties, hasChannel, isDestinationProperty, setChannel, setChannel, setDestinationProperty
     
    Methods inherited from interface javax.jms.Message
    acknowledge, clearBody, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
     

    Method Detail

    getPartCount

    int getPartCount()
                     throws JMSException
    Gets the count of the number of Parts for the MultipartMessage.

    Returns:
    index The number of Parts.
    Throws:
    JMSException - if index is out of bounds.

    getPart

    Part getPart(int index)
                 throws JMSException
    Gets the Part from the MultipartMessage by index

    Parameters:
    index - The 0-based array index of the part requested.
    Throws:
    JMSException - if index is out of bounds.

    getPart

    Part getPart(java.lang.String cid)
                 throws JMSException
    Gets an Part from the message based on the content-id property of the Part.

    Parameters:
    cid - The Content-Id of the requested Part
    Throws:
    JMSException - If a part with cid does not exist

    doesPartExist

    boolean doesPartExist(java.lang.String cid)
                          throws JMSException
    Checks if a Part with the given content-id exists

    Parameters:
    cid - The content-id of the Part
    Throws:
    JMSException - If a part with cid does not exist

    getMessageFromPart

    Message getMessageFromPart(int index)
                               throws JMSException
    convenience method to retrieve a Message from the multipart

    Parameters:
    index - the index of the part
    Throws:
    JMSException - If the index is out of bounds or if the part is not a MessagePart

    getMessageFromPart

    Message getMessageFromPart(java.lang.String cid)
                               throws JMSException
    Convenience method to retrieve a Message from the multipart

    Parameters:
    cid - the content-id of the part
    Throws:
    JMSException - thrown if the part does not exist or the part is not a MessagePart

    isMessagePart

    boolean isMessagePart(int index)
                          throws JMSException
    Checks if the Part is a MessagePart

    Parameters:
    index - the index of the Part
    Throws:
    JMSException

    isMessagePart

    boolean isMessagePart(java.lang.String cid)
                          throws JMSException
    Checks if the Part is a MessagePart

    Parameters:
    cid - The content-id of the Part
    Throws:
    JMSException

    removePart

    void removePart(int index)
                    throws JMSException
    Removes a Part from the Multipart.

    Parameters:
    index - the index of the part to remove.
    Throws:
    JMSException - If operation failed due to some internal error.
    MessageNotWriteableException - If message is in read-only mode.

    removePart

    void removePart(java.lang.String cid)
                    throws JMSException
    Removes a Part from the Multipart.

    Parameters:
    cid - the content-id of the part to remove
    Throws:
    JMSException - If operation failed due to some internal error.
    MessageNotWriteableException - If message is in read-only mode.

    addPart

    void addPart(Part part)
                 throws JMSException
    Adds a part to the multipart.

    Parameters:
    part - The part to be added.
    Throws:
    MessageNotWriteableException - If message is in read-only mode.
    JMSException - If a part with same cid already exists.

    createPart

    Part createPart(javax.activation.DataHandler handler)
                    throws JMSException
    Creates a Part from a DataHandler. Does not require the user to know the class of the part created.

    The Part is not automatically added to the Message.

    Parameters:
    handler - the data
    Throws:
    JMSException

    createPart

    Part createPart()
    Creates an empty part. Doesn't require knowledge of Part implementation class.

    The Part is not automatically added to the Message.


    createPart

    Part createPart(java.lang.Object object,
                    java.lang.String type)
                    throws JMSException
    Creates a part. Doesn't require knowledge of Part implementation class.

    The Part is not automatically added to the Message.

    Parameters:
    object - The content of the part.
    type - The Content-Type associated with the content.
    Throws:
    JMSException - thrown if the type is unsupported or the content is incompatible with the type specified

    createMessagePart

    Part createMessagePart(Message message)
                           throws JMSException
    Creates a part whose content is a Message.

    The Part is not automatically added to the Message.

    Parameters:
    message - The content of the part.
    Throws:
    JMSException - thrown if the type is unsupported or the content is incompatible with the type specified

    isReadOnly

    boolean isReadOnly()
                       throws JMSException
    Checks if the message is in read-only mode. This is a extension to JMS.

    Returns:
    True, if message is read-only.
    Throws:
    JMSException - If operation failed due to some internal error.

    clearReadOnly

    void clearReadOnly()
                       throws JMSException
    Makes a message writable. This is a extension to the JMS specification which does not allow changing the read-only property without clearing the body or properties.

    Throws:
    JMSException - If operation failed due to some internal error.

    getProfileName

    java.lang.String getProfileName()
                                    throws JMSException
    Return the name of the extended type, or profile, used to create this message.

    Returns:
    The name of the extended type.
    Throws:
    JMSException - If operation failed due to some internal error.

    SonicMQ API

    Copyright © 1999-2012 Progress Software Corporation. All Rights Reserved.
    HTML formatted on 13-March-2012.