Oracle Application Server Wireless Java API Reference
B14043-01


oracle.panama.messaging.push
Class Packet

java.lang.Object
  extended byoracle.panama.messaging.push.Packet

All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Packet
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Packet class represents a generic message. (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:
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.
Following functions are for backward compatible purpose and they DON'T support failover. All failover transport types and address are ignored.
public void addRecipients(String transportType, AddressData recipients[])
public Vector getRecipients(String transportType)
public Vector getAllRecipients()
public Enumeration getTransports()
public boolean removeRecipient(String transportType, AddressData recipient)
Following functions supports recipients with or without failover attributes.
public boolean removeRecipient(AddressData recipient)
public void addRecipients(AddressData recipients[])
public Vector getRecipients()

See Also:
Serialized Form

Field Summary
java.lang.String[] compactAddress
java.util.Hashtable failover
java.util.Hashtable from
UserAddressData fromUser
Message message
java.util.Hashtable metaInfo
MessageInfo msgInfo
java.util.Hashtable recipients
java.util.Hashtable replyTo
UserAddressData replyToUser
java.util.Vector vAddress
boolean validation

Constructor Summary
Packet()
Create an empty packet.

Method Summary
void addRecipient(AddressData recipient)
Add recipient to the packet.
void addRecipient(java.lang.String transportType, DeviceAddressData recipient)
Deprecated. Use addRecipients(AddressData[]) instead
void addRecipients(AddressData[] recipients)
Add recipients to the packet.
void addRecipients(java.lang.String transportType, AddressData[] recipients)
Deprecated. Use addRecipients(AddressData[]) instead
void addRecipients(java.lang.String transportType, DeviceAddressData[] recipients)
Deprecated. Use addRecipients(AddressData[]) instead
java.lang.Object clone()
boolean equals(java.lang.Object other)
java.util.Vector getAllRecipients()
Deprecated. Use getRecipients()
java.lang.String[] getFailover(java.lang.String transportType)
Deprecated. Failover is defined at recipient level not at transport level any more.
java.util.Enumeration getFrom()
Get all 'from user' and 'from device' set by setFrom(transport, DeviceAddressData) or setFrom(AddressData).
DeviceAddressData getFrom(java.lang.String transport)
Get the sender's physical address of specified transport.
java.util.Hashtable getFromAddresses()
Get a copy of from address hashtable.
UserAddressData getFromUser()
Get from user of the packet set by setFrom(AddressData)
Message getMessage()
get message object from packet
MessageInfo getMessageInfo()
get MessageInfo object from packet
java.lang.String getMetaInfo(java.lang.String name)
Get Meta information of the packet
java.util.Enumeration getMetaInfoNames()
return all names in Meta Info object of current package
java.util.Vector getRecipients()
Get recipients added by addRecipients(AddressData[]).
java.util.Vector getRecipients(java.lang.String transportType)
Deprecated. Use getRecipients() instead
java.util.Enumeration getReplyTo()
get all reply to user and reply to device address set by setReplyTo(transport, DeviceAddressData) or setReplyTo(AddressData).
DeviceAddressData getReplyTo(java.lang.String transport)
get reply to device address by transport type.
java.util.Hashtable getReplyToAddresses()
Get a copy of reply to address hashtable.
UserAddressData getReplyToUser()
get reply to user of the packet set by setReplyTo(AddressData)
java.util.Enumeration getTransports()
Return all transport types (delivery types) will be used to deliver the message.
boolean getValidation()
Get the validation flag.
int hashCode()
void removeMetaInfo(java.lang.String name)
Remove a Meta information item from the packet
boolean removeRecipient(AddressData recipient)
remove a recipient from recipient list, which was added by addRecipients().
boolean removeRecipient(java.lang.String transportType, DeviceAddressData recipient)
Deprecated. Use removeRecipient(AddressData) instead
void removeRecipients(java.lang.String transportType)
remove all non-failover recipient from recipient list for transport type
void setFailover(java.lang.String transportType, java.lang.String[] failovers)
Deprecated. Failover is defined at recipient level not at transport level any more.
void setFrom(AddressData sender)
set the from address of the message.
void setFrom(java.lang.String transport, AddressData sender)
Deprecated. by setFrom(AddressData)
void setFrom(java.lang.String transport, DeviceAddressData sender)
Deprecated. by setFrom(AddressData)
void setMessage(Message msg)
Set message of current packet.
void setMessageInfo(MessageInfo msgI)
Set additional info of message.
void setMetaInfo(java.lang.String name, java.lang.String value)
Set Meta information of the packet
void setReplyTo(AddressData replyToAddress)
Set an alternative 'reply to' address.
void setReplyTo(java.lang.String transport, DeviceAddressData replyToAddress)
Deprecated. by setReplyTo(AddressData)
void setValidation(boolean validation)
setValidation(true): Enable validation.

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

compactAddress

public java.lang.String[] compactAddress

failover

public java.util.Hashtable failover

from

public java.util.Hashtable from

fromUser

public UserAddressData fromUser

message

public Message message

metaInfo

public java.util.Hashtable metaInfo

msgInfo

public MessageInfo msgInfo

recipients

public java.util.Hashtable recipients

replyTo

public java.util.Hashtable replyTo

replyToUser

public UserAddressData replyToUser

vAddress

public java.util.Vector vAddress

validation

public boolean validation

Constructor Detail

Packet

public Packet()
Create an empty packet.

Method Detail

addRecipient

public void addRecipient(AddressData recipient)
Add recipient to the packet.
This function may be called more than once. Recipient in this call may or may not have failover transport/address.
Parameters:
recipient -
See Also:
getRecipients()

addRecipient

public void addRecipient(java.lang.String transportType,
                         DeviceAddressData recipient)
Deprecated. Use addRecipients(AddressData[]) instead
Add a recipient of a transport type to the packet.
Append the recipient to the end of existing recipients list of the same transport type. This function may be called more than once for the same transport type.
This method is deprecated. It doesn't support failover. All failover addresses of recipients are ignored. The purpose of this method is to keep it backward compatible. This method doesn't support failover. addFailoverRecipients(AddressData[]) supports failover
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.
recipient - a recipient's DeviceAddressData
See Also:
TransportType, addRecipients(AddressData[])

addRecipients

public void addRecipients(AddressData[] recipients)
Add recipients to the packet.
This function may be called more than once. Recipient in this call may or may not have failover transport/address.
Parameters:
recipients - Array of recipients
See Also:
getRecipients()

addRecipients

public void addRecipients(java.lang.String transportType,
                          AddressData[] recipients)
Deprecated. Use addRecipients(AddressData[]) instead
The purpose of the method is to keep backward compatible with earlier version of Push client. Please use addRecipients(String, DeviceAddressData[]) or addRecipients(AddressData[]) in new programs.
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.
This method is deprecated. It doesn't support failover. All failover addresses of recipients are ignored. The purpose of this method is to keep it backward compatible. This method doesn't support failover. addFailoverRecipients(AddressData[]) supports failover
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, addRecipients(AddressData[]), addRecipients(String, DeviceAddressData[])

addRecipients

public void addRecipients(java.lang.String transportType,
                          DeviceAddressData[] recipients)
Deprecated. Use addRecipients(AddressData[]) instead
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.
This method is deprecated. It doesn't support failover. All failover addresses of recipients are ignored. The purpose of this method is to keep it backward compatible. This method doesn't support failover. addFailoverRecipients(AddressData[]) supports failover
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, addRecipients(AddressData[])

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object other)

