|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJDBCFeatureSource
JDBCFeatureStore
public class JDBCFeatureStore
This is a starting point for providing your own FeatureStore implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class JDBCFeatureSource |
---|
JDBCFeatureSource.JDBCQueryCapabilities |
Field Summary | |
---|---|
protected Transaction |
transaction
Current Transaction this FeatureSource |
Fields inherited from class JDBCFeatureSource |
---|
queryCapabilities |
Constructor Summary | |
---|---|
JDBCFeatureStore(JDBC1DataStore jdbcDataStore,
SimpleFeatureType featureType)
|
Method Summary | |
---|---|
List<FeatureId> |
addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
Adds all features from the passed feature collection to the datasource. |
Set |
addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Add Features from reader to this FeatureStore. |
protected void |
assertFids(Set fids)
|
protected void |
assertFilter(Filter filter)
|
protected Set |
fids(Filter filter)
|
protected InProcessLockingManager |
getInProcessLockingManager()
Used by subclasses to access locking manager. |
Transaction |
getTransaction()
Retrieve the Transaction this FeatureSource |
protected void |
modifyFeatures(AttributeDescriptor[] type,
Object[] value,
FeatureWriter<SimpleFeatureType,SimpleFeature> writer)
|
void |
modifyFeatures(AttributeDescriptor[] type,
Object[] value,
Filter filter)
Modifies features matching filter . |
void |
modifyFeatures(AttributeDescriptor type,
Object value,
Filter filter)
Modifies features matching filter . |
void |
removeFeatures(Filter filter)
Removes features indicated by provided filter. |
void |
setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Replace with contents of reader. |
void |
setTransaction(Transaction transaction)
Provides a transaction for commit/rollback control of this FeatureStore. |
Methods inherited from class JDBCFeatureSource |
---|
addFeatureListener, close, close, close, count, getBounds, getBounds, getConnection, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getJDBCDataStore, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface FeatureSource |
---|
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener |
Field Detail |
---|
protected Transaction transaction
Constructor Detail |
---|
public JDBCFeatureStore(JDBC1DataStore jdbcDataStore, SimpleFeatureType featureType)
Method Detail |
---|
public Transaction getTransaction()
JDBCFeatureSource
For a plain JDBCFeatureSource that cannot modify this will always be Transaction.AUTO_COMMIT.
getTransaction
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
getTransaction
in class JDBCFeatureSource
protected InProcessLockingManager getInProcessLockingManager()
All our implementations here are rely on FeatureWriter to check the locks.
When making your own SQL opperations, have a look at assertFids( Set fids ), and assertFids( Filter ). You may use these to check against the lockingManager if one is used.
If the lockingManager is not used, ie is null, it assumed that you are making use of native database locks. Or doing your own thing.That is the assertFids functions only when lockingManager is non null.
protected Set fids(Filter filter) throws NoSuchElementException, IOException, IllegalAttributeException
NoSuchElementException
IOException
IllegalAttributeException
protected void assertFilter(Filter filter) throws IOException
IOException
protected void assertFids(Set fids) throws FeatureLockException
FeatureLockException
public void modifyFeatures(AttributeDescriptor type, Object value, Filter filter) throws IOException
filter
.
Equivelent to:
modifyFeatures( new AttributeDescriptor[]{ type, }, new Object[]{ value, }, filter );
Subclasses may override this method to perform the appropriate optimization for this result.
modifyFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
type
- Attribute to modifyvalue
- Modification being made to typefilter
- Identifies features to modify
IOException
public void modifyFeatures(AttributeDescriptor[] type, Object[] value, Filter filter) throws IOException
filter
.
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, filter, transaction );
Feature feature;
while( writer.hasNext() ){
feature = writer.next();
feature.setAttribute( type[0].getName(), value[0] );
feature.setAttribute( type[1].getName(), value[1] );
...
feature.setAttribute( type[N].getName(), value[N] );
writer.write();
}
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
modifyFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
type
- Attributes to modifyvalue
- Modifications being made to typefilter
- Identifies features to modify
IOException
protected void modifyFeatures(AttributeDescriptor[] type, Object[] value, FeatureWriter<SimpleFeatureType,SimpleFeature> writer) throws DataSourceException, IOException
DataSourceException
IOException
public Set addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
Equivelent to:
Set set = new HashSet();
FeatureWriter writer = dataStore.getFeatureWriter( typeName, true, transaction );
Featrue feature, newFeature;
while( reader.hasNext() ){
feature = reader.next();
newFeature = writer.next();
newFeature.setAttributes( feature.getAttribtues( null ) );
writer.write();
set.add( newfeature.getID() );
}
reader.close();
writer.close();
return set;
(If you don't have a FeatureReader
Subclasses may override this method to perform the appropriate optimization for this result.
reader
-
IOException
org.geotools.data.FeatureStore#addFeatures(org.geotools.data.FeatureReader)
public List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) throws IOException
FeatureStore
A list of FeatureIds is returned; one for each Feature in the order created. Please note that these FeatureIds may not be assigned until after a commit has been performed.
addFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
collection
- The collection of features to add.
IOException
- if anything goes wrong.public void removeFeatures(Filter filter) throws IOException
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, filter, transaction );
Feature feature;
while( writer.hasNext() ){
feature = writer.next();
writer.remove();
}
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
removeFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
filter
- Identifies features to remove
IOException
public void setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, false, transaction );
Feature feature, newFeature;
while( writer.hasNext() ){
feature = writer.next();
writer.remove();
}
while( reader.hasNext() ){
newFeature = reader.next();
feature = writer.next();
newFeature.setAttributes( feature.getAttributes( null ) );
writer.write();
}
reader.close();
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
setFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
reader
- Contents to replace with
IOException
public void setTransaction(Transaction transaction)
FeatureStore
This method operates as a replacement for setAutoCommitMode. When a transaction is provided you are no longer automatically committing.
In order to return to AutoCommit mode supply the Transaction.AUTO_COMMIT to this method. Since this represents a return to AutoCommit mode the previous Transaction will be commited.
setTransaction
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
transaction
- DOCUMENT ME!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |