org.geotools.data.postgis
Class PostgisFeatureLocking

java.lang.Object
  extended by org.geotools.data.jdbc.JDBCFeatureSource
      extended by org.geotools.data.jdbc.JDBCFeatureStore
          extended by org.geotools.data.postgis.PostgisFeatureStore
              extended by org.geotools.data.postgis.PostgisFeatureLocking
All Implemented Interfaces:
FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

public class PostgisFeatureLocking
extends PostgisFeatureStore
implements FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>

Extends PostgisFeatureLocking with support for Locking.

This class will be, horror, modey. While the are plenty of Object Oriented ways to fix this I have a deadline right now.

When the DataStore is constructed it will create a LockingManager only if the Postgis implementation does not support database locking. If the lockingManger is present it will be used.

If the lockingManger is not present, the this class will use Database locking

Version:
$Id: PostgisFeatureLocking.java 30669 2008-06-12 23:36:58Z acuster $
Author:
Jody Garnett, Refractions Research, Inc

Nested Class Summary
 
Nested classes/interfaces inherited from class org.geotools.data.jdbc.JDBCFeatureSource
JDBCFeatureSource.JDBCQueryCapabilities
 
Nested classes/interfaces inherited from interface org.geotools.data.FeatureLocking
FeatureLocking.Response
 
Field Summary
 
Fields inherited from class org.geotools.data.postgis.PostgisFeatureStore
CONN_ERROR, fidMapper, geometryFactory, geometryReader, geometryWriter, sqlBuilder, tableName
 
Fields inherited from class org.geotools.data.jdbc.JDBCFeatureStore
transaction
 
Fields inherited from class org.geotools.data.jdbc.JDBCFeatureSource
queryCapabilities
 
Constructor Summary
PostgisFeatureLocking(PostgisDataStore postgisDataStore, org.opengis.feature.simple.SimpleFeatureType featureType)
           
 
Method Summary
 int lockFeature(org.opengis.feature.simple.SimpleFeature feature)
          HACK HACK HACK!!! Don't use unless you're working on geoserver.
 int lockFeatures()
          Lock all Features
 int lockFeatures(org.opengis.filter.Filter filter)
          Lock features matching filter.
 int lockFeatures(Filter filter)
           
 int lockFeatures(Query query)
          Lock features matching Query.
 void setFeatureLock(FeatureLock lock)
          Provide a FeatureLock for locking operations to operate against.
 void unLockFeatures()
          Unlock all Features.
 void unLockFeatures(org.opengis.filter.Filter filter)
          Unlock Features specified by filter.
 void unLockFeatures(Query query)
          Unlock features specified by the query.
 
Methods inherited from class org.geotools.data.postgis.PostgisFeatureStore
bounds, getBounds, getBounds, getEnvelope, getPostgisDataStore, getSRID, makeSql, modifyFeatures, modifyFeatures, removeFeatures
 
Methods inherited from class org.geotools.data.jdbc.JDBCFeatureStore
addFeatures, addFeatures, assertFids, assertFilter, fids, getInProcessLockingManager, getTransaction, modifyFeatures, setFeatures, setTransaction
 
Methods inherited from class org.geotools.data.jdbc.JDBCFeatureSource
addFeatureListener, close, close, close, count, getConnection, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getJDBCDataStore, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.FeatureStore
addFeatures, getTransaction, modifyFeatures, modifyFeatures, removeFeatures, setFeatures, setTransaction
 
Methods inherited from interface org.geotools.data.FeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
 

Constructor Detail

PostgisFeatureLocking

public PostgisFeatureLocking(PostgisDataStore postgisDataStore,
                             org.opengis.feature.simple.SimpleFeatureType featureType)
                      throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setFeatureLock

public void setFeatureLock(FeatureLock lock)
Provide a FeatureLock for locking operations to operate against.

Initial Transactional duration locks can be restored with setFeatureLock( FetaureLock.TRANSACTION )

Specified by:
setFeatureLock in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Parameters:
lock - FeatureLock (or FeatureLock.TRANSACTION );
Throws:
java.lang.NullPointerException - If lock was null
See Also:
FeatureLocking.setFeatureLock(org.geotools.data.FeatureLock)

lockFeatures

public int lockFeatures()
                 throws java.io.IOException
Lock all Features

Specified by:
lockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Returns:
Number of Locked features
Throws:
java.io.IOException
See Also:
FeatureLocking.lockFeatures()

lockFeatures

public int lockFeatures(org.opengis.filter.Filter filter)
                 throws java.io.IOException
Lock features matching filter.

Specified by:
lockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Parameters:
filter -
Returns:
Number of locked Features
Throws:
java.io.IOException
See Also:
org.geotools.data.FeatureLocking#lockFeatures(org.geotools.filter.Filter)

lockFeatures

public int lockFeatures(Filter filter)
                 throws java.io.IOException
Throws:
java.io.IOException

lockFeatures

public int lockFeatures(Query query)
                 throws java.io.IOException
Lock features matching Query.

FeatureStores that have provided their own locking to will need to override this method.

Specified by:
lockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Parameters:
query -
Returns:
Number of locked Features
Throws:
java.io.IOException - If we could not determine which feature to lock based on Query
java.lang.UnsupportedOperationException - When DataStore does not provide a LockingManager
DataSourceException - If feature to be locked does not exist
See Also:
FeatureLocking.lockFeatures(org.geotools.data.Query)

lockFeature

public int lockFeature(org.opengis.feature.simple.SimpleFeature feature)
                throws java.io.IOException
HACK HACK HACK!!! Don't use unless you're working on geoserver. just using ints for return now, to easily swap out with what we've got going on right now.

Parameters:
feature - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
java.lang.UnsupportedOperationException - DOCUMENT ME!

unLockFeatures

public void unLockFeatures()
                    throws java.io.IOException
Unlock all Features.

Specified by:
unLockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Throws:
java.io.IOException
See Also:
FeatureLocking.unLockFeatures()

unLockFeatures

public void unLockFeatures(org.opengis.filter.Filter filter)
                    throws java.io.IOException
Unlock Features specified by filter.

Specified by:
unLockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Parameters:
filter -
Throws:
java.io.IOException
See Also:
org.geotools.data.FeatureLocking#unLockFeatures(org.geotools.filter.Filter)

unLockFeatures

public void unLockFeatures(Query query)
                    throws java.io.IOException
Unlock features specified by the query.

FeatureStores that have provided their own locking to will need to override this method.

Specified by:
unLockFeatures in interface FeatureLocking<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Parameters:
query -
Throws:
java.io.IOException
java.lang.UnsupportedOperationException - If lockingManager is not provided by DataStore subclass
DataSourceException - Filter describes an unlocked Feature, or authorization not held
See Also:
FeatureLocking.unLockFeatures(org.geotools.data.Query)


Copyright © 1996-2010 Geotools. All Rights Reserved.