## org.opengis.feature
Interface LockResponse

    @XmlElement(value="LockFeatureResponse")
    public interface LockResponse

Represents a response for a lock request. A lock is requested for a duration, except for the special case of a `TRANSACTION_LOCK` where the request is until the next commit or rollback.

A successful lock request will result in an authorization ID being generated. This is a simple token you can keep until you need to work with the content again. Without this token you are prevented from work (at least until the duration is up).

Since:
  GeoAPI 2.0

Method Summary
`void` `addAuthorization(FeatureStore store, String token)` Add an additional authorization token to collected results for `Transaction.commit()`.
`String` `getAuthorization(FeatureStore store)` Returns the authorization token for indicated feature store, or null if there is no locks known for the feature store.
`Set<FeatureStore>` `getFeatureStores()` Returns the set of locked feature stores.
`int` `getNumberLocked()` Number of features successfully locked, or -1 if unknown In the rare case where you need to report back on the number of successful locks you can issue a bunch of individual lock request and check the number of features locked.
`String` `getToken()` Retreives the authorization token for the special case of only one `FeatureStore` being locked.
`void` `increaseNumberLocked(int amount)` Used to collect the results of a number of lock requests for `Transaction.commit()`.

Method Detail

### getNumberLocked

    int getNumberLocked()

  Number of features successfully locked, or -1 if unknown In the rare case where you need to report back on the number of successful locks you can issue a bunch of individual lock request and check the number of features locked.

  Returns:
    number of locked features or -1 if unknown.

### increaseNumberLocked

    void increaseNumberLocked(int amount)

  Used to collect the results of a number of lock requests for `Transaction.commit()`.

### addAuthorization

    void addAuthorization(FeatureStore store,
                          String token)

  Add an additional authorization token to collected results for `Transaction.commit()`. Note this abstraction does not allow the collection of more than one token per `FeatureStore`. This should not be an issue give our two workflows:
  - `AUTO_COMMIT`: Each lock method returns a different `LockResponse`.
  - `Transaction` + `TRANSACTION_LOCK`: Sepcial case object `TRANSACTION_LOCK_RESPONSE` is always returned.
  - `Transaction`: Each lock method returns null, commit returns a single `LockResponse`. Given that a `Transaction` is supposed to gather everything up into a single commit, a datastore should be capable of issuing a single authorization token (even if more then one of its `FeatureCollection`s was involved in the transaction.

### getToken

    @XmlElement(value="LockID")
    String getToken()

  Retreives the authorization token for the special case of only one `FeatureStore` being locked. This is the most common situation. Often client code will only work on one `FeatureCollection` at a time, or several `FeatureCollection`s belonging to the same `FeatureStore`.

  Returns:
    token, or null if a single token was unavailable.
  TODO:
    Consider renaming this method as `getAuthorization()` for consistency with `getAuthorization(org.opengis.feature.FeatureStore)` and the rest of feature API.

### getAuthorization

    String getAuthorization(FeatureStore store)

  Returns the authorization token for indicated feature store, or null if there is no locks known for the feature store.

  Parameters:
    `store` - The feature store to search for.
  Returns:
    token, or null if a token for feature store was unavailable.

### getFeatureStores

    @XmlElement(value="FeaturesLocked")
    Set<FeatureStore> getFeatureStores()

  Returns the set of locked feature stores.

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.