|
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
databaseConnection
- The database connection used to
generate the next sequence number.SQLException
- on error.public long getCurrent(java.sql.Connection databaseConnection) throws java.sql.SQLException
databaseConnection
- 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 startTransaction
true
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 startTransaction
true
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()
getCacheSize()
public void setIncrementAmount(long incrementAmount)
incrementAmount
- The increment amount.setCacheSize(long)
public long getCacheSize()
public void setCacheSize(long cacheSize)
cacheSize
- The cache size.public long getStepSize()
getNext()
.public void setStepSize(long stepSize)
getNext()
.stepSize
- The step size.public java.lang.String getSequencerName()
public void setSequencerName(java.lang.String sequencerName)
sequencerName
- The new sequencer name.public java.lang.String getSequenceName()
public void setSequenceName(java.lang.String sequenceName)
sequenceName
- The new sequence name.
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |