org.geotools.data.wfs.v1_0_0
Class WFS_1_0_0_DataStore

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

public class WFS_1_0_0_DataStore
extends AbstractDataStore
implements WFSDataStore

DataStore used for connecting to 1.0.0 protocol.

Please note this datastore uses the first version of the GTXML parsing / encoding technology and may be a bit difficult to follow as a result.

Author:
dzwiers

Field Summary
protected  WFSCapabilities capabilities
           
static Logger LOGGER
           
protected  HttpMethod preferredProtocol
           
protected  WFSStrategy strategy
           
 
Fields inherited from class AbstractDataStore
isWriteable, listenerManager
 
Fields inherited from interface WFSDataStore
AXIS_ORDER_COMPLIANT, AXIS_ORDER_EAST_NORTH, AXIS_ORDER_NORTH_EAST, WFS_VENDOR_PARAMETERS
 
Constructor Summary
WFS_1_0_0_DataStore(HttpMethod protocol, WFS100ProtocolHandler protocolHandler, int timeout, int buffer, boolean lenient)
          Construct WFSDataStore.
WFS_1_0_0_DataStore(HttpMethod protocol, WFS100ProtocolHandler protocolHandler, int timeout, int buffer, boolean lenient, String wfsStrategy, Integer filterCompliance)
          Construct WFSDataStore.
 
Method Summary
 void addFidMapping(String original, String finalFid)
          Adds a new fid mapping to the fid map.
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.
 WFSCapabilities getCapabilities()
           
 URL getCapabilitiesURL()
           
 String getDefaultEncoding()
           
 URL getDescribeFeatureTypeURL(String typeName)
           
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction)
          Gets a FeatureReader for features selected by the given Query.
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName)
          Subclass must implement.
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName, Query query)
          GR: this method is called from inside getFeatureReader(Query ,Transaction ) to allow subclasses return an optimized FeatureReader wich supports the filter and attributes truncation specified in query A subclass that supports the creation of such an optimized FeatureReader shold override this method.
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReaderGet(Query request, Transaction transaction)
           
protected  FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReaderPost(Query query, Transaction transaction)
           
 SimpleFeatureSource getFeatureSource(Name typeName)
          Delegates to AbstractDataStore.getFeatureSource(String) with name.getLocalPart()
 WFSFeatureSource getFeatureSource(String typeName)
          Default implementation based on getFeatureReader and getFeatureWriter.
 String getFeatureTypeAbstract(String typeName)
           
 ReferencedEnvelope getFeatureTypeBounds(String typeName)
           
 CoordinateReferenceSystem getFeatureTypeCRS(String typeName)
           
 Set<String> getFeatureTypeKeywords(String typeName)
           
 QName getFeatureTypeName(String typeName)
           
 String getFeatureTypeTitle(String typeName)
           
 ReferencedEnvelope getFeatureTypeWGS84Bounds(String typeName)
           
 WFSServiceInfo getInfo()
          Information about this service.
 Integer getMaxFeatures()
           
 List<Name> getNames()
          Returns the same list of names than AbstractDataStore.getTypeNames() meaning the returned Names have no namespace set.
 SimpleFeatureType getSchema(Name name)
          Delegates to AbstractDataStore.getSchema(String) with name.getLocalPart()
 SimpleFeatureType getSchema(String typeName)
          DOCUMENT ME!
protected  SimpleFeatureType getSchemaGet(String typeName)
           
protected  SimpleFeatureType getSchemaPost(String typeName)
           
 String getServiceAbstract()
           
 Set<String> getServiceKeywords()
           
 URI getServiceProviderUri()
           
 String getServiceTitle()
           
 String getServiceVersion()
           
 String[] getTypeNames()
          helper method for retrieving all the names.
protected  Filter getUnsupportedFilter(String typeName, Filter filter)
          GR: if a subclass supports filtering, it should override this method to return the unsupported part of the passed filter, so a FilteringFeatureReader will be constructed upon it.
 boolean isPreferPostOverGet()
           
 Filter processFilter(Filter filter)
          Runs UpdateFidFilterVisitor on the filter and returns the result as long as transaction is not AUTO_COMMIT or null.
 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 setMaxFeatures(Integer maxFeatures)
           
 void setNamespaceOverride(String namespaceOverride)
           
 void setPreferPostOverGet(Boolean booleanValue)
           
 void setUseDefaultSRS(Boolean useDefaultSRS)
           
protected  Filter[] splitFilters(Query q, Transaction t)
           
 void updateSchema(Name typeName, SimpleFeatureType featureType)
          Delegates to AbstractDataStore.updateSchema(String, SimpleFeatureType) with name.getLocalPart()
 
Methods inherited from class AbstractDataStore
createFeatureWriter, createLockingManager, createMetadata, createSchema, dispose, getCount, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSupportedHints, state, updateSchema
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface DataStore
getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, updateSchema
 
Methods inherited from interface DataAccess
createSchema, dispose
 

Field Detail

LOGGER

public static final Logger LOGGER

capabilities

protected WFSCapabilities capabilities

preferredProtocol

