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

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

public class CachingBroker<T extends Dao>
extends java.lang.Object
implements TMCBroker<T>

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

Constructor Summary
CachingBroker()
           
 
Method Summary
 void blobHack(java.lang.String lockStatement, java.lang.String statement, int id, byte[] blobData)
           
 java.lang.String connectionReport()
           
 boolean delete(java.lang.String statement, java.lang.Object... objects)
           
 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.
 void modifyRelationship(java.lang.String statement, java.lang.Object... objects)
           
 int save(java.lang.String statement, java.lang.Object... objects)
           
 void update(java.lang.String statement, java.lang.Object... objects)
           
 void useSQL(java.lang.String statement, java.lang.Object... objects)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingBroker

public CachingBroker()
Method Detail

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

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

useSQL

public void useSQL(java.lang.String statement,
                   java.lang.Object... objects)
            throws java.sql.SQLException
Specified by:
useSQL in interface TMCBroker<T extends Dao>
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>