getAllRecipients

public java.util.Vector getAllRecipients()
Deprecated. Use getRecipients()
get all non-failover recipients of the packet, which have been added by addRecipients(String transport, DeviceAddressData[])

getFailover

public java.lang.String[] getFailover(java.lang.String transportType)
Deprecated. Failover is defined at recipient level not at transport level any more.
Get failover(s) of the transport type.

getFrom

public java.util.Enumeration getFrom()
Get all 'from user' and 'from device' set by setFrom(transport, DeviceAddressData) or setFrom(AddressData). 'From' address could be either a user or physical address(es). Use getFrom(transport) to get physical addresses of a transport type.
Returns:
An enumeration of AddressData objects. null if no from address has been set.
See Also:
setFrom(AddressData), setFrom(String, DeviceAddressData), getFrom(String)

getFrom

public DeviceAddressData getFrom(java.lang.String transport)
Get the sender's physical address of specified transport. 'From' address could be either a user or physical address(es).
See Also:
setFrom(String,DeviceAddressData), setFrom(AddressData)

getFromAddresses

public java.util.Hashtable getFromAddresses()
Get a copy of from address hashtable.
Key is transport type names (java string).
Value is DeviceAddressData. From user is not included in the hashtable. Use getFromUser() or getFrom() to get from user.
See Also:
setFrom(AddressData), setFrom(String, DeviceAddressData), getFromUser(), getFrom()

