org.geotools.data.wfs.v1_0_0
Class WFS_1_0_0_DataStore

java.lang.Object
  extended by org.geotools.data.AbstractDataStore
      extended by org.geotools.data.wfs.v1_0_0.WFS_1_0_0_DataStore
All Implemented Interfaces:
DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, DataStore, WFSDataStore

public class WFS_1_0_0_DataStore
extends AbstractDataStore
implements WFSDataStore

DOCUMENT ME!

Author:
dzwiers

Field Summary
protected  WFSCapabilities capabilities
           
static java.util.logging.Logger LOGGER
           
protected  HttpMethod preferredProtocol
           
protected  org.geotools.data.wfs.v1_0_0.WFSStrategy strategy
           
 
Fields inherited from class org.geotools.data.AbstractDataStore
isWriteable, listenerManager
 
Constructor Summary
WFS_1_0_0_DataStore(HttpMethod protocol, WFS100ProtocolHandler protocolHandler, int timeout, int buffer, boolean lenient)
          Construct WFSDataStore.
 
Method Summary
 void addFidMapping(java.lang.String original, java.lang.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()
           
 java.net.URL getCapabilitiesURL()
           
 java.net.URL getDescribeFeatureTypeURL(java.lang.String typeName)
           
 FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(Query query, Transaction transaction)
          Access a FeatureReader providing access to Feature information.
protected  FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.lang.String typeName)
          Subclass must implement.
protected  FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.lang.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
protected  FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReaderGet(Query request, Transaction transaction)
           
protected  FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReaderPost(Query query, Transaction transaction)
           
 FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(org.opengis.feature.type.Name typeName)
          Delegates to AbstractDataStore.getFeatureSource(String) with name.getLocalPart()
 WFSFeatureSource getFeatureSource(java.lang.String typeName)
          Default implementation based on getFeatureReader and getFeatureWriter.
 java.lang.String getFeatureTypeAbstract(java.lang.String typeName)
           
 ReferencedEnvelope getFeatureTypeBounds(java.lang.String typeName)
           
 org.opengis.referencing.crs.CoordinateReferenceSystem getFeatureTypeCRS(java.lang.String typeName)
           
 java.util.Set<java.lang.String> getFeatureTypeKeywords(java.lang.String typeName)
           
 javax.xml.namespace.QName getFeatureTypeName(java.lang.String typeName)
           
 java.lang.String getFeatureTypeTitle(java.lang.String typeName)
           
 ReferencedEnvelope getFeatureTypeWGS84Bounds(java.lang.String typeName)
           
 WFSServiceInfo getInfo()
          Information about this service.
 java.lang.Integer getMaxFeatures()
           
 java.util.List<org.opengis.feature.type.Name> getNames()
          Returns the same list of names than AbstractDataStore.getTypeNames() meaning the returned Names have no namespace set.
 org.opengis.feature.simple.SimpleFeatureType getSchema(org.opengis.feature.type.Name name)
          Delegates to AbstractDataStore.getSchema(String) with name.getLocalPart()
 org.opengis.feature.simple.SimpleFeatureType getSchema(java.lang.String typeName)
          DOCUMENT ME!
protected  org.opengis.feature.simple.SimpleFeatureType getSchemaGet(java.lang.String typeName)
           
protected  org.opengis.feature.simple.SimpleFeatureType getSchemaPost(java.lang.String typeName)
           
 java.lang.String getServiceAbstract()
           
 java.util.Set<java.lang.String> getServiceKeywords()
           
 java.net.URI getServiceProviderUri()
           
 java.lang.String getServiceTitle()
           
 java.lang.String getServiceVersion()
           
 java.lang.String[] getTypeNames()
          helper method for retrieving all the names.
