org.deegree_impl.services.wfs.postgis
Class CTransaction

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.deegree_impl.services.wfs.WFSMainLoop
          extended byorg.deegree_impl.services.wfs.postgis.CTransaction
All Implemented Interfaces:
java.lang.Runnable

class CTransaction
extends WFSMainLoop

class defining the processing of a transaction request


Field Summary
private  DatastoreConfiguration config
           
private  DBConnectionPool pool
           
 
Fields inherited from class org.deegree_impl.services.wfs.WFSMainLoop
parent, request
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CTransaction(PostgisDataStore parent, OGCWebServiceRequest request)
          Creates a new CTransaction object.
 
Method Summary
private static int extractCRS(GM_Object geom)
          extracts a valid postgis crs code from the passed geometry. if no valid code can be extracted '-1', indicating 'no CRS' will be returned.
private  java.lang.String[] getAffectedFeatureTypes(WFSOperation[] operations)
          returns the list of feature types that are affected by a Transaction
private  java.util.Set getFeatureIDs(FeatureType ft, Filter filter, DBAccess osa)
          Retrieves all IDs of the Feature's MasterTable that are affected by the given Filter.
private static java.lang.String getGeometryFromText(java.lang.String gml)
          generates a sql fragment from the passed GML geometry that can be used to create insert and update statementens for the postgis database
private  void performDelete(FeatureType ft, java.util.HashMap tables)
          deletes the targeted rows from the tables contained in the passed HashMap
private  boolean performDelete(WFSDelete delete)
          Deletes FeatureType-instances from the datastore that are specified by the given WFSDelete.
 java.util.ArrayList performInsert(InsertTree tree, PostgisDBAccess osa)
           
private  java.lang.Object[] performInsert(WFSInsert insert)
          performs an insertion of one or more features into the database
protected  OGCWebServiceResponse[] performRequest(OGCWebServiceRequest request)
          performs the passed transaction request encapsulated in a OGCWebServiceRequest.
(package private)  boolean performUpdate(PostgisRowSelector selector, java.util.HashMap changes)
           
private  boolean performUpdate(WFSUpdate update)
          Updates FeatureType-instances from the datastore that are specified by the given WFSUpdate.
private  java.lang.String[] splitString(java.lang.String name)
          Extracts the two parts of a concatenated String of the form [a.]b (part a is optional).
 
Methods inherited from class org.deegree_impl.services.wfs.WFSMainLoop
run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pool

private DBConnectionPool pool

config

private DatastoreConfiguration config
Constructor Detail

CTransaction

public CTransaction(PostgisDataStore parent,
                    OGCWebServiceRequest request)
Creates a new CTransaction object.

Parameters:
parent -
request -
Method Detail

performRequest

protected OGCWebServiceResponse[] performRequest(OGCWebServiceRequest request)
performs the passed transaction request encapsulated in a OGCWebServiceRequest.

Specified by:
performRequest in class WFSMainLoop
Parameters:
request - request to perform
Returns:

getAffectedFeatureTypes

private java.lang.String[] getAffectedFeatureTypes(WFSOperation[] operations)
returns the list of feature types that are affected by a Transaction


performInsert

private java.lang.Object[] performInsert(WFSInsert insert)
                                  throws java.lang.Exception
performs an insertion of one or more features into the database

Throws:
java.lang.Exception

performInsert

public java.util.ArrayList performInsert(InsertTree tree,
                                         PostgisDBAccess osa)
                                  throws java.lang.Exception
Parameters:
tree -
osa -
Returns:
Throws:
java.lang.Exception
InsertException

performUpdate

private boolean performUpdate(WFSUpdate update)
                       throws java.lang.Exception
Updates FeatureType-instances from the datastore that are specified by the given WFSUpdate.

Parameters:
update - the WFSUpdate request to perform
Returns:
true, if the Request succeeded, else false
Throws:
java.lang.Exception

performUpdate

boolean performUpdate(PostgisRowSelector selector,
                      java.util.HashMap changes)
                throws java.lang.Exception
Throws:
java.lang.Exception

performDelete

private boolean performDelete(WFSDelete delete)
                       throws java.lang.Exception
Deletes FeatureType-instances from the datastore that are specified by the given WFSDelete.

Parameters:
delete - the WFS-Delete request to perform
Returns:
true, if the Request succeeded, else false
Throws:
java.lang.Exception

performDelete

private void performDelete(FeatureType ft,
                           java.util.HashMap tables)
                    throws java.lang.Exception
deletes the targeted rows from the tables contained in the passed HashMap

Throws:
java.lang.Exception

getFeatureIDs

private java.util.Set getFeatureIDs(FeatureType ft,
                                    Filter filter,
                                    DBAccess osa)
                             throws java.lang.Exception
Retrieves all IDs of the Feature's MasterTable that are affected by the given Filter.

Parameters:
ft - configuration information that is used for the mapping of the XML-Filter to the SQL-table structure
filter - Filter that is transformed to a WHERE-clause
Throws:
java.lang.Exception - if SQL-generation from the Filter fails or an SQL-error occurs

getGeometryFromText

private static java.lang.String getGeometryFromText(java.lang.String gml)
                                             throws java.lang.Exception
generates a sql fragment from the passed GML geometry that can be used to create insert and update statementens for the postgis database

Throws:
java.lang.Exception

extractCRS

private static int extractCRS(GM_Object geom)
extracts a valid postgis crs code from the passed geometry. if no valid code can be extracted '-1', indicating 'no CRS' will be returned.


splitString

private java.lang.String[] splitString(java.lang.String name)
Extracts the two parts of a concatenated String of the form [a.]b (part a is optional). Method is null-save.

Returns:
array of Strings, [0] = a, [1] = b