getFromUser

public UserAddressData getFromUser()
Get from user of the packet set by setFrom(AddressData)
See Also:
setFrom(AddressData), getFrom()

getMessage

public Message getMessage()
get message object from packet

getMessageInfo

public MessageInfo getMessageInfo()
get MessageInfo object from packet

getMetaInfo

public java.lang.String getMetaInfo(java.lang.String name)
Get Meta information of the packet

getMetaInfoNames

public java.util.Enumeration getMetaInfoNames()
return all names in Meta Info object of current package

getRecipients

public java.util.Vector getRecipients()
Get recipients added by addRecipients(AddressData[]).
Returns:
a Vector of AddressData
See Also:
addRecipients(AddressData[])

getRecipients

public java.util.Vector getRecipients(java.lang.String transportType)
Deprecated. Use getRecipients() instead
Get all non-failover recipients of one particular transport type. Transport types are defined as constants in TransportType.java. Recipients returned by this call don't have failover capability.
Returns:
a Vector of DeviceAddressData
See Also:
getRecipients()

getReplyTo

public java.util.Enumeration getReplyTo()
get all reply to user and reply to device address set by setReplyTo(transport, DeviceAddressData) or setReplyTo(AddressData). 'reply to' address could be either a user or physical address(es). Use getReplyTo(transport) to get physical addresses of a transport type.
Returns:
An enumeration of AddressData objects. null if no reply to address has been set.
See Also:
setFrom(AddressData), setFrom(String, DeviceAddressData), getFrom(String), setReplyTo(String,DeviceAddressData), setReplyTo(AddressData)

getReplyTo

public DeviceAddressData getReplyTo(java.lang.String transport)
get reply to device address by transport type.
Returns:
null if no reply to address is defined for that transport type.
See Also:
setReplyTo(AddressData), setReplyTo(String,DeviceAddressData)

getReplyToAddresses

public java.util.Hashtable getReplyToAddresses()
Get a copy of reply to address hashtable.
Key is transport type names (java string).
Value is DeviceAddressData. Reply to user is not included in the hashtable. Use getReplyToUser() or getReplyTo() to get reply to user.
See Also:
setReplyTo(AddressData), setReplyTo(String, DeviceAddressData), getReplyToUser(), getReplyTo()

getReplyToUser

public UserAddressData getReplyToUser()
get reply to user of the packet set by setReplyTo(AddressData)
See Also:
setReplyTo(AddressData), getReplyTo()

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).

getValidation

public boolean getValidation()
Get the validation flag. If validation is on, an IllegalArgumentException will be thrown out when illegal data are being added to a Packet object. If the validation is off, any data will be added and send to PushServer "as is". The PushServer will use error tolerant approach by ignoring those non-fatal illegal data members and move on.
See Also:
getValidation()

hashCode

public int hashCode()

removeMetaInfo

public void removeMetaInfo(java.lang.String name)
Remove a Meta information item from the packet

removeRecipient

public boolean removeRecipient(AddressData recipient)
remove a recipient from recipient list, which was added by addRecipients(). Recipient in this call may or may not have failover transport/address.
Returns:
true: the object has been removed false: input data error or recipient not found in the list
See Also:
addRecipients(AddressData[]), getRecipients()

removeRecipient

public boolean removeRecipient(java.lang.String transportType,
                               DeviceAddressData recipient)
Deprecated. Use removeRecipient(AddressData) instead
remove a non-failover recipient from recipient list, which is added by addRecipients(String, DeviceAddressData[])
Returns:
true: the object has been removed false: input data error or recipient not found in the list

removeRecipients

public void removeRecipients(java.lang.String transportType)
remove all non-failover recipient from recipient list for transport type

setFailover

public void setFailover(java.lang.String transportType,
                        java.lang.String[] failovers)
