deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.ogcwebservices.wfs.operation
Class LockFeature

java.lang.Object
  extended by org.deegree.ogcwebservices.AbstractOGCWebServiceRequest
      extended by org.deegree.ogcwebservices.wfs.operation.AbstractWFSRequest
          extended by org.deegree.ogcwebservices.wfs.operation.LockFeature
All Implemented Interfaces:
java.io.Serializable, OGCWebServiceRequest

public class LockFeature
extends AbstractWFSRequest

Represents a LockFeature request to a web feature service.

Web connections are inherently stateless. Unfortunately, this means that the semantics of serializable transactions are not preserved. To understand the issue consider an UPDATE operation.

The client fetches a feature instance. The feature is then modified on the client side, and submitted back to the database, via a Transaction request for update. Serializability is lost since there is nothing to guarantee that while the feature was being modified on the client side, another client did not come along and update that same feature in the database.

One way to ensure serializability is to require that access to data be done in a mutually exclusive manner; that is while one transaction accesses a data item, no other transaction can modify the same data item. This can be accomplished by using locks that control access to the data.

The purpose of the LockFeature interface is to expose a long term feature locking mechanism to ensure consistency. The lock is considered long term because network latency would make feature locks last relatively longer than native commercial database locks.

The LockFeature interface is optional and need only be implemented if the underlying datastore supports (or can be made to support) data locking. In addition, the implementation of locking is completely opaque to the client.

Version:
$Revision: 18195 $
Author:
Andreas Poth , Markus Schneider, last edited by: $Author: mschneider $
See Also:
Serialized Form

Nested Class Summary
static class LockFeature.ALL_SOME_TYPE
          Known lock actions.
 
Field Summary
static java.lang.String DEFAULT_EXPIRY
          Default value for expiry (in minutes).
static java.lang.String LOCK_ACTION_ALL
          String value for ALL_SOME_TYPE.ALL.
static java.lang.String LOCK_ACTION_SOME
          String value for ALL_SOME_TYPE.SOME.
 
Fields inherited from class org.deegree.ogcwebservices.wfs.operation.AbstractWFSRequest
FORMAT_GML2, FORMAT_GML2_WFS100, FORMAT_GML3, FORMAT_XML
 
Constructor Summary
LockFeature(java.lang.String version, java.lang.String id, java.lang.String handle, long expiry, LockFeature.ALL_SOME_TYPE lockAction, java.util.List<Lock> locks)
          Creates a new LockFeature instance from the given parameters.
 
Method Summary
static LockFeature create(java.util.Map<java.lang.String,java.lang.String> kvp)
          Creates a new LockFeature request from the given parameter map.
static LockFeature create(java.lang.String id, org.w3c.dom.Element root)
          Creates a new LockFeature instance from a document that contains the DOM representation of the request.
static LockFeature create(java.lang.String version, java.lang.String id, java.lang.String handle, long expiry, LockFeature.ALL_SOME_TYPE lockAction, java.util.List<Lock> locks)
          Creates a new LockFeature instance from the given parameters.
 long getExpiry()
          Returns the limit on how long the web feature service holds the lock in the event that a transaction is never issued that would release the lock.
 LockFeature.ALL_SOME_TYPE getLockAction()
          Returns the mode for lock acquisition.
 java.util.List<Lock> getLocks()
          Returns the contained lock operations.
 void guessMissingNamespaces(WFService wfs)
          Adds missing namespaces in the names of targeted feature types.
 boolean lockAllFeatures()
          Returns whether this request requires that all features have to be lockable in order to be performed succesfully.
(package private) static LockFeature.ALL_SOME_TYPE validateLockAction(java.lang.String lockActionString)
          Ensures that given lock action String is valid and returns the corresponding LockFeature.ALL_SOME_TYPE.
 
Methods inherited from class org.deegree.ogcwebservices.wfs.operation.AbstractWFSRequest
checkServiceParameter, checkVersionParameter, extractBBOXFilter, extractFilters, extractNamespaceParameter, extractTypeNames, getHandle, getServiceName
 
Methods inherited from class org.deegree.ogcwebservices.AbstractOGCWebServiceRequest
getId, getParam, getParamAsInt, getParamValues, getRequestParameter, getRequiredParam, getVendorSpecificParameter, getVendorSpecificParameters, getVersion, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_EXPIRY

public static java.lang.String DEFAULT_EXPIRY
Default value for expiry (in minutes).


LOCK_ACTION_ALL

public static java.lang.String LOCK_ACTION_ALL
String value for ALL_SOME_TYPE.ALL.


LOCK_ACTION_SOME

public static java.lang.String LOCK_ACTION_SOME
String value for ALL_SOME_TYPE.SOME.

Constructor Detail

LockFeature

LockFeature(java.lang.String version,
            java.lang.String id,
            java.lang.String handle,
            long expiry,
            LockFeature.ALL_SOME_TYPE lockAction,
            java.util.List<Lock> locks)
Creates a new LockFeature instance from the given parameters.

Parameters:
version - request version
id - id of the request
handle - handle of the request
expiry - the limit on how long the web feature service keeps the lock (in milliseconds)
lockAction - method for lock acquisition
locks - contained lock operations
Method Detail

create

public static LockFeature create(java.lang.String version,
                                 java.lang.String id,
                                 java.lang.String handle,
                                 long expiry,
                                 LockFeature.ALL_SOME_TYPE lockAction,
                                 java.util.List<Lock> locks)
Creates a new LockFeature instance from the given parameters.

Parameters:
version - request version
id - id of the request
handle - handle of the request
expiry - the limit on how long the web feature service holds the lock (in milliseconds)
lockAction - method for lock acquisition
locks - contained lock operations
Returns:
new LockFeature request

create

public static LockFeature create(java.lang.String id,
                                 org.w3c.dom.Element root)
                          throws OGCWebServiceException
Creates a new LockFeature instance from a document that contains the DOM representation of the request.

Parameters:
id - of the request
root - element that contains the DOM representation of the request
Returns:
new LockFeature request
Throws:
OGCWebServiceException

create

public static LockFeature create(java.util.Map<java.lang.String,java.lang.String> kvp)
                          throws InconsistentRequestException,
                                 InvalidParameterValueException,
                                 MissingParameterValueException
Creates a new LockFeature request from the given parameter map.

Parameters:
kvp - key-value pairs, keys have to be uppercase
Returns:
new LockFeature request
Throws:
InconsistentRequestException
InvalidParameterValueException
MissingParameterValueException

getExpiry

public long getExpiry()
Returns the limit on how long the web feature service holds the lock in the event that a transaction is never issued that would release the lock. The expiry limit is specified in milliseconds.

Returns:
the limit on how long the web feature service holds the lock (in milliseconds)

getLockAction

public LockFeature.ALL_SOME_TYPE getLockAction()
Returns the mode for lock acquisition.

Returns:
the mode for lock acquisition
See Also:
LockFeature.ALL_SOME_TYPE

lockAllFeatures

public boolean lockAllFeatures()
Returns whether this request requires that all features have to be lockable in order to be performed succesfully.

Returns:
true, if all features have to be lockable, false otherwise
See Also:
LockFeature.ALL_SOME_TYPE

getLocks

public java.util.List<Lock> getLocks()
Returns the contained lock operations.

Returns:
the contained lock operations

guessMissingNamespaces

public void guessMissingNamespaces(WFService wfs)
Adds missing namespaces in the names of targeted feature types.

If the QualifiedName of a targeted type has a null namespace, the first qualified feature type name of the given WFService with the same local name is used instead.

Note: The method changes this request (the feature type names) and should only be called by the WFSHandler class.

Parameters:
wfs - WFService instance that is used for the lookup of proper (qualified) feature type names

validateLockAction

static LockFeature.ALL_SOME_TYPE validateLockAction(java.lang.String lockActionString)
                                             throws InvalidParameterValueException
Ensures that given lock action String is valid and returns the corresponding LockFeature.ALL_SOME_TYPE.

The given String must be either:

Parameters:
lockActionString - String to validate
Returns:
corresponding LockFeature.ALL_SOME_TYPE
Throws:
InvalidParameterValueException - if string is neither ALL nor SOME

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org