net.rim.pushsdk.pap.control
Class PushMessageControl

java.lang.Object
  extended by net.rim.pushsdk.pap.control.PapControl
      extended by net.rim.pushsdk.pap.control.PushMessageControl

public class PushMessageControl
extends PapControl

Represents the Push PAP request message control (XML).

Author:
mdicesare

Field Summary
 
Fields inherited from class net.rim.pushsdk.pap.control.PapControl
ATTRIBUTE_KEY_VALUE_SEPARATOR, CLOSE_BRACKET, CLOSE_BRACKET_WITH_SLASH, DTD_DECLARATION_BES, DTD_DECLARATION_PUBLIC, EPILOGUE, ESCAPED_DOUBLE_QUOTE, FORWARD_SLASH, NEW_LINE, OPEN_BRACKET, OPEN_BRACKET_WITH_SLASH, PREAMBLE_BES, PREAMBLE_PUBLIC, pushId, pushSDKProperties, usingPublicPush, XML_DECLARATION
 
Constructor Summary
PushMessageControl()
          Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.
PushMessageControl(boolean usingPublicPush)
          Constructs a push message control for either a public (BIS) push or an enterprise (BES) push.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username)
          Same behaviour as PushMessageControl(boolean, IdGenerator, String, List) but with a PUSH_ALL for the address.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, List<String> addresses)
          Constructs a push message control, for either a public (BIS) push or an enterprise (BES) push, with the following defaulted values: replacePushId, replaceMethod, deliverAfterTimestamp defaulted to null (see the PAP spec for more details about the meaning of these fields) progressNotesRequested defaulted to false sourceReference set to the specified username a configurable default expiry time for the push no result notifications are sent a quality of service with a delivery method of unconfirmed the address list set to the list of addresses specified
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo)
          Same behaviour as PushMessageControl(boolean, IdGenerator, String, String, List) but with a PUSH_ALL for the address.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo, List<String> addresses)
          Constructs a push message control, for either a public (BIS) push or an enterprise (BES) push, with the following defaulted values: replacePushId, replaceMethod, deliverAfterTimestamp defaulted to null (see the PAP spec for more details about the meaning of these fields) progressNotesRequested defaulted to false sourceReference set to the specified username a configurable default expiry time for the push result notifications are sent a quality of service with a delivery method of confirmed the address list set to the list of addresses specified
PushMessageControl(IdGenerator pushIdGenerator, String username)
          Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.
PushMessageControl(IdGenerator pushIdGenerator, String username, List<String> addresses)
          Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, List) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.
PushMessageControl(IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo)
          Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, String) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.
PushMessageControl(IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo, List<String> addresses)
          Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, String, List) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.
 
Method Summary
 AddressList getAddresses()
          Deprecated. As of release 1.1, replaced by getAddressList().
 List<String> getAddressList()
          Gets the list of addresses associated with the push message control.
 Date getDefaultDeliverBeforeTimestamp()
          Returns the default deliver before timestamp (expiry date).
 Date getDeliverBeforeTimestamp()
          Gets the deliver before timestamp (expiry date) associated with the push message control.
 String getPpgNotifyRequestedTo()
          Gets the notification URL (possibly a fragment) associated with the push message control.
 String getPushId()
          Gets the push id associated with the push message control.
 QualityOfService getQualityOfService()
          Gets the quality of service associated with the push message control.
 String getSourceReference()
          Gets the source reference associated with the push message control.
 void setAddresses(AddressList addresses)
          Deprecated. As of release 1.1, replaced by setAddressList(List).
 void setAddressList(List<String> addresses)
          Sets the address list associated with the push message control.
 void setDeliverBeforeTimestamp(Date deliverBeforeTimestamp)
          Sets the deliver before timestamp (expiry date) associated with the push message control.
 void setPpgNotifyRequestedTo(String ppgNotifyRequestedTo)
          Sets the notification URL (possibly a fragment) associated with the push message control.
 void setPushId(String pushId)
          Sets the push id associated with the push message control.
 void setQualityOfService(QualityOfService qualityOfService)
          Sets the quality of service associated with the push message control.
 void setSourceReference(String sourceReference)
          Sets the source reference associated with the push message control.
 String toString()
          Constructs a String with all attributes in name = value format.