Deprecated. Failover is defined at recipient level not at transport level any more.
Set failover(s) of the transport type.

setFrom

public void setFrom(AddressData sender)
set the from address of the message. Sender could be a registered iAS Wireless user or third party user. Only one from user per message. If this method has been called more than once with different users, the last user will be used.
Sender could be a device address like email address or phone number. Primary transport type will be the transport type of this address. So, primary transport type can't be null. Only one from device address is allowed per transport type. If setFrom(AddressData) or setFrom(transport, DeviceAddressData) have been called more than once with the same transport type, only the last DeviceAddressData object will be used.
When calling setFrom(AddressData) with both UserAddressData and DeviceAddressData objects or calling setFrom(AddressData) with UserAddressData object and setFrom(transport, DeviceAddressData) with DeviceAddressData, Push server believes that DeviceAddressData instance overrides UserAddressData on the transport types specified in the call.
For example: setFrom(john) setFrom("SMS","1-650-1234567") get called no matter in what order. It means that to use 1-650-1234567 as the from address of SMS, for other transport types, use addresses from john's profile.
Parameters:
sender - address of the sender. An address could be either a user or a device.
See Also:
setFrom(String, DeviceAddressData)

setFrom

public void setFrom(java.lang.String transport,
                    AddressData sender)
Deprecated. by setFrom(AddressData)
Keep backward compatible with previous version of client API. Please use setFrom(String, DeviceAddressData) and setFrom(AddressData) in new programs.
Parameters:
transport - delivery type name.
sender - address of the sender. It must be a DeviceAddressData or the method call will fail.
See Also:
setFrom(String, DeviceAddressData), setFrom(AddressData)

setFrom

public void setFrom(java.lang.String transport,
                    DeviceAddressData sender)
Deprecated. by setFrom(AddressData)
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 a sender. If this function is called more than once for the same transport type, only the last sender will be used.
When calling setFrom(AddressData) with both UserAddressData and DeviceAddressData objects or calling setFrom(AddressData) with UserAddressData object and setFrom(transport, DeviceAddressData) with DeviceAddressData, Push server believes that DeviceAddressData instance overrides UserAddressData on the transport types specified in the call.
For example: setFrom(john) setFrom("SMS","1-650-1234567") get called no matter in what order. It means that to use 1-650-1234567 as the from address of SMS, for other transport types, use addresses from john's profile.
Parameters:
transport - transport type to deliver the message.
sender - physical address (i.e. email and phone number) of the sender
See Also:
setFrom(AddressData)

setMessage

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

setMessageInfo

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

setMetaInfo

public void setMetaInfo(java.lang.String name,
                        java.lang.String value)
Set Meta information of the packet

setReplyTo

public void setReplyTo(AddressData replyToAddress)
Set an alternative 'reply to' address.
'reply to' address has the same rules and constrains as 'from address':
1. Only one user may be specified as 'reply to user' in one packet.
2. Only one device may be specified as 'reply to device address' per transport type in the same packet.
3. If both 'reply to user' and 'reply to device' present, 'reply to device' address overrides the address of 'reply to user' on that transport type.
Please see setFrom(AddressData) and setFrom(transport, DeviceAddressData) for more details.
Parameters:
replyToAddress - alternative address of the sender
See Also:
setFrom(AddressData), setFrom(String, DeviceAddressData)

setReplyTo

public void setReplyTo(java.lang.String transport,
                       DeviceAddressData replyToAddress)
Deprecated. by setReplyTo(AddressData)
Set an alternative 'reply to' physical 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.
replyToAddress - address of the sender
See Also:
setFrom(String,DeviceAddressData), setFrom(AddressData)

setValidation

public void setValidation(boolean validation)
setValidation(true): Enable validation. (The validation is disabled by default.) setValidation(false): Disable validation. If validation is enabled, an IllegalArgumentException will be thrown out when illegal data are being added to a Packet object. If the validation is disabled, any data will be added and send to PushServer "as is". The PushServer will use more error tolerant approach by ignoring those non-fatal illegal data members and moves on.
See Also:
getValidation()

Oracle Application Server Wireless Java API Reference
B14043-01


Copyright © 2004 Oracle Corporation. All Rights Reserved.