deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.feature
Class GMLFeatureAdapter

java.lang.Object
  extended by org.deegree.model.feature.GMLFeatureAdapter

public class GMLFeatureAdapter
extends Object

Exports feature instances to their GML representation.

Has support for XLink output and to disable XLink output (which is generally not feasible).

Also responsible for "xlinking" features: if a feature occurs several times in a feature collection, it must be exported only once - all other occurences must use xlink-attributes in the surrounding property element to reference the feature. TODO Handle FeatureCollections like ordinary Features (needs changes in feature model). TODO Separate cycle check (for suppressXLinkOutput). TODO Use a more straight-forward approach to export DOM representations. TODO Handle multiple application schemas (in xsi:schemaLocation attribute). TODO Handle WFS-schema-binding in a subclass in the WFS package?

Version:
$Revision: 20808 $, $Date: 2009-11-16 14:03:13 +0100 (Mo, 16. Nov 2009) $
Author:
Markus Schneider , last edited by: $Author: mschneider $

Constructor Summary
GMLFeatureAdapter()
          Creates a new GMLFeatureAdapter instance with enabled XLink output.
GMLFeatureAdapter(boolean suppressXLinkOutput)
          Creates a new instance GMLFeatureAdapter with configurable XLink output.
GMLFeatureAdapter(boolean suppressXLinkOutput, String schemaURL)
          Creates a new instance GMLFeatureAdapter with configurable XLink output.
GMLFeatureAdapter(boolean suppressXLinkOutput, String schemaURL, boolean printGeometryIds)
           
GMLFeatureAdapter(boolean suppressXLinkOutput, String schemaURL, boolean printGeometryIds, int depth)
           
GMLFeatureAdapter(boolean suppressXLinkOutput, String schemaURL, String wfsSchemaBinding, boolean printGeometryIds)
          Creates a new instance GMLFeatureAdapter with configurable XLink output.
GMLFeatureAdapter(boolean suppressXLinkOutput, String schemaURL, String wfsSchemaBinding, boolean printGeometryIds, int depth)
           
GMLFeatureAdapter(int xlinkdepth)
           
GMLFeatureAdapter(String schemaURL)
          Creates a new GMLFeatureAdapter instance with enabled XLink output and schema reference.
 
Method Summary
 void append(Element root, Feature feature)
          Appends the DOM representation of the given feature to the also given Node.
 void append(Element root, FeatureCollection fc)
          Appends the DOM representation of the given FeatureCollection to the also given Node.
 GMLFeatureDocument export(Feature feature)
          Export a Feature to it's XML representation.
 GMLFeatureCollectionDocument export(FeatureCollection fc)
          Export a FeatureCollection to it's XML representation.
 void export(FeatureCollection fc, OutputStream os)
          Exports an instance of a FeatureCollection to the passed OutputStream formatted as GML.
 void export(FeatureCollection fc, OutputStream os, String charsetName)
          Exports a FeatureCollection instance to the passed OutputStream formatted as GML.
 void export(Feature feature, OutputStream os)
          Exports an instance of a Feature to the passed OutputStream formatted as GML.
 void export(Feature feature, OutputStream os, String charsetName)
          Exports a Feature instance to the passed OutputStream formatted as GML.
 void setBaseURL(String url)
           
 void setPropertyPaths(Collection<PropertyPath[]> paths)
          Sets the property paths for which special xlink traversal will be done.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLFeatureAdapter

public GMLFeatureAdapter()
Creates a new GMLFeatureAdapter instance with enabled XLink output.


GMLFeatureAdapter

public GMLFeatureAdapter(int xlinkdepth)
Parameters:
xlinkdepth -

GMLFeatureAdapter

public GMLFeatureAdapter(String schemaURL)
Creates a new GMLFeatureAdapter instance with enabled XLink output and schema reference.

Parameters:
schemaURL - URL of schema document (used as xsi:schemaLocation attribute in XML output)

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput,
                         String schemaURL,
                         boolean printGeometryIds)
Parameters:
suppressXLinkOutput -
schemaURL -
printGeometryIds -

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput,
                         String schemaURL,
                         boolean printGeometryIds,
                         int depth)
Parameters:
suppressXLinkOutput -
schemaURL -
printGeometryIds -
depth - the depth of xlinks to resolve

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput)
Creates a new instance GMLFeatureAdapter with configurable XLink output.