protected  void validate()
          Validates the following:
- the push id is not null
- the push id does not contain certain special characters (see the "parser.special.characters" property in PushSDK.properties for the full list)
- the address list is not null and passes validation
- if the deliver before timestamp is set, it should be in the future
- a source reference is specified for a public (BIS) push
- a quality of service is specified for a public (BIS) push
- if a quality of service is specified, it should pass its own validation
 void writeTo(ByteArrayOutputStream out)
          Writes the PAP control out to the specified output stream.
 
Methods inherited from class net.rim.pushsdk.pap.control.PapControl
getAttribute, getContentType, getEndTag, getEpilogue, getPreamble, getStartTagClosed, getStartTagOpen, isUsingPublicPush, setPushSDKProperties, setUsingPublicPush, validatePushIdForSpecialCharacters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PushMessageControl

@Deprecated
public PushMessageControl()
Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.

Default push message control constructor.


PushMessageControl

public PushMessageControl(boolean usingPublicPush)
Constructs a push message control for either a public (BIS) push or an enterprise (BES) push.

Parameters:
usingPublicPush - true if configuring for a public (BIS) push; false otherwise
Since:
1.1

PushMessageControl

@Deprecated
public PushMessageControl(IdGenerator pushIdGenerator,
                                     String username,
                                     List<String> addresses)
Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, List) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.

Constructs a push message control with the following defaulted values:

Parameters:
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
addresses - a list of addresses to push to

PushMessageControl

public PushMessageControl(boolean usingPublicPush,
                          IdGenerator pushIdGenerator,
                          String username,
                          List<String> addresses)
Constructs a push message control, for either a public (BIS) push or an enterprise (BES) push, with the following defaulted values:

Parameters:
usingPublicPush - true if configuring for a public (BIS) push; false otherwise
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
addresses - a list of addresses to push to
Since:
1.1

PushMessageControl

@Deprecated
public PushMessageControl(IdGenerator pushIdGenerator,
                                     String username)
Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.

Same behaviour as PushMessageControl(IdGenerator, String, List) but with a PUSH_ALL for the address.

Parameters:
pushIdGenerator - the Push Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator

PushMessageControl

public PushMessageControl(boolean usingPublicPush,
                          IdGenerator pushIdGenerator,
                          String username)
Same behaviour as PushMessageControl(boolean, IdGenerator, String, List) but with a PUSH_ALL for the address.

Parameters:
usingPublicPush - true if configuring for a public (BIS) push; false otherwise
pushIdGenerator - the Push Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
Since:
1.1

PushMessageControl

@Deprecated
public PushMessageControl(IdGenerator pushIdGenerator,
                                     String username,
                                     String ppgNotifyRequestedTo,
                                     List<String> addresses)
Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, String, List) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.

Constructs a push message control with the following defaulted values:

Parameters:
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
ppgNotifyRequestedTo - context part of the URL for result notifications
addresses - a list of addresses to push to

PushMessageControl

public PushMessageControl(boolean usingPublicPush,
                          IdGenerator pushIdGenerator,
                          String username,
                          String ppgNotifyRequestedTo,
                          List<String> addresses)
Constructs a push message control, for either a public (BIS) push or an enterprise (BES) push, with the following defaulted values:

Parameters:
usingPublicPush - true if configuring for a public (BIS) push; false otherwise
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
ppgNotifyRequestedTo - context part of the URL for result notifications
addresses - a list of addresses to push to
Since:
1.1

PushMessageControl

@Deprecated
public PushMessageControl(IdGenerator pushIdGenerator,
                                     String username,
                                     String ppgNotifyRequestedTo)
Deprecated. As of release 1.1, replaced by the PushMessageControl(boolean, IdGenerator, String, String) constructor instead. To use this constructor, you must configure the SDK to be in public or enterprise mode through the PushSDK.properties file by setting the use.public.push flag.

Same behaviour as PushMessageControl(IdGenerator, String, String, List) but with a PUSH_ALL for the address.

