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). This object would be used with the push API of the PapServiceImpl class. This object contains the details necessary for the PPG to deliver the push such as the push id and the addresses to push to. In addition it controls the PPG behaviour related to sending the content to the device such as specifying an expiry time, requesting an acknowledgement, the quality of service to use, etc... This information is not normally delivered to the device.

Example of creating a PushMessageControl for a public/BIS push.

 PushMessageControl pushMessageControl = new PushMessageControl(PPGType.PUBLIC_PUSH);
 pushMessageControl.setPushId(pushId);
 pushMessageControl.setDeliverBeforeTimestamp(deliverBeforeTimestamp);
 pushMessageControl.setPpgNotifyRequestedTo(notifyURL);
 pushMessageControl.setSourceReference(pushApplicationId);
 
List<String> addresses = new ArrayList<String>(); addresses.add(mypin); pushMessageControl.setAddressList(addresses);
QualityOfService qos = new QualityOfService(); qos.setDeliveryMethod(DeliveryMethod.UNCONFIRMED); pushMessageControl.setQualityOfService(qos);

Author:
mdicesare

Field Summary
 
Fields inherited from class net.rim.pushsdk.pap.control.PapControl
ATTRIBUTE_KEY_VALUE_SEPARATOR, CLOSE_BRACKET, CLOSE_BRACKET_WITH_SLASH, ESCAPED_DOUBLE_QUOTE, FORWARD_SLASH, NEW_LINE, OPEN_BRACKET, OPEN_BRACKET_WITH_SLASH, ppgType, pushId, pushSDKProperties, XML_DECLARATION
 
Constructor Summary
PushMessageControl(boolean usingPublicPush)
          Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType) constructor instead.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username)
          Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String) constructor instead.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, List<String> addresses)
          Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, List) constructor instead.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo)
          Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, String) constructor instead.
PushMessageControl(boolean usingPublicPush, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo, List<String> addresses)
          Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, String, List) constructor instead.
PushMessageControl(PPGType ppgType)
          Constructs a push message control for either a public (BIS) push, an enterprise (BES) push, or an enterprise (BDS) push.
PushMessageControl(PPGType ppgType, IdGenerator pushIdGenerator, String username)
          Same behaviour as PushMessageControl(PPGType, IdGenerator, String, List) but with a PUSH_ALL for the address.
PushMessageControl(PPGType ppgType, IdGenerator pushIdGenerator, String username, List<String> addresses)
          Constructs a push message control, for either a public (BIS) push, an enterprise (BES) push, or an enterprise (BDS) 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(PPGType ppgType, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo)
          Same behaviour as PushMessageControl(PPGType, IdGenerator, String, String, List) but with a PUSH_ALL for the address.
PushMessageControl(PPGType ppgType, IdGenerator pushIdGenerator, String username, String ppgNotifyRequestedTo, List<String> addresses)
          Constructs a push message control, for either a public (BIS) push, an enterprise (BES) push, or an enterprise (BDS) 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
 
Method Summary
 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 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, getPPGType, getPreamble, getStartTagClosed, getStartTagOpen, isUsingPublicPush, setPPGType, 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(boolean usingPublicPush)
Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType) constructor instead.

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 for enterprise (BES) push.
Since:
1.1

PushMessageControl

public PushMessageControl(PPGType ppgType)
Constructs a push message control for either a public (BIS) push, an enterprise (BES) push, or an enterprise (BDS) push.

Parameters:
ppgType - the type of PPG being used
Since:
1.2

PushMessageControl

@Deprecated
public PushMessageControl(boolean usingPublicPush,
                                     IdGenerator pushIdGenerator,
                                     String username,
                                     List<String> addresses)
Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, List) constructor instead.

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

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

Parameters:
ppgType - the type of PPG being used
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.2

PushMessageControl

@Deprecated
public PushMessageControl(boolean usingPublicPush,
                                     IdGenerator pushIdGenerator,
                                     String username)
Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String) constructor instead.

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 for enterprise (BES)
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

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

Parameters:
ppgType - the type of PPG being used
pushIdGenerator - the Push Id Generator to use to generate a unique push id
username - the unique id of the Push Initiator
Since:
1.2

PushMessageControl

@Deprecated
public PushMessageControl(boolean usingPublicPush,
                                     IdGenerator pushIdGenerator,
                                     String username,
                                     String ppgNotifyRequestedTo,
                                     List<String> addresses)
Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, String, List) constructor instead.

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

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

Parameters:
ppgType - the type of PPG being used
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.2

PushMessageControl

@Deprecated
public PushMessageControl(boolean usingPublicPush,
                                     IdGenerator pushIdGenerator,
                                     String username,
                                     String ppgNotifyRequestedTo)
Deprecated. As of release 1.2, replaced by the PushMessageControl(PPGType, IdGenerator, String, String) constructor instead.

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

PushMessageControl

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

Parameters:
ppgType - the type of PPG being used
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.2
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

getAddressList

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

Returns:
the list of addresses
Since:
1.1

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


Send feedback

Copyright © 2013 BlackBerry. All rights reserved.