com.flexive.shared.interfaces
Interface SequencerEngine

All Known Subinterfaces:
SequencerEngineLocal

public interface SequencerEngine

Interface for the sequencer beans.

The beans generates Id's for any data-table. It should be used instead of database spezific autoincrements or sequences.

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at), Gregor Schober (gregor.schober@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Method Summary
 void createSequencer(java.lang.String name, boolean allowRollover, long startNumber)
          Create a new sequencer
 long getCurrentId(FxSystemSequencer sequencer)
          Read the current value of the given system internal sequencer without incrementing it Internal method!! Safe to use but of no use to 'end-users'! Warning: getCurrentId() is not reliable if called after the sequence has been reset or if the database caches sequencers!
 long getCurrentId(java.lang.String sequencer)
          Read the current value of the given sequencer without incrementing it.
 java.util.List<java.lang.String> getCustomSequencerNames()
          Get the names of all known user-created sequencers.
 java.util.List<CustomSequencer> getCustomSequencers()
          Get a list of all known (user-created) sequencer
 long getId(FxSystemSequencer sequencer)
          Get a new unique id for the requested system sequencer.
 long getId(java.lang.String sequencer)
          Get a new unique id from a registered custom sequencer
 long getMaxId()
          Return the maximum possible id that can be created
 void removeSequencer(java.lang.String name)
          Remove an existing sequencer
 boolean sequencerExists(java.lang.String name)
          Check existance of a sequencer
 

Method Detail

getMaxId

long getMaxId()
              throws FxNotFoundException
Return the maximum possible id that can be created

Returns:
maximum possible id that can be created
Throws:
FxNotFoundException - if no sequencer engine could be found

getId

long getId(FxSystemSequencer sequencer)
           throws FxApplicationException
Get a new unique id for the requested system sequencer. Internal method!! Safe to use but of no use to 'end-users'!

Parameters:
sequencer - the system sequencer to get an id for
Returns:
new id
Throws:
FxApplicationException - on errors

getId

long getId(java.lang.String sequencer)
           throws FxApplicationException
Get a new unique id from a registered custom sequencer

Parameters:
sequencer - name of the sequencer to use
Returns:
new id
Throws:
FxApplicationException - on errors

getCurrentId

long getCurrentId(java.lang.String sequencer)
                  throws FxApplicationException
Read the current value of the given sequencer without incrementing it. Warning: getCurrentId() is not reliable if called after the sequence has been reset or if the database caches sequencers!

Parameters:
sequencer - name of the sequencer to use
Returns:
current value
Throws:
FxApplicationException - on errors

getCurrentId

long getCurrentId(FxSystemSequencer sequencer)
                  throws FxApplicationException
Read the current value of the given system internal sequencer without incrementing it Internal method!! Safe to use but of no use to 'end-users'! Warning: getCurrentId() is not reliable if called after the sequence has been reset or if the database caches sequencers!

Parameters:
sequencer - the system sequencer to use
Returns:
current value
Throws:
FxApplicationException - on errors

createSequencer

void createSequencer(java.lang.String name,
                     boolean allowRollover,
                     long startNumber)
                     throws FxApplicationException
Create a new sequencer

Parameters:
name - desired name
allowRollover - allow id's that reach the limit (MAX_ID) to be reset to zero?
startNumber - the number to start at
Throws:
FxApplicationException - on errors

removeSequencer

void removeSequencer(java.lang.String name)
                     throws FxApplicationException
Remove an existing sequencer

Parameters:
name - name of the sequencer
Throws:
FxApplicationException - on errors

sequencerExists

boolean sequencerExists(java.lang.String name)
                        throws FxApplicationException
Check existance of a sequencer

Parameters:
name - name of the sequencer to check
Returns:
if the sequencer exists
Throws:
FxApplicationException - on errors

getCustomSequencers

java.util.List<CustomSequencer> getCustomSequencers()
                                                    throws FxApplicationException
Get a list of all known (user-created) sequencer

Returns:
list of all known (user-created) sequencer
Throws:
FxApplicationException - on errors

getCustomSequencerNames

java.util.List<java.lang.String> getCustomSequencerNames()
                                                         throws FxApplicationException
Get the names of all known user-created sequencers. Use this over getCustomSequencers() when you only need the sequencer IDs, which is considerably faster on some DBs.

Returns:
all sequencer names
Throws:
FxApplicationException - on errors
Since:
3.2.0