org.geotools.data.directory
Class DirectoryFeatureLocking

Object
  extended by DirectoryFeatureSource
      extended by DirectoryFeatureStore
          extended by DirectoryFeatureLocking
All Implemented Interfaces:
FeatureLocking<SimpleFeatureType,SimpleFeature>, FeatureSource<SimpleFeatureType,SimpleFeature>, FeatureStore<SimpleFeatureType,SimpleFeature>, SimpleFeatureLocking, SimpleFeatureSource, SimpleFeatureStore

public class DirectoryFeatureLocking
extends DirectoryFeatureStore
implements SimpleFeatureLocking


Nested Class Summary
 
Nested classes/interfaces inherited from interface FeatureLocking
FeatureLocking.Response
 
Constructor Summary
DirectoryFeatureLocking(SimpleFeatureLocking locking)
           
 
Method Summary
 int lockFeatures()
          FeatureLock all Features.
 int lockFeatures(Filter filter)
          FeatureLock features described by Filter.
 int lockFeatures(Query query)
          FeatureLock features described by Query.
 void setFeatureLock(FeatureLock lock)
          All locking operations will operate against the provided lock.
 void unLockFeatures()
          Unlocks all Features.
 void unLockFeatures(Filter filter)
          Unlock Features denoted by provided filter.
 void unLockFeatures(Query query)
          Unlock Features denoted by provided query.
 SimpleFeatureLocking unwrap()
           
 
Methods inherited from class DirectoryFeatureStore
addFeatures, getTransaction, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, removeFeatureListener, removeFeatures, setFeatures, setTransaction
 
Methods inherited from class DirectoryFeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SimpleFeatureStore
getFeatures, getFeatures, getFeatures, modifyFeatures, modifyFeatures
 
Methods inherited from interface FeatureStore
addFeatures, getTransaction, modifyFeatures, modifyFeatures, modifyFeatures, modifyFeatures, removeFeatures, setFeatures, setTransaction
 
Methods inherited from interface FeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
 

Constructor Detail

DirectoryFeatureLocking

public DirectoryFeatureLocking(SimpleFeatureLocking locking)
Method Detail

lockFeatures

public int lockFeatures()
                 throws IOException
Description copied from interface: FeatureLocking
FeatureLock all Features.

The method does not prevent addFeatures() from being used (we could add a lockDataSource() method if this functionality is required.

Specified by:
lockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Returns:
Number of Features locked by this opperation
Throws:
IOException

lockFeatures

public int lockFeatures(Filter filter)
                 throws IOException
Description copied from interface: FeatureLocking
FeatureLock features described by Filter.

To implement WFS parcial Locking retrieve your features with a query operation first before trying to lock them individually. If you are not into WFS please don't ask what parcial locking is.

Specified by:
lockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Parameters:
filter - Filter describing the features to lock
Returns:
Number of features locked
Throws:
IOException - Thrown if anything goes wrong

setFeatureLock

public void setFeatureLock(FeatureLock lock)
Description copied from interface: FeatureLocking
All locking operations will operate against the provided lock.

This in in keeping with the stateful spirit of DataSource in which operations are against the "current" transaction. If a FeatureLock is not provided lock operations will only be applicable for the current transaction (they will expire on the next commit or rollback).

That is lockFeatures() operations will:

Calling this method with setFeatureLock( FeatureLock.TRANSACTION ) will revert to per transaction operation.

This design allows for the following:

Specified by:
setFeatureLock in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Parameters:
lock - DOCUMENT ME!

lockFeatures

public int lockFeatures(Query query)
                 throws IOException
Description copied from interface: FeatureLocking
FeatureLock features described by Query.

To implement WFS parcial Locking retrieve your features with a query operation first before trying to lock them individually. If you are not into WFS please don't ask what parcial locking is.

Specified by:
lockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Parameters:
query - Query describing the features to lock
Returns:
Number of features locked
Throws:
IOException - Thrown if anything goes wrong

unLockFeatures

public void unLockFeatures()
                    throws IOException
Description copied from interface: FeatureLocking
Unlocks all Features.

Authorization must be provided prior before calling this method.


 void releaseLock( String lockId, LockingDataSource ds ){
    ds.setAuthorization( "LOCK534" );
    ds.unLockFeatures();
 }
 

Specified by:
unLockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Throws:
IOException

unLockFeatures

public void unLockFeatures(Filter filter)
                    throws IOException
Description copied from interface: FeatureLocking
Unlock Features denoted by provided filter.

Authorization must be provided prior before calling this method.

Specified by:
unLockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Throws:
IOException

unLockFeatures

public void unLockFeatures(Query query)
                    throws IOException
Description copied from interface: FeatureLocking
Unlock Features denoted by provided query.

Authorization must be provided prior before calling this method.

Specified by:
unLockFeatures in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
Parameters:
query - Specifies fatures to unlock
Throws:
IOException

unwrap

public SimpleFeatureLocking unwrap()
Overrides:
unwrap in class DirectoryFeatureStore


Copyright © 1996-2014 Geotools. All Rights Reserved.