Parameters:
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
ppgNotifyRequestedTo - context part of the URL for result notifications

PushMessageControl

public PushMessageControl(boolean usingPublicPush,
                          IdGenerator pushIdGenerator,
                          String username,
                          String ppgNotifyRequestedTo)
Same behaviour as PushMessageControl(boolean, IdGenerator, String, String, List) but with a PUSH_ALL for the address.

Parameters:
usingPublicPush - true if configuring for a public (BIS) push; false otherwise
pushIdGenerator - the Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
ppgNotifyRequestedTo - context part of the URL for result notifications
Since:
1.1
Method Detail

getDefaultDeliverBeforeTimestamp

public Date getDefaultDeliverBeforeTimestamp()
Returns the default deliver before timestamp (expiry date).

Returns:
the default deliver before timestamp (expiry date)

writeTo

public void writeTo(ByteArrayOutputStream out)
             throws IOException
Description copied from class: PapControl
Writes the PAP control out to the specified output stream.

Specified by:
writeTo in class PapControl
Parameters:
out - the output stream
Throws:
IOException - if any errors occur writing to the output stream

getPushId

public String getPushId()
Gets the push id associated with the push message control.

Returns:
the push id

setPushId

public void setPushId(String pushId)
Sets the push id associated with the push message control.

Parameters:
pushId - the push id

getDeliverBeforeTimestamp

public Date getDeliverBeforeTimestamp()
Gets the deliver before timestamp (expiry date) associated with the push message control.

Returns:
the deliver before timestamp (expiry date)

setDeliverBeforeTimestamp

public void setDeliverBeforeTimestamp(Date deliverBeforeTimestamp)
Sets the deliver before timestamp (expiry date) associated with the push message control.

Parameters:
deliverBeforeTimestamp - the deliver before timestamp (expiry date)

getSourceReference

public String getSourceReference()
Gets the source reference associated with the push message control.

Returns:
the source reference

setSourceReference

public void setSourceReference(String sourceReference)
Sets the source reference associated with the push message control.

Parameters:
sourceReference - the source reference

getPpgNotifyRequestedTo

public String getPpgNotifyRequestedTo()
Gets the notification URL (possibly a fragment) associated with the push message control.

Returns:
the notification URL

setPpgNotifyRequestedTo

public void setPpgNotifyRequestedTo(String ppgNotifyRequestedTo)
Sets the notification URL (possibly a fragment) associated with the push message control.

Parameters:
ppgNotifyRequestedTo - the notification URL

getAddresses

@Deprecated
public AddressList getAddresses()
Deprecated. As of release 1.1, replaced by getAddressList().

Gets the address list associated with the push message control.

Returns:
the address list

getAddressList

public List<String> getAddressList()
Gets the list of addresses associated with the push message control.

Returns:
the list of addresses
Since:
1.1

setAddresses

@Deprecated
public void setAddresses(AddressList addresses)
Deprecated. As of release 1.1, replaced by setAddressList(List).

Sets the address list associated with the push message control.

Parameters:
addresses - the address list

setAddressList

public void setAddressList(List<String> addresses)
Sets the address list associated with the push message control.

Parameters:
addresses - the address list
Since:
1.1

getQualityOfService

public QualityOfService getQualityOfService()
Gets the quality of service associated with the push message control.

Returns:
the quality of service

setQualityOfService

public void setQualityOfService(QualityOfService qualityOfService)
Sets the quality of service associated with the push message control.

Parameters:
qualityOfService - the quality of service

toString

public String toString()
Constructs a String with all attributes in name = value format.

Overrides:
toString in class Object
Returns:
a String representation of this object.

validate

protected void validate()
Validates the following:
- the push id is not null
- the push id does not contain certain special characters (see the "parser.special.characters" property in PushSDK.properties for the full list)
- the address list is not null and passes validation
- if the deliver before timestamp is set, it should be in the future
- a source reference is specified for a public (BIS) push
- a quality of service is specified for a public (BIS) push
- if a quality of service is specified, it should pass its own validation

Specified by:
validate in class PapControl


Copyright © 2011 Research In Motion. All Rights Reserved.