com.metamatrix.common.id.dbid.spi.jdbc
Class DBIDResourceTransaction

java.lang.Object
  extended by com.metamatrix.common.connection.BaseTransaction
      extended by com.metamatrix.common.id.dbid.spi.jdbc.DBIDResourceTransaction
All Implemented Interfaces:
TransactionInterface, DBIDSourceTransaction

public class DBIDResourceTransaction
extends BaseTransaction
implements DBIDSourceTransaction

TransactionSourceTransaction implementation.


Constructor Summary
DBIDResourceTransaction(ManagedConnection connection, boolean readonly)
          Create a new instance of a transaction for a managed connection.
 
Method Summary
 ReservedIDBlock createIDBlock(long blockSize, java.lang.String context, boolean wrapNumber)
          Create and return a new ReservedIDBlock.
 
Methods inherited from class com.metamatrix.common.connection.BaseTransaction
close, commit, finalize, getConnection, getRollbackOnFinalize, isClosed, isEnded, isReadonly, rollback, setRollbackOnFinalize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metamatrix.common.connection.TransactionInterface
close, commit, isClosed, isReadonly, rollback
 

Constructor Detail

DBIDResourceTransaction

public DBIDResourceTransaction(ManagedConnection connection,
                               boolean readonly)
                        throws ManagedConnectionException
Create a new instance of a transaction for a managed connection.

Parameters:
connectionPool - the pool to which the transaction should return the connection when completed
connection - the connection that should be used and that was created using this factory's createConnection method (thus the transaction subclass may cast to the type created by the createConnection method.
readonly - true if the transaction is to be readonly, or false otherwise
Throws:
ManagedConnectionException - if there is an error creating the transaction.
Method Detail

createIDBlock

public ReservedIDBlock createIDBlock(long blockSize,
                                     java.lang.String context,
                                     boolean wrapNumber)
                              throws java.lang.Exception

Create and return a new ReservedIDBlock.

Read in nextID from database, createIDBlock, then update nextID in database.

Specified by:
createIDBlock in interface DBIDSourceTransaction
Parameters:
blockSize - size of id block
wrapNumber - is true when the context is at its maximum limit and the next block should start over at the beginning
Returns:
ReservedIDBlock instance
Throws:
TransactionServiceException - when an error updating or reading the database occurs
java.lang.Exception - when an error updating or reading the database occurs


Copyright © 2009. All Rights Reserved.