protected HttpMethod preferredProtocol

strategy

protected WFSStrategy strategy
Constructor Detail

WFS_1_0_0_DataStore

public WFS_1_0_0_DataStore(HttpMethod protocol,
                           WFS100ProtocolHandler protocolHandler,
                           int timeout,
                           int buffer,
                           boolean lenient)
                    throws SAXException,
                           IOException
Construct WFSDataStore.

Parameters:
host - - may not yet be a capabilities url
protocol - - true,false,null (post,get,auto)
username - - iff password
password - - iff username
timeout - - default 3000 (ms)
buffer - - default 10 (features)
tryGZIP - - indicates to use GZIP if server supports it.
lenient - - if true the parsing will be very forgiving to bad data. Errors will be logged rather than exceptions.
Throws:
SAXException
IOException

WFS_1_0_0_DataStore

public WFS_1_0_0_DataStore(HttpMethod protocol,
                           WFS100ProtocolHandler protocolHandler,
                           int timeout,
                           int buffer,
                           boolean lenient,
                           String wfsStrategy,
                           Integer filterCompliance)
                    throws SAXException,
                           IOException
Construct WFSDataStore.

Parameters:
host - - may not yet be a capabilities url
protocol - - true,false,null (post,get,auto)
username - - iff password
password - - iff username
timeout - - default 3000 (ms)
buffer - - default 10 (features)
tryGZIP - - indicates to use GZIP if server supports it.
lenient - - if true the parsing will be very forgiving to bad data. Errors will be logged rather than exceptions.
wfsStrategy - - "mapserver", "geoserver", "strict" and "nonstrict:
filterCompliance - - filter compliance level *
Throws:
SAXException
IOException
Method Detail

getDefaultEncoding

public String getDefaultEncoding()

getInfo

public WFSServiceInfo 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>
Specified by:
getInfo in interface WFSDataStore
Overrides:
getInfo in class AbstractDataStore
Returns:
SeviceInfo
See Also:
DataAccess.getInfo()

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
See Also:
AbstractDataStore.getTypeNames()

getSchema

public SimpleFeatureType getSchema(String typeName)
                            throws IOException
DOCUMENT ME!

Specified by:
getSchema in interface DataStore
Specified by:
getSchema in class AbstractDataStore
Parameters:
typeName - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
IOException
See Also:
AbstractDataStore.getSchema(java.lang.String)

getSchemaGet

protected SimpleFeatureType getSchemaGet(String typeName)
                                  throws SAXException,
                                         IOException
Throws:
SAXException
IOException

getSchemaPost

protected SimpleFeatureType getSchemaPost(String typeName)
                                   throws IOException,
                                          SAXException
Throws:
IOException
SAXException

getFeatureReaderGet

protected FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReaderGet(Query request,
                                                                             Transaction transaction)
                                                                      throws UnsupportedEncodingException,
                                                                             IOException,
                                                                             SAXException
Throws:
UnsupportedEncodingException
IOException
SAXException

getFeatureReaderPost

protected FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReaderPost(Query query,
                                                                              Transaction transaction)
                                                                       throws SAXException,
                                                                              IOException
Throws:
SAXException
IOException

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

getFeatureReader

protected FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(String typeName,
                                                                          Query query)
                                                                   throws IOException
Description copied from class: AbstractDataStore
GR: this method is called from inside getFeatureReader(Query ,Transaction ) to allow subclasses return an optimized FeatureReader wich supports the filter and attributes truncation specified in query

A subclass that supports the creation of such an optimized FeatureReader shold override this method. Otherwise, it just returns getFeatureReader(typeName)

Overrides:
getFeatureReader in class AbstractDataStore
Throws:
IOException

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
                                                                       Transaction transaction)
                                                                throws IOException
Description copied from interface: DataStore
Gets a FeatureReader for features selected by the given Query. FeatureReader provies an iterator-style API to feature data.

The Query provides the schema for the form of the returned features as well as a Filter to constrain the features available via the reader.

The Transaction can be used to externalize the state of the DataStore. Examples of this include a JDBCDataStore sharing a connection for use across several FeatureReader requests; and a ShapefileDataStore redirecting requests to an alternate file during the course of a Transaction.

Specified by:
getFeatureReader in interface DataStore
Overrides:
getFeatureReader in class AbstractDataStore
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:
an instance of FeatureReader
Throws:
IOException - if data access errors occur
See Also:
DataStore.getFeatureReader(org.geotools.data.Query, org.geotools.data.Transaction)

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

splitFilters

protected Filter[] splitFilters(Query q,
                                Transaction t)
                         throws IOException
Throws:
IOException

getUnsupportedFilter

protected Filter getUnsupportedFilter(String typeName,
                                      Filter filter)
Description copied from class: AbstractDataStore
GR: if a subclass supports filtering, it should override this method to return the unsupported part of the passed filter, so a FilteringFeatureReader will be constructed upon it. Otherwise it will just return the same filter.

If the complete filter is supported, the subclass must return Filter.INCLUDE

Overrides:
getUnsupportedFilter in class AbstractDataStore
See Also:
org.geotools.data.AbstractDataStore#getUnsupportedFilter(java.lang.String, org.geotools.filter.Filter)

getFeatureSource

public WFSFeatureSource 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)

processFilter

public Filter processFilter(Filter filter)
Runs UpdateFidFilterVisitor on the filter and returns the result as long as transaction is not AUTO_COMMIT or null.

Parameters:
filter - filter to process.
Returns:
Runs UpdateFidFilterVisitor on the filter and returns the result as long as transaction is not AUTO_COMMIT or null.

addFidMapping

public void addFidMapping(String original,
                          String finalFid)
Adds a new fid mapping to the fid map.

Parameters:
original - the before fid
finalFid - the final fid;

getCapabilities

public WFSCapabilities getCapabilities()

getFeatureSource

public SimpleFeatureSource getFeatureSource(Name typeName)
                                     throws IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.getFeatureSource(String) with name.getLocalPart()

Specified by:
getFeatureSource in interface DataAccess<SimpleFeatureType,SimpleFeature>
Specified by:
getFeatureSource in interface DataStore
Overrides:
getFeatureSource in class AbstractDataStore
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
See Also:
DataAccess.getFeatureSource(Name)

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(Name name)
                            throws IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.getSchema(String) with name.getLocalPart()

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

updateSchema

public void updateSchema(Name typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.updateSchema(String, SimpleFeatureType) with name.getLocalPart()

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

getDescribeFeatureTypeURL

public URL getDescribeFeatureTypeURL(String typeName)
Specified by:
getDescribeFeatureTypeURL in interface WFSDataStore
See Also:
WFSDataStore.getDescribeFeatureTypeURL(String)

getFeatureTypeAbstract

public String getFeatureTypeAbstract(String typeName)
Specified by:
getFeatureTypeAbstract in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeBounds(String)

getFeatureTypeBounds

public ReferencedEnvelope getFeatureTypeBounds(String typeName)
Specified by:
getFeatureTypeBounds in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeBounds(String)

getFeatureTypeCRS

public CoordinateReferenceSystem getFeatureTypeCRS(String typeName)
Specified by:
getFeatureTypeCRS in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeCRS(String)

getFeatureTypeKeywords

public Set<String> getFeatureTypeKeywords(String typeName)
Specified by:
getFeatureTypeKeywords in interface WFSDataStore
See Also:
WFSDataStore#

getFeatureTypeTitle

public String getFeatureTypeTitle(String typeName)
Specified by:
getFeatureTypeTitle in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeTitle(String)

getFeatureTypeWGS84Bounds

public ReferencedEnvelope getFeatureTypeWGS84Bounds(String typeName)
Specified by:
getFeatureTypeWGS84Bounds in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeWGS84Bounds(String)

setMaxFeatures

public void setMaxFeatures(Integer maxFeatures)
Specified by:
setMaxFeatures in interface WFSDataStore

getCapabilitiesURL

public URL getCapabilitiesURL()
Specified by:
getCapabilitiesURL in interface WFSDataStore

getFeatureTypeName

public QName getFeatureTypeName(String typeName)
Specified by:
getFeatureTypeName in interface WFSDataStore

getMaxFeatures

public Integer getMaxFeatures()
Specified by:
getMaxFeatures in interface WFSDataStore

getServiceAbstract

public String getServiceAbstract()
Specified by:
getServiceAbstract in interface WFSDataStore

getServiceKeywords

public Set<String> getServiceKeywords()
Specified by:
getServiceKeywords in interface WFSDataStore

getServiceProviderUri

public URI getServiceProviderUri()
Specified by:
getServiceProviderUri in interface WFSDataStore

getServiceTitle

public String getServiceTitle()
Specified by:
getServiceTitle in interface WFSDataStore

getServiceVersion

public String getServiceVersion()
Specified by:
getServiceVersion in interface WFSDataStore

isPreferPostOverGet

public boolean isPreferPostOverGet()
Specified by:
isPreferPostOverGet in interface WFSDataStore

setPreferPostOverGet

public void setPreferPostOverGet(Boolean booleanValue)
Specified by:
setPreferPostOverGet in interface WFSDataStore
Parameters:
booleanValue - Boolean.TRUE to prefer POST over GET, Boolean.FALSE for the opposite, null for auto (let the implementation decide)

setNamespaceOverride

public void setNamespaceOverride(String namespaceOverride)
Specified by:
setNamespaceOverride in interface WFSDataStore
See Also:
WFSDataStore.setNamespaceOverride(java.lang.String)

setUseDefaultSRS

public void setUseDefaultSRS(Boolean useDefaultSRS)
Specified by:
setUseDefaultSRS in interface WFSDataStore

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
Overrides:
removeSchema in class AbstractDataStore
Throws:
IOException - if the operation failed
See Also:
DataStore.removeSchema(String)

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>
Overrides:
removeSchema in class AbstractDataStore
Throws:
IOException - if the operation failed
See Also:
DataAccess.removeSchema(Name)


Copyright © 1996-2014 Geotools. All Rights Reserved.