public class DefaultTransaction extends Object implements Transaction
Please see Transaction interface for an outline of what this class is all about.
Transaction.State
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOGGER
The logger for the data module.
|
AUTO_COMMIT
Constructor and Description |
---|
DefaultTransaction() |
DefaultTransaction(String handle) |
Modifier and Type | Method and Description |
---|---|
void |
addAuthorization(String authID)
Provides an authorization ID allowing access to locked Features.
|
void |
close()
Frees all State held by this Transaction.
|
void |
commit()
Commits all modifications against this Transaction.
|
protected void |
finalize() |
Set |
getAuthorizations()
The current set of Authorization IDs held by this Transaction.
|
Object |
getProperty(Object key)
Implementation of getProperty.
|
Transaction.State |
getState(Object key)
Returns externalized state or
null if not available. |
void |
putProperty(Object key,
Object value)
Implementation of addProperty.
|
void |
putState(Object key,
Transaction.State state)
Remembers Externalized State for a DataSource.
|
void |
removeState(Object key)
Removes state from DefaultTransaction's care.
|
void |
rollback()
Rollsback all modifications against this Transaction.
|
String |
toString() |
protected static final Logger LOGGER
public DefaultTransaction()
public DefaultTransaction(String handle)
public void putState(Object key, Transaction.State state)
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.
putState
in interface Transaction
key
- Key used to externalize Statestate
- Externalized State (Momeneto)IllegalArgumentException
- When Transaction already using keyTransaction.putState(java.lang.Object,
org.geotools.data.Transaction.State)
public void removeState(Object key)
Currently does not complain if there is no State associated with key to remove - this may change in the future.
removeState
in interface Transaction
key
- IllegalArgumentException
- If no State was maintained for supplied key
Transaction.removeState(java.lang.Object)
public Transaction.State getState(Object key)
null
if not available.
Used by DataStore implementations to externalize information required for Transaction support using the GOF Momento pattern.
getState
in interface Transaction
key
- Transaction.getState(java.lang.Object)
public void commit() throws IOException
This implementation will call commit() on all State managed by this Transaction. This allows DataStores to provide their own implementation of commit().
commit
in interface Transaction
IOException
- Encountered problem maintaining transaction stateDataSourceException
- See IOExceptionTransaction.commit()
public void rollback() throws IOException
This implementation will call rollback() on all State managed by this Transaction. This allows DataStores to provide their own implementation of rollback().
rollback
in interface Transaction
IOException
- Encountered problem maintaining transaction StateDataSourceException
- IOExceptionTransaction.rollback()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Transaction
public Set getAuthorizations()
This set is reset by the next call to commit or rollback.
getAuthorizations
in interface Transaction
public void addAuthorization(String authID) throws IOException
Remember authorizations are cleared after every commit/rollback.
addAuthorization
in interface Transaction
authID
- Provided Authorization IDIOException
- Encountered problems maintaing Transaction StateDataSourceException
- See IOExceptionorg.geotools.data.Transaction#setAuthorization(java.lang.String)
public Object getProperty(Object key)
getProperty
in interface Transaction
key
- Transaction.getProperty(java.lang.Object)
public void putProperty(Object key, Object value) throws IOException
putProperty
in interface Transaction
key
- value
- IOException
org.geotools.data.Transaction#addProperty(java.lang.Object, java.lang.Object)
Copyright © 1996–2019 Geotools. All rights reserved.