|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dasein.persist.Sequencer
public abstract class Sequencer
Provides a generic interface for sequence generation that may be
implemented by a number of different sequence providers. You request
sequencer instances by calling getInstance(String) with the
name of the sequence or getInstance(Class) with the class for which
the sequence should be unique. You may configure what sequencer is used through
the configuration file dasein-persistence.properties. You
specify a concrete sequencer using the following:
dasein.sequencer.NAME=CLASSNAME
For example:
dasein.sequencer.pageId=org.dasein.persist.DaseinSequencer
In code, you might have the following:
Sequencer seq = Sequencer.getInstance(this.class);
id = seq.next();
Last modified $Date: 2005/08/15 16:15:59 $
| Field Summary | |
|---|---|
static String |
PROPERTIES
|
| Constructor Summary | |
|---|---|
Sequencer()
Constructs an empty sequencer with no name. |
|
| Method Summary | |
|---|---|
static Sequencer |
getInstance(Class cls)
Returns a sequencer that will provide unique identifiers across all instances of the specified class. |
static Sequencer |
getInstance(String name)
Looks to see if a sequencer has been generated for the sequence with the specified name. |
String |
getName()
|
abstract long |
next()
Generates a new unique number based on the implementation class' algorithm of choice. |
void |
setName(String nom)
Sets the sequencer name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTIES
| Constructor Detail |
|---|
public Sequencer()
setName(String) before
the sequencer is used.
| Method Detail |
|---|
public static final Sequencer getInstance(String name)
HashMap lookup.
name - the name of the desired sequencer
public static Sequencer getInstance(Class cls)
getInstance(String) where the name being used for the desired
sequence is the name of the class passed to this method.
cls - the class for which unique IDs are desired
public String getName()
public abstract long next()
throws PersistenceException
PersistenceException - a data store error
occurred while generating the numberpublic final void setName(String nom)
nom - the name of the sequencer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||