org.geotools.data
Class DefaultFeatureLock

java.lang.Object
  extended byorg.geotools.data.DefaultFeatureLock
All Implemented Interfaces:
FeatureLock

public class DefaultFeatureLock
extends java.lang.Object
implements FeatureLock

Used to lock features when used with LockingDataSource.

This class is responsible for supplying a unique Authorization ID and expirery date for LockingDataSource locking operations.

Example:
 FeatureLock lock1 = FeatureLockFactory.generate( 18*60*60 ); // expire in 18 min
 FeatureLock lock3 = FeatureLockFactory.generate( "MyLock", 30*60*60 ); // expire in 30 min
 

Although it is tempting to have these FeatureLock objects stored in a static repository in the manner of GeoServer's TypeRepository.InternalLock - that decision should be left to the individual DataSources.

An AbstractLockingDataSource with appropriate overrideable callbacks may be an elegent way to acomplish this.

Author:
jgarnett, Refractions Research, Inc.

See Also:
http://vwfs.refractions.net/docs/Database_Research.pdf, http://vwfs.refractions.net/docs/Transactional_WFS_Design.pdf, http://vwfs.refractions.net/docs/Design_Implications.pdf

Field Summary
 
Fields inherited from interface org.geotools.data.FeatureLock
TRANSACTION
 
Method Summary
 java.lang.String getAuthorization()
          LockId used for transaction authorization.
 long getDuration()
          Time from now the lock will expire
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAuthorization

public java.lang.String getAuthorization()
LockId used for transaction authorization.

Specified by:
getAuthorization in interface FeatureLock
Returns:
A string of the LockId.

getDuration

public long getDuration()
Time from now the lock will expire

Specified by:
getDuration in interface FeatureLock
Returns:
A long of the time till the lock expires.


Copyright © GeoTools. All Rights Reserved.