protected  org.opengis.filter.Filter getUnsupportedFilter(java.lang.String typeName, org.opengis.filter.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()
           
 org.opengis.filter.Filter processFilter(org.opengis.filter.Filter filter)
          Runs FidFilterVisitor on the filter and returns the result as long as transaction is not AUTO_COMMIT or null.
 void setMaxFeatures(java.lang.Integer maxFeatures)
           
 void setPreferPostOverGet(java.lang.Boolean booleanValue)
           
protected  org.opengis.filter.Filter[] splitFilters(Query q, Transaction t)
           
 void updateSchema(org.opengis.feature.type.Name typeName, org.opengis.feature.simple.SimpleFeatureType featureType)
          Delegates to AbstractDataStore.updateSchema(String, SimpleFeatureType) with name.getLocalPart()
 
Methods inherited from class org.geotools.data.AbstractDataStore
createFeatureWriter, createLockingManager, createMetadata, createSchema, dispose, getCount, getFeatureWriter, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSupportedHints, getView, state, updateSchema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.data.DataStore
getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getView, updateSchema
 
Methods inherited from interface org.geotools.data.DataAccess
createSchema, dispose
 

Field Detail

LOGGER

public static final java.util.logging.Logger LOGGER

capabilities

protected WFSCapabilities capabilities

preferredProtocol

protected HttpMethod preferredProtocol

strategy

protected org.geotools.data.wfs.v1_0_0.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 org.xml.sax.SAXException,
                           java.io.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:
org.xml.sax.SAXException
java.io.IOException
Method Detail

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<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Specified by:
getInfo in interface WFSDataStore
Overrides:
getInfo in class AbstractDataStore
Returns:
SeviceInfo
See Also:
DataAccess.getInfo()

getTypeNames

public java.lang.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:
typeNames for available FeatureTypes.
See Also:
AbstractDataStore.getTypeNames()

getSchema

public org.opengis.feature.simple.SimpleFeatureType getSchema(java.lang.String typeName)
                                                       throws java.io.IOException
DOCUMENT ME!

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

getSchemaGet

protected org.opengis.feature.simple.SimpleFeatureType getSchemaGet(java.lang.String typeName)
                                                             throws org.xml.sax.SAXException,
                                                                    java.io.IOException
Throws:
org.xml.sax.SAXException
java.io.IOException

getSchemaPost

protected org.opengis.feature.simple.SimpleFeatureType getSchemaPost(java.lang.String typeName)
                                                              throws java.io.IOException,
                                                                     org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getFeatureReaderGet

protected FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReaderGet(Query request,
                                                                                                                                   Transaction transaction)
                                                                                                                            throws java.io.UnsupportedEncodingException,
                                                                                                                                   java.io.IOException,
                                                                                                                                   org.xml.sax.SAXException
Throws:
java.io.UnsupportedEncodingException
java.io.IOException
org.xml.sax.SAXException

getFeatureReaderPost

protected FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReaderPost(Query query,
                                                                                                                                    Transaction transaction)
                                                                                                                             throws org.xml.sax.SAXException,
                                                                                                                                    java.io.IOException
Throws:
org.xml.sax.SAXException
java.io.IOException

getFeatureReader

protected FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.lang.String typeName)
                                                                                                                         throws java.io.IOException
Description copied from class: AbstractDataStore
Subclass must implement.

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

getFeatureReader

protected FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(java.lang.String typeName,
                                                                                                                                Query query)
                                                                                                                         throws java.io.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:
java.io.IOException

getFeatureReader

public FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(Query query,
                                                                                                                             Transaction transaction)
                                                                                                                      throws java.io.IOException
Description copied from interface: DataStore
Access a FeatureReader providing access to Feature information.

Filter is used as a low-level indication of constraints. (Implementations may resort to using a FilteredFeatureReader, or provide their own optimizations)

FeatureType provides a template for the returned FeatureReader

Transaction to externalize DataStore state on a per Transaction basis. The most common example is a JDBC datastore saving a Connection for use across several FeatureReader requests. Similarly a Shapefile reader may wish to redirect FeatureReader requests to a alternate filename over the course of a Transaction.

Notes For Implementing DataStore

Subclasses may need to retrieve additional attributes, beyond those requested by featureType.getAttributeTypes(), in order to correctly apply the filter.
These Additional attribtues should be not be returned by FeatureReader. Subclasses may use ReTypeFeatureReader to aid in acomplishing this.

Helper classes for implementing a FeatureReader (in order):

Sample use (not optimized):


 if (filter == Filter.EXCLUDE) {
      return new EmptyFeatureReader(featureType);
  }

  String typeName = featureType.getTypeName();
  FeatureType schema = getSchema( typeName );
  FeatureReader reader = new DefaultFeatureReader( getAttributeReaders(), schema );

  if (filter != Filter.INCLUDE) {
      reader = new FilteringFeatureReader(reader, filter);
  }

  if (transaction != Transaction.AUTO_COMMIT) {
      Map diff = state(transaction).diff(typeName);
      reader = new DiffFeatureReader(reader, diff);
  }

  if (!featureType.equals(reader.getFeatureType())) {
      reader = new ReTypeFeatureReader(reader, featureType);
  }
 return reader
 

Locking support does not need to be provided for FeatureReaders.

Specified by:
getFeatureReader in interface DataStore
Overrides:
getFeatureReader in class AbstractDataStore
Parameters:
query - Requested form of the returned Features and the filter used to constraints the results
transaction - Transaction this query operates against
Returns:
FeatureReader Allows Sequential Processing of featureType
Throws:
java.io.IOException
See Also:
DataStore.getFeatureReader(org.geotools.data.Query, org.geotools.data.Transaction)

getBounds

protected ReferencedEnvelope getBounds(Query query)
                                throws java.io.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
java.io.IOException

splitFilters

protected org.opengis.filter.Filter[] splitFilters(Query q,
                                                   Transaction t)
                                            throws java.io.IOException
Throws:
java.io.IOException

getUnsupportedFilter

protected org.opengis.filter.Filter getUnsupportedFilter(java.lang.String typeName,
                                                         org.opengis.filter.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(java.lang.String typeName)
                                  throws java.io.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
Returns:
FeatureSource (or subclass) providing operations for typeName
Throws:
java.io.IOException
See Also:
DataStore.getFeatureSource(java.lang.String)

processFilter

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

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

addFidMapping

public void addFidMapping(java.lang.String original,
                          java.lang.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 FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(org.opengis.feature.type.Name typeName)
                                                                                                                      throws java.io.IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.getFeatureSource(String) with name.getLocalPart()

Specified by:
getFeatureSource in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
getFeatureSource in class AbstractDataStore
Returns:
Access to the named resource being made available
Throws:
java.io.IOException
See Also:
DataAccess.getFeatureSource(Name)

getNames

public java.util.List<org.opengis.feature.type.Name> getNames()
                                                       throws java.io.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<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
getNames in class AbstractDataStore
Returns:
Names of the available contents.
Throws:
java.io.IOException
See Also:
DataAccess.getNames()

getSchema

public org.opengis.feature.simple.SimpleFeatureType getSchema(org.opengis.feature.type.Name name)
                                                       throws java.io.IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.getSchema(String) with name.getLocalPart()

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

updateSchema

public void updateSchema(org.opengis.feature.type.Name typeName,
                         org.opengis.feature.simple.SimpleFeatureType featureType)
                  throws java.io.IOException
Description copied from class: AbstractDataStore
Delegates to AbstractDataStore.updateSchema(String, SimpleFeatureType) with name.getLocalPart()

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

getDescribeFeatureTypeURL

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

getFeatureTypeAbstract

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

getFeatureTypeBounds

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

getFeatureTypeCRS

public org.opengis.referencing.crs.CoordinateReferenceSystem getFeatureTypeCRS(java.lang.String typeName)
Specified by:
getFeatureTypeCRS in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeCRS(String)

getFeatureTypeKeywords

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

getFeatureTypeTitle

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

getFeatureTypeWGS84Bounds

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

setMaxFeatures

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

getCapabilitiesURL

public java.net.URL getCapabilitiesURL()
Specified by:
getCapabilitiesURL in interface WFSDataStore

getFeatureTypeName

public javax.xml.namespace.QName getFeatureTypeName(java.lang.String typeName)
Specified by:
getFeatureTypeName in interface WFSDataStore

getMaxFeatures

public java.lang.Integer getMaxFeatures()
Specified by:
getMaxFeatures in interface WFSDataStore

getServiceAbstract

public java.lang.String getServiceAbstract()
Specified by:
getServiceAbstract in interface WFSDataStore

getServiceKeywords

public java.util.Set<java.lang.String> getServiceKeywords()
Specified by:
getServiceKeywords in interface WFSDataStore

getServiceProviderUri

public java.net.URI getServiceProviderUri()
Specified by:
getServiceProviderUri in interface WFSDataStore

getServiceTitle

public java.lang.String getServiceTitle()
Specified by:
getServiceTitle in interface WFSDataStore

getServiceVersion

public java.lang.String getServiceVersion()
Specified by:
getServiceVersion in interface WFSDataStore

isPreferPostOverGet

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

setPreferPostOverGet

public void setPreferPostOverGet(java.lang.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)


Copyright © 1996-2010 Geotools. All Rights Reserved.