Class DefaultTransaction
- All Implemented Interfaces:
Closeable,AutoCloseable,Transaction
Please see Transaction interface for an outline of what this class is all about.
- Author:
- Jody Garnett, Refractions Research
-
Nested Class Summary
Nested classes/interfaces inherited from interface Transaction
Transaction.State -
Field Summary
FieldsFields inherited from interface Transaction
AUTO_COMMIT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthorization(String authID) Provides an authorization ID allowing access to locked Features.voidclose()Frees all State held by this Transaction.voidcommit()Commits all modifications against this Transaction.protected voidfinalize()The current set of Authorization IDs held by this Transaction.getProperty(Object key) Implementation of getProperty.Returns externalized state ornullif not available.voidputProperty(Object key, Object value) Implementation of addProperty.voidputState(Object key, Transaction.State state) Remembers Externalized State for a DataSource.voidremoveState(Object key) Removes state from DefaultTransaction's care.voidrollback()Rollsback all modifications against this Transaction.toString()
-
Field Details
-
LOGGER
The logger for the data module.
-
-
Constructor Details
-
DefaultTransaction
public DefaultTransaction() -
DefaultTransaction
-
-
Method Details
-
putState
Remembers Externalized State for a DataSource.This is the GOF Momento pattern: a SimpleFeatureSource is able to externalize its internal State required for Transaction support and have this class manage it. It may retrieve this State with getState( key ).
In addition several SimpleFeatureSource implementations may share State, a common example is JDBCDataSources keeping a shared JDBC connection using the JDBC URL as a key.
- Specified by:
putStatein interfaceTransaction- Parameters:
key- Key used to externalize Statestate- Externalized State (Momeneto)- Throws:
IllegalArgumentException- When Transaction already using key- See Also:
-
removeState
Removes state from DefaultTransaction's care.Currently does not complain if there is no State associated with key to remove - this may change in the future.
- Specified by:
removeStatein interfaceTransaction- Parameters:
key- Key that was used to externalize State- Throws:
IllegalArgumentException- If no State was maintained for suppliedkey- See Also:
-
getState
Returns externalized state ornullif not available.Used by DataStore implementations to externalize information required for Transaction support using the GOF Momento pattern.
- Specified by:
getStatein interfaceTransaction- Returns:
- Previously externalized State.
- See Also:
-
commit
Commits all modifications against this Transaction.This implementation will call commit() on all State managed by this Transaction. This allows DataStores to provide their own implementation of commit().
- Specified by:
commitin interfaceTransaction- Throws:
IOException- Encountered problem maintaining transaction stateDataSourceException- See IOException- See Also:
-
rollback
Rollsback all modifications against this Transaction.This implementation will call rollback() on all State managed by this Transaction. This allows DataStores to provide their own implementation of rollback().
- Specified by:
rollbackin interfaceTransaction- Throws:
IOException- Encountered problem maintaining transaction StateDataSourceException- IOException- See Also:
-
close
public void close()Frees all State held by this Transaction.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceTransaction
-
getAuthorizations
The current set of Authorization IDs held by this Transaction.This set is reset by the next call to commit or rollback.
- Specified by:
getAuthorizationsin interfaceTransaction- Returns:
- Set of Authorization IDs
-
addAuthorization
Provides an authorization ID allowing access to locked Features.Remember authorizations are cleared after every commit/rollback.
- Specified by:
addAuthorizationin interfaceTransaction- Parameters:
authID- Provided Authorization ID- Throws:
IOException- Encountered problems maintaing Transaction StateDataSourceException- See IOException- See Also:
-
Transaction#setAuthorization(java.lang.String)
-
toString
-
getProperty
Implementation of getProperty.- Specified by:
getPropertyin interfaceTransaction- See Also:
-
putProperty
Implementation of addProperty.- Specified by:
putPropertyin interfaceTransaction- Throws:
IOException- See Also:
-
Transaction#addProperty(java.lang.Object, java.lang.Object)
-
finalize
-