gov.lanl.Database
Class JNDIDatabaseMgr

java.lang.Object
  |
  +--gov.lanl.Database.JNDIDatabaseMgr
All Implemented Interfaces:
DatabaseMgr

public class JNDIDatabaseMgr
extends java.lang.Object
implements DatabaseMgr

Class declaration

 

Field Summary
protected  int Debug_Level
           
 
Fields inherited from interface gov.lanl.Database.DatabaseMgr
DEEP, SHALLOW
 
Constructor Summary
JNDIDatabaseMgr()
          Constructor
 
Method Summary
 java.util.Vector accessElements(gov.lanl.Database.PersistentObject obj, java.lang.String element, java.lang.String element_value)
          Obtain a Vector of elements from the Object obj already obtained (via shallow copy) JNDI does not have any easy way to access a previously retrieved object, so get the object again and then get the elements.
 void close()
          Close the conntection to the database manager
static gov.lanl.Database.DatabaseMgr current()
          Get the current instantiation of the database manager
 void deleteElement(gov.lanl.Database.PersistentObject obj)
          Delete object completely It will also delete all sub-objects
 long getNextSeq(java.lang.Class clazz, java.lang.String fieldName)
          Get next number in a persistent sequence
 gov.lanl.Database.PersistentObjectFactory getObjectFactory()
          this method returns an instance of the specified PersistentObjectFactory
 void init(java.lang.String databaseURLString)
          Initialize the DatabaseMgr
 void insertElement(gov.lanl.Database.PersistentObject obj, java.lang.String name)
          Input an object into database
static gov.lanl.Database.DatabaseMgr open(gov.lanl.Utility.ConfigProperties props)
          Open a new instantiation of the database manager
 void reopen()
          Reopen the conntection to the database manager
 gov.lanl.Database.PersistentObject retrieveElement(java.lang.Object obj, java.lang.String elementName, java.lang.String value)
          Get single element (DEEP) with simple query returns the first element (if there is one) This will find the first element of type obj which has an attribute of elementName = value.
 gov.lanl.Database.PersistentObject retrieveElement(java.lang.Object obj, java.lang.String elementName, java.lang.String value, int deep)
          Get single element (DEEP) with simple query returns the first element (if there is one) This will find the first element of type obj which has an attribute of elementName = value.
 java.util.Vector retrieveElements(java.lang.Object obj, gov.lanl.Database.SearchFilter query, int deep)
          Retrieve elements of type Object with generalized query and depth flag It will also retrieve all the sub-objects, if requested.
 java.util.Vector retrieveElements(java.lang.Object obj, java.lang.String[] elements, java.lang.String[] name)
          Retrieve elements with multiple constraints It will also retrieve all the sub-objects.
 java.util.Vector retrieveElements(java.lang.Object obj, java.lang.String operator, java.lang.String element, int[] values, int deep)
          Retrieve elements with complext query
 java.util.Vector retrieveElements(java.lang.Object obj, java.lang.String operator, java.lang.String element, java.lang.String[] values, int deep)
          Retrieve elements with complext query
 void setDebug(boolean flag)
          Turns the debug mode on/off (default is off)
 void setObjectFactory(java.lang.String objectPackage)
          Method declaration
 void txn_abort()
          Cancel transaction JNDI does not have transations that use multiple commands
 void txn_begin()
          Begin Transaction context JNDI does not have transations that use multiple commands
 void txn_commit()
          Method declaration
 void updateElement(gov.lanl.Database.PersistentObject obj)
          Update object fully
 void updateElement(gov.lanl.Database.PersistentObject obj, int deep)
          Update object optionally fully or shallowly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Debug_Level

protected int Debug_Level
Constructor Detail

JNDIDatabaseMgr

public JNDIDatabaseMgr()
Constructor

Method Detail

setDebug

public void setDebug(boolean flag)
Turns the debug mode on/off (default is off)

Specified by:
setDebug in interface DatabaseMgr
Parameters:
flag -

init

public void init(java.lang.String databaseURLString)
Description copied from interface: DatabaseMgr
Initialize the DatabaseMgr

Specified by:
init in interface DatabaseMgr
Parameters:
databaseURLString - The string containing the database information

open

public static gov.lanl.Database.DatabaseMgr open(gov.lanl.Utility.ConfigProperties props)
Open a new instantiation of the database manager


reopen

public void reopen()
Reopen the conntection to the database manager


close

public void close()
Close the conntection to the database manager


current

public static gov.lanl.Database.DatabaseMgr current()
Get the current instantiation of the database manager


txn_begin

public void txn_begin()
               throws DBException
Begin Transaction context JNDI does not have transations that use multiple commands

Specified by:
txn_begin in interface DatabaseMgr
DBException

txn_commit

public void txn_commit()
                throws DBException
Method declaration

Specified by:
txn_commit in interface DatabaseMgr
Throws:
DBException
See Also:

txn_abort

public void txn_abort()
Cancel transaction JNDI does not have transations that use multiple commands

Specified by:
txn_abort in interface DatabaseMgr

retrieveElement

public gov.lanl.Database.PersistentObject retrieveElement(java.lang.Object obj,
                                                          java.lang.String elementName,
                                                          java.lang.String value)
                                                   throws DBException
Get single element (DEEP) with simple query returns the first element (if there is one) This will find the first element of type obj which has an attribute of elementName = value. It will also retrieve all the sub-objects

Specified by:
retrieveElement in interface DatabaseMgr
DBException
Parameters:
obj - The input object template being requested
elementName - The element desired
value - The value of the element desired
Returns:
The first object found matching the criteria

retrieveElement

public gov.lanl.Database.PersistentObject retrieveElement(java.lang.Object obj,
                                                          java.lang.String elementName,
                                                          java.lang.String value,
                                                          int deep)
                                                   throws DBException
Get single element (DEEP) with simple query returns the first element (if there is one) This will find the first element of type obj which has an attribute of elementName = value. It will also retrieve all the sub-objects

Specified by:
retrieveElement in interface DatabaseMgr
DBException
Parameters:
obj - The input object template being requested
elementName - The element desired
value - The value of the element desired
deep - Indicates if sub-objects are to be retrieved as well
Returns:
The first object found matching the criteria

updateElement

public void updateElement(gov.lanl.Database.PersistentObject obj)
                   throws DBException
Update object fully

Specified by:
updateElement in interface DatabaseMgr
DBException
Parameters:
obj - The object to be updated

updateElement

public void updateElement(gov.lanl.Database.PersistentObject obj,
                          int deep)
                   throws DBException
Update object optionally fully or shallowly

Specified by:
updateElement in interface DatabaseMgr
DBException
Parameters:
obj - The object to be updated
deep - Indicates if sub-objects are to be updated

deleteElement

public void deleteElement(gov.lanl.Database.PersistentObject obj)
                   throws DBException
Delete object completely It will also delete all sub-objects

Specified by:
deleteElement in interface DatabaseMgr
DBException
Parameters:
obj - The object to be deleted

insertElement

public void insertElement(gov.lanl.Database.PersistentObject obj,
                          java.lang.String name)
                   throws DBException
Input an object into database

Specified by:
insertElement in interface DatabaseMgr
DBException
Parameters:
obj - The object to be inserted
name - The name of the object

accessElements

public java.util.Vector accessElements(gov.lanl.Database.PersistentObject obj,
                                       java.lang.String element,
                                       java.lang.String element_value)
                                throws DBException
Obtain a Vector of elements from the Object obj already obtained (via shallow copy) JNDI does not have any easy way to access a previously retrieved object, so get the object again and then get the elements. This will return a vector of all objects that have an attribute whos name is element that has a value of value. It will also get all their sub-objects

Specified by:
accessElements in interface DatabaseMgr
DBException
Parameters:
obj - The class for the object to be retrieved
element - The name of the element to be matched
element_value -
Returns:
A Vector containing all objects found

retrieveElements

public java.util.Vector retrieveElements(java.lang.Object obj,
                                         java.lang.String[] elements,
                                         java.lang.String[] name)
                                  throws DBException
Retrieve elements with multiple constraints It will also retrieve all the sub-objects.

Specified by:
retrieveElements in interface DatabaseMgr
DBException
Parameters:
obj - The class for the object to be retrieved
elements - The String array of elements to be filtered on
name - The String array of values of the elements desired
Returns:

retrieveElements

public java.util.Vector retrieveElements(java.lang.Object obj,
                                         gov.lanl.Database.SearchFilter query,
                                         int deep)
                                  throws DBException
Retrieve elements of type Object with generalized query and depth flag It will also retrieve all the sub-objects, if requested.

Specified by:
retrieveElements in interface DatabaseMgr
DBException
Parameters:
obj - The class for the object to be retrieved
query - The SearchFilter object to be used during the search
deep - Indicates if sub-objects are to be retrieved
Returns:
The set of objects that meet the filter parameters

retrieveElements

public java.util.Vector retrieveElements(java.lang.Object obj,
                                         java.lang.String operator,
                                         java.lang.String element,
                                         java.lang.String[] values,
                                         int deep)
                                  throws DBException
Retrieve elements with complext query

Specified by:
retrieveElements in interface DatabaseMgr
DBException
Parameters:
obj - The class for the object to be retrieved
operator - The operator to use in combining the tests
element - The element to be tested
values - Array of possible matches for the element
deep - Indicates if sub-objects are to be retrieved
Returns:
The set of objects that meet the filter parameters

retrieveElements

public java.util.Vector retrieveElements(java.lang.Object obj,
                                         java.lang.String operator,
                                         java.lang.String element,
                                         int[] values,
                                         int deep)
                                  throws DBException
Retrieve elements with complext query

Specified by:
retrieveElements in interface DatabaseMgr
DBException
Parameters:
obj - The class for the object to be retrieved
operator - The operator to use in combining the tests
element - The element to be tested
values - Integer array of possible matches for the element
deep - Indicates if sub-objects are to be retrieved
Returns:
The set of objects that meet the filter parameters

getNextSeq

public long getNextSeq(java.lang.Class clazz,
                       java.lang.String fieldName)
Get next number in a persistent sequence

Specified by:
getNextSeq in interface DatabaseMgr
Parameters:
clazz -
fieldName -

setObjectFactory

public void setObjectFactory(java.lang.String objectPackage)
Method declaration

Specified by:
setObjectFactory in interface DatabaseMgr
Parameters:
objectPackage -
See Also:

getObjectFactory

public gov.lanl.Database.PersistentObjectFactory getObjectFactory()
this method returns an instance of the specified PersistentObjectFactory

Specified by:
getObjectFactory in interface DatabaseMgr