net.rim.pushsdk.subscription.sync
Class SubSyncByAddressRDBMSDAOImpl

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

public class SubSyncByAddressRDBMSDAOImpl
extends Object
implements SubSyncByAddressDAO

RDBMS implementation of the SubSyncByAddressDAO interface.

Author:
mdandrea

Constructor Summary
SubSyncByAddressRDBMSDAOImpl()
           
 
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 setDataSource(DataSource dataSource)
          Sets the data source to use for interactions with the database.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
          Support for dependency injection.
 void setSqlProperties(SQLProperties sqlProperties)
          Sets the SQL properties to use for querying the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubSyncByAddressRDBMSDAOImpl

public SubSyncByAddressRDBMSDAOImpl()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
Sets the data source to use for interactions with the database.

Parameters:
dataSource - the data source

setSqlProperties

public void setSqlProperties(SQLProperties sqlProperties)
Sets the SQL properties to use for querying the database.

Parameters:
sqlProperties - the SQL properties

setPushSDKProperties

public void setPushSDKProperties(PushSDKProperties pushSDKProperties)
Support for dependency injection. This will override the default PushSDKProperties implementation.

Parameters:
pushSDKProperties - an instance of PushSDKProperties

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.