|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectInProcessLockingManager
public class InProcessLockingManager
Provides In-Process FeatureLocking support for DataStore implementations.
If at all possible DataStore implementations should provide a real Feature Locking support that is persisted to disk or database and resepected by other processes.
This class provides a stop gap solution that implementations may use for GeoServer compatability.
modules/library/main (gt-main.jar)
Field Summary | |
---|---|
protected Map |
lockTables
lockTable access by typeName stores Transactions or MemoryLocks |
Constructor Summary | |
---|---|
InProcessLockingManager()
|
Method Summary | |
---|---|
protected Set |
allLocks()
Set of all locks. |
void |
assertAccess(String typeName,
String featureID,
Transaction transaction)
Checks mutability of featureID for this transaction. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
checkedWriter(FeatureWriter<SimpleFeatureType,SimpleFeature> writer,
Transaction transaction)
Provides a wrapper on the provided writer that checks locks. |
protected InProcessLockingManager.Lock |
createLock(Transaction transaction,
FeatureLock featureLock)
Creates the right sort of In-Process Lock. |
boolean |
exists(String authID)
Implment lockExists. |
protected InProcessLockingManager.Lock |
getLock(String typeName,
String featureID)
Lock for typeName & featureID if it exists. |
boolean |
isLocked(String typeName,
String featureID)
Used by test cases |
void |
lockFeatureID(String typeName,
String featureID,
Transaction transaction,
FeatureLock featureLock)
Aquire lock on featureID. |
protected Map |
locks(String typeName)
Access to a Map of locks for typeName |
boolean |
refresh(String authID,
Transaction transaction)
Refresh locks held by the authorization authID . |
boolean |
release(String authID,
Transaction transaction)
Release locks held by the authorization authID . |
void |
unLockFeatureID(String typeName,
String featureID,
Transaction transaction,
FeatureLock featureLock)
Release indicated featureID, must have correct authroization. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map lockTables
Constructor Detail |
---|
public InProcessLockingManager()
Method Detail |
---|
public void lockFeatureID(String typeName, String featureID, Transaction transaction, FeatureLock featureLock) throws FeatureLockException
This method will fail if Lock is already held by another.
lockFeatureID
in interface LockingManager
typeName
- TypeName storing featurefeatureID
- FeatureID to locktransaction
- Transaction to lock againstfeatureLock
- FeatureLock describing lock request
FeatureLockException
- Indicates a problem with the lock requestprotected InProcessLockingManager.Lock getLock(String typeName, String featureID)
This method will not return expired locks.
typeName
- featureID
-
protected InProcessLockingManager.Lock createLock(Transaction transaction, FeatureLock featureLock) throws FeatureLockException
transaction
- featureLock
-
FeatureLockException
- When a Transaction lock is requested
against Transaction.AUTO_COMMITprotected Map locks(String typeName)
typeName
- typeName
protected Set allLocks()
public void assertAccess(String typeName, String featureID, Transaction transaction) throws FeatureLockException
Two behaviors are defined by FeatureLocking:
Right now we are just going to error out with an exception
typeName
- Feature type to check againstfeatureID
- FeatureID to checktransaction
- Provides Authorization
FeatureLockException
- If transaction does not have sufficient
authroizationpublic FeatureWriter<SimpleFeatureType,SimpleFeature> checkedWriter(FeatureWriter<SimpleFeatureType,SimpleFeature> writer, Transaction transaction)
writer
- FeatureWriter requiring access controltransaction
- Transaction being used
public void unLockFeatureID(String typeName, String featureID, Transaction transaction, FeatureLock featureLock) throws IOException
unLockFeatureID
in interface LockingManager
typeName
- featureID
- transaction
- featureLock
-
IOException
- If lock could not be releasedpublic boolean refresh(String authID, Transaction transaction) throws IOException
authID
.
(remember that the lock may have expired)
refresh
in interface LockingManager
authID
- Authorization identifing Lock to refreshtransaction
- Transaction with authorization for lockID
true
if lock was found and refreshed
IOException
- If transaction not authorized to refresh authID
IllegalArgumentException
- If authID or transaction not providedpublic boolean release(String authID, Transaction transaction) throws IOException
authID
.
(remember that the lock may have expired)
release
in interface LockingManager
authID
- Authorization identifing Lock to releasetransaction
- Transaction with authorization for lockID
true
if lock was found and released
IOException
- If transaction not authorized to release authID
IllegalArgumentException
- If authID or transaction not providedpublic boolean exists(String authID)
Remeber lock may have expired.
exists
in interface LockingManager
authID
-
org.geotools.data.LockingManager#lockExists(java.lang.String)
public boolean isLocked(String typeName, String featureID)
typeName
- featureID
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |