|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.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.
Field Summary | |
protected java.util.Map |
lockTables
lockTable access by typeName stores Transactions or MemoryLocks |
Constructor Summary | |
InProcessLockingManager()
|
Method Summary | |
protected java.util.Set |
allLocks()
Set of all locks. |
void |
assertAccess(java.lang.String typeName,
java.lang.String featureID,
Transaction transaction)
Checks mutability of featureID for this transaction. |
FeatureWriter |
checkedWriter(FeatureWriter writer,
Transaction transaction)
Provides a wrapper on the provided writer that checks locks. |
protected org.geotools.data.InProcessLockingManager.Lock |
createLock(Transaction transaction,
FeatureLock featureLock)
Creates the right sort of In-Process Lock. |
boolean |
exists(java.lang.String authID)
Implment lockExists. |
protected org.geotools.data.InProcessLockingManager.Lock |
getLock(java.lang.String typeName,
java.lang.String featureID)
Lock for typeName & featureID if it exists. |
boolean |
isLocked(java.lang.String typeName,
java.lang.String featureID)
Used by test cases |
void |
lockFeatureID(java.lang.String typeName,
java.lang.String featureID,
Transaction transaction,
FeatureLock featureLock)
Aquire lock on featureID. |
protected java.util.Map |
locks(java.lang.String typeName)
Access to a Map of locks for typeName |
boolean |
refresh(java.lang.String authID,
Transaction transaction)
Refresh locks held by the authorization authID .
|
boolean |
release(java.lang.String authID,
Transaction transaction)
Release locks held by the authorization authID .
|
void |
unLockFeatureID(java.lang.String typeName,
java.lang.String featureID,
Transaction transaction,
FeatureLock featureLock)
Release indicated featureID, must have correct authroization. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Map lockTables
Constructor Detail |
public InProcessLockingManager()
Method Detail |
public void lockFeatureID(java.lang.String typeName, java.lang.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 org.geotools.data.InProcessLockingManager.Lock getLock(java.lang.String typeName, java.lang.String featureID)
This method will not return expired locks.
typeName
- featureID
-
protected org.geotools.data.InProcessLockingManager.Lock createLock(Transaction transaction, FeatureLock featureLock) throws FeatureLockException
transaction
- featureLock
-
FeatureLockException
- When a Transaction lock is requested
against Transaction.AUTO_COMMITprotected java.util.Map locks(java.lang.String typeName)
typeName
- typeName
protected java.util.Set allLocks()
public void assertAccess(java.lang.String typeName, java.lang.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 checkedWriter(FeatureWriter writer, Transaction transaction)
writer
- FeatureWriter requiring access controltransaction
- Transaction being used
public void unLockFeatureID(java.lang.String typeName, java.lang.String featureID, Transaction transaction, FeatureLock featureLock) throws java.io.IOException
unLockFeatureID
in interface LockingManager
typeName
- featureID
- transaction
- featureLock
-
java.io.IOException
- If lock could not be releasedpublic boolean refresh(java.lang.String authID, Transaction transaction) throws java.io.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
java.io.IOException
- If transaction not authorized to refresh authID
java.lang.IllegalArgumentException
- If authID or transaction not providedpublic boolean release(java.lang.String authID, Transaction transaction) throws java.io.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
java.io.IOException
- If transaction not authorized to release authID
java.lang.IllegalArgumentException
- If authID or transaction not providedpublic boolean exists(java.lang.String authID)
Remeber lock may have expired.
exists
in interface LockingManager
authID
-
org.geotools.data.LockingManager#lockExists(java.lang.String)
public boolean isLocked(java.lang.String typeName, java.lang.String featureID)
typeName
- featureID
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |