deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.portal.standard.wfs.control
Class DigitizeListener

java.lang.Object
  extended by org.deegree.enterprise.control.AbstractListener
      extended by org.deegree.portal.standard.wfs.control.DigitizeListener
All Implemented Interfaces:
EventListener, WebListener

public class DigitizeListener
extends AbstractListener

This Listener is used to perform a wfs transaction (e.g. write a geometry that was digitized in the client to a WFS). The featureType must be passed as first parameter of the RPC request, the second parameter must contain a struct, whose members are replaced in the transaction template. WFS address and transaction template are both taken from the module configuration.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Judit Mays, last edited by: $Author: mschneider $

Field Summary
protected  DigitizerClientConfiguration config
           
protected static String CRS
           
protected static String DIGITIZER_CLIENT_CONFIGURATION
           
protected static String GEOMETRY
           
 
Constructor Summary
DigitizeListener()
           
 
Method Summary
 void actionPerformed(FormEvent event)
           
protected  String createWFSTransactionRequest(RPCWebEvent rpcEvent, String transactionType)
          Create a WFS request (transaction) from the params given in the rpc event and the module configuration.
protected  QualifiedName extractFeatureTypeAsQualifiedName(RPCWebEvent rpcEvent)
          The FEATURE_TYPE passed in the rpc must be given with namespace and featuretype name in the form: {http://some.address.com}:featureTypeName.
protected  void handleNegativeResponse(XMLFragment response)
          A negative response by the WFS needs to be handled individually in each derived Listener.
protected  Object[] handlePositiveResponse(XMLFragment response)
          A positive response by the WFS needs to be handled individually in each derived Listener.
protected  Object[] handleResponse(XMLFragment response)
          Handle the WFS transaction response.
protected  XMLFragment performRequest(String request, String wfsAddress)
          Send the request (e.g. wfs:Transaction, wfs:GetFeature) to the WFS of the passed address and return the received WFS response as XMLFragment.
protected  String replaceDeleteTemplateVars(String request, Object... args)
          this method will be overwritten in derived listeners
protected  String replaceSpecialTemplateVars(String request, Object... args)
          this method will be overwritten in derived listeners
protected  String replaceUpdateTemplateVars(String request, Object... args)
          this method will be overwritten in derived listeners
protected  void validateRequest(RPCWebEvent rpcEvent)
          Validate the RPC request: number of RPCParameter must be 2 or more.
 
Methods inherited from class org.deegree.enterprise.control.AbstractListener
getAlternativeNextPage, getHomePath, getInitParameter, getInitParameterList, getNextPage, getRequest, getReturnValue, gotoErrorPage, handle, setAlternativeNextPage, setDefaultAlternativeNextPage, setDefaultNextPage, setNextPage, setReturnValue, toModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIGITIZER_CLIENT_CONFIGURATION

protected static final String DIGITIZER_CLIENT_CONFIGURATION
See Also:
Constant Field Values

GEOMETRY

protected static final String GEOMETRY
See Also:
Constant Field Values

CRS

protected static final String CRS
See Also:
Constant Field Values

config

protected DigitizerClientConfiguration config
Constructor Detail

DigitizeListener

public DigitizeListener()
Method Detail

actionPerformed

public void actionPerformed(FormEvent event)
Specified by:
actionPerformed in interface WebListener
Specified by:
actionPerformed in class AbstractListener

validateRequest

protected void validateRequest(RPCWebEvent rpcEvent)
                        throws RPCException,
                               GeometryException,
                               UnknownCRSException
Validate the RPC request: number of RPCParameter must be 2 or more. The first param must contain the "FEATURE_TYPE". The second param must contain a struct with all the parameters that shall be replaced in the WFS request template. If the struct contains a member "GEOM", then one more member is mandatory: "CRS". Further params will be ignored in this Listener. They might want to be used to handle specific behaviour in derived Listeners.

Parameters:
rpcEvent -
Throws:
RPCException
GeometryException
UnknownCRSException

extractFeatureTypeAsQualifiedName

protected QualifiedName extractFeatureTypeAsQualifiedName(RPCWebEvent rpcEvent)
                                                   throws WFSClientException
The FEATURE_TYPE passed in the rpc must be given with namespace and featuretype name in the form: {http://some.address.com}:featureTypeName. This string gets extracted from the rpc and transformed into a QualifiedName.

Parameters:
rpcEvent -
Returns:
the QualifiedNames for the featureType in the passed rpcEvent
Throws:
WFSClientException - if featureType cannot be transformed to a QualifiedName.

createWFSTransactionRequest

protected String createWFSTransactionRequest(RPCWebEvent rpcEvent,
                                             String transactionType)
                                      throws WFSClientException
Create a WFS request (transaction) from the params given in the rpc event and the module configuration.

Parameters:
rpcEvent -
transactionType - the type of WFS transaction (might be "INSERT", "UPDATE", "DELETE")
Returns:
the request as string
Throws:
WFSClientException - if featureType in rpcEvent cannot be transformed to a QualifiedName or if the query template could not be read.

performRequest

protected XMLFragment performRequest(String request,
                                     String wfsAddress)
                              throws WFSClientException
Send the request (e.g. wfs:Transaction, wfs:GetFeature) to the WFS of the passed address and return the received WFS response as XMLFragment.

Parameters:
request - the request for the WFS
wfsAddress - the address of the WFS
Returns:
the response by the WFS as XMLFragment.
Throws:
WFSClientException - if request agains wfsAddress failed, or if wfs response could not be loaded as XMLFragment

handleResponse

protected Object[] handleResponse(XMLFragment response)
                           throws WFSClientException
Handle the WFS transaction response. A positive response may be overwritten in method handlePositiveResponse(). A negative response may be overwritten in method handleNegativeResponse().

Parameters:
response -
Returns:
any objects that are returned from handlePositiveResponse() and that might be needed in derived listeners. Here, it returns null.
Throws:
WFSClientException - if the transaction response does not contain a root element of "wfs:TransactionResponse"

handlePositiveResponse

protected Object[] handlePositiveResponse(XMLFragment response)
A positive response by the WFS needs to be handled individually in each derived Listener. Override the method, if needed. In this basic implementation, it sets the request attribute MESSAGE with the value of i18n.IGEO_STD_WFS_TRANSACTION_SUCCESS

Parameters:
response -
Returns:
any objects that might be needed. Here, it returns null.

handleNegativeResponse

protected void handleNegativeResponse(XMLFragment response)
                               throws WFSClientException
A negative response by the WFS needs to be handled individually in each derived Listener. Override the method, if needed. In this basic implementation, it throws a WFSClientException IGEO_STD_WFS_TRANSACTION_FAILED, containing the message of the ServiceException element of the response.

Parameters:
response -
Throws:
WFSClientException - in any case. always.

replaceSpecialTemplateVars

protected String replaceSpecialTemplateVars(String request,
                                            Object... args)
                                     throws WFSClientException
this method will be overwritten in derived listeners

Parameters:
request -
args - any number of Objects needed in this method
Returns:
the request, with all special variables replaced. In this implementation, it returns the original request.
Throws:
WFSClientException

replaceUpdateTemplateVars

protected String replaceUpdateTemplateVars(String request,
                                           Object... args)
                                    throws WFSClientException
this method will be overwritten in derived listeners

Parameters:
request -
args - any number of Objects needed in this method
Returns:
the request, with all update variables replaced. In this implementation, it returns the original request.
Throws:
WFSClientException

replaceDeleteTemplateVars

protected String replaceDeleteTemplateVars(String request,
                                           Object... args)
                                    throws WFSClientException
this method will be overwritten in derived listeners

Parameters:
request -
args - any number of Objects needed in this method
Returns:
the request, with all delete variables replaced. In this implementation, it returns the original request.
Throws:
WFSClientException

deegree 2.3 (2010/04/09 10:10 build-4-official)

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