org.geotools.arcsde.data
Class ArcSDEDataStore

Object
  extended by ArcSDEDataStore
All Implemented Interfaces:
DataAccess<SimpleFeatureType,SimpleFeature>, DataStore

public class ArcSDEDataStore
extends Object
implements DataStore

DataStore implementation to work upon an ArcSDE spatial database gateway.

Takes ownership of the provided ISessionPool so make sure to call dispose() in order to release resources (ArcSDE connections).

Author:
Gabriel Roldan (TOPP)

Constructor Summary
ArcSDEDataStore(ISessionPool connPool)
          Creates a new ArcSDE DataStore working over the given connection pool
ArcSDEDataStore(ISessionPool connPool, String namespaceUri, String versionName, boolean allowNonSpatialTables)
          Creates a new ArcSDE DataStore working over the given connection pool
 
Method Summary
 void createSchema(SimpleFeatureType featureType)
          Creates a new ArcSDE FeatureClass if featureType has at least one geometry attribute, or an ObjectClass (aka, non spatial registered table) if this data store instance allows non spatial tables and there's no geometry attribute in featureType.
 void createSchema(SimpleFeatureType featureType, Map<String,String> hints)
          Creates a given FeatureType on the ArcSDE instance this DataStore is running over.
 void dispose()
          Disposes this ArcSDEDataStore, which means disposing its session pool and hence closing all the SeConnection objects held.
protected  void finalize()
           
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction)
          Returns an ArcSDEFeatureReader Preconditions: query !
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction, SimpleFeatureType featureType)
           
 SimpleFeatureSource getFeatureSource(Name typeName)
          Delegates to getFeatureSource(String) with name.getLocalPart()
 SimpleFeatureSource getFeatureSource(String typeName)
          Gets a SimpleFeatureSource for features of the specified type.
 ArcSdeFeatureWriter getFeatureWriter(String typeName, Filter filter, Transaction transaction)
          Gets a FeatureWriter to modify features in this DataStore.
 ArcSdeFeatureWriter getFeatureWriter(String typeName, Transaction transaction)
          Delegates to getFeatureWriter(typeName, Filter.INCLUDE, transaction)
 ArcSdeFeatureWriter getFeatureWriterAppend(String typeName, Transaction transaction)
          Delegates to getFeatureWriter(typeName, Filter.EXCLUDE, transaction)
 ServiceInfo getInfo()
          Information about this service.
 LockingManager getLockingManager()
          Retrieve a per featureID based locking service from this DataStore.
 List<Name> getNames()
          Returns the same list of names than getTypeNames() meaning the returned Names have no namespace set.
 SimpleFeatureType getQueryType(Query query)
           
 SimpleFeatureType getSchema(Name name)
          Delegates to getSchema(String) with name.getLocalPart()
 SimpleFeatureType getSchema(String typeName)
          Obtains the schema for the given featuretype name.
 ISession getSession(Transaction transaction)
          Retrieve the connection for the provided transaction.
 String[] getTypeNames()
          List of type names; should be a list of all feature classes.
 void removeSchema(Name typeName)
          Used to permanently remove a schema from the underlying storage This functionality is similar to an "drop table" statement in SQL.
 void removeSchema(String typeName)
          Used to permanently remove a schema from the underlying storage This functionality is similar to an "drop table" statement in SQL.
 void updateSchema(Name typeName, SimpleFeatureType featureType)
          Delegates to updateSchema(String, SimpleFeatureType) with name.getLocalPart()
 void updateSchema(String typeName, SimpleFeatureType featureType)
          This operation is not supported at this version of the GeoTools ArcSDE plugin.
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArcSDEDataStore

public ArcSDEDataStore(ISessionPool connPool)
                throws IOException
Creates a new ArcSDE DataStore working over the given connection pool

Parameters:
connPool - pool of Session this datastore works upon.
Throws:
IOException

ArcSDEDataStore

public ArcSDEDataStore(ISessionPool connPool,
                       String namespaceUri,
                       String versionName,
                       boolean allowNonSpatialTables)
                throws IOException
Creates a new ArcSDE DataStore working over the given connection pool

Parameters:
connPool - pool of Session this datastore works upon.
namespaceUri - namespace URI for the SimpleFeatureTypes, AttributeTypes, and AttributeDescriptors created by this datastore. May be null.
versionName - the name of the ArcSDE version to work upon, or null for the DEFAULT version
allowNonSpatialTables - whether ArcSDE registered, non-spatial tables are to be published
Throws:
IOException
Method Detail

getSession

public ISession getSession(Transaction transaction)
                    throws IOException
Retrieve the connection for the provided transaction.

The connection is held open until while the transaction is underway. A a Transaction.State is registered for this SessionPool in order to hold the session.

Parameters:
transaction -
Returns:
the session associated with the transaction
Throws:
IOException

createSchema

public void createSchema(SimpleFeatureType featureType)
                  throws IOException
Creates a new ArcSDE FeatureClass if featureType has at least one geometry attribute, or an ObjectClass (aka, non spatial registered table) if this data store instance allows non spatial tables and there's no geometry attribute in featureType.

The new arcsde table created will have an SDE managed column to be used as primary key.

Specified by:
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
featureType - FetureType to add to DataStore
Throws:
IOException - If featureType cannot be created
See Also:
DataStore#createSchema(SimpleFeatureType), createSchema(SimpleFeatureType, Map)

getSchema

public SimpleFeatureType getSchema(String typeName)
                            throws IOException
Obtains the schema for the given featuretype name.

Specified by:
getSchema in interface DataStore
Parameters:
typeName - the feature type name
Returns:
the requested feature type
Throws:
IOException - if typeName is not available
See Also:
DataStore.getSchema(String)

getTypeNames

public String[] getTypeNames()
                      throws IOException
List of type names; should be a list of all feature classes.

Specified by:
getTypeNames in interface DataStore
Returns:
the list of full qualified feature class names on the ArcSDE database this DataStore works on. An ArcSDE full qualified class name is composed of three dot separated strings: "DATABASE.USER.CLASSNAME", wich is usefull enough to use it as namespace
Throws:
RuntimeException - if an exception occurs while retrieving the list of registeres feature classes on the backend, or while obtaining the full qualified name of one of them
IOException - if data access errors occur

getInfo

public ServiceInfo getInfo()
Description copied from interface: DataAccess
Information about this service.

This method offers access to a summary of header or metadata information describing the service.

Subclasses may return a specific ServiceInfo instance that has additional information (such as FilterCapabilities).

Specified by:
getInfo in interface DataAccess<SimpleFeatureType,SimpleFeature>
Returns:
SeviceInfo

dispose

public void dispose()
Disposes this ArcSDEDataStore, which means disposing its session pool and hence closing all the SeConnection objects held.

Specified by:
dispose in interface DataAccess<SimpleFeatureType,SimpleFeature>
See Also:
DataAccess.dispose()

finalize

protected void finalize()
Overrides:
finalize in class Object

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
                                                                       Transaction transaction)
                                                                throws IOException
Returns an ArcSDEFeatureReader

Preconditions:

Specified by:
getFeatureReader in interface DataStore
Parameters:
query - a query providing the schema and constraints for features that the reader will return
transaction - a transaction that this reader will operate against
Returns:
ArcSDEFeatureReader aware of the transaction state
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureReader(Query, Transaction)

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
                                                                       Transaction transaction,
                                                                       SimpleFeatureType featureType)
                                                                throws IOException
Throws:
IOException

getQueryType

public SimpleFeatureType getQueryType(Query query)
                               throws IOException
Throws:
IOException

getFeatureSource

public SimpleFeatureSource getFeatureSource(String typeName)
                                     throws IOException
Description copied from interface: DataStore
Gets a SimpleFeatureSource for features of the specified type. SimpleFeatureSource provides a high-level API for feature operations.

The resulting SimpleFeatureSource may implment more functionality as in this example:



 SimpleFeatureSource fsource = dataStore.getFeatureSource("roads");
 if (fsource instanceof SimpleFeatureStore) {
     // we have write access to the feature data
     SimpleFeatureStore fstore = (SimpleFeatureStore) fs;
 }
 else {
     System.out.println("We do not have write access to roads");
 }
 

Specified by:
getFeatureSource in interface DataStore
Parameters:
typeName - the feature type
Returns:
FeatureSource or FeatureStore depending on if the user has write permissions over typeName
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureSource(String)

getFeatureWriter

public ArcSdeFeatureWriter getFeatureWriter(String typeName,
                                            Transaction transaction)
                                     throws IOException
Delegates to getFeatureWriter(typeName, Filter.INCLUDE, transaction)

Specified by:
getFeatureWriter in interface DataStore
Parameters:
typeName - the type name for features that will be accessible
transaction - the transation that the returned writer operates against
Returns:
an instance of FeatureWriter
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriter(String, Transaction)

getFeatureWriter

public ArcSdeFeatureWriter getFeatureWriter(String typeName,
                                            Filter filter,
                                            Transaction transaction)
                                     throws IOException
Description copied from interface: DataStore
Gets a FeatureWriter to modify features in this DataStore. FeatureWriter provides an iterator style API to features.

The returned writer does not allow features to be added.

Specified by:
getFeatureWriter in interface DataStore
Parameters:
typeName - the type name for features that will be accessible
filter - defines additional constraints on the features that will be accessible
transaction - the transation that the returned writer operates against
Returns:
an instance of FeatureWriter
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriter(String, Filter, Transaction)

getFeatureWriterAppend

public ArcSdeFeatureWriter getFeatureWriterAppend(String typeName,
                                                  Transaction transaction)
                                           throws IOException
Delegates to getFeatureWriter(typeName, Filter.EXCLUDE, transaction)

Specified by:
getFeatureWriterAppend in interface DataStore
Parameters:
typeName - name of the feature type for which features will be added
transaction - the transaction to operate against
Returns:
an instance of FeatureWriter that can only be used to append new features
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriterAppend(String, Transaction)

getLockingManager

public LockingManager getLockingManager()
Description copied from interface: DataStore
Retrieve a per featureID based locking service from this DataStore.

Specified by:
getLockingManager in interface DataStore
Returns:
null, no locking yet
See Also:
DataStore.getLockingManager()

updateSchema

public void updateSchema(String typeName,
                         SimpleFeatureType featureType)
                  throws IOException
This operation is not supported at this version of the GeoTools ArcSDE plugin.

Specified by:
updateSchema in interface DataStore
Parameters:
typeName - name of the feature type to update
featureType - the new schema to apply
Throws:
IOException - on error
See Also:
DataStore.updateSchema(String, SimpleFeatureType)

getFeatureSource

public SimpleFeatureSource getFeatureSource(Name typeName)
                                     throws IOException
Delegates to getFeatureSource(String) with name.getLocalPart()

Specified by:
getFeatureSource in interface DataAccess<SimpleFeatureType,SimpleFeature>
Specified by:
getFeatureSource in interface DataStore
Parameters:
typeName - the qualified name of the feature type
Returns:
a SimpleFeatureSource (or possibly a subclass) providing operations for features of the specified type
Throws:
IOException - if data access errors occur
Since:
2.5
See Also:
DataAccess.getFeatureSource(Name)

getNames

public List<Name> getNames()
                    throws IOException
Returns the same list of names than getTypeNames() meaning the returned Names have no namespace set.

Specified by:
getNames in interface DataAccess<SimpleFeatureType,SimpleFeature>
Returns:
Names of the available contents.
Throws:
IOException
Since:
2.5
See Also:
DataAccess.getNames()

getSchema

public SimpleFeatureType getSchema(Name name)
                            throws IOException
Delegates to getSchema(String) with name.getLocalPart()

Specified by:
getSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
name - Type name a the resource from getNames()
Returns:
Description of the FeatureType being made avaialble
Throws:
IOException
Since:
2.5
See Also:
DataAccess.getSchema(Name)

updateSchema

public void updateSchema(Name typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Delegates to updateSchema(String, SimpleFeatureType) with name.getLocalPart()

Specified by:
updateSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Throws:
IOException - if the operation failed
Since:
2.5
See Also:
DataAccess.getFeatureSource(Name)

createSchema

public void createSchema(SimpleFeatureType featureType,
                         Map<String,String> hints)
                  throws IOException,
                         IllegalArgumentException
Creates a given FeatureType on the ArcSDE instance this DataStore is running over.

This deviation from the DataStore#createSchema(SimpleFeatureType) API is to allow the specification of ArcSDE specific hints for the "Feature Class" to create:

Parameters:
featureType -
hints -
Throws:
IOException
IllegalArgumentException

removeSchema

public void removeSchema(Name typeName)
                  throws IOException
Description copied from interface: DataAccess
Used to permanently remove a schema from the underlying storage

This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.

Specified by:
removeSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Throws:
IOException - if the operation failed

removeSchema

public void removeSchema(String typeName)
                  throws IOException
Description copied from interface: DataStore
Used to permanently remove a schema from the underlying storage

This functionality is similar to an "drop table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.

Specified by:
removeSchema in interface DataStore
Throws:
IOException - if the operation failed


Copyright © 1996-2014 Geotools. All Rights Reserved.