deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.feature.persistence.lock
Interface LockManager

All Known Implementing Classes:
DefaultLockManager

public interface LockManager

Keeps track of the lock state of the features stored in a FeatureStore.

Locked features cannot be updated or deleted except by transactions that specify their lock identifier.

Implementations must ensure that the active locks survive a restart of the VM (e.g. by persisting them in a database).

Version:
$Revision: 20580 $, $Date: 2009-11-04 18:47:14 +0100 (Mi, 04 Nov 2009) $
Author:
Markus Schneider, last edited by: $Author: mschneider $

Method Summary
 Lock acquireLock(LockOperation[] lockRequests, boolean mustLockAll, long expireTimeout)
          Acquires a lock for the specified features instances.
 CloseableIterator<Lock> getActiveLocks()
          Returns all active locks.
 Lock getLock(String lockId)
          Returns the active lock with the given id.
 boolean isFeatureLocked(String fid)
          Returns whether an active lock on the specified feature exists.
 boolean isFeatureModifiable(String fid, String lockId)
          Returns whether the specified feature is modifiable for the owner of the specified lock.
 

Method Detail

acquireLock

Lock acquireLock(LockOperation[] lockRequests,
                 boolean mustLockAll,
                 long expireTimeout)
                 throws FeatureStoreException
Acquires a lock for the specified features instances.

If mustLockAll is true and not all of the specified features can be locked, a FeatureStoreException is thrown.

If no features have been locked at all, a lock will be issued, but the lock is not registered (as requested by the WFS spec.).

Parameters:
lockRequests - lock requests to be executed, must not be null
mustLockAll - if true, a FeatureStoreException is thrown if any of the requested feature instances could not be locked
expireTimeout - number of milliseconds before the lock is automatically released
Returns:
lock identifier, never null
Throws:
FeatureStoreException - if an internal error occurs or if mustLockAll is true and at least one feature could not be locked

getLock

Lock getLock(String lockId)
             throws FeatureStoreException
Returns the active lock with the given id.

Parameters:
lockId -
Returns:
the active lock with the given id
Throws:
FeatureStoreException

getActiveLocks

CloseableIterator<Lock> getActiveLocks()
                                       throws FeatureStoreException
Returns all active locks.

NOTE: The caller must invoke CloseableIterator.close() after it's not needed anymore -- otherwise, backing resources (such as database connections) may not be freed.

Returns:
an iterator for all locks
Throws:
FeatureStoreException

isFeatureLocked

boolean isFeatureLocked(String fid)
                        throws FeatureStoreException
Returns whether an active lock on the specified feature exists.

Parameters:
fid - id of the feature
Returns:
true, if an active lock on the feature exists, false otherwise
Throws:
FeatureStoreException

isFeatureModifiable

boolean isFeatureModifiable(String fid,
                            String lockId)
                            throws FeatureStoreException
Returns whether the specified feature is modifiable for the owner of the specified lock.

Parameters:
fid - id of the feature, must not be null
lockId - if of the lock, may be null (in this case the feature is only modifiable if the feature is not locked at all)
Returns:
true, if the feature is not locked at all or the specified lock matches the feature's lock, false otherwise
Throws:
FeatureStoreException

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>