public interface FeatureLocking<T extends FeatureType,F extends Feature> extends FeatureStore<T,F>
Features from individual shapefiles, database tables, etc. can be protected or reserved from modification through this interface.
To use please cast your SimpleFeatureSource to this interface.
SimpleFeatureSource source = dataStore.getFeatureSource("roads");
if( source instanceof FeatureLocking ) {
FeatureLocking locking = (FeatureLocking) source;
...
}
Modifier and Type | Interface and Description |
---|---|
static class |
FeatureLocking.Response
Idea for a response from a high-level lock( Query ) function.
|
Modifier and Type | Method and Description |
---|---|
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.
|
addFeatures, getTransaction, modifyFeatures, modifyFeatures, removeFeatures, setFeatures, setTransaction
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
void setFeatureLock(FeatureLock lock)
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:
lock
- FeatureLock configuration including authorization and requested durationint lockFeatures(Query query) throws IOException
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.
query
- Query describing the features to lockIOException
- Thrown if anything goes wrongint lockFeatures(Filter filter) throws IOException
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.
filter
- Filter describing the features to lockIOException
- Thrown if anything goes wrongint lockFeatures() throws IOException
The method does not prevent addFeatures() from being used (we could add a lockDataSource() method if this functionality is required.
IOException
void unLockFeatures() throws IOException
Authorization must be provided prior before calling this method.
void releaseLock( String lockId, LockingDataSource ds ){
ds.setAuthorization( "LOCK534" );
ds.unLockFeatures();
}
IOException
void unLockFeatures(Filter filter) throws IOException
Authorization must be provided prior before calling this method.
IOException
void unLockFeatures(Query query) throws IOException
Authorization must be provided prior before calling this method.
query
- Specifies fatures to unlockIOException
Copyright © 1996–2022 Geotools. All rights reserved.