net.walend.lyophil.jdbc
Class JDBCCaster

java.lang.Object
  |
  +--net.walend.lyophil.jdbc.JDBCCaster
All Implemented Interfaces:
Caster

public class JDBCCaster
extends java.lang.Object
implements Caster

This class implements a simple Caster for jdbc based systems.

Since:
12-26-2000
Author:
David Walend

Field Summary
protected  MutableMap interfacesToWhereClauses
           
protected  Map rolesToConcreteTrays
           
static java.lang.String SQLPROPERTYKEY
           
protected  Map trayClassesToTrays
           
 
Fields inherited from interface net.walend.lyophil.Caster
CASTER
 
Constructor Summary
JDBCCaster()
           
 
Method Summary
 boolean checkSetUp()
          make sure the backing storage is set up correctly
 int count()
          count the Freezables in the freezer.
 int countByClass(java.lang.Class interf)
          Count the number of freezables that implement this interf.
 Set findByClass(java.lang.Class interf)
          Returns the Set of Freezables in the Freezer that can be cast to interf.
 java.lang.Class findInterfaceForFreezable(Freezable freezable)
          Returns the working interface for the freezable.
private  java.lang.Class findInterfaceForFreezableFromProperties(Freezable freezable)
           
 java.lang.Class findInterfaceForIdentifier(java.io.Serializable id)
          Returns the working interface for the object pointed at by identifier.
protected  ConcreteTray findTrayForIdentifier(java.io.Serializable id)
           
 void freeze(Freezable freezable)
          Add a freezable to the Caster's collection if it isn't already there.
 Set getAllIdentifiers()
          Get a Set containing all the identifiers in the Freezer.
protected  PropertySource getCasterPropertySource()
           
protected  java.lang.String getDatabaseName()
           
protected  Mother getMother()
           
protected  PropertySource getPropertySource()
           
protected  ConcreteTray getTrayForFreezable(Freezable victem)
           
private  ConcreteTray getTrayForIdentifier(java.io.Serializable id)
           
 ConcreteTray getTrayForRole(java.lang.String role)
           
protected  ConcreteTray getTrayForTrayClass(java.lang.Class trayClass)
           
protected  java.lang.String getWhereClauseFor(java.lang.Class interf)
           
 boolean isAbsent(java.io.Serializable id)
          Return true if identifier is available in the frozen medium.
 boolean isPresent(java.io.Serializable id)
          Return true if identifier is available in the frozen medium.
 void setUp()
          set up the backing storage
 void tearDown()
          clean up the backing storage
 Freezable thaw(java.io.Serializable id)
          Thaw out a freezable.
 void throwOut(java.io.Serializable id)
          Remove a freezable from the Caster's collection
 void validate(java.io.Serializable id, InvalidFrozenMap ifm)
          Validates identifier.
 void validateAll(InvalidFrozenMap ifm)
          Validates all the identifiers in the Caster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQLPROPERTYKEY

public static final java.lang.String SQLPROPERTYKEY

rolesToConcreteTrays

protected Map rolesToConcreteTrays

trayClassesToTrays

protected Map trayClassesToTrays

interfacesToWhereClauses

protected MutableMap interfacesToWhereClauses
Constructor Detail

JDBCCaster

public JDBCCaster()
Method Detail

getDatabaseName

protected java.lang.String getDatabaseName()

getPropertySource

protected PropertySource getPropertySource()

getCasterPropertySource

protected PropertySource getCasterPropertySource()

getMother

protected Mother getMother()

getTrayForIdentifier

private ConcreteTray getTrayForIdentifier(java.io.Serializable id)
                                   throws NotInFreezerException

getTrayForFreezable

protected ConcreteTray getTrayForFreezable(Freezable victem)

getTrayForRole

public ConcreteTray getTrayForRole(java.lang.String role)

getTrayForTrayClass

protected ConcreteTray getTrayForTrayClass(java.lang.Class trayClass)

findInterfaceForIdentifier

public java.lang.Class findInterfaceForIdentifier(java.io.Serializable id)
                                           throws NotInFreezerException
Description copied from interface: Caster
Returns the working interface for the object pointed at by identifier.

Specified by:
findInterfaceForIdentifier in interface Caster

findInterfaceForFreezableFromProperties

private java.lang.Class findInterfaceForFreezableFromProperties(Freezable freezable)

findInterfaceForFreezable

public java.lang.Class findInterfaceForFreezable(Freezable freezable)
Description copied from interface: Caster
Returns the working interface for the freezable.

Specified by:
findInterfaceForFreezable in interface Caster

freeze

public void freeze(Freezable freezable)
Description copied from interface: Caster
Add a freezable to the Caster's collection if it isn't already there.

Specified by:
freeze in interface Caster

thaw

public Freezable thaw(java.io.Serializable id)
               throws NotInFreezerException
Description copied from interface: Caster
Thaw out a freezable.

Specified by:
thaw in interface Caster

throwOut

public void throwOut(java.io.Serializable id)
              throws NotInFreezerException
Description copied from interface: Caster
Remove a freezable from the Caster's collection

Specified by:
throwOut in interface Caster

validate

public void validate(java.io.Serializable id,
                     InvalidFrozenMap ifm)
Description copied from interface: Caster
Validates identifier.

Specified by:
validate in interface Caster

validateAll

public void validateAll(InvalidFrozenMap ifm)
Description copied from interface: Caster
Validates all the identifiers in the Caster.

Specified by:
validateAll in interface Caster

isAbsent

public boolean isAbsent(java.io.Serializable id)
Description copied from interface: Caster
Return true if identifier is available in the frozen medium.

Specified by:
isAbsent in interface Caster

isPresent

public boolean isPresent(java.io.Serializable id)
Description copied from interface: Caster
Return true if identifier is available in the frozen medium.

Specified by:
isPresent in interface Caster

getAllIdentifiers

public Set getAllIdentifiers()
Description copied from interface: Caster
Get a Set containing all the identifiers in the Freezer.

Specified by:
getAllIdentifiers in interface Caster

count

public int count()
Description copied from interface: Caster
count the Freezables in the freezer.

Specified by:
count in interface Caster

getWhereClauseFor

protected java.lang.String getWhereClauseFor(java.lang.Class interf)

countByClass

public int countByClass(java.lang.Class interf)
Description copied from interface: Caster
Count the number of freezables that implement this interf.

Specified by:
countByClass in interface Caster

findByClass

public Set findByClass(java.lang.Class interf)
Description copied from interface: Caster
Returns the Set of Freezables in the Freezer that can be cast to interf.

Specified by:
findByClass in interface Caster

checkSetUp

public boolean checkSetUp()
Description copied from interface: Caster
make sure the backing storage is set up correctly

Specified by:
checkSetUp in interface Caster

setUp

public void setUp()
Description copied from interface: Caster
set up the backing storage

Specified by:
setUp in interface Caster

tearDown

public void tearDown()
Description copied from interface: Caster
clean up the backing storage

Specified by:
tearDown in interface Caster

findTrayForIdentifier

protected ConcreteTray findTrayForIdentifier(java.io.Serializable id)
                                      throws NotInFreezerException


Copyright (c) 2000, 2001, David Walend