org.geotools.data.property
Class PropertyDataStore

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

public class PropertyDataStore
extends AbstractDataStore

Sample DataStore implementation, please see formal tutorial included with users docs.

Author:
Jody Garnett, Refractions Research Inc.

Field Summary
protected  File directory
           
protected  String namespaceURI
           
 
Fields inherited from class AbstractDataStore
isWriteable, listenerManager, LOGGER
 
Constructor Summary
PropertyDataStore(File dir)
           
PropertyDataStore(File dir, String namespaceURI)
           
 
Method Summary
protected  FeatureWriter<SimpleFeatureType,SimpleFeature> createFeatureWriter(String typeName, Transaction transaction)
          Subclass should implement this to provide writing support.
 void createSchema(SimpleFeatureType featureType)
          Subclass should implement to provide writing support.
protected  ReferencedEnvelope getBounds(Query query)
          Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result.
protected  int getCount(Query query)
          Gets the number of the features that would be returned by this query for the specified feature type.
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
          Subclass must implement.
 SimpleFeatureSource getFeatureSource(String typeName)
          Default implementation based on getFeatureReader and getFeatureWriter.
 ServiceInfo getInfo()
          Information about this service.
 List<Name> getNames()
          Returns the same list of names than AbstractDataStore.getTypeNames() meaning the returned Names have no namespace set.
 SimpleFeatureType getSchema(String typeName)
          Retrive schema information for typeName
 String[] getTypeNames()
          helper method for retrieving all the names.
 void setNamespaceURI(String namespaceURI)
           
 
Methods inherited from class AbstractDataStore
createLockingManager, createMetadata, dispose, getFeatureReader, getFeatureReader, getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSchema, getSupportedHints, getUnsupportedFilter, removeSchema, removeSchema, state, updateSchema, updateSchema
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

directory

protected File directory

namespaceURI

protected String namespaceURI
Constructor Detail

PropertyDataStore

public PropertyDataStore(File dir)

PropertyDataStore

public PropertyDataStore(File dir,
                         String namespaceURI)
Method Detail

createSchema

public void createSchema(SimpleFeatureType featureType)
                  throws IOException
Description copied from class: AbstractDataStore
Subclass should implement to provide writing support.

Specified by:
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Overrides:
createSchema in class AbstractDataStore
Parameters:
featureType - Requested FeatureType
Throws:
IOException

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>
Overrides:
getInfo in class AbstractDataStore
Returns:
SeviceInfo

setNamespaceURI

public void setNamespaceURI(String namespaceURI)

getTypeNames

public String[] getTypeNames()
Description copied from class: AbstractDataStore
helper method for retrieving all the names.

Specified by:
getTypeNames in interface DataStore
Specified by:
getTypeNames in class AbstractDataStore
Returns:
names of feature types available in this DataStore

getNames

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

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

getSchema

public SimpleFeatureType getSchema(String typeName)
                            throws IOException
Description copied from class: AbstractDataStore
Retrive schema information for typeName

Specified by:
getSchema in interface DataStore
Specified by:
getSchema in class AbstractDataStore
Parameters:
typeName - the feature type name
Returns:
the requested feature type
Throws:
IOException - if typeName is not available

getFeatureReader

protected FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
                                                                   throws IOException
Description copied from class: AbstractDataStore
Subclass must implement.

Specified by:
getFeatureReader in class AbstractDataStore
Returns:
FeatureReader over contents of typeName
Throws:
IOException

createFeatureWriter

protected FeatureWriter<SimpleFeatureType,SimpleFeature> createFeatureWriter(String typeName,
                                                                             Transaction transaction)
                                                                      throws IOException
Description copied from class: AbstractDataStore
Subclass should implement this to provide writing support.

A feature writer writes to the resource so it should considered to always be committing. The transaction is passed in so that it can be known what FeatureListeners should be notified of the changes. If the Transaction is AUTOCOMMIT then all listeners should be notified. If not all listeners that are NOT registered with that transaction should be notified.

Overrides:
createFeatureWriter in class AbstractDataStore
transaction - a feature writer
Returns:
FeatureWriter over contents of typeName
Throws:
IOException

getCount

protected int getCount(Query query)
                throws IOException
Description copied from class: AbstractDataStore
Gets the number of the features that would be returned by this query for the specified feature type.

If getBounds(Query) returns -1 due to expense consider using getFeatures(Query).getCount() as a an alternative.

Overrides:
getCount in class AbstractDataStore
Parameters:
query - Contains the Filter and MaxFeatures to find the bounds for.
Returns:
The number of Features provided by the Query or -1 if count is too expensive to calculate or any errors or occur.
Throws:
IOException

getBounds

protected ReferencedEnvelope getBounds(Query query)
                                throws IOException
Description copied from class: AbstractDataStore
Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result.

Will return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features

Overrides:
getBounds in class AbstractDataStore
Returns:
the bounds, or null if too expensive
Throws:
SchemaNotFoundException
IOException

getFeatureSource

public SimpleFeatureSource getFeatureSource(String typeName)
                                     throws IOException
Description copied from class: AbstractDataStore
Default implementation based on getFeatureReader and getFeatureWriter.

We should be able to optimize this to only get the RowSet once

Specified by:
getFeatureSource in interface DataStore
Overrides:
getFeatureSource in class AbstractDataStore
Parameters:
typeName - 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
See Also:
DataStore.getFeatureSource(java.lang.String)


Copyright © 1996-2014 Geotools. All Rights Reserved.