net.rim.pushsdk.subscription.sync
Class SubSyncByAddressMemoryDAOImpl

java.lang.Object
  extended by net.rim.pushsdk.subscription.sync.SubSyncByAddressMemoryDAOImpl
All Implemented Interfaces:
SubSyncByAddressDAO

public class SubSyncByAddressMemoryDAOImpl
extends Object
implements SubSyncByAddressDAO

Memory implementation of the SubSyncByAddressDAO interface.

Author:
mdandrea

Field Summary
protected  SubMemoryDataStore subMemoryDataStore
          The subscriber in-memory data store.
 
Constructor Summary
SubSyncByAddressMemoryDAOImpl()
           
 
Method Summary
 void close()
          Closes the result set and releases the database connection.
 SubscriberPartial getNextResult()
          Gets the next result from the result set (after performing a query for subscribers).
 void prepareFindByAppIdAndStatus(String pushApplicationId, SubscriberStatus status)
          Deprecated. 
 void prepareFindByAppIdAndStatus(String pushApplicationId, SubscriberStatus status, int startIndex, int endIndex)
          Performs a query for subscribers based on the given app id, status, and start and end indexes.
 void prepareFindByAppIdAndStatusAndType(String pushApplicationId, SubscriberStatus status, SubscriberType type)
          Deprecated. 
 void prepareFindByAppIdAndStatusAndType(String pushApplicationId, SubscriberStatus status, SubscriberType type, int startIndex, int endIndex)
          Performs a query for subscribers based on the given app id, status, type, and start and end indexes.
 void setSubMemoryDataStore(SubMemoryDataStore subMemoryDataStore)
          Sets the in-memory data store to use for storing subscribers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subMemoryDataStore

protected SubMemoryDataStore subMemoryDataStore
The subscriber in-memory data store.

Constructor Detail

SubSyncByAddressMemoryDAOImpl

public SubSyncByAddressMemoryDAOImpl()
Method Detail

setSubMemoryDataStore

public void setSubMemoryDataStore(SubMemoryDataStore subMemoryDataStore)
Sets the in-memory data store to use for storing subscribers.

Parameters:
subMemoryDataStore - subscriber in-memory data store

close

public void close()
Description copied from interface: SubSyncByAddressDAO
Closes the result set and releases the database connection.

Note: This method should only be called after first calling the prepareFindByAppIdAndStatus(appid, status) method or the prepareFindByAppIdAndStatusAndType(appid, status, type) method and getting the results of the query back by repeated calls to the getNextResult() method.

This method should be called in a finally block.

Specified by:
close in interface SubSyncByAddressDAO

getNextResult

public SubscriberPartial getNextResult()
                                throws SQLException
Description copied from interface: SubSyncByAddressDAO
Gets the next result from the result set (after performing a query for subscribers).

Note: This method can only be called after a call to the prepareFindByAppIdAndStatus(appid, status) method or the prepareFindByAppIdAndStatusAndType(appid, status, type) method.

Specified by:
getNextResult in interface SubSyncByAddressDAO
Returns:
the next subscriber result
Throws:
SQLException - if any errors occur retrieving the next result from the result set

prepareFindByAppIdAndStatus

@Deprecated
public void prepareFindByAppIdAndStatus(String pushApplicationId,
                                                   SubscriberStatus status)
                                 throws SQLException
Deprecated. 

Description copied from interface: SubSyncByAddressDAO
Performs a query for subscribers based on the given app id and status.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatusAndType() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Specified by:
prepareFindByAppIdAndStatus in interface SubSyncByAddressDAO
Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
Throws:
SQLException - if any errors occur executing the query

prepareFindByAppIdAndStatusAndType

@Deprecated
public void prepareFindByAppIdAndStatusAndType(String pushApplicationId,
                                                          SubscriberStatus status,
                                                          SubscriberType type)
                                        throws SQLException
Deprecated. 

Description copied from interface: SubSyncByAddressDAO
Performs a query for subscribers based on the given app id, status, and type.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatus() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Specified by:
prepareFindByAppIdAndStatusAndType in interface SubSyncByAddressDAO
Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
type - the type of a subscriber
Throws:
SQLException - if any errors occur executing the query

prepareFindByAppIdAndStatus

public void prepareFindByAppIdAndStatus(String pushApplicationId,
                                        SubscriberStatus status,
                                        int startIndex,
                                        int endIndex)
                                 throws SQLException
Description copied from interface: SubSyncByAddressDAO
Performs a query for subscribers based on the given app id, status, and start and end indexes.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatusAndType() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Specified by:
prepareFindByAppIdAndStatus in interface SubSyncByAddressDAO
Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
startIndex - the start index to query from
endIndex - the end index to stop querying at
Throws:
SQLException - if any errors occur executing the query

prepareFindByAppIdAndStatusAndType

public void prepareFindByAppIdAndStatusAndType(String pushApplicationId,
                                               SubscriberStatus status,
                                               SubscriberType type,
                                               int startIndex,
                                               int endIndex)
                                        throws SQLException
Description copied from interface: SubSyncByAddressDAO
Performs a query for subscribers based on the given app id, status, type, and start and end indexes.

Note: When a status of INACTIVE is specified, it will only retrieve inactive subscribers for which there is not an active or suspended subscriber for that application currently using the same address (e.g. PIN).

Note: This method does not have a return value because the result set is kept alive as an instance variable. The results are accessed through the getNextResult() method. When use of the result set is done, the close() method should be called.

Note: This method uses the same result set instance variable as the prepareFindByAppIdAndStatus() method and so, for a given object of this class, only one of the two methods should be called at any given time.

Specified by:
prepareFindByAppIdAndStatusAndType in interface SubSyncByAddressDAO
Parameters:
pushApplicationId - the push application id
status - the status of a subscriber
type - the type of a subscriber
startIndex - the start index to query from
endIndex - the end index to stop querying at
Throws:
SQLException - if any errors occur executing the query


Copyright © 2011 Research In Motion. All Rights Reserved.