com.moximedia.ows.wfs
Class GetFeature

java.lang.Object
  extended bycom.moximedia.ows.wfs.GetFeature
All Implemented Interfaces:
java.io.Serializable

public class GetFeature
extends java.lang.Object
implements java.io.Serializable

Implementation of a WFS GetFeature query. This class executes a query for the layer and returns the result as a recordset.

Author:
Doug Cates - www.moximedia.com
See Also:
Serialized Form

Constructor Summary
GetFeature()
          Creates a new GetFeature object.
GetFeature(java.lang.String layerName, WfsService service, Filter filter, Recordset rs)
          Creates a new GetFeature object for the specified layer, filter and recordset.
GetFeature(java.lang.String layerName, WfsService service, Filter filter, Recordset rs, int maxFeatures)
          Creates a new GetFeature object for the specified layer, filter and recordset.
GetFeature(WfsLayer layer, Filter filter)
          Creates a new GetFeature object for the specified layer, and filter.
GetFeature(WfsLayer layer, Filter filter, int maxFeatures)
          Creates a new GetFeature object for the specified layer, and filter.
 
Method Summary
 java.lang.String getKvpRequestString()
          Gets the HTTP request used for the GetFeature query.
 java.lang.String getPostRequestString()
          Gets the XML used for the GetFeature query.
 java.lang.String getRequest()
          Gets the request XML or HTTP.
 java.lang.String getResponse()
          Gets the response from the WFS server.
 boolean isValid()
          Returns an indicator of whether the settings are complete enough to make a WFS request.
 Recordset query()
          Submits the WFS query for the object and returns the recordset.
static Recordset query(java.lang.String url, java.lang.String layerName, Filter filter, int maxFeatures)
          Executes a static WFS GetFeature POST request with the values specified, using the default version 1.0.0, output format GML2, parser com.moximedia.ows.xml.GetFeatureGML2 and null namespace.
static Recordset query(java.lang.String url, java.lang.String version, java.lang.String layerName, Filter filter, int maxFeatures, java.lang.String namespace, java.lang.String schema, java.lang.String outputFormat, java.lang.String parsingFormat)
          Executes a static WFS GetFeature POST request with the values specified.
 void setFieldNames(java.lang.String names)
          Sets the names of the fields to return feature information for.
 void setFilter(Filter filter)
          Sets the filter for the query.
 void setLayerName(java.lang.String name)
          Sets the layer name to be queried.
 void setMaxFeatures(int maxFeatures)
          Sets the maximum number of features to be returned as a result.
 void setNamespace(java.lang.String namespace)
          Sets the namespace addition for the query header.
 void setOutputFormat(java.lang.String format)
          Sets the output format.
 void setParsingFormat(java.lang.String format)
          Sets the name of the class used to parse features.
 void setRecordset(Recordset rs)
          Sets the recordset that features will be loaded into.
 void setRequestMethod(int method)
          Sets the request method.
 void setSchema(java.lang.String schema)
          Sets the schema addition for the query header.
 void setService(WfsService service)
          Sets the WFS service.
 void setUrl(java.lang.String url)
          Sets the URL to call for the GetFeature request.
 void setUseOgcNamespaces(boolean useOgcNamespaces)
          Sets whether the request should include OGC namespaces.
 void setVersion(java.lang.String version)
          Sets the version string to send to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetFeature

public GetFeature()
Creates a new GetFeature object.


GetFeature

public GetFeature(WfsLayer layer,
                  Filter filter)
Creates a new GetFeature object for the specified layer, and filter. Note that the following properties are set to the settings of the service that is associated to the layer: url, namespace, request method, output format, and parsing format. If there is no service set, these properties will use the defaults or must be set using the setter methods. Note: output format defaults to "GML2", parsing format defaults to "com.moximedia.ows.xml.GetFeatureGML2", request method defaults to WFS_REQUEST_METHOD_POST, maximum features defaults to 25, and version defaults to "1.0.0"

Parameters:
layer - The WFS layer to query.
filter - The filter to use to select features.

GetFeature

public GetFeature(WfsLayer layer,
                  Filter filter,
                  int maxFeatures)
Creates a new GetFeature object for the specified layer, and filter. Note that the following properties are set to the settings of the service that is associated to the layer: url, namespace, request method, output format, and parsing format. If there is no service set, these properties will use the defaults or must be set using the setter methods. Note: output format defaults to "GML2", parsing format defaults to "com.moximedia.ows.xml.GetFeatureGML2", request method defaults to WFS_REQUEST_METHOD_POST and version defaults to "1.0.0"

Parameters:
layer - The WFS layer to query.
filter - The filter to use to select features.
maxFeatures - The maximum number of results.

GetFeature

public GetFeature(java.lang.String layerName,
                  WfsService service,
                  Filter filter,
                  Recordset rs)
Creates a new GetFeature object for the specified layer, filter and recordset. This constructor is used if the target recordset is not the recordset of the WFS layer, such as when the WFS layer is a layer associated with a WMS layer.

Parameters:
layerName - The name of the WFS layer.
service - The WFS service.
filter - The filter to use to select features.
rs - The target recordset for the results.

GetFeature

public GetFeature(java.lang.String layerName,
                  WfsService service,
                  Filter filter,
                  Recordset rs,
                  int maxFeatures)
Creates a new GetFeature object for the specified layer, filter and recordset. This constructor is used if the target recordset is not the recordset of the WFS layer, such as when the WFS layer is a layer associated with a WMS layer.

Parameters:
layerName - The name of the WFS layer.
service - The WFS service.
filter - The filter to use to select features.
rs - The target recordset for the results.
maxFeatures - The maximum number of results.
Method Detail

setFieldNames

public void setFieldNames(java.lang.String names)
Sets the names of the fields to return feature information for.

Parameters:
names - The field names, comma separated, no spaces.

setFilter

public void setFilter(Filter filter)
Sets the filter for the query.

Parameters:
filter - The filter.

setLayerName

public void setLayerName(java.lang.String name)
Sets the layer name to be queried.

Parameters:
name - The layer name.

setMaxFeatures

public void setMaxFeatures(int maxFeatures)
Sets the maximum number of features to be returned as a result.

Parameters:
maxFeatures - The maximum number of features to be returned.

setNamespace

public void setNamespace(java.lang.String namespace)
Sets the namespace addition for the query header.

Parameters:
namespace - The namespace text.

setOutputFormat

public void setOutputFormat(java.lang.String format)
Sets the output format.

Parameters:
format - The output format, like "GML2".

setParsingFormat

public void setParsingFormat(java.lang.String format)
Sets the name of the class used to parse features.

Parameters:
format - The name of the class used to parse features, like "com.moximedia.ows.xml.GetFeatureGML2".

setRequestMethod

public void setRequestMethod(int method)
Sets the request method.

Parameters:
method - The request method, either WfsService.WFS_REQUEST_METHOD_GET or WfsService.WFS_REQUEST_METHOD_POST.

setRecordset

public void setRecordset(Recordset rs)
Sets the recordset that features will be loaded into. In most cases, this will be a layer's recordset, but it can be a stand alone recordset.

Parameters:
rs - The recordset.

setSchema

public void setSchema(java.lang.String schema)
Sets the schema addition for the query header.

Parameters:
schema - The schema text.

setService

public void setService(WfsService service)
Sets the WFS service. When this method is used, the following settings from the WFS service are used by the GetFeature request unless specified after this request: namespace, url, request method, ouput format, version, parsing format.

Parameters:
service - The WFS service.

setUrl

public void setUrl(java.lang.String url)
Sets the URL to call for the GetFeature request.

Parameters:
url - The URL.

setUseOgcNamespaces

public void setUseOgcNamespaces(boolean useOgcNamespaces)
Sets whether the request should include OGC namespaces.

Parameters:
useOgcNamespaces - True if they are used, otherwise false.

setVersion

public void setVersion(java.lang.String version)
Sets the version string to send to the server.

Parameters:
version - The version string, like "1.0.0".

getRequest

public java.lang.String getRequest()
Gets the request XML or HTTP.

Returns:
The request, or null.

getResponse

public java.lang.String getResponse()
Gets the response from the WFS server.

Returns:
The response string or null.

isValid

public boolean isValid()
Returns an indicator of whether the settings are complete enough to make a WFS request.

Returns:
True if the object state is valid, otherwise false.

query

public Recordset query()
Submits the WFS query for the object and returns the recordset.

Returns:
The recordset containing the query results.

query

public static Recordset query(java.lang.String url,
                              java.lang.String layerName,
                              Filter filter,
                              int maxFeatures)
Executes a static WFS GetFeature POST request with the values specified, using the default version 1.0.0, output format GML2, parser com.moximedia.ows.xml.GetFeatureGML2 and null namespace.

Parameters:
url -
layerName - The layer name.
filter - The filter to select features.
maxFeatures - The maximum number of features to return.
Returns:
The recordset containing the results.

query

public static Recordset query(java.lang.String url,
                              java.lang.String version,
                              java.lang.String layerName,
                              Filter filter,
                              int maxFeatures,
                              java.lang.String namespace,
                              java.lang.String schema,
                              java.lang.String outputFormat,
                              java.lang.String parsingFormat)
Executes a static WFS GetFeature POST request with the values specified.

Parameters:
url -
version - The WFS version number.
layerName - The layer name.
filter - The filter to select features.
maxFeatures - The maximum number of features to return.
namespace - The extra namespace definition to add to the request.
outputFormat - The output format for the response.
parsingFormat - The name of the class used for parsing the response.
Returns:
The recordset containing the results.

getKvpRequestString

public java.lang.String getKvpRequestString()
Gets the HTTP request used for the GetFeature query.

Returns:
The HTTP request used in GetFeature requests using GET protocol.

getPostRequestString

public java.lang.String getPostRequestString()
Gets the XML used for the GetFeature query.

Returns:
The XML used in GetFeature requests using POST protocol.


Internet Mapping Framework for OpenGIS Java Object Model API (v1.3.007)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.