com.sun.im.service
Interface Message

All Superinterfaces:
MessagePart, ReadOnlyMessagePart
All Known Subinterfaces:
InviteMessage

public interface Message
extends MessagePart


Method Summary
 void addPart(MessagePart part)
          adds a body part to the end of the message being built
 MessageProcessingRule addProcessingRule(int index, MessageProcessingRule.Condition condition, MessageProcessingRule.Action action)
          insert a message processing rule at the given position rules are to be processed by the service in the order in which they are specified, until one matches.
 MessageProcessingRule addProcessingRule(MessageProcessingRule.Condition condition, MessageProcessingRule.Action action)
          adds a message processing rule at the end of the rule set.
 void addRecipient(java.lang.String destination)
          adds a recipient to a message
 java.util.Date getExpirationDate()
          returns the date of expiration of this message.
 java.lang.String getHeader(java.lang.String header)
          get the value of a header
 java.lang.String getMessageId()
          returns the message identifier.
 java.lang.String getOriginator()
          returns the originator address
 MessagePart[] getParts()
          get the nested parts of a multi-part message or message part
 java.lang.String[] getRecipients()
          get the recipients of the message.
 MessagePart newPart()
          instantiates a new body part.
 void removePart(MessagePart part)
          removes a bodypart
 MessageProcessingRule removeProcessingRule(int index)
          removes a message processing rule.
 boolean removeProcessingRule(MessageProcessingRule rule)
          removes a message processing rule.
 void removeRecipient(java.lang.String destination)
          removes a recipient from the recipient list of a message.
 void sendReply(Message message)
          send a reply to the alert message
 void sendStatus(int status)
          acknowledge reception of the message
 void setExpirationDate(java.util.Date expireAt)
           
 void setHeader(java.lang.String header, java.lang.String value)
          set the value of a header
 void setOriginator(java.lang.String originator)
          returns the originator address
 
Methods inherited from interface com.sun.im.service.MessagePart
clearContent, setContent, setContent, setContent, setContent, setContentName, setContentType
 
Methods inherited from interface com.sun.im.service.ReadOnlyMessagePart
getBytes, getContent, getContent, getContentEncoding, getContentID, getContentName, getContentType, getInputStream, getSize
 

Method Detail

sendStatus

public void sendStatus(int status)
                throws CollaborationException
acknowledge reception of the message

Parameters:
status - reception status as defined in MessageStatus
Throws:
CollaborationException
See Also:
MessageStatus

sendReply

public void sendReply(Message message)
               throws CollaborationException
send a reply to the alert message

Parameters:
message - reply message. The reply message must be implemented with the createReply method.
Throws:
CollaborationException

getOriginator

public java.lang.String getOriginator()
returns the originator address

Returns:
originator address

setOriginator

public void setOriginator(java.lang.String originator)
                   throws CollaborationException
returns the originator address

Returns:
originator address
Throws:
CollaborationException

addRecipient

public void addRecipient(java.lang.String destination)
                  throws CollaborationException
adds a recipient to a message

Parameters:
destination - recipient's address
Throws:
CollaborationException

removeRecipient

public void removeRecipient(java.lang.String destination)
                     throws CollaborationException
removes a recipient from the recipient list of a message.

Parameters:
destination - recipient's address
Throws:
CollaborationException

getRecipients

public java.lang.String[] getRecipients()
                                 throws CollaborationException
get the recipients of the message.

Returns:
array of recipient addresses
Throws:
CollaborationException

getMessageId

public java.lang.String getMessageId()
returns the message identifier. The message identifier is generated by the provider.

Returns:
message identifier

getExpirationDate

public java.util.Date getExpirationDate()
returns the date of expiration of this message.

Returns:
message expiration date

newPart

public MessagePart newPart()
                    throws CollaborationException
instantiates a new body part. Note that this is not equivalent to adding a part. It merely instantiates a MessagePart object which can be added to this message when complete.

Returns:
new, empty message part
Throws:
CollaborationException
See Also:
addPart(MessagePart).

getHeader

public java.lang.String getHeader(java.lang.String header)
get the value of a header


setHeader

public void setHeader(java.lang.String header,
                      java.lang.String value)
               throws CollaborationException
set the value of a header

Throws:
CollaborationException

addPart

public void addPart(MessagePart part)
             throws CollaborationException
adds a body part to the end of the message being built

Parameters:
part - message bodypart to add.
Throws:
CollaborationException

removePart

public void removePart(MessagePart part)
                throws CollaborationException
removes a bodypart

Parameters:
part - Message Part tp remove.
Throws:
CollaborationException

getParts

public MessagePart[] getParts()
get the nested parts of a multi-part message or message part


setExpirationDate

public void setExpirationDate(java.util.Date expireAt)
                       throws CollaborationException
Parameters:
expireAt - date at which the message will expire
Throws:
CollaborationException

addProcessingRule

public MessageProcessingRule addProcessingRule(MessageProcessingRule.Condition condition,
                                               MessageProcessingRule.Action action)
                                        throws ServiceUnavailableException
adds a message processing rule at the end of the rule set. Rules are to be processed by the service in the order in which they are specified, until one matches.

Parameters:
condition - matching condition for this rule
action - what to do if the condition is matched
Throws:
ServiceUnavailableException - the service does not support user-controlled message processing or does not support the specific action/condition combination provided
java.lang.IllegalArgumentException - if the condition or action is null

addProcessingRule

public MessageProcessingRule addProcessingRule(int index,
                                               MessageProcessingRule.Condition condition,
                                               MessageProcessingRule.Action action)
                                        throws ServiceUnavailableException,
                                               java.lang.IndexOutOfBoundsException
insert a message processing rule at the given position rules are to be processed by the service in the order in which they are specified, until one matches.

Parameters:
index - position of the rule within the rule set. Order of rule matters since they are applied sequentially until a match is found.
condition - matching condition for this rule
action - what to do if the condition is matched
Throws:
ServiceUnavailableException - the service does not support user-controlled message processing.
java.lang.IndexOutOfBoundsException - if the index is out of range
java.lang.IllegalArgumentException - if the condition or action is null

removeProcessingRule

public boolean removeProcessingRule(MessageProcessingRule rule)
removes a message processing rule.

Parameters:
rule - the rule to remove
Returns:
true if a matching rule was present and effectively removed from this, false otherwise

removeProcessingRule

public MessageProcessingRule removeProcessingRule(int index)
                                           throws java.lang.IndexOutOfBoundsException
removes a message processing rule.

Parameters:
index - position of the rule to remove
Returns:
true if a matching rule was present and effectively removed from this, false otherwise
Throws:
java.lang.IndexOutOfBoundsException