org.geotools.data.wfs.v1_1_0
Class WFS_1_1_0_DataStore

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

public final class WFS_1_1_0_DataStore
extends Object
implements WFSDataStore

A WFS 1.1 DataStore implementation.

Note with the current design, this class is meant to be pulled up as the single WFS DataStore implementation regardless of the WFS version, since the protocol version specifics is meant to be handled by the WFSProtocol implementation provided to this class. For the time being, while there are no resources to spend on porting the WFS 1.0.0 datastore to the new design, this keeps here in this 1.1 specific package.

Since:
2.5.x
Author:
Gabriel Roldan

Field Summary
protected  WFSProtocol wfs
           
 
Fields inherited from interface WFSDataStore
AXIS_ORDER_COMPLIANT, AXIS_ORDER_EAST_NORTH, AXIS_ORDER_NORTH_EAST, WFS_VENDOR_PARAMETERS
 
Constructor Summary
WFS_1_1_0_DataStore(WFSProtocol wfs)
          The WFS capabilities document.
 
Method Summary
 void createSchema(SimpleFeatureType featureType)
          Creates storage for a new featureType.
 void dispose()
          Disposes of this data store and releases any resource that it is using.
 String getAxisOrderForFilter()
           
 String getAxisOrderForOutput()
           
 ReferencedEnvelope getBounds(Query query)
          Only returns the bounds of the query (ie, the bounds of the whole feature type) if the query has no filter set, otherwise the bounds may be too expensive to acquire.
 URL getCapabilitiesURL()
           
 int getCount(Query query)
          If the query is fully supported, makes a GetFeature request with resultType=hits and returns the counts returned by the server, otherwise returns -1 as the result is too expensive to calculate.
 URL getDescribeFeatureTypeURL(String typeName)
           
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction)
          Gets a FeatureReader for features selected by the given Query.
 SimpleFeatureSource getFeatureSource(Name typeName)
          Gets a SimpleFeatureSource for features of the type specified by a qualified name (namespace plus type name).
 WFSFeatureSource getFeatureSource(String typeName)
          Gets a SimpleFeatureSource for features of the specified type.
 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)
           
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction)
          Not supported.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction)
          Not supported.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction)
          Not supported.
 WFSServiceInfo getInfo()
          Overrides DataAccess.getInfo() so it type narrows to a WFSServiceInfo
 LockingManager getLockingManager()
          Retrieve a per featureID based locking service from this DataStore.
 Integer getMaxFeatures()
           
protected  int getMaxFeatures(Query query)
           
 List<Name> getNames()
          Names of the available Resources.
 SimpleFeatureType getSchema(Name name)
          Description of the named resource.
 SimpleFeatureType getSchema(String prefixedTypeName)
          Makes a DescribeFeatureType request for typeName feature type, parses the server response into a SimpleFeatureType and returns it.
 String getServiceAbstract()
           
 Set<String> getServiceKeywords()
           
 URI getServiceProviderUri()
           
 String getServiceTitle()
           
 String getServiceVersion()
           
 String[] getTypeNames()
          Gets the names of feature types available in this DataStore.
static boolean invertAxisNeeded(String axisOrder, CoordinateReferenceSystem crs)
          Checks if axis flipping is needed comparing axis order requested for the DataStore with query crs.
 boolean isPreferPostOverGet()
           
 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 setAxisOrder(String axisOrderOutput, String axisOrderFilter)
          Configure expected axis order for output and filters.
 void setGetFeatureOutputFormat(String outputFormat)
           
 void setMappedURIs(Map<String,String> mappedURIs)
           
 void setMaxFeatures(Integer maxFeatures)
           
 void setNamespaceOverride(String namespaceOverride)
           
 void setPreferPostOverGet(Boolean booleanValue)
           
 void setUseDefaultSRS(Boolean useDefaultSRS)
           
 String toString()
           
 void updateSchema(Name typeName, SimpleFeatureType featureType)
          Used to update a schema in place.
 void updateSchema(String typeName, SimpleFeatureType featureType)
          Applies a new schema to the given feature type.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wfs

protected WFSProtocol wfs
Constructor Detail

WFS_1_1_0_DataStore

public WFS_1_1_0_DataStore(WFSProtocol wfs)
The WFS capabilities document.

Parameters:
capabilities -
Method Detail

setMappedURIs

public void setMappedURIs(Map<String,String> mappedURIs)
Parameters:
mappedURIs - the mappedURIs to set

setAxisOrder

public void setAxisOrder(String axisOrderOutput,
                         String axisOrderFilter)
Configure expected axis order for output and filters.

Parameters:
axisOrder -
axisOrderFilter -

getAxisOrderForOutput

public String getAxisOrderForOutput()

getAxisOrderForFilter

public String getAxisOrderForFilter()

setNamespaceOverride

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

setMaxFeatures

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

getMaxFeatures

public Integer getMaxFeatures()
Specified by:
getMaxFeatures in interface WFSDataStore
See Also:
WFSDataStore.getMaxFeatures()

isPreferPostOverGet

public boolean isPreferPostOverGet()
Specified by:
isPreferPostOverGet in interface WFSDataStore
See Also:
WFSDataStore.isPreferPostOverGet()

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)
See Also:
WFSDataStore#setPreferPostOverGet(boolean)

getInfo

public WFSServiceInfo getInfo()
Description copied from interface: WFSDataStore
Overrides DataAccess.getInfo() so it type narrows to a WFSServiceInfo

Specified by:
getInfo in interface DataAccess<SimpleFeatureType,SimpleFeature>
Specified by:
getInfo in interface WFSDataStore
Returns:
service information
See Also:
WFSDataStore.getInfo()

getSchema

public SimpleFeatureType getSchema(String prefixedTypeName)
                            throws IOException
Makes a DescribeFeatureType request for typeName feature type, parses the server response into a SimpleFeatureType and returns it.

Due to a current limitation widely spread through the GeoTools library, the parsed FeatureType will be adapted to share the same name than the Features produced for it. For example, if the actual feature type name is Streams_Type and the features name (i.e. which is the FeatureType name as stated in the WFS capabilities document) is Stream, the returned feature type name will also be Stream.

Specified by:
getSchema in interface DataStore
Parameters:
prefixedTypeName - the type name as stated in the WFS capabilities document
Returns:
the GeoTools FeatureType for the typeName as stated on the capabilities document.
Throws:
IOException - if typeName is not available
See Also:
DataStore.getSchema(java.lang.String)

getSchema

public SimpleFeatureType getSchema(Name name)
                            throws IOException
Description copied from interface: DataAccess
Description of the named resource.

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

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
See Also:
DataAccess.getSchema(Name), getSchema(String)

getNames

public List<Name> getNames()
                    throws IOException
Description copied from interface: DataAccess
Names of the available Resources.

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

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

getTypeNames

public String[] getTypeNames()
                      throws IOException
Description copied from interface: DataStore
Gets the names of feature types available in this DataStore. Please note that this is not guaranteed to return a list of unique names since the same unqualified name may be present in separate namespaces within the DataStore.

Specified by:
getTypeNames in interface DataStore
Returns:
names of feature types available in this DataStore
Throws:
IOException - if data access errors occur
See Also:
DataStore.getTypeNames()

dispose

public void dispose()
Description copied from interface: DataAccess
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.

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

invertAxisNeeded

public static boolean invertAxisNeeded(String axisOrder,
                                       CoordinateReferenceSystem crs)
Checks if axis flipping is needed comparing axis order requested for the DataStore with query crs.

Parameters:
axisOrder -
coordinateSystem -
Returns:

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

getFeatureSource

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

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 lock support so far
See Also:
DataStore.getLockingManager()

getFeatureWriter

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                       Filter filter,
                                                                       Transaction transaction)
                                                                throws IOException
Not supported.

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:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriter(java.lang.String, org.opengis.filter.Filter, org.geotools.data.Transaction)

getFeatureWriter

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                       Transaction transaction)
                                                                throws IOException
Not supported.

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:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriter(java.lang.String, org.geotools.data.Transaction)

