net.walend.lyophil.jdbc
Class JDBCIdentifierSource

java.lang.Object
  |
  +--net.walend.lyophil.jdbc.JDBCIdentifierSource
All Implemented Interfaces:
IdentifierSource

public class JDBCIdentifierSource
extends java.lang.Object
implements IdentifierSource

A long number source that keeps them in a table in a database and pulls them out one at a time, starting at zero. Built off of the JDBC 1.2 protocol. It'd be much nicer with the JDBC 2.0 protocol.

Since:
20001127
Author:
David Walend

Field Summary
private  java.lang.Object guard
          synchronization guard for the database.
private static long LASTID
           
static java.lang.String PROPKEY
           
 
Fields inherited from interface net.walend.lyophil.IdentifierSource
ROLE
 
Constructor Summary
JDBCIdentifierSource()
           
 
Method Summary
 boolean checkSetUp()
          make sure the backing storage is set up correctly
 java.io.Serializable createID()
          Return a Long unique in the system, based on a database table.
protected  java.lang.String getDatabaseName()
           
protected  PropertySource getLongProperties()
           
protected  PropertySource getPropertySource()
           
 java.io.Serializable peekNextID()
          Returns the next id to be created, without assigning it as in use.
 void setUp()
          set up the backing storage
 void tearDown()
          clean up the backing storage
 
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

guard

private final java.lang.Object guard
synchronization guard for the database.


LASTID

private static final long LASTID
Constructor Detail

JDBCIdentifierSource

public JDBCIdentifierSource()
Method Detail

getPropertySource

protected PropertySource getPropertySource()

getDatabaseName

protected java.lang.String getDatabaseName()

getLongProperties

protected PropertySource getLongProperties()

checkSetUp

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

Specified by:
checkSetUp in interface IdentifierSource

setUp

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

Specified by:
setUp in interface IdentifierSource

tearDown

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

Specified by:
tearDown in interface IdentifierSource

peekNextID

public java.io.Serializable peekNextID()
Description copied from interface: IdentifierSource
Returns the next id to be created, without assigning it as in use. I use this method for testing.

Specified by:
peekNextID in interface IdentifierSource

createID

public java.io.Serializable createID()
Return a Long unique in the system, based on a database table.

Specified by:
createID in interface IdentifierSource


Copyright (c) 2000, 2001, David Walend