net.rim.pushsdk.push.stats
Interface PushStatsDAO

All Known Implementing Classes:
PushStatsMemoryDAOImpl, PushStatsRDBMSDAOImpl

public interface PushStatsDAO

Interface defining data access methods needed to manage push statistics in the persistent store.

Author:
dstrelbytsky

Method Summary
 void addPushStats(PushStats pushStats)
          Adds push statistics for the push application with the specified id and provided running push count, running content sum, and daily push count.
 int[] batchUpdatePushStats(Map<String,PushStats> pushStatsMap)
          Performs a batch update of push statistics for various push applications.
 PushStats getPushStats(String pushApplicationId, boolean preferUseCache)
          Gets push statistics for the specified push application.
 void resetRunningContentSum(String pushApplicationId)
          Resets the running content sum pushed to the specified push application.
 void resetRunningPushCount(String pushApplicationId)
          Resets the running push count for the specified push application.
 void updateCache(PushStats pushStats)
          Updates the cache with the given push stats.
 int updatePushStats(PushStats pushStats)
          Updates push statistics for the specified push application.
 

Method Detail

addPushStats

void addPushStats(PushStats pushStats)
                  throws org.springframework.dao.DataAccessException
Adds push statistics for the push application with the specified id and provided running push count, running content sum, and daily push count.

Parameters:
pushStats - push statistics that contain id of the push application, running push count, running content sum, and daily push count
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

updatePushStats

int updatePushStats(PushStats pushStats)
                    throws org.springframework.dao.DataAccessException
Updates push statistics for the specified push application. As a result of this update, the push statistics in the persistent store will be updated as follows:
- the running push count will be incremented by the corresponding pushStats parameter;
- the running content sum will be incremented by the corresponding pushStats parameter;
- the daily push count will be incremented by the corresponding pushStats parameter if the update happens on the same day as the in storage daily push count date. Otherwise, this is the first update during the day and the daily push count will be set to the corresponding pushStats parameter;
- the daily push count date will be set to the current date and time.

Parameters:
pushStats - push statistics that contain id of the push application, running push count, running content sum, and daily push count
Returns:
number of records in the persistent store affected as a result of this update. In most cases (when the record for this push application already exists), the method returns 1. Otherwise 0 is returned, meaning that the user of the method should call addPushStats.
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

batchUpdatePushStats

int[] batchUpdatePushStats(Map<String,PushStats> pushStatsMap)
                           throws org.springframework.dao.DataAccessException
Performs a batch update of push statistics for various push applications.

Parameters:
pushStatsMap - the push stats to update in storage
Returns:
an array where each item corresponds to an update in the batch and indicates the number of rows changed by that update (typically 1 if the row was updated or 0 if the row was not updated)
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

getPushStats

PushStats getPushStats(String pushApplicationId,
                       boolean preferUseCache)
                       throws org.springframework.dao.DataAccessException
Gets push statistics for the specified push application.

Parameters:
pushApplicationId - id of the push application
preferUseCache - specifies whether the cached value of the remaining quota is preferable or not. In the first case ( preferUseCache is equal to true), the method will try to retrieve the remaining quota from the cache first. If there is no cached value found, a look up in the persistent store will be done. If preferUseCache is equal to false, the remaining quota will always be retrieved from the persistent store. Using the cache will generally be a faster operation. Note: Retrieving the remaining quota from the persistent store can be somewhat inaccurate. Updates to the push statistics in storage are batched and persisted at a regular interval and so the stats might be slightly off within that interval.
Returns:
push statistics
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

resetRunningPushCount

void resetRunningPushCount(String pushApplicationId)
                           throws org.springframework.dao.DataAccessException
Resets the running push count for the specified push application. This method can be useful for report generation. For example, if the content provider wants to generate weekly push statistics reports, then they should call this API weekly to reset the count.

Parameters:
pushApplicationId - id of the push application
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

resetRunningContentSum

void resetRunningContentSum(String pushApplicationId)
                            throws org.springframework.dao.DataAccessException
Resets the running content sum pushed to the specified push application. This method can be useful for report generation. For example, if the content provider wants to generate weekly push statistics reports, then they should call this API weekly to reset the running content sum.

Parameters:
pushApplicationId - id of the push application
Throws:
org.springframework.dao.DataAccessException - if any data access errors occur

updateCache

void updateCache(PushStats pushStats)
Updates the cache with the given push stats. For implementations of this DAO that do not use a cache, this method should do nothing.

Parameters:
pushStats - the push stats to updated the cache with


Copyright © 2011 Research In Motion. All Rights Reserved.