oracle.panama.messaging.push
Class Packet

java.lang.Object
  |
  +--oracle.panama.messaging.push.Packet

public class Packet
extends java.lang.Object

Packet class represents a generic message in the real world. (For example: email) It has a subject, one body or a set of message bodies (multipart). The same message may be delivered to multiple recipients of multiple transport types (delivery types).
For example: the same message can be delivered to 2 email recipients, 3 SMS recipients and 4 fax machines in the same packet.
Every transport type may have a sender, an alternate reply to address and a group of recipients. The packet could have a set of optional delivery instructions, like priority, registered etc.

Message, recipients and transport(s) are required fields.
Notes:
1. Never access any public data fields inside this class directly, because they are for internal use in this release and will be changed in coming releases. Always use public methods of this class.
2. Failover is NOT implemented in this release. All failover related data fields are ignored.


Field Summary
TypeField
 java.util.Hashtable failover
           
 java.util.Hashtable from
           
 Message message
           
 MessageInfo msgInfo
           
 java.util.Hashtable recipients
           
 java.util.Hashtable replyTo
           
 
Constructor Summary
Packet()
          Create an empty packet.
 
Method Summary
TypeMethod
 void addRecipients(java.lang.String transportType, AddressData[] recipients)
          Add recipients of one transport type to the packet.
 java.util.Vector getAllRecipients()
          get all recipients of the packet
 java.lang.String[] getFailover(java.lang.String transportType)
          Get failover(s) of the transport type.
 AddressData getFrom(java.lang.String transport)
          Get the sender of specified transport.
 Message getMessage()
          get message object from packet
 MessageInfo getMessageInfo()
          get MessageInfo object from packet
 java.util.Vector getRecipients(java.lang.String transportType)
          Get all recipients of one particular transport type.
 AddressData getReplyTo(java.lang.String transport)
          get reply to address of the transport.
 java.util.Enumeration getTransports()
          Return all transport types (delivery types) will be used to deliver the message.
 boolean removeRecipient(java.lang.String transportType, AddressData recipient)
          remove a recipient from recipient list
 void setFailover(java.lang.String transportType, java.lang.String[] failovers)
          Set failover transports which may be used if the primary transport fails to deliver message to certain recipients.
 void setFrom(java.lang.String transport, AddressData sender)
          Set the sender address of specified transport type.
 void setMessage(Message msg)
          Set message of current packet.
 void setMessageInfo(MessageInfo msgI)
          Set additional info of message.
 void setReplyTo(java.lang.String transport, AddressData replyToAddress)
          Set an alternative 'reply to' address for the transport.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

from

public java.util.Hashtable from

replyTo

public java.util.Hashtable replyTo

message

public Message message

msgInfo

public MessageInfo msgInfo

failover

public java.util.Hashtable failover

recipients

public java.util.Hashtable recipients
Constructor Detail

Packet

public Packet()
Create an empty packet.
Method Detail

setFrom

public void setFrom(java.lang.String transport,
                    AddressData sender)
Set the sender address of specified transport type. Since one message can be sent out via different transports (e.g. email and SMS) in the same request, every transport in the request may have an sender. If this function is called more than once for same transport type, the last sender will be used.
Parameters:
transport - transport supported by Messaging gateway/engine.
Address - address of the sender

getFrom

public AddressData getFrom(java.lang.String transport)
Get the sender of specified transport.
See Also:
setFrom(String,AddressData)

setReplyTo

public void setReplyTo(java.lang.String transport,
                       AddressData replyToAddress)
Set an alternative 'reply to' address for the transport. If this function is called more than once for same transport type, the last address will be used.
Parameters:
transport - transport supported by Messaging gateway/engine.
Address - address of the sender
See Also:
setFrom(String,AddressData)

getReplyTo

public AddressData getReplyTo(java.lang.String transport)
get reply to address of the transport.
Returns:
null if no reply to address is defined.
See Also:
setFrom(String,AddressData), setReplyTo(String,AddressData)

setMessage

public void setMessage(Message msg)
Set message of current packet.

getMessage

public Message getMessage()
get message object from packet

setMessageInfo

public void setMessageInfo(MessageInfo msgI)
Set additional info of message. For example: priority, delay, speed requirements of the message.

getMessageInfo

public MessageInfo getMessageInfo()
get MessageInfo object from packet

removeRecipient

public boolean removeRecipient(java.lang.String transportType,
                               AddressData recipient)
remove a recipient from recipient list
Returns:
true: the object has been removed false: input data error or recipient not found in the list

addRecipients

public void addRecipients(java.lang.String transportType,
                          AddressData[] recipients)
Add recipients of one transport type to the packet.
Append recipients to the end of existing recipients list of the same transport. This function may be called more than once for the same transport type.
Parameters:
transportType - The basic type of transport which will be used to deliver the message first. transport types are defined as constants in TransportType.java.
recipients - Array of recipients
See Also:
TransportType

getRecipients

public java.util.Vector getRecipients(java.lang.String transportType)
Get all recipients of one particular transport type. Transport types are defined as constants in TransportType.java.
Returns:
a Vector of AddressData

getAllRecipients

public java.util.Vector getAllRecipients()
get all recipients of the packet

setFailover

public void setFailover(java.lang.String transportType,
                        java.lang.String[] failovers)
Set failover transports which may be used if the primary transport fails to deliver message to certain recipients. If messaging engine couldn't deliver the message to some recipients and the failovers have been set, it will use failover transports one by one (starts from index 0) to every recipient who has not received the message until the message has been delivered successfully once or all failover transports have been tried.
For example: Suppose SMS is the basic transport and voice and email are the failovers. If messaging engine could not deliver the message to a recipient via SMS. It will use voice to contact that person. If it still fails, it will try email.
Parameters:
transportType - The transport type.
failovers - Backup transports which may be used if the basic transport fails to deliver to certain recipients. Valid transport and failover types are defined as constants in TransportType.java.

getFailover

public java.lang.String[] getFailover(java.lang.String transportType)
Get failover(s) of the transport type.

getTransports

public java.util.Enumeration getTransports()
Return all transport types (delivery types) will be used to deliver the message.
Returns:
An enumeration of transport type strings (java.lang.String type).