Package com.luciad.ogc.wfs
Class ALcdWFSTransactionHandler
java.lang.Object
com.luciad.ogc.wfs.ALcdWFSTransactionHandler
An interface for handling WFS-T transactions. This class should be
implemented in case a WFS-T wants to do custom handling of transactions. This
allows users to more efficiently apply changes to an underlying data store.
When a transaction request is received by the request handler, a new
ALcdWFSTransactionHandler
instance is created. Each action of
the request will result in a call to a method of that new instance. The order
of the calls will always match the order of actions in the request.
After all actions have been successfully handled, the commit(java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
method is called. When an error occurs before this call, the
rollback(com.luciad.ogc.wfs.TLcdWFSRequestContext)
method is called.- Since:
- 10.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
commit
(String aHandle, TLcdWFSRequestContext aContext) Commits this transaction to the data store.abstract int
handleDeleteSFCT
(ILcdWFSFeatureType aFeatureType, List<Object> aDeletedFeaturesSFCT, TLcdOGCFilter aFilter, String aHandle, TLcdWFSRequestContext aContext) Handles a delete action of a transaction request.handleInsert
(ILcdWFSFeatureType aFeatureType, List<Object> aNewFeatures, String aHandle, TLcdWFSRequestContext aContext) Handles an insert action of a transaction request.abstract int
handleUpdateSFCT
(ILcdWFSFeatureType aFeatureType, List<TLcdWFSTransactionUpdateProperty> aUpdateProperties, List<Object> aUpdatedFeatureTokensSFCT, List<Object> aNewFeatureTokensSFCT, TLcdOGCFilter aFilter, String aHandle, TLcdWFSRequestContext aContext) Handles an update action of a transaction request.abstract void
rollback
(TLcdWFSRequestContext aContext) Rolls back a transaction which is in progress, this method is called whenever an exception occurs before a transaction is committed.
-
Constructor Details
-
ALcdWFSTransactionHandler
public ALcdWFSTransactionHandler()
-
-
Method Details
-
handleInsert
public abstract List<Object> handleInsert(ILcdWFSFeatureType aFeatureType, List<Object> aNewFeatures, String aHandle, TLcdWFSRequestContext aContext) throws TLcdWFSServiceException Handles an insert action of a transaction request. This method takes any previous updates, deletes or inserts into account when applying the action. If atomic transactions should be supported, this method should not commit the result of this action beforecommit(java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
is called.- Parameters:
aFeatureType
- the feature type of the features inaNewFeatures
.aNewFeatures
- a List containing features of the sameILcdWFSFeatureType
in the native format of the feature type.aHandle
- a handle that identifies this insert action in the request, or null if it is not specified.aContext
- the request context.- Returns:
- A
List
of inserted features. No assumptions are being made about the type of objects in theList
. The objects can be used with theILcdOGCFeatureIdRetriever
to obtain the feature ids of the inserted features. ThisList
does not have to contain the same objects asaNewFeatures
, but the order should be respected. - Throws:
TLcdWFSServiceException
- in case the action could not be executed and the transaction should be aborted.
-
handleUpdateSFCT
public abstract int handleUpdateSFCT(ILcdWFSFeatureType aFeatureType, List<TLcdWFSTransactionUpdateProperty> aUpdateProperties, List<Object> aUpdatedFeatureTokensSFCT, List<Object> aNewFeatureTokensSFCT, TLcdOGCFilter aFilter, String aHandle, TLcdWFSRequestContext aContext) throws TLcdWFSServiceException Handles an update action of a transaction request. This method takes any previous updates, deletes or inserts into account when applying the action. In case atomic transactions should be supported, this method should not commit the result of this action beforecommit(java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
is called. It is possible to remove a given property by setting the value corresponding to the name of that property to null, however a WFS should throw an exception in case the update tries to remove a required property. The return value of this method is the number of updated features, but as a side effect it should also fill in twoList
s of feature 'tokens'. In this context, a feature token is any Object which can be passed on to anILcdOGCFeatureIdRetriever
to retrieve feature id's or anALcdWFSLock
to unlock features. The first List,aUpdatedFeatureTokensSFCT
is used to unlock features that were affected by this request in case the lockAction attribute was set to 'SOME'. Next to that, it can also be used to retrieve the feature id's of the features affected by this update. This is mostly important when the server supports versioning which causes the feature id's to change after an update. When this List is not filled in, the server will not be able to selectively unlock features affected by this transaction. Only if the lockAction is set to 'ALL', the lock will be released. The server will also assume that no updated feature id's should be returned to the client. The second List,aNewFeatureTokensSFCT
is used to determine the new feature id's in case the update caused those to change. This is usually the case when the server supports versioning. The length of this List should always match the length ofaUpdatedFeatureTokensSFCT
.- Parameters:
aFeatureType
- the feature type of the features to be updated.aUpdateProperties
- a List containing the updates which should be applied.aUpdatedFeatureTokensSFCT
- an empty List which is to be filled with feature 'tokens'. These 'tokens' can be used to retrieve the id's of features that are affected, and to unlock those features.aNewFeatureTokensSFCT
- an empty List which can be used to store the feature 'tokens' that are the result of updating the features inaUpdatedFeatureTokensSFCT
, this List is only relevant if the server supports versioning.aFilter
- a filter which specifies the features that should be updated.aHandle
- a handle which identifies this update action in the request, or null if it is not specified.aContext
- aContext the request context.- Returns:
- The number of updated features.
- Throws:
TLcdWFSServiceException
- if the update request cannot be applied. This includes: assigning null values to required properties or assigning values with a type different from the type of the property (e.g., 'abc' to an integer property).
-
handleDeleteSFCT
public abstract int handleDeleteSFCT(ILcdWFSFeatureType aFeatureType, List<Object> aDeletedFeaturesSFCT, TLcdOGCFilter aFilter, String aHandle, TLcdWFSRequestContext aContext) throws TLcdWFSServiceException Handles a delete action of a transaction request. This method takes any previous updates, deletes or inserts into account when applying the action. In case atomic transactions should be supported, this method should not commit the result of this action beforecommit(java.lang.String, com.luciad.ogc.wfs.TLcdWFSRequestContext)
is called.- Parameters:
aFeatureType
- the feature type of the features to be deleted.aDeletedFeaturesSFCT
- a list which can optionally be used to store all features which were deleted by this method. This list can then be used to unlock deleted features. In case the list is not empty, its size should match the returned integer.aFilter
- the filter that specifies the features to be deleted. A filter can not be null, otherwise no features should be deleted.aHandle
- a handle which identifies this delete action in the request, or null if it is not specified.aContext
- the request context.- Returns:
- The number of deleted features.
- Throws:
TLcdWFSServiceException
- In case the action could not be executed and the transaction should be aborted.
-
commit
public abstract void commit(String aHandle, TLcdWFSRequestContext aContext) throws TLcdWFSServiceException Commits this transaction to the data store. If this handler supports atomic transactions, the transaction will only be applied persistently to the data store once this method is called, and no exception has been thrown.- Parameters:
aHandle
- a handle which identifies this transaction.aContext
- the request context.- Throws:
TLcdWFSServiceException
- if the transaction could not be committed.
-
rollback
Rolls back a transaction which is in progress, this method is called whenever an exception occurs before a transaction is committed.- Parameters:
aContext
- the request context.
-