Package com.luciad.ogc.wfs
Class ALcdWFSLock
java.lang.Object
com.luciad.ogc.wfs.ALcdWFSLock
A base class for locks.
This class should be implemented to support
a custom locking mechanism in a WFS-T server.
- Since:
- 10.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumeration that corresponds to the 'LockAction' attribute of 'GetFeaturesWithLock' and 'LockFeatures' requests. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the duration for which this lock is valid after its creation time in seconds.abstract ILcdModel
getFeaturesWithLock
(TLcdWFSGetFeatureConstraints aConstraints, ALcdWFSLock.LockAction aLockAction, TLcdWFSRequestContext aContext) Tries to acquire a lock on features and returns the locked features as anILcdModel
.getId()
Returns the server-wide unique id of this lock.boolean
isValid()
Returns whether this lock is valid based on its expiry.abstract void
lockFeaturesSFCT
(List<TLcdWFSGetFeatureConstraints> aConstraints, ALcdWFSLock.LockAction aLockAction, TLcdWFSRequestContext aRequestContext, List<String> aLockedFeaturesSFCT, List<String> aNotLockedFeaturesSFCT) Tries to acquire a lock on features.void
setExpiry
(long aExpiry) Sets the expiry of a lock, can be used after initialization, or to refresh the lock.abstract void
Unlocks all features that are locked by this lock.abstract void
unlockFeatures
(Map<ILcdWFSFeatureType, List<Object>> aFeatures, TLcdWFSRequestContext aContext) Unlocks all the specified features.
-
Constructor Details
-
ALcdWFSLock
public ALcdWFSLock()Creates a lock. The expiry of a lock is relative to the time when this constructor has been called.
-
-
Method Details
-
getId
Returns the server-wide unique id of this lock.- Returns:
- An id which identifies this lock.
-
getExpiry
public long getExpiry()Returns the duration for which this lock is valid after its creation time in seconds.- Returns:
- A valid expiry.
-
setExpiry
public void setExpiry(long aExpiry) Sets the expiry of a lock, can be used after initialization, or to refresh the lock. The expiry is always relative to the initial creation time of the lock. The expiry of a lock can only be changed if the lock is still valid. A negative expiry results in an immediate invalidation of the lock.- Parameters:
aExpiry
- a valid expiry.
-
isValid
public boolean isValid()Returns whether this lock is valid based on its expiry.- Returns:
- true if the lock is valid, false otherwise.
-
lockFeaturesSFCT
public abstract void lockFeaturesSFCT(List<TLcdWFSGetFeatureConstraints> aConstraints, ALcdWFSLock.LockAction aLockAction, TLcdWFSRequestContext aRequestContext, List<String> aLockedFeaturesSFCT, List<String> aNotLockedFeaturesSFCT) throws TLcdWFSServiceException Tries to acquire a lock on features. The features to be locked are defined by a list of constraints. This method should add all id's of features that have been locked toaLockedFeaturesSFCT
. The id's of features that could not be locked should be added toaNotLockedFeaturesSFCT
. IfaLockAction
is set to 'ALL'aNotLockedFeaturesSFCT
should be empty if all features are successfully locked, otherwise an exception should be thrown to indicate that not all features could be locked.- Parameters:
aConstraints
- the constraints that specify which features should be locked.aLockAction
- specifies whether this method should only lock features if 'ALL' features can be locked, or also if only 'SOME' features can be locked.aRequestContext
- a request context.aLockedFeaturesSFCT
- a list to which all id's of locked features should be added.aNotLockedFeaturesSFCT
- a list to which all id's of features which could not be locked should be added.- Throws:
TLcdWFSServiceException
- An exception which will be returned to the client in case anything goes wrong, or if the lock action is set to 'ALL' and not all features can be locked.
-
getFeaturesWithLock
public abstract ILcdModel getFeaturesWithLock(TLcdWFSGetFeatureConstraints aConstraints, ALcdWFSLock.LockAction aLockAction, TLcdWFSRequestContext aContext) throws TLcdWFSServiceException Tries to acquire a lock on features and returns the locked features as anILcdModel
. IfaLockAction
is set to 'ALL' and one of the requested features can not be locked, aTLcdWFSServiceException
is thrown.- Parameters:
aConstraints
- the constraints that define the features that should be locked.aLockAction
- specifies whether this method should only lock features if 'ALL' features can be locked, or also if only 'SOME' features can be locked.aContext
- a request context.- Returns:
- an ILcdModel that contains only features that satisfy one of the constraints in aConstraints, and that are locked by this lock.
- Throws:
TLcdWFSServiceException
- if the operation fails.
-
unlockFeatures
public abstract void unlockFeatures(Map<ILcdWFSFeatureType, List<Object>> aFeatures, TLcdWFSRequestContext aContext) Unlocks all the specified features. This method is used if a transaction with a release action of 'SOME' has been applied successfully to features locked by this lock. The objects stored inaFeatures
are the same objects as the ones returned byALcdWFSTransactionHandler.handleUpdateSFCT(com.luciad.ogc.wfs.ILcdWFSFeatureType, java.util.List<com.luciad.ogc.wfs.TLcdWFSTransactionUpdateProperty>, java.util.List<java.lang.Object>, java.util.List<java.lang.Object>, com.luciad.ogc.filter.model.TLcdOGCFilter, java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
, and/orALcdWFSTransactionHandler.handleDeleteSFCT(com.luciad.ogc.wfs.ILcdWFSFeatureType, java.util.List<java.lang.Object>, com.luciad.ogc.filter.model.TLcdOGCFilter, java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
.- Parameters:
aFeatures
- a map containing a list of features which should be unlocked for each feature type.aContext
- a request context.
-
unlockAllFeatures
public abstract void unlockAllFeatures()Unlocks all features that are locked by this lock. This method is used when a transaction specifies 'ALL' as release action.
-