getFeatureWriterAppend

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName,
                                                                             Transaction transaction)
                                                                      throws IOException
Not supported.

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:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - if data access errors occur
See Also:
DataStore.getFeatureWriterAppend(java.lang.String, org.geotools.data.Transaction)

getFeatureSource

public SimpleFeatureSource getFeatureSource(Name typeName)
                                     throws IOException
Description copied from interface: DataStore
Gets a SimpleFeatureSource for features of the type specified by a qualified name (namespace plus type name).

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
See Also:
DataAccess.getFeatureSource(org.opengis.feature.type.Name)

updateSchema

public void updateSchema(Name typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Description copied from interface: DataAccess
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.

Specified by:
updateSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Throws:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - if the operation failed
See Also:
DataAccess.updateSchema(Name, org.opengis.feature.type.FeatureType)

updateSchema

public void updateSchema(String typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Description copied from interface: DataStore
Applies a new schema to the given feature type. This can be used to add or remove properties. The resulting update will be persistent.

Specified by:
updateSchema in interface DataStore
Parameters:
typeName - name of the feature type to update
featureType - the new schema to apply
Throws:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - on error
See Also:
DataStore.updateSchema(java.lang.String, org.opengis.feature.simple.SimpleFeatureType)

createSchema

public void createSchema(SimpleFeatureType featureType)
                  throws IOException
Description copied from interface: DataAccess
Creates storage for a new featureType.

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

Specified by:
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
featureType - FetureType to add to DataStore
Throws:
UnsupportedOperationException - always since this operation does not apply to a WFS backend
IOException - If featureType cannot be created
See Also:
org.geotools.data.DataStore#createSchema(org.opengis.feature.simple.SimpleFeatureType)

getFeatureTypeName

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

getFeatureTypeTitle

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

getFeatureTypeAbstract

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

getFeatureTypeWGS84Bounds

public ReferencedEnvelope getFeatureTypeWGS84Bounds(String typeName)
Specified by:
getFeatureTypeWGS84Bounds in interface WFSDataStore
See Also:
WFSDataStore.getFeatureTypeWGS84Bounds(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
Returns:
a non null CRS for the feature type, if the actual CRS can't be determined, DefaultEngineeringCRS.GENERIC_2D is returned
See Also:
WFSDataStore.getFeatureTypeCRS(String)

getFeatureTypeKeywords

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

getDescribeFeatureTypeURL

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

getServiceAbstract

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

getServiceKeywords

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

getServiceProviderUri

public URI getServiceProviderUri()
Specified by:
getServiceProviderUri in interface WFSDataStore
See Also:
WFSDataStore.getServiceProviderUri()

getCapabilitiesURL

public URL getCapabilitiesURL()
Specified by:
getCapabilitiesURL in interface WFSDataStore
See Also:
WFSDataStore.getCapabilitiesURL()

getServiceTitle

public String getServiceTitle()
Specified by:
getServiceTitle in interface WFSDataStore
See Also:
WFSDataStore#getserviceTitle()

getServiceVersion

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

getBounds

public ReferencedEnvelope getBounds(Query query)
                             throws IOException
Only returns the bounds of the query (ie, the bounds of the whole feature type) if the query has no filter set, otherwise the bounds may be too expensive to acquire.

Parameters:
query -
Returns:
The bounding box of the datasource in the CRS required by the query, or null if unknown and too expensive for the method to calculate or any errors occur.
Throws:
IOException

getCount

public int getCount(Query query)
             throws IOException
If the query is fully supported, makes a GetFeature request with resultType=hits and returns the counts returned by the server, otherwise returns -1 as the result is too expensive to calculate.

Parameters:
query -
Returns:
the number of features returned by a GetFeature?resultType=hits request, or -1 if not supported
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

getMaxFeatures

protected int getMaxFeatures(Query query)

setUseDefaultSRS

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

setGetFeatureOutputFormat

public void setGetFeatureOutputFormat(String outputFormat)

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

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


Copyright © 1996-2014 Geotools. All Rights Reserved.