org.geotools.data
Class Lock

java.lang.Object
  |
  +--org.geotools.data.Lock

public class Lock
extends java.lang.Object

Used to Lock features for long transaction operations.

This class is responsible for supplying a unique ID for TransactionDataSource locking operations.

Example:
 Lock lock = Lock.create( 1800 ); // expire in 18 min
 

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

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


Field Summary
private static int count
           
private  java.util.Date date
           
private  java.lang.String id
           
 
Constructor Summary
private Lock(java.lang.String id, java.util.Date date)
          Private constructor - use create factory method
 
Method Summary
static Lock create(int expire)
          Create a Lock for use.
 long getExpire()
          Time from now the lock will expire
 java.lang.String getID()
          LockId used for transaction authorization.
private static int nextIdNumber()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private final java.lang.String id

date

private final java.util.Date date

count

private static int count
Constructor Detail

Lock

private Lock(java.lang.String id,
             java.util.Date date)
Private constructor - use create factory method

Method Detail

getID

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


getExpire

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


create

public static Lock create(int expire)
Create a Lock for use.

Parameters:
expire - Time from now that the lock will expire.

nextIdNumber

private static int nextIdNumber()