org.apache.lokahi.core.common.database
Class DerbyBroker<T extends Dao>

java.lang.Object
  extended by org.apache.lokahi.core.common.interfaces.GenericDatabaseBroker<T>
      extended by org.apache.lokahi.core.common.database.DerbyBroker<T>
All Implemented Interfaces:
ReadOnlyBroker<T>, TMCBroker<T>

public class DerbyBroker<T extends Dao>
extends GenericDatabaseBroker<T>
implements TMCBroker<T>

Version:
$Id: DerbyBroker.java,v 1.3 2006/03/07 20:18:52 drtobes Exp $
Author:
Stephen Toback

Constructor Summary
DerbyBroker()
           
 
Method Summary
 void blobHack(java.lang.String lockStatement, java.lang.String statement, int id, byte[] blobData)
           
protected  java.sql.PreparedStatement buildParams(java.sql.PreparedStatement psmt, java.lang.Object... params)
           
 java.lang.String connectionReport()
           
 boolean delete(java.lang.String statement, java.lang.Object... objects)
           
 Field[] getFields(org.jdom.Document d)
           
 java.lang.String getModule(org.jdom.Document d)
           
 T getObject(java.lang.Class<T> c, java.lang.String statement, boolean cache, java.lang.Object... objects)
          Gets a singular object from the datastore.
 java.util.Collection<T> getObjects(java.lang.Class<T> c, boolean cache, java.lang.String statement, java.lang.Object... objects)
          Gets a collection of objects from the datastore.
protected  java.sql.PreparedStatement getStatement(java.sql.Connection conn, java.lang.String statement, java.lang.Object... objects)
           
static void initalize()
           
 void modifyRelationship(java.lang.String statement, java.lang.Object... objects)
           
 int save(java.lang.String statement, java.lang.Object... objects)
           
static void shutDown()
           
 org.jdom.Document testFile(java.lang.String file, boolean b)
           
 void update(java.lang.String statement, java.lang.Object... objects)
           
 void useSQL(java.lang.String statement, java.lang.Object... params)
           
 
Methods inherited from class org.apache.lokahi.core.common.interfaces.GenericDatabaseBroker
buildParams, fillObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerbyBroker

public DerbyBroker()
Method Detail

initalize

public static void initalize()

shutDown

public static void shutDown()
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

testFile

public org.jdom.Document testFile(java.lang.String file,
                                  boolean b)

getModule

public java.lang.String getModule(org.jdom.Document d)

getFields

public Field[] getFields(org.jdom.Document d)

useSQL

public void useSQL(java.lang.String statement,
                   java.lang.Object... params)
            throws java.sql.SQLException
Specified by:
useSQL in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

buildParams

protected java.sql.PreparedStatement buildParams(java.sql.PreparedStatement psmt,
                                                 java.lang.Object... params)
                                          throws java.sql.SQLException
Throws:
java.sql.SQLException

save

public int save(java.lang.String statement,
                java.lang.Object... objects)
         throws java.sql.SQLException
Specified by:
save in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

getStatement

protected java.sql.PreparedStatement getStatement(java.sql.Connection conn,
                                                  java.lang.String statement,
                                                  java.lang.Object... objects)
                                           throws TMCIllegalArgumentException,
                                                  java.sql.SQLException
Throws:
TMCIllegalArgumentException
java.sql.SQLException

delete

public boolean delete(java.lang.String statement,
                      java.lang.Object... objects)
               throws java.sql.SQLException
Specified by:
delete in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

update

public void update(java.lang.String statement,
                   java.lang.Object... objects)
            throws java.sql.SQLException
Specified by:
update in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

modifyRelationship

public void modifyRelationship(java.lang.String statement,
                               java.lang.Object... objects)
                        throws java.sql.SQLException
Specified by:
modifyRelationship in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

getObject

public T getObject(java.lang.Class<T> c,
                   java.lang.String statement,
                   boolean cache,
                   java.lang.Object... objects)
                        throws java.sql.SQLException
Description copied from interface: ReadOnlyBroker
Gets a singular object from the datastore.

Specified by:
getObject in interface ReadOnlyBroker<T extends Dao>
Parameters:
c - Class of the expected object return.
statement - key to get the object from the datastore.
cache - true a cached object will suffice.
objects - objects to look up the desired object by.
Returns:
object of Class c populated.
Throws:
java.sql.SQLException

getObjects

public java.util.Collection<T> getObjects(java.lang.Class<T> c,
                                          boolean cache,
                                          java.lang.String statement,
                                          java.lang.Object... objects)
                                               throws java.sql.SQLException
Description copied from interface: ReadOnlyBroker
Gets a collection of objects from the datastore.

Specified by:
getObjects in interface ReadOnlyBroker<T extends Dao>
Parameters:
c - Class of the expected object return.
cache - true a cached object will suffice.
statement - key to get the object from the datastore.
objects - objects to look up the desired object by.
Returns:
object of Class c populated.
Throws:
java.sql.SQLException

blobHack

public void blobHack(java.lang.String lockStatement,
                     java.lang.String statement,
                     int id,
                     byte[] blobData)
              throws java.sql.SQLException
Specified by:
blobHack in interface TMCBroker<T extends Dao>
Throws:
java.sql.SQLException

connectionReport

public java.lang.String connectionReport()
Specified by:
connectionReport in interface TMCBroker<T extends Dao>