Parameters:
suppressXLinkOutput - set to true, if no XLinks shall be used

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput,
                         String schemaURL)
Creates a new instance GMLFeatureAdapter with configurable XLink output.

Parameters:
suppressXLinkOutput - set to true, if no XLinks shall be used
schemaURL - URL of schema document (used as xsi:schemaLocation attribute in XML output)

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput,
                         String schemaURL,
                         String wfsSchemaBinding,
                         boolean printGeometryIds)
Creates a new instance GMLFeatureAdapter with configurable XLink output.

Parameters:
suppressXLinkOutput - set to true, if no XLinks shall be used
schemaURL - URL of schema document (used for "xsi:schemaLocation" attribute in XML output)
wfsSchemaBinding - fragment for the "xsi:schemaLocation" attribute that binds the wfs namespace
printGeometryIds -

GMLFeatureAdapter

public GMLFeatureAdapter(boolean suppressXLinkOutput,
                         String schemaURL,
                         String wfsSchemaBinding,
                         boolean printGeometryIds,
                         int depth)
Parameters:
suppressXLinkOutput -
schemaURL -
wfsSchemaBinding -
printGeometryIds -
depth -
Method Detail

setPropertyPaths

public void setPropertyPaths(Collection<PropertyPath[]> paths)
Sets the property paths for which special xlink traversal will be done.

Parameters:
paths -

setBaseURL

public void setBaseURL(String url)
Parameters:
url - the base url to use for GetGmlObject references

append

public void append(Element root,
                   Feature feature)
            throws FeatureException,
                   IOException,
                   SAXException
Appends the DOM representation of the given feature to the also given Node.

TODO do this a better way (append nodes directly without serializing to string and parsing it again)

Parameters:
root -
feature -
Throws:
FeatureException
IOException
SAXException

export

public GMLFeatureDocument export(Feature feature)
                          throws IOException,
                                 FeatureException,
                                 XMLException,
                                 SAXException
Export a Feature to it's XML representation.

Parameters:
feature - feature to export
Returns:
XML representation of feature
Throws:
IOException
FeatureException
XMLException
SAXException

append

public void append(Element root,
                   FeatureCollection fc)
            throws FeatureException,
                   IOException,
                   SAXException
Appends the DOM representation of the given FeatureCollection to the also given Node.

TODO do this a better way (append nodes directly without serializing to string and parsing it again)

Parameters:
root -
fc -
Throws:
FeatureException
IOException
SAXException

export

public GMLFeatureCollectionDocument export(FeatureCollection fc)
                                    throws IOException,
                                           FeatureException,
                                           XMLException,
                                           SAXException
Export a FeatureCollection to it's XML representation.

Parameters:
fc - feature collection
Returns:
XML representation of feature collection
Throws:
IOException
FeatureException
XMLException
SAXException

export

public void export(FeatureCollection fc,
                   OutputStream os)
            throws IOException,
                   FeatureException
Exports an instance of a FeatureCollection to the passed OutputStream formatted as GML. Uses the deegree system character set for the XML header encoding information.

Parameters:
fc - feature collection to export
os - output stream to write to
Throws:
IOException
FeatureException

export

public void export(FeatureCollection fc,
                   OutputStream os,
                   String charsetName)
            throws IOException,
                   FeatureException
Exports a FeatureCollection instance to the passed OutputStream formatted as GML.

Parameters:
fc - feature collection to export
os - output stream to write to
charsetName - name of the used charset/encoding (for the XML header)
Throws:
IOException
FeatureException

export

public void export(Feature feature,
                   OutputStream os)
            throws IOException,
                   FeatureException
Exports an instance of a Feature to the passed OutputStream formatted as GML. Uses the deegree system character set for the XML header encoding information.

Parameters:
feature - feature to export
os - output stream to write to
Throws:
IOException
FeatureException

export

public void export(Feature feature,
                   OutputStream os,
                   String charsetName)
            throws IOException,
                   FeatureException
Exports a Feature instance to the passed OutputStream formatted as GML.

Parameters:
feature - feature to export
os - output stream to write to
charsetName - name of the used charset/encoding (for the XML header)
Throws:
IOException
FeatureException

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org