net.rim.pushsdk.push.count
Interface PushCountDAO

All Known Implementing Classes:
PushCountMemoryDAOImpl, PushCountRDBMSDAOImpl

public interface PushCountDAO

Interface defining data access methods needed to track when push requests are complete. If a push is sent to more than one address then and the track last notification or auto-delete flags are turned on for a PushApplication then this DAO is used to help determine when the last notification has been received for a particular push. Therefore, when a push is initiated and either of those flags are turned on the add() API is called. As each individual notification arrives from the PPG, for each of the addresses in the push request for a particular push id, the increment() API is called to increment the count and determine if the maximum total has been reached which indicates the last notification has arrived. Lastly, the remove() API is called to clean up the database after the last notification has arrived for a particular push id.

Author:
mhogan

Method Summary
 void add(String pushId)
          Adds a new zero default counter record to the storage for the push request with the given push id.
 boolean increment(String pushId, int amount, int max)
          Increments the counter for the push request with the given push id by the amount indicated.
 void remove(String pushId)
          Removes a counter from storage for the push request with the given push id.
 

Method Detail

add

void add(String pushId)
Adds a new zero default counter record to the storage for the push request with the given push id.

Parameters:
pushId - the id of a push
Throws:
PushSDKException - if any errors occur

remove

void remove(String pushId)
Removes a counter from storage for the push request with the given push id.

Parameters:
pushId - the id of a push
Throws:
PushSDKException - if any errors occur

increment

boolean increment(String pushId,
                  int amount,
                  int max)
Increments the counter for the push request with the given push id by the amount indicated. The increment can determine if the maximum total you are expecting has been reached. This can be used to determine if the last notification for a push request has arrived. The logic is: return (previousAmount + amount) == max

Parameters:
pushId - the id of a push
amount - the amount to increment by
max - the max. count to compare against
Returns:
whether the counter is equal to the given maxCount as a result of the invocation
Throws:
PushSDKException - if any errors occur


Send feedback

Copyright © 2013 BlackBerry. All rights reserved.