net.walend.collection.lyophil.jdbc
Class JDBCBackedMutableSetTray

java.lang.Object
  |
  +--net.walend.collection.lyophil.jdbc.JDBCBackedMutableSetTray
All Implemented Interfaces:
ConcreteTray, Tray

public class JDBCBackedMutableSetTray
extends java.lang.Object
implements ConcreteTray

A simple backing for MutableSets that uses the jdbc kit. A jdbc-based Freezer or a Frozen EJB for MutableSets can use this class for database access.

On freeze, all this particular tray does is maintain the set's existence. MutableSet methods do all the work.

Since:
20010213
Author:
David Walend

Field Summary
static java.lang.String PROPKEY
           
 
Fields inherited from interface net.walend.lyophil.Tray
TRAY
 
Constructor Summary
JDBCBackedMutableSetTray()
           
 
Method Summary
 boolean add(java.io.Serializable id, java.io.Serializable member)
           
protected  java.lang.Long castIdentifier(java.io.Serializable identifier)
           
 boolean checkSetUp()
          make sure the backing storage is set up correctly
 void clear(java.io.Serializable id)
           
 boolean contains(java.io.Serializable identifier, java.io.Serializable member)
           
 void delete(java.io.Serializable id)
          Remove everything about this id from the Tray.
 void freeze(Freezable object)
          Puts the Freezable in cold storage.
 Set getAllIdentifiersInTray()
          Get a Set containing all the identifiers in this Tray.
protected  java.lang.String getDatabaseName()
           
protected  PropertySource getPropertySource()
           
 java.util.Iterator identifierIterator(java.io.Serializable id)
           
 Set identifierSet(java.io.Serializable id)
           
 void insertNew(Freezable object)
          Stick a new Freezable into the database.
 boolean isAbsent(java.io.Serializable id)
          For this tray only, is the id not represented by data? In most cases, this is simply !isPresent(id).
 boolean isPresent(java.io.Serializable id)
          For this tray only, is the tray ready for data about this id?
 boolean remove(java.io.Serializable id, java.io.Serializable member)
           
 void setUp()
          Set up the backing storage
 int size(java.io.Serializable id)
           
 void tearDown()
          clean up the backing storage
 Freezable thaw(java.io.Serializable identifier)
          Gets a Freezable out of cold storage.
 void throwOut(java.io.Serializable identifier)
          Remove a frozen instance from cold storage.
 void updateOld(Freezable object)
          Update an old Freezable in the database.
 void validate(java.io.Serializable id, InvalidFrozenMap ifm)
          Validates identifier.
 void validateAll(InvalidFrozenMap ifm, Caster caster)
          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

PROPKEY

public static final java.lang.String PROPKEY
Constructor Detail

JDBCBackedMutableSetTray

public JDBCBackedMutableSetTray()
Method Detail

getDatabaseName

protected java.lang.String getDatabaseName()

getPropertySource

protected PropertySource getPropertySource()

castIdentifier

protected java.lang.Long castIdentifier(java.io.Serializable identifier)

isPresent

public boolean isPresent(java.io.Serializable id)
Description copied from interface: Tray
For this tray only, is the tray ready for data about this id?

Specified by:
isPresent in interface Tray

isAbsent

public boolean isAbsent(java.io.Serializable id)
Description copied from interface: Tray
For this tray only, is the id not represented by data? In most cases, this is simply !isPresent(id). For empty sets, both can return true.

Specified by:
isAbsent in interface Tray

insertNew

public void insertNew(Freezable object)
Description copied from interface: Tray
Stick a new Freezable into the database. Don't look at it first to make sure it's not there.

Specified by:
insertNew in interface Tray

updateOld

public void updateOld(Freezable object)
Description copied from interface: Tray
Update an old Freezable in the database. Don't look first to make sure that it's there.

Specified by:
updateOld in interface Tray

delete

public void delete(java.io.Serializable id)
Description copied from interface: Tray
Remove everything about this id from the Tray.

A recursive method.

Specified by:
delete in interface Tray

validate

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

Specified by:
validate in interface Tray

validateAll

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

Specified by:
validateAll in interface Tray

getAllIdentifiersInTray

public Set getAllIdentifiersInTray()
Description copied from interface: Tray
Get a Set containing all the identifiers in this Tray. It doesn't use the Freezables table.

Specified by:
getAllIdentifiersInTray in interface Tray

freeze

public void freeze(Freezable object)
Description copied from interface: ConcreteTray
Puts the Freezable in cold storage.

Specified by:
freeze in interface ConcreteTray

thaw

public Freezable thaw(java.io.Serializable identifier)
Description copied from interface: ConcreteTray
Gets a Freezable out of cold storage. Normally, this should be a new instance of a previously frozen Freezable.

Specified by:
thaw in interface ConcreteTray

throwOut

public void throwOut(java.io.Serializable identifier)
              throws NotInFreezerException
Remove a frozen instance from cold storage.

Specified by:
throwOut in interface ConcreteTray
Throws:
CannotThrowOutException
NotInFreezerException

checkSetUp

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

Specified by:
checkSetUp in interface Tray

setUp

public void setUp()
Description copied from interface: Tray
Set up the backing storage

Specified by:
setUp in interface Tray

tearDown

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

Specified by:
tearDown in interface Tray

size

public int size(java.io.Serializable id)

contains

public boolean contains(java.io.Serializable identifier,
                        java.io.Serializable member)

identifierIterator

public java.util.Iterator identifierIterator(java.io.Serializable id)

identifierSet

public Set identifierSet(java.io.Serializable id)

add

public boolean add(java.io.Serializable id,
                   java.io.Serializable member)

remove

public boolean remove(java.io.Serializable id,
                      java.io.Serializable member)

clear

public void clear(java.io.Serializable id)


Copyright (c) 2000, 2001, David Walend