Class ALcdWFSLock

java.lang.Object
com.luciad.ogc.wfs.ALcdWFSLock

public abstract class ALcdWFSLock extends Object
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:
  • 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

      public String 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 to aLockedFeaturesSFCT. The id's of features that could not be locked should be added to aNotLockedFeaturesSFCT.

      If aLockAction 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 an ILcdModel. If aLockAction is set to 'ALL' and one of the requested features can not be locked, a TLcdWFSServiceException 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)
      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.