State machine for WFS locking

Copyright © 2010 Open Geospatial Consortium 75 A service shall support the ability to lock more than one set of features where each feature may only be locked by one lock. Each of the locks is independent when viewed from the service defined by the WFS specification. LockFeature Request Lock Active Lock Processing Transaction Some lock requests failed Lock action = All LockFeature Response Some lock requests failed Lock action = Some LockFeature Response All lock requests succeeded LockFeature Response Transaction Request Error occurs, e.g., invalid lock Transaction Response Requesting Lock Lock expires Processing complete, Some features not modified, Release action = some Set lock ID = valid, Transaction Response Transaction Request Set lock ID = invalid, LockFeature Response Processing complete Release action = all Transaction Response Processing complete, All features modified, Release action = some Transaction Response All lock requests failed LockFeature Response Figure 20 — State diagram for a WFS lock 12.3 Response

12.3.1 Response semantics

Figure 21 describes the schema of a LockFeature response. LockFeatureResponse + lock Id : CharacterString + feat uresLocked [0..] : ResourceId + feat uresNotLoc ked [ 0..] : ResourceId Figure 21 — LockFeature response 76 Copyright © 2010 Open Geospatial Consortium

12.3.2 XML-encoding

The following XML Schema fragment defines the XML encoding of a LockFeature response: xsd:element name=LockFeatureResponse type=wfs:LockFeatureResponseType xsd:complexType name=LockFeatureResponseType xsd:sequence xsd:element name=FeaturesLocked type=wfs:FeaturesLockedType minOccurs=0 xsd:element name=FeaturesNotLocked type=wfs:FeaturesNotLockedType minOccurs=0 xsd:sequence xsd:attribute name=lockId type=xsd:string xsd:complexType xsd:complexType name=FeaturesLockedType xsd:sequence maxOccurs=unbounded xsd:element ref=fes:ResourceId xsd:sequence xsd:complexType xsd:complexType name=FeaturesNotLockedType xsd:sequence maxOccurs=unbounded xsd:element ref=fes:ResourceId xsd:sequence xsd:complexType In response to a LockFeature request, a web feature service shall generate a wfs:LockFeatureResponse element. This document shall contain a lock identifier that a client application may use in subsequent WFS operations to operate upon the set of locked feature instances. The response may also contain the optional elements wfs:FeaturesLocked and wfs:FeaturesNotLocked depending on the value of the lockAction attribute see 13.2.4.2. If the lock action is specified as ALL and all identified feature instances are successfully locked, a WFS shall respond with a wfs:WFS_LockFeatureResponse element that contains the wfs:FeaturesLocked element and no wfs:FeatureNotLocked element since either all identified feature instances may be locked or none at all. If some or all feature instances cannot be locked, a WFS shall respond with an exception indicating that the lock request failed because some or all feature instances are locked by other clients. If the lock action is specified as SOME, then the wfs:WFS_LockFeatureResponse element shall contain the wfs:FeaturesLocked and wfs:FeatureNotLocked elements. The wfs:FeaturesLocked element shall list the feature identifiers of all the feature instances that were locked by the LockFeature request. The wfs:FeaturesNotLocked element shall contain a list of feature identifiers for the feature instances that could not be locked by the web feature service possibly because they were already locked by someone else. If the lock request results in no features being locked, then a WFS shall respond with wfs:LockFeatureResponse document that contains a value for the lockId attribute but that contains neither a wfs:FeaturesLocked element nor a wfs:FeatureNotLocked element. In other words, an empty response. After the request is completed, the lockId shall be immediately released since no resources were locked. If that same lockId is used in a subsequent transaction an InvalidLockId exception shall be raised, as described in 7.5, since that lockId value no longer exists. No assumption is made about the format of the lock identifier. The only requirement is that it can be expressed in the character set of the transaction request.

12.4 Exceptions

If a WFS does not implement the LockFeature operation then it shall generate an OperationNotSupported exception, indicating that the operation is not supported, if such a request is encountered. In the event that a web feature service does support the LockFeature operation and encounters an error parsing the request, it shall raise an OperationParsingFailed exception as described in 7.5. In the event that a web feature service does support the LockFeature operation and encounters an error processing the request, it shall raise an OperationProcessingFailed exception as described in 7.5.