OSID Logo
OSID Specifications
transaction package
Version 3.0.0
Release Candidate Preview
Interfaceosid.transaction.TransactionSession
Implementsosid.OsidSession
Description

The transaction session is coordinate transactions. A transaction session allows for Transactions to be added to the list of transactions it is managing. Upon a commit(), all registered transactions receive a prepare() and a commit(). Upon an abort() all registered transactions receive an abort(). A TransactionSession itself may implement transactions (as it is an OsidSession ) as a means of enabling a form of federated transaction management.

Methodadd
Description

Adds a Transaction to be managed by this transaction service.

Parametersosid.transaction.Transactiontransactionthe transaction to add
ErrorsALREADY_EXISTStransaction already added
ILLEGAL_STATEthis transaction has ended
INVALID_ARGUMENTthe session doesn't support transactions
NULL_ARGUMENTa null argument provided
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Methodcommit
Description

Commits the transaction and makes the state change(s) visible. This transaction is effectively closed and the only valid method that may be invoked is getState().

ErrorsILLEGAL_STATEthis transaction has been committed or aborted
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Provider Notes

prepare() should be invoked on all regstered transactions and iff all are successful should commit() be invoked on all registered transactions. In case of error on any prepare(), all transactions should be aborted. If an error occurs on a commit() after a transaction reported success on a prepare() after one or more transactions were already committed, then it is not ACID compliant and success should be assumed by committing the rest of the transactions. If a commit() error occurs when no transactions have been committed, then this operation should not proceed.

Methodabort
Description

Cancels this transaction, rolling back the queue of operations since the start of this transaction. This transaction is effectively closed and the only valid method that may be invoked is getState().

ErrorsILLEGAL_STATEthis transaction has been committed or aborted
CompliancemandatoryThis method must be implemented.
Provider Notes

Invokes abort() on all registered transactions().

MethodgetState
Description

Gets the current state of this transaction.

Returnosid.transaction.TransactionStatethe current state of this transaction
ErrorsILLEGAL_STATEthis transaction has been committed or aborted
CompliancemandatoryThis method must be implemented.