ibrokerkit.ibrokerstore.store.impl.db
Class DatabaseStore

java.lang.Object
  extended by ibrokerkit.ibrokerstore.store.impl.db.DatabaseStore
All Implemented Interfaces:
Store

public class DatabaseStore
extends java.lang.Object
implements Store

Hibernate-based implementation of the Store interface.


Constructor Summary
DatabaseStore(java.util.Properties properties)
           
 
Method Summary
 User checkUserPassword(java.lang.String identifier, java.lang.String pass)
          Check if the user's hashed password is correct.
 void close()
          Closes the Store.
 User createOrUpdateUser(java.lang.String identifier, java.lang.String pass, java.lang.String recovery, java.lang.String name, java.lang.String email, java.lang.Boolean openid)
           
 Private createPrivate()
           
 PrivateAuthorization createPrivateAuthorization()
           
 PrivateSelector createPrivateSelector()
           
 void deleteObject(java.lang.Object object)
          Deletes an object from the database.
 boolean existsUser(java.lang.String identifier, java.lang.String name)
          Check if a user with a given identifier or name exists already.
 Private findPrivate(java.lang.String qxri)
           
 Private findPrivateBySelector(java.lang.String selector)
           
 Private[] findPrivates(java.lang.String qxri)
           
 User findUser(java.lang.String identifier)
          Find a user by a given identifier.
 User findUserByRecovery(java.lang.String recovery)
          Find all users with a given recovery code.
 User[] findUsersByEmail(java.lang.String email)
          Find all users with a given email address.
 Private getPrivate(java.lang.Long id)
           
 org.hibernate.SessionFactory getSessionFactory()
          Checks if the database connection is still alive; if not, try to reconnect, then throw exception.
 void init()
          Initializes the Store.
 boolean isClosed()
          True, if the Store has been initialized.
 boolean isInitialized()
          True, if the Store has been initialized.
 Private[] listPrivates()
           
 Private[] listPrivatesByIndex(java.lang.String indx)
           
 User[] listUsers()
          List all users in the Store.
 void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
          Allow the connection to be changed externally.
 void updateObject(java.lang.Object object)
          Updates an object in the database after modifications have been made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseStore

public DatabaseStore(java.util.Properties properties)
Method Detail

init

public void init()
          throws StoreException
Description copied from interface: Store
Initializes the Store.

Specified by:
init in interface Store
Throws:
StoreException

isInitialized

public boolean isInitialized()
Description copied from interface: Store
True, if the Store has been initialized.

Specified by:
isInitialized in interface Store

close

public void close()
Description copied from interface: Store
Closes the Store.

Specified by:
close in interface Store

isClosed

public boolean isClosed()
Description copied from interface: Store
True, if the Store has been initialized.

Specified by:
isClosed in interface Store

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()
                                               throws StoreException
Checks if the database connection is still alive; if not, try to reconnect, then throw exception.

Returns:
The database connection.
Throws:
StoreException

setSessionFactory

public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Allow the connection to be changed externally.

Parameters:
sessionFactory -

updateObject

public void updateObject(java.lang.Object object)
                  throws StoreException
Description copied from interface: Store
Updates an object in the database after modifications have been made.

Specified by:
updateObject in interface Store
Throws:
StoreException

deleteObject

public void deleteObject(java.lang.Object object)
                  throws StoreException
Description copied from interface: Store
Deletes an object from the database.

Specified by:
deleteObject in interface Store
Throws:
StoreException

createOrUpdateUser

public User createOrUpdateUser(java.lang.String identifier,
                               java.lang.String pass,
                               java.lang.String recovery,
                               java.lang.String name,
                               java.lang.String email,
                               java.lang.Boolean openid)
                        throws StoreException
Specified by:
createOrUpdateUser in interface Store
Throws:
StoreException

listUsers

public User[] listUsers()
                 throws StoreException
Description copied from interface: Store
List all users in the Store.

Specified by:
listUsers in interface Store
Throws:
StoreException

findUser

public User findUser(java.lang.String identifier)
              throws StoreException
Description copied from interface: Store
Find a user by a given identifier.

Specified by:
findUser in interface Store
Throws:
StoreException

findUsersByEmail

public User[] findUsersByEmail(java.lang.String email)
                        throws StoreException
Description copied from interface: Store
Find all users with a given email address.

Specified by:
findUsersByEmail in interface Store
Throws:
StoreException

findUserByRecovery

public User findUserByRecovery(java.lang.String recovery)
                        throws StoreException
Description copied from interface: Store
Find all users with a given recovery code.

Specified by:
findUserByRecovery in interface Store
Throws:
StoreException

existsUser

public boolean existsUser(java.lang.String identifier,
                          java.lang.String name)
                   throws StoreException
Description copied from interface: Store
Check if a user with a given identifier or name exists already. Both parameters may be null.

Specified by:
existsUser in interface Store
Throws:
StoreException

checkUserPassword

public User checkUserPassword(java.lang.String identifier,
                              java.lang.String pass)
                       throws StoreException
Description copied from interface: Store
Check if the user's hashed password is correct.

Specified by:
checkUserPassword in interface Store
Throws:
StoreException

createPrivate

public Private createPrivate()
                      throws StoreException
Specified by:
createPrivate in interface Store
Throws:
StoreException

getPrivate

public Private getPrivate(java.lang.Long id)
                   throws StoreException
Specified by:
getPrivate in interface Store
Throws:
StoreException

listPrivates

public Private[] listPrivates()
                       throws StoreException
Specified by:
listPrivates in interface Store
Throws:
StoreException

listPrivatesByIndex

public Private[] listPrivatesByIndex(java.lang.String indx)
                              throws StoreException
Specified by:
listPrivatesByIndex in interface Store
Throws:
StoreException

findPrivate

public Private findPrivate(java.lang.String qxri)
                    throws StoreException
Specified by:
findPrivate in interface Store
Throws:
StoreException

findPrivates

public Private[] findPrivates(java.lang.String qxri)
                       throws StoreException
Specified by:
findPrivates in interface Store
Throws:
StoreException

findPrivateBySelector

public Private findPrivateBySelector(java.lang.String selector)
                              throws StoreException
Specified by:
findPrivateBySelector in interface Store
Throws:
StoreException

createPrivateSelector

public PrivateSelector createPrivateSelector()
                                      throws StoreException
Specified by:
createPrivateSelector in interface Store
Throws:
StoreException

createPrivateAuthorization

public PrivateAuthorization createPrivateAuthorization()
                                                throws StoreException
Specified by:
createPrivateAuthorization in interface Store
Throws:
StoreException


Copyright © 2009. All Rights Reserved.