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

org.deegree.feature.persistence.lock
Class DefaultLock

java.lang.Object
  extended by org.deegree.feature.persistence.lock.DefaultLock
All Implemented Interfaces:
Lock

 class DefaultLock
extends Object
implements Lock

Lock implementation that is based on an SQL database.

Version:
$Revision: 21300 $, $Date: 2009-12-07 22:38:20 +0100 (Mo, 07 Dez 2009) $
Author:
Markus Schneider, last edited by: $Author: mschneider $
See Also:
DefaultLockManager

Constructor Summary
DefaultLock(DefaultLockManager manager, String jdbcConnId, String id, Date acquired, Date expires, int numLocked, int numFailed)
          Creates a new DefaultLock instance.
 
Method Summary
 CloseableIterator<String> getFailedToLockFeatures()
          Returns the ids of all features that have been requested to be locked, but which couldn't.
 String getId()
          Returns the lock identifier.
 CloseableIterator<String> getLockedFeatures()
          Returns the ids of all locked features.
 int getNumFailedToLock()
          Returns the number of features that have been requested to be locked, but which couldn't.
 int getNumLocked()
          Returns the number of locked features.
 boolean isLocked(String fid)
          Returns whether this Lock involves the specified feature.
 void release()
          Releases all locked features (invalidates the lock).
 void release(QName ftName, Filter filter)
          Releases the specified features from the lock.
 void release(String fid)
          Releases the specified feature from the lock (if it was locked).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultLock

DefaultLock(DefaultLockManager manager,
            String jdbcConnId,
            String id,
            Date acquired,
            Date expires,
            int numLocked,
            int numFailed)
Creates a new DefaultLock instance.

Parameters:
manager - corresponding DefaultLockManager instance, must not be null
jdbcConnId - id of the JDBC connection, must not be null
id - lock id, must not be null
acquired - time that the lock has been acquired, never null
expires - time that the lock will expire, never null
numLocked - number of locked features
numFailed - number of features that have been requested to be locked, but which couldn't
Method Detail

getId

public String getId()
Description copied from interface: Lock
Returns the lock identifier.

Specified by:
getId in interface Lock
Returns:
the lock identifier

getNumLocked

public int getNumLocked()
Description copied from interface: Lock
Returns the number of locked features.

Specified by:
getNumLocked in interface Lock
Returns:
the number of locked features

getNumFailedToLock

public int getNumFailedToLock()
Description copied from interface: Lock
Returns the number of features that have been requested to be locked, but which couldn't.

Specified by:
getNumFailedToLock in interface Lock
Returns:
the number of features that have been requested to be locked, but which couldn't

getLockedFeatures

public CloseableIterator<String> getLockedFeatures()
                                            throws FeatureStoreException
Description copied from interface: Lock
Returns the ids of all locked features.

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

Specified by:
getLockedFeatures in interface Lock
Returns:
an iterator for all locked feature ids
Throws:
FeatureStoreException

getFailedToLockFeatures

public CloseableIterator<String> getFailedToLockFeatures()
                                                  throws FeatureStoreException
Description copied from interface: Lock
Returns the ids of all features that have been requested to be locked, but which couldn't.

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

Specified by:
getFailedToLockFeatures in interface Lock
Returns:
an iterator for all locked feature ids
Throws:
FeatureStoreException

isLocked

public boolean isLocked(String fid)
                 throws FeatureStoreException
Description copied from interface: Lock
Returns whether this Lock involves the specified feature.

Specified by:
isLocked in interface Lock
Parameters:
fid - id of the feature
Returns:
true, if the feature is involved, false otherwise
Throws:
FeatureStoreException

release

public void release()
             throws FeatureStoreException
Description copied from interface: Lock
Releases all locked features (invalidates the lock).

Specified by:
release in interface Lock
Throws:
FeatureStoreException

release

public void release(String fid)
             throws FeatureStoreException
Description copied from interface: Lock
Releases the specified feature from the lock (if it was locked).

Specified by:
release in interface Lock
Parameters:
fid - id of the feature
Throws:
FeatureStoreException

release

public void release(QName ftName,
                    Filter filter)
             throws FeatureStoreException
Description copied from interface: Lock
Releases the specified features from the lock.

Specified by:
release in interface Lock
Throws:
FeatureStoreException

toString

public String toString()
Overrides:
toString in class Object

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

]]>