|
BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.beasys.commerce.util.JDBCSequencer
| Field Summary | |
static long |
DEFAULT_CACHE_SIZE
|
static java.lang.String |
DEFAULT_SEQUENCE_NAME
|
static java.lang.String |
DEFAULT_SEQUENCER_NAME
|
static long |
DEFAULT_STEP_SIZE
|
static java.lang.String |
SEQUENCE_NAME_IDENTIFIER
|
static java.lang.String |
SEQUENCE_VALUE_IDENTIFIER
|
| Constructor Summary | |
JDBCSequencer()
Default constructor. |
|
JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName)
Creates a new JDBCSequencer with the supplied sequencer name
and managed sequence name. |
|
JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName,
long cacheSize)
Creates a new JDBCSequencer with the supplied sequencer name,
managed sequence name, and cache size. |
|
JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName,
long cacheSize,
long stepSize)
Creates a new JDBCSequencer with the supplied sequencer name,
managed sequence name, cache size, and step size. |
|
| Method Summary | |
protected void |
allocateSequenceBlock(java.sql.Connection databaseConnection)
Allocates a new block of sequence numbers from the database using the supplied database connection. |
protected void |
cleanUpResources()
Closes any open DB resources. |
protected static boolean |
commitTransaction(java.sql.Connection databaseConnection,
boolean transactionStarted)
Commits the transaction associated with the supplied database connection if a transaction was previously started. |
long |
getCacheSize()
Returns the cache size. |
long |
getCurrent(java.sql.Connection databaseConnection)
Gets the current sequence number associated with this sequencer. |
long |
getIncrementAmount()
Deprecated. Replaced by getCacheSize |
long |
getNext(java.sql.Connection databaseConnection)
Gets the next sequence number using the supplied database connection. |
java.lang.String |
getSequenceName()
Returns the name of the sequence that is managed by this sequencer. |
java.lang.String |
getSequencerName()
Returns the name of this sequencer. |
long |
getStepSize()
Returns the step size. |
protected static boolean |
rollbackTransaction(java.sql.Connection databaseConnection,
boolean transactionStarted)
Forces a rollback of the transaction associated with the supplied database connection if a transaction was previously started. |
void |
setCacheSize(long cacheSize)
Sets the cache size. |
void |
setIncrementAmount(long incrementAmount)
Deprecated. Replaced by setCacheSize |
void |
setSequenceName(java.lang.String sequenceName)
Sets the name of the sequence that is managed by this sequencer. |
void |
setSequencerName(java.lang.String sequencerName)
Sets the name of this sequencer. |
void |
setStepSize(long stepSize)
Sets the step size. |
protected static boolean |
startTransaction(java.sql.Connection databaseConnection)
Starts a transaction using the supplied database connection if the connection is not already assoicated with a transaction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final long DEFAULT_CACHE_SIZE
public static final long DEFAULT_STEP_SIZE
public static final java.lang.String DEFAULT_SEQUENCER_NAME
public static final java.lang.String DEFAULT_SEQUENCE_NAME
public static final java.lang.String SEQUENCE_NAME_IDENTIFIER
public static final java.lang.String SEQUENCE_VALUE_IDENTIFIER
| Constructor Detail |
public JDBCSequencer()
public JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName)
JDBCSequencer with the supplied sequencer name
and managed sequence name.sequencerName - The name of the new sequencer.sequenceName - The name of the managed sequence.
public JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName,
long cacheSize)
JDBCSequencer with the supplied sequencer name,
managed sequence name, and cache size.sequencerName - The name of the new sequencer.sequenceName - The name of the managed sequence.cacheSize - The cache size.
public JDBCSequencer(java.lang.String sequencerName,
java.lang.String sequenceName,
long cacheSize,
long stepSize)
JDBCSequencer with the supplied sequencer name,
managed sequence name, cache size, and step size.sequencerName - The name of the new sequencer.sequenceName - The name of the managed sequence.cacheSize - The cache size.| Method Detail |
public long getNext(java.sql.Connection databaseConnection)
throws java.sql.SQLException
getNext in interface SequencerdatabaseConnection - The database connection used to
generate the next sequence number.SQLException - on error.
public long getCurrent(java.sql.Connection databaseConnection)
throws java.sql.SQLException
getCurrent in interface SequencerdatabaseConnection - The database connection used to
generate the next sequence number.SQLException - on error.
protected static boolean startTransaction(java.sql.Connection databaseConnection)
throws java.sql.SQLException
databaseConnection - The database connectiontrue if a transaction was started, false otherwiseSQLException - on error.
protected static boolean rollbackTransaction(java.sql.Connection databaseConnection,
boolean transactionStarted)
throws java.sql.SQLException
databaseConnection - The database connectiontransactionStarted - Return value from a call to startTransactiontrue if a rollback was performed, false otherwiseSQLException - on error.
protected static boolean commitTransaction(java.sql.Connection databaseConnection,
boolean transactionStarted)
throws java.sql.SQLException
databaseConnection - The database connectiontransactionStarted - Return value from a call to startTransactiontrue if the transaction was committed, false otherwiseSQLException - on error.
protected final void allocateSequenceBlock(java.sql.Connection databaseConnection)
throws java.sql.SQLException
databaseConnection - The database connection used to
generate the next sequence number.SQLException - on error.protected final void cleanUpResources()
public long getIncrementAmount()
getIncrementAmount in interface SequencergetCacheSize()public void setIncrementAmount(long incrementAmount)
setIncrementAmount in interface SequencerincrementAmount - The increment amount.setCacheSize(long)public long getCacheSize()
getCacheSize in interface Sequencerpublic void setCacheSize(long cacheSize)
setCacheSize in interface SequencercacheSize - The cache size.public long getStepSize()
getNext().getStepSize in interface Sequencerpublic void setStepSize(long stepSize)
getNext().setStepSize in interface SequencerstepSize - The step size.public java.lang.String getSequencerName()
getSequencerName in interface Sequencerpublic void setSequencerName(java.lang.String sequencerName)
setSequencerName in interface SequencersequencerName - The new sequencer name.public java.lang.String getSequenceName()
getSequenceName in interface Sequencerpublic void setSequenceName(java.lang.String sequenceName)
setSequenceName in interface SequencersequenceName - The new sequence name.
|
BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||