net.rim.pushsdk.pushappmgmt
Class PushAppRDBMSDAOImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.jdbc.core.support.JdbcDaoSupport
          extended by net.rim.pushsdk.commons.PushSDKBaseDAO
              extended by net.rim.pushsdk.pushappmgmt.PushAppRDBMSDAOImpl
All Implemented Interfaces:
PushApplicationDAO, org.springframework.beans.factory.InitializingBean

public class PushAppRDBMSDAOImpl
extends PushSDKBaseDAO
implements PushApplicationDAO

RDBMS implementation of the PushApplicationDAO interface.

Dependencies that must be injected to properly initialize this object for use:
- dataSource
- cache (optional)
- passwordEncryptorDecryptor
- sqlProperties

Author:
mdicesare

Field Summary
 
Fields inherited from class net.rim.pushsdk.commons.PushSDKBaseDAO
DATABASE_TZ
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PushAppRDBMSDAOImpl()
           
 
Method Summary
 void addPushApplication(PushApplication pushApplication)
          Adds the specified push application to the persistent store.
 void changePushApplicationCredentials(String id, String newUsername, String newPassword, String modifiedBy)
          Deprecated. 
 void changePushApplicationEnterpriseCredentials(String id, String newUsername, String newPassword, String modifiedBy)
          Change the enterprise username and password of a push application that has a type of Enterprise Push or Public+Enterprise Push.
 void changePushApplicationPublicCredentials(String id, String newPassword, String modifiedBy)
          Change the public password of a push application that has a type of Public Push, Web Signal, or Public+Enterprise Push.
 void changePushApplicationTypeFromEnterpriseToPublicAndEnterprise(String id, String publicPassword, String publicNotifyUrl, String modifiedBy)
          Changes the type of a push application from Enterprise Push to Public+Enterprise Push.
 void changePushApplicationTypeFromPublicToPublicAndEnterprise(String id, String enterpriseUsername, String enterprisePassword, String enterpriseNotifyUrl, String modifiedBy)
          Changes the type of a push application from Public Push to Public+Enterprise Push.
 void deletePushApplication(String id, String deletedBy)
          Warning!
Removes a push application entirely and permanently from the persistent store (and any related entities if a foreign key cascading relationship exists).
 void disablePushApplication(String id, String modifiedBy)
          Disables (sets to inactive) a push application.
 void enablePushApplication(String id, Date expiryDate, String modifiedBy)
          Enables (sets to active) a push application.
 void enablePushApplication(String id, String modifiedBy)
          Enables (sets to active) a push application.
 List<PushApplication> findAll()
          Finds a list of all the push applications in storage.
 PushApplication findById(String id)
          Finds the push application with the specified push application id.
 PushApplication findByName(String name)
          Finds the push application with the specified name.
 List<PushApplication> findByStatus(PushApplicationStatus status)
          Finds a list of push applications with the specified status.
 List<PushApplication> findByType(PushApplicationType type)
          Finds a list of push applications with the specified type.
 void removeAllFromCache()
          Removes all objects from the cache
 void setCache(net.sf.ehcache.Cache cache)
          Sets a cache to use to cache PushApplications.
 void setPasswordEncryptorDecryptor(PasswordEncryptorDecryptor passwordEncryptorDecryptor)
           
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
          Deprecated. 
 void setSqlProperties(SQLProperties sqlProperties)
           
 void updatePushApplication(PushApplication pushApplication)
          Updates the details of a push application.
 
Methods inherited from class net.rim.pushsdk.commons.PushSDKBaseDAO
encodeSQLText, encodeSQLText, encodeSQLText, getSimpleJdbcTemplate
 
Methods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PushAppRDBMSDAOImpl

public PushAppRDBMSDAOImpl()
Method Detail

setCache

public void setCache(net.sf.ehcache.Cache cache)
Sets a cache to use to cache PushApplications. Optional - do not call setter if no cache should be used.

Parameters:
cache - an instance of a cache

setPushSDKProperties

@Deprecated
public void setPushSDKProperties(PushSDKProperties pushSDKProperties)
Deprecated. 

Description copied from interface: PushApplicationDAO
Support for dependency injection. This will override the default PushSDKProperties implementation.

Specified by:
setPushSDKProperties in interface PushApplicationDAO

setPasswordEncryptorDecryptor

public void setPasswordEncryptorDecryptor(PasswordEncryptorDecryptor passwordEncryptorDecryptor)

setSqlProperties

public void setSqlProperties(SQLProperties sqlProperties)

addPushApplication

public void addPushApplication(PushApplication pushApplication)
                        throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Adds the specified push application to the persistent store.

Specified by:
addPushApplication in interface PushApplicationDAO
Parameters:
pushApplication - the push application to add
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findById

public PushApplication findById(String id)
                         throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Finds the push application with the specified push application id.

Specified by:
findById in interface PushApplicationDAO
Parameters:
id - the id of the push application to lookup
Returns:
the push application; null if the push application is not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByName

public PushApplication findByName(String name)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Finds the push application with the specified name.

Specified by:
findByName in interface PushApplicationDAO
Parameters:
name - the name of the push application to lookup
Returns:
the push application; null if the push application is not found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByStatus

public List<PushApplication> findByStatus(PushApplicationStatus status)
                                   throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Finds a list of push applications with the specified status.

Specified by:
findByStatus in interface PushApplicationDAO
Parameters:
status - the status of a push application
Returns:
a list of push applications; otherwise, an empty list, if no matches could be found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findAll

public List<PushApplication> findAll()
                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Finds a list of all the push applications in storage.

Specified by:
findAll in interface PushApplicationDAO
Returns:
a list of push applications; otherwise, an empty list, if there are none in storage
Throws:
org.springframework.dao.DataAccessException - if any errors occur

findByType

public List<PushApplication> findByType(PushApplicationType type)
                                 throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Finds a list of push applications with the specified type.

Specified by:
findByType in interface PushApplicationDAO
Parameters:
type - the type of a push application
Returns:
a list of push applications; otherwise, an empty list, if no matches could be found
Throws:
org.springframework.dao.DataAccessException - if any errors occur

disablePushApplication

public void disablePushApplication(String id,
                                   String modifiedBy)
                            throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Disables (sets to inactive) a push application.

Specified by:
disablePushApplication in interface PushApplicationDAO
Parameters:
id - the id of the push application
modifiedBy - the user that disabled the push application
Throws:
org.springframework.dao.DataAccessException - if any errors occur

enablePushApplication

public void enablePushApplication(String id,
                                  String modifiedBy)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Enables (sets to active) a push application. Expiry date will remain unchanged.

Specified by:
enablePushApplication in interface PushApplicationDAO
Parameters:
id - the id of the push application
modifiedBy - the user that enabled the push application
Throws:
org.springframework.dao.DataAccessException - if any errors occur

enablePushApplication

public void enablePushApplication(String id,
                                  Date expiryDate,
                                  String modifiedBy)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Enables (sets to active) a push application.

Specified by:
enablePushApplication in interface PushApplicationDAO
Parameters:
id - the id of the push application
expiryDate - the new expiry date for the push application
modifiedBy - the user that enabled the push application
Throws:
org.springframework.dao.DataAccessException - if any errors occur

deletePushApplication

public void deletePushApplication(String id,
                                  String deletedBy)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Warning!
Removes a push application entirely and permanently from the persistent store (and any related entities if a foreign key cascading relationship exists). Related entities may include any push messages sent to the push application and any subscriptions for the push application.

Specified by:
deletePushApplication in interface PushApplicationDAO
Parameters:
id - the id of the push application to remove entirely and permanently
deletedBy - an identifier that identifies the caller of this API. The deletedBy value will be placed into the log files at info level for audit purposes
Throws:
org.springframework.dao.DataAccessException - if any errors occur

changePushApplicationCredentials

@Deprecated
public void changePushApplicationCredentials(String id,
                                                        String newUsername,
                                                        String newPassword,
                                                        String modifiedBy)
                                      throws org.springframework.dao.DataAccessException
Deprecated. 

Description copied from interface: PushApplicationDAO
Change the credentials of a push application.

Specified by:
changePushApplicationCredentials in interface PushApplicationDAO
Parameters:
id - the id of the push application
newUsername - the new username for the push application (Note: for an application with a type of Public Push, this parameter is ignored, since it needs to match the id.)
newPassword - the new password for the push application
modifiedBy - the user that is changing the push application's password
Throws:
org.springframework.dao.DataAccessException - if any errors occur

changePushApplicationPublicCredentials

public void changePushApplicationPublicCredentials(String id,
                                                   String newPassword,
                                                   String modifiedBy)
                                            throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Change the public password of a push application that has a type of Public Push, Web Signal, or Public+Enterprise Push.

Specified by:
changePushApplicationPublicCredentials in interface PushApplicationDAO
Parameters:
id - the id of the push application
newPassword - the new password for the push application
modifiedBy - the user that is changing the push application's public credentials
Throws:
org.springframework.dao.DataAccessException - if any errors occur

changePushApplicationEnterpriseCredentials

public void changePushApplicationEnterpriseCredentials(String id,
                                                       String newUsername,
                                                       String newPassword,
                                                       String modifiedBy)
                                                throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Change the enterprise username and password of a push application that has a type of Enterprise Push or Public+Enterprise Push.

Specified by:
changePushApplicationEnterpriseCredentials in interface PushApplicationDAO
Parameters:
id - the id of the push application
newUsername - the new username for the push application (might be null)
newPassword - the new password for the push application (might be null)
modifiedBy - the user that is changing the push application's enterprise credentials
Throws:
org.springframework.dao.DataAccessException - if any errors occur

updatePushApplication

public void updatePushApplication(PushApplication pushApplication)
                           throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Updates the details of a push application. Note: This method cannot be used to update a push application's status or to change the password of a push application.

Specified by:
updatePushApplication in interface PushApplicationDAO
Parameters:
pushApplication - the updated push application
Throws:
org.springframework.dao.DataAccessException - if any errors occur

changePushApplicationTypeFromPublicToPublicAndEnterprise

public void changePushApplicationTypeFromPublicToPublicAndEnterprise(String id,
                                                                     String enterpriseUsername,
                                                                     String enterprisePassword,
                                                                     String enterpriseNotifyUrl,
                                                                     String modifiedBy)
                                                              throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Changes the type of a push application from Public Push to Public+Enterprise Push.

Specified by:
changePushApplicationTypeFromPublicToPublicAndEnterprise in interface PushApplicationDAO
Parameters:
id - the id of the push application
enterpriseUsername - an optional username for enterprise (BES) pushes; null if not required
enterprisePassword - an optional password for enterprise (BES) pushes; null if not required
enterpriseNotifyUrl - a full notification URL for enterprise (BES) acknowledgements; null if using a service level of Push Essentials
modifiedBy - the user that is changing the push application's type
Throws:
org.springframework.dao.DataAccessException - if any errors occur

changePushApplicationTypeFromEnterpriseToPublicAndEnterprise

public void changePushApplicationTypeFromEnterpriseToPublicAndEnterprise(String id,
                                                                         String publicPassword,
                                                                         String publicNotifyUrl,
                                                                         String modifiedBy)
                                                                  throws org.springframework.dao.DataAccessException
Description copied from interface: PushApplicationDAO
Changes the type of a push application from Enterprise Push to Public+Enterprise Push.

Specified by:
changePushApplicationTypeFromEnterpriseToPublicAndEnterprise in interface PushApplicationDAO
Parameters:
id - the id of the push application
publicPassword - a password for public (BIS) pushes
publicNotifyUrl - a notification URL fragment for public (BIS) acknowledgements; null if using a service level of Push Essentials
modifiedBy - the user that is changing the push application's type
Throws:
org.springframework.dao.DataAccessException - if any errors occur

removeAllFromCache

public void removeAllFromCache()
Removes all objects from the cache



Copyright © 2011 Research In Motion. All Rights Reserved.