net.rim.pushsdk.push.stats
Interface PushStatsService

All Known Implementing Classes:
PushStatsServiceImpl

public interface PushStatsService

Business service methods relating to managing push statistics.

Author:
dstrelbytsky

Method Summary
 long getRemainingQuota(String pushApplicationId, boolean preferUseCache)
          Gets the remaining quota (in number of pushes) for the specified push application.
 long getRunningContentSum(String pushApplicationId)
          Gets the total bytes of content pushed to the specified push application.
 long getRunningPushCount(String pushApplicationId)
          Gets a running count of pushes for the specified push application.
 void incrementPushStats(String pushApplicationId, long pushCount, long contentSum)
          Increments the push statistics for a push application by the given push count and total content sum.
 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 setPushApplicationService(PushApplicationService pushAppService)
          Support for dependency injection.
 void setPushStatsBatchUpdaterService(PushStatsBatchUpdaterService pushStatsBatchUpdaterService)
          Support for dependency injection.
 void setPushStatsDAO(PushStatsDAO pushStatsDAO)
          Support for dependency injection.
 

Method Detail

incrementPushStats

void incrementPushStats(String pushApplicationId,
                        long pushCount,
                        long contentSum)
                        throws PushSDKException
Increments the push statistics for a push application by the given push count and total content sum. If there are no push statistics for this push application, a new entry will be created in storage and will be used as a basis for future increments.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
pushCount - the number of addresses being pushed to in a push request. If one push contains N addresses, the pushCount will be equal to N.
contentSum - the content size of the push multiplied by the number of addresses being pushed to in the push request. If J bytes of content was sent to N devices, the contentSum will be equal to J * N.
Throws:
PushSDKException - if any errors occur

getRunningPushCount

long getRunningPushCount(String pushApplicationId)
                         throws PushSDKException
Gets a running count of pushes for the specified push application.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
Returns:
the number of pushes since this value was reset for the push application
Throws:
PushSDKException - if any errors occur

getRunningContentSum

long getRunningContentSum(String pushApplicationId)
                          throws PushSDKException
Gets the total bytes of content pushed to the specified push application.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
Returns:
the total volume of content pushed since this value was reset for the push application
Throws:
PushSDKException - if any errors occur

getRemainingQuota

long getRemainingQuota(String pushApplicationId,
                       boolean preferUseCache)
                       throws PushSDKException
Gets the remaining quota (in number of pushes) for the specified push application.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
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:
the remaining daily quota in number of pushes
Throws:
PushSDKException - if any errors occur

resetRunningPushCount

void resetRunningPushCount(String pushApplicationId)
                           throws PushSDKException
Resets the running push count for the specified push application.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
Throws:
PushSDKException - if any errors occur

resetRunningContentSum

void resetRunningContentSum(String pushApplicationId)
                            throws PushSDKException
Resets the running content sum pushed to the specified push application.

Parameters:
pushApplicationId - id of the push application that the push statistics correspond to
Throws:
PushSDKException - if any errors occur

setPushStatsDAO

void setPushStatsDAO(PushStatsDAO pushStatsDAO)
Support for dependency injection. Sets the PushStatsDAO to use.

Parameters:
pushStatsDAO - a Push Stats Data Access Object

setPushApplicationService

void setPushApplicationService(PushApplicationService pushAppService)
Support for dependency injection. Inject an implementation of a PushApplicationService collaborating object - this is used to interface with the business service that manages push applications.

Parameters:
pushAppService - an instance of a PushApplicationService implementation (must be thread safe)

setPushStatsBatchUpdaterService

void setPushStatsBatchUpdaterService(PushStatsBatchUpdaterService pushStatsBatchUpdaterService)
Support for dependency injection. Sets the PushStatsBatchUpdaterService to use.

Parameters:
pushStatsBatchUpdaterService - the Push Stats Batch Updater Service


Copyright © 2011 Research In Motion. All Rights Reserved.