org.geotools.data
Interface DataAccess<T extends FeatureType,F extends Feature>

Type Parameters:
T - Type of Feature Content, may be SimpleFeatureType
F - Feature Content, may be SimpleFetaure
All Known Subinterfaces:
DataStore, FileDataStore, WFSDataStore
All Known Implementing Classes:
AbstractDataStore, AbstractDataStore2, AbstractFileDataStore, ArcSDEDataStore, CollectionDataStore, ContentDataStore, DB2DataStore, DirectoryDataStore, DirectoryDataStore, IndexedShapefileDataStore, JDBC1DataStore, JDBC2DataStore, JDBCDataStore, JDBCDataStore, MemoryDataStore, PostgisDataStore, PreGeneralizedDataStore, PropertyDataStore, ShapefileDataStore, WFS_1_0_0_DataStore, WFS_1_1_0_DataStore

public interface DataAccess<T extends FeatureType,F extends Feature>

Access to Feature content from a service or file.

Description

The DataAccess interface provides the following information about its contents:

Contents

You can access the contents of a service or file using getFeatureSource( Name ). Depending the abilities of your implementation and your credentials you will have access to

Please note that all interaction occurs within the context of a Transaction, this facility provides session management and is strongly advised. Please note that your application is responsible for managing its own Transactions; as an example they are often associated with a single Map in a desktop application; or a single session in a J2EE web app.

The use of Transaction.AUTO_COMMIT is suitable for read-only access when you wish to minimize the number of connections in use, when used for writing performance will often be terrible.

Lifecycle

Normal use: Creation:

Applications are responsible for holding a single instance to the service or file, The DataAccess implementations will hold onto database connections, internal caches and so on - and as such should not be duplicated.

See Also:
Subclass restricted to working with simple content
Module:
modules/library/api (gt-api.jar)

Method Summary
 void createSchema(T featureType)
          Creates storage for a new featureType.
 void dispose()
          Disposes of this data store and releases any resource that it is using.
 FeatureSource<T,F> getFeatureSource(Name typeName)
          Access to the named resource.
 ServiceInfo getInfo()
          Information about this service.
 List<Name> getNames()
          Names of the available Resources.
 T getSchema(Name name)
          Description of the named resource.
 void updateSchema(Name typeName, T featureType)
          Used to update a schema in place.
 

Method Detail

getInfo

ServiceInfo getInfo()
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).

Returns:
SeviceInfo

createSchema

void createSchema(T featureType)
                  throws IOException
Creates storage for a new featureType.

The provided featureType we be accessable by the typeName provided by featureType.getTypeName().

Parameters:
featureType - FetureType to add to DataStore
Throws:
IOException - If featureType cannot be created

updateSchema

void updateSchema(Name typeName,
                  T featureType)
                  throws IOException
Used to update a schema in place.

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

Parameters:
typeName -
featureType -
Throws:
IOException - if the operation failed
UnsupportedOperation - if functionality is not available

getNames

List<Name> getNames()
                    throws IOException
Names of the available Resources.

For additional information please see getInfo( Name ) and getSchema( Name ).

Returns:
Names of the available contents.
Throws:
IOException

getSchema

T getSchema(Name name)
                                throws IOException
Description of the named resource.

The FeatureType returned describes the contents being published. For additional metadata please review getInfo( Name ).

Parameters:
name - Type name a the resource from getNames()
Returns:
Description of the FeatureType being made avaialble
Throws:
IOException

getFeatureSource

FeatureSource<T,F> getFeatureSource(Name typeName)
                                                                        throws IOException
Access to the named resource.

The level of access is represented by the instance of the FeatureSource being returned.

Formally:


dispose

void dispose()
Disposes of this data store and releases any resource that it is using.

A DataStore cannot be used after dispose has been called, neither can any data access object it helped create, such as FeatureReader, FeatureSource or FeatureCollection.

This operation can be called more than once without side effects.

There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.



Copyright © 1996-2010 Geotools. All Rights Reserved.