SigPath

org.sigpath.database
Class SPDBManager

java.lang.Object
  extended by org.sigpath.database.SPDBManager
All Implemented Interfaces:
SigPathManager, TransactionManager

public class SPDBManager
extends Object
implements TransactionManager, SigPathManager

SPDBManager Central point for database access in the SigPath system. An instantiation of the SPDBManager allows 1.base TransactionManager Interface functionality for database process delimitation methods 2.access to SigPath related database process managers

Version:
$Revision: 8115 $
Author:
Benjamin Chiang

Constructor Summary
SPDBManager()
          Class Constructor.
 
Method Summary
 void abortTxn()
          Abort a transaction.
 void beginTxn()
          Begin a transaction.
 void bind(Object obj)
          Same as makePersistent
 void bind(Object obj, String name)
          Binds a transient object to a name and make it persistent.
 void checkpointTxn()
          Checkpoints a transaction.
 void close()
          Close the resources used by this db manager.
 void commitTxn()
          Commit a transaction.
static SPDBManager current()
          Returns the current active SPDBManager.
 boolean delete(Object object)
          Deletes an object from the database.
 boolean deleteAll(Collection c)
           
protected  void finalize()
          Finalize method for the class.
 DBInformation getDBInformation()
          Get the DBInformation class
 Properties getDBProperties()
          Get Database Properties
 Properties getDictionaryProperties()
          Get Dictionary Properties
 EntityManager getEntityManager()
          Get the EntityManager object for this class
 Extent getExtent(Class extentClass, boolean getSubclasses)
           
 Extent getExtent(String classname, boolean getSubclasses)
           
 Iterator getExtentIterator(Class extentClass, boolean getSubclasses)
           
 Iterator getExtentIterator(String classname, boolean getSubclasses)
           
 FullTextSearchManager getFullTextSearchManager()
          Returns the FullTextSearchManager.
 JdoExtension getJdoExtension()
           
 Object getObjectByObjectId(Class clazz, String objid)
           
 Object getObjectByObjectId(Object objid)
          Returns the object for a certain object id of a firstclass object (JDO persistent object).
 Object getObjectId(Object obj)
          Returns the object id of a firstclass object (JDO persistent object).
 PersistenceManager getPersistenceManager()
           
 QueryManager getQueryManager()
          Returns the QueryManager.
 SigPathFactory getSigPathFactory()
          Get a SigPathFactory.
 SPIDManager getSPIDManager()
          Get the SPIDManager object for this class
 UnitManager getUnitManager()
          Returns the UnitManager.
 UserManager getUserManager()
          Returns the UserManager.
protected  void init()
           
 boolean isJdoFullTextSearch()
           
 Object lookup(String name)
          Returns the reference to the named object, or null if the name cannot be found.
 void makePersistent(Object obj)
          Makes a transient object persistent.
 Query newQuery()
           
 void retrieve(Object obj)
          Retrieve an instance from the database.
 void retrieveAll(Collection c)
          Retrieve instances from the store.
 void shutdown()
          Closes the db manager, and releases the connection to the database.
 boolean txnInProgress()
          Checks that a valid Transaction is in progress during a database process.
 void unbind(String name)
          Release the association between the name and a stored object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPDBManager

public SPDBManager()
            throws SigPathDatabaseException
Class Constructor. Creates a new SPDBManager in the web application context.

Throws:
SigPathDatabaseException
Method Detail

init

protected void init()
             throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getJdoExtension

public JdoExtension getJdoExtension()

current

public static SPDBManager current()
Returns the current active SPDBManager.

Returns:
the current SPDMmanager

beginTxn

public void beginTxn()
Begin a transaction. To begin a database related process such as storing a SigPathEntity, the process must be within a beginTxn()-commitTxn()/abortTxn() block. beginTxn() delimits the beginning of a database related process.

Specified by:
beginTxn in interface TransactionManager

commitTxn

public void commitTxn()
Commit a transaction. To complete a database related process such as storing a SigPathEntity, the process must be within a beginTxn()-commitTxn()/abortTxn() block. commitTxn() delimits the completion of a database related process.

Specified by:
commitTxn in interface TransactionManager

checkpointTxn

public void checkpointTxn()
Checkpoints a transaction. This is similar to doing a commitTxn() followed by beginTxn() but keep references open.


abortTxn

public void abortTxn()
Abort a transaction. To abort a database related process such as a failure while attempting to store a SigPathEntity, the process must be begun with a beginTxn() call followed by an abortTxn() call when the process fails, or a commitTxn() call when the process successfully completes. abortTxn() delimits the end of a database process when the process fails

Specified by:
abortTxn in interface TransactionManager

