org.vfny.geoserver.responses.wfs
Class TransactionResponse

java.lang.Object
  extended byorg.vfny.geoserver.responses.wfs.TransactionResponse
All Implemented Interfaces:
Response

public class TransactionResponse
extends java.lang.Object
implements Response

Handles a Transaction request and creates a TransactionResponse string.


Field Summary
protected  org.geotools.data.Transaction transaction
          Geotools2 transaction used for this opperations
 
Constructor Summary
TransactionResponse()
          Constructor
 
Method Summary
 void abort(GeoServer gs)
          Called when things go horriably wrong.
 void execute(Request request)
          Excecutes a request.
protected  void execute(TransactionRequest transactionRequest)
          Execute Transaction request.
protected  void featureValidation(org.geotools.feature.FeatureType type, org.geotools.feature.FeatureCollection collection)
           
 java.lang.String getContentType(GeoServer gs)
          Responce MIME type as define by ServerConig.
protected  void integrityValidation(java.util.Map stores, com.vividsolutions.jts.geom.Envelope check)
           
 void writeTo(java.io.OutputStream out)
          Writes generated xmlResponse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transaction

protected org.geotools.data.Transaction transaction
Geotools2 transaction used for this opperations

Constructor Detail

TransactionResponse

public TransactionResponse()
Constructor

Method Detail

execute

public void execute(Request request)
             throws WfsException
Description copied from interface: Response
Excecutes a request. If this method finalizes without throwing an Exception, the Response instance should be ready to write the response content through the writeTo method with the minimal posible risk of failure other than not beeing able to write to the output stream due to external reassons

We should clarify when a ServiceException is thrown? I would assume that a "failed" request should still result in a Response that we could write out.

Specified by:
execute in interface Response
Parameters:
request - a Request object that implementations should cast to it's Request specialization, wich must contain the parsed and ready to use parameters sent by the calling client. In general, such a Request will be created by either a KVP or XML request reader; resulting in a Request object more usefull than a set of raw parameters, as can be the list of feature types requested as a set of FeatureTypeInfo objects rather than just a list of String type names
Throws:
WfsException

execute

protected void execute(TransactionRequest transactionRequest)
                throws WfsException
Execute Transaction request.

The results of this opperation are stored for use by writeTo:

Because we are using geotools2 locking facilities our modification will simply fail with IOException if we have not provided proper authorization.

The specification allows a WFS to implement PARTIAL sucess if it is unable to rollback all the requested changes. This implementation is able to offer full Rollback support and will not require the use of PARTIAL success.

Parameters:
transactionRequest -
Throws:
WfsException
WfsTransactionException - DOCUMENT ME!

featureValidation

protected void featureValidation(org.geotools.feature.FeatureType type,
                                 org.geotools.feature.FeatureCollection collection)
                          throws java.io.IOException,
                                 WfsTransactionException
Throws:
java.io.IOException
WfsTransactionException

integrityValidation

protected void integrityValidation(java.util.Map stores,
                                   com.vividsolutions.jts.geom.Envelope check)
                            throws java.io.IOException,
                                   WfsTransactionException
Throws:
java.io.IOException
WfsTransactionException

getContentType

public java.lang.String getContentType(GeoServer gs)
Responce MIME type as define by ServerConig.

Specified by:
getContentType in interface Response
Parameters:
gs - DOCUMENT ME!
Returns:
DOCUMENT ME!

writeTo

public void writeTo(java.io.OutputStream out)
             throws ServiceException,
                    java.io.IOException
Writes generated xmlResponse.

I have delayed commiting the result until we have returned it to the user, this gives us a chance to rollback if we are not able to provide a response.

I could not quite figure out what to about releasing locks. It could be we are supposed to release locks even if the transaction fails, or only if it succeeds.

Specified by:
writeTo in interface Response
Parameters:
out - DOCUMENT ME!
Throws:
ServiceException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!

abort

public void abort(GeoServer gs)
Description copied from interface: Response
Called when things go horriably wrong.

Used try and restore application state when things go wrong. This is called by AbstractAction to try and recover when sending out a ServiceException.

Allows a Response a chance to clean up after its self when AbstractionAction is error handling.

Specified by:
abort in interface Response