txnInProgress

public boolean txnInProgress()
Checks that a valid Transaction is in progress during a database process.

Specified by:
txnInProgress in interface TransactionManager
Returns:
true if a valid Transaction is in progress for this thread, otherwise false

retrieve

public void retrieve(Object obj)
Retrieve an instance from the database. This is only a hint to the PersistenceManager that the application intends to use the instance, and its field values should be retrieved.

Parameters:
obj - Object to be retrived.

retrieveAll

public void retrieveAll(Collection c)
Retrieve instances from the store. This is only a hint to the PersistenceManager that the application intends to use the instances, and their field values should be retrieved.

Parameters:
c - Collection of objects to be retrived.

makePersistent

public void makePersistent(Object obj)
Makes a transient object persistent.


getObjectId

public Object getObjectId(Object obj)
Returns the object id of a firstclass object (JDO persistent object).

Parameters:
obj - The object you want the oid from.
Returns:
the oid of object obj

getObjectByObjectId

public Object getObjectByObjectId(Object objid)
Returns the object for a certain object id of a firstclass object (JDO persistent object).

Parameters:
objid - an object id.
Returns:
the object

getObjectByObjectId

public Object getObjectByObjectId(Class clazz,
                                  String objid)

bind

public void bind(Object obj)
Same as makePersistent


bind

public void bind(Object obj,
                 String name)
          throws SigPathDatabaseException
Binds a transient object to a name and make it persistent.

Throws:
SigPathDatabaseException

unbind

public void unbind(String name)
            throws SigPathDatabaseException
Release the association between the name and a stored object. After this call, lookup(name) will return null.

Throws:
SigPathDatabaseException

lookup

public Object lookup(String name)
              throws SigPathDatabaseException
Returns the reference to the named object, or null if the name cannot be found.

Throws:
SigPathDatabaseException

delete

public boolean delete(Object object)
Deletes an object from the database. This call expilcitly removes an object from the database. In general, it is not necessary to call this method to delete an object. Objects are garbage collected when they are no longer referenced. In some special circumstances, though, it is useful to immediately remove the object. This method can then be used.


deleteAll

public boolean deleteAll(Collection c)

finalize

protected void finalize()
                 throws Throwable
Finalize method for the class.

Overrides:
finalize in class Object
Throws:
Throwable

close

public void close()
Close the resources used by this db manager.

Specified by:
close in interface SigPathManager

shutdown

public void shutdown()
Closes the db manager, and releases the connection to the database.


getPersistenceManager

public PersistenceManager getPersistenceManager()

getExtent

public Extent getExtent(String classname,
                        boolean getSubclasses)
                 throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getExtent

public Extent getExtent(Class extentClass,
                        boolean getSubclasses)

getExtentIterator

public Iterator getExtentIterator(String classname,
                                  boolean getSubclasses)
                           throws SigPathDatabaseException
Throws:
SigPathDatabaseException

getExtentIterator

public Iterator getExtentIterator(Class extentClass,
                                  boolean getSubclasses)
                           throws SigPathDatabaseException
Throws:
SigPathDatabaseException

newQuery

public Query newQuery()

getEntityManager

public EntityManager getEntityManager()
Get the EntityManager object for this class

Returns:
the EntityManager object for this class

getSPIDManager

public SPIDManager getSPIDManager()
Get the SPIDManager object for this class

Returns:
the SPIDManager object for this class

getSigPathFactory

public SigPathFactory getSigPathFactory()
Get a SigPathFactory.

Returns:
a new SigPathFactory

getFullTextSearchManager

public FullTextSearchManager getFullTextSearchManager()
Returns the FullTextSearchManager.

Returns:
the FullTextSearchManager.

isJdoFullTextSearch

public boolean isJdoFullTextSearch()

getUserManager

public UserManager getUserManager()
Returns the UserManager.

Returns:
the UserManager.

getQueryManager

public QueryManager getQueryManager()
Returns the QueryManager.

Returns:
the QueryManager.

getUnitManager

public UnitManager getUnitManager()
Returns the UnitManager.

Returns:
the UnitManager.

getDBInformation

public DBInformation getDBInformation()
Get the DBInformation class

Returns:
the DBInformation object

getDBProperties

public Properties getDBProperties()
                           throws SigPathDatabaseException
Get Database Properties

Returns:
Properties object
Throws:
SigPathDatabaseException

getDictionaryProperties

public Properties getDictionaryProperties()
                                   throws SigPathDatabaseException
Get Dictionary Properties

Returns:
Properties object
Throws:
SigPathDatabaseException

SigPath

Copyright © 2002-2005 Institute for Computational Biomedicine, All Rights Reserved.