public class StreamGmlWriter extends AbstractInstanceWriter implements XmlWriterBase, GMLConstants
XMLStreamWriter
GZipEnabledExport.GZipOutputSupplier
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_SIMPLIFY_GEOMETRY
The parameter name for the flag specifying if a geometry should be
simplified before writing it, if possible.
|
static String |
SCHEMA_INSTANCE_NS
Schema instance namespace (for specifying schema locations)
|
PARAM_ROOT_ELEMENT_NAME, PARAM_ROOT_ELEMENT_NAMESPACE
PARAM_CHARSET, PARAM_CONTENT_TYPE
GML_NAMESPACE_CORE, NS_GML, NS_GML_32
PARAM_TARGET
Constructor and Description |
---|
StreamGmlWriter(boolean useFeatureCollection)
Create a GML writer
|
Modifier and Type | Method and Description |
---|---|
void |
checkCompatibility()
Validate the basic
InstanceWriter configuration, to determine if
the target schema (and instances if set) are compatible to the writer. |
protected IOReport |
execute(ProgressIndicator progress,
IOReporter reporter)
Execute the I/O provider.
|
protected XmlElement |
findDefaultContainter(XmlIndex targetIndex,
IOReporter reporter)
Find the default container element.
|
protected DefinitionPath |
findMemberAttribute(TypeDefinition container,
QName containerName,
TypeDefinition memberType)
Find a matching attribute for the given member type in the given
container type
|
static XmlElement |
getConfiguredContainerElement(IOProvider provider,
XmlIndex targetIndex)
Get the for an I/O provider configured target container element, assuming
the I/O provider uses the
XmlWriterBase.PARAM_ROOT_ELEMENT_NAMESPACE and
parameters for this. |
protected String |
getDefaultTypeName()
Get the default type name if no content type is provided
|
protected StreamGeometryWriter |
getGeometryWriter()
Get the geometry writer
|
protected XmlIndex |
getXMLIndex()
Get the XML type index.
|
static XmlIndex |
getXMLIndex(SchemaSpace schemas)
Get the XML index from the given schema space
|
boolean |
isCancelable()
States if the execution of the provider is cancelable
|
protected boolean |
requiresDefaultContainer()
States if the instance writer in all cases requires that the default
container is being found.
|
void |
validate()
Additionally checks for instances.
|
void |
write(InstanceCollection instances,
ProgressIndicator progress,
IOReporter reporter)
Write the given instances.
|
protected void |
writeAdditionalElements(XMLStreamWriter writer,
TypeDefinition containerDefinition,
IOReporter reporter)
This method is called after the container element is started and filled
with needed attributes.
|
protected void |
writeMember(Instance instance,
TypeDefinition type)
Write a given instance
|
getInstances, getTargetSchema, getValidationSchemas, setInstances, setTargetSchema
getTarget
createReporter, setParameter, setTarget, storeConfiguration
addSupportedParameter, execute, fail, getCharset, getContentType, getDefaultCharset, getParameter, getSupportedParameters, getTypeName, loadConfiguration, setCharset, setContentType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTargetSchema
createReporter, execute, getCharset, getContentType, getParameter, getSupportedParameters, loadConfiguration, setCharset, setContentType, setParameter, storeConfiguration
getTarget, setTarget
public static final String SCHEMA_INSTANCE_NS
public static final String PARAM_SIMPLIFY_GEOMETRY
public StreamGmlWriter(boolean useFeatureCollection)
useFeatureCollection
- if a GML feature collection shall be used to
store the instances (if possible)protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException
AbstractIOProvider
execute
in class AbstractIOProvider
progress
- the progress indicatorreporter
- the reporter to use for the execution reportIOProviderConfigurationException
- if the I/O provider was not
configured properlyIOException
- if an I/O operation failsAbstractIOProvider.execute(ProgressIndicator, IOReporter)
public void validate() throws IOProviderConfigurationException
AbstractInstanceWriter
validate
in interface IOProvider
validate
in class AbstractInstanceWriter
IOProviderConfigurationException
- if the I/O provider was not
configured properlyAbstractInstanceWriter.validate()
public void checkCompatibility() throws IOProviderConfigurationException
InstanceWriter
InstanceWriter
configuration, to determine if
the target schema (and instances if set) are compatible to the writer.
Other parameters should be ignored for the check.checkCompatibility
in interface InstanceWriter
checkCompatibility
in class AbstractInstanceWriter
IOProviderConfigurationException
- if the I/O provider was not
configured properlyAbstractInstanceWriter.checkCompatibility()
protected boolean requiresDefaultContainer()
protected XmlIndex getXMLIndex()
public static XmlIndex getXMLIndex(SchemaSpace schemas)
schemas
- the schema spacenull
public boolean isCancelable()
IOProvider
isCancelable
in interface IOProvider
IOProvider.isCancelable()
protected String getDefaultTypeName()
AbstractIOProvider
getDefaultTypeName
in class AbstractIOProvider
AbstractIOProvider.getDefaultTypeName()
public void write(InstanceCollection instances, ProgressIndicator progress, IOReporter reporter) throws XMLStreamException
instances
- the instance collectionreporter
- the reporterprogress
- the progressXMLStreamException
- if writing the feature collection failsprotected void writeAdditionalElements(XMLStreamWriter writer, TypeDefinition containerDefinition, IOReporter reporter) throws XMLStreamException
writer
- the XML stream writercontainerDefinition
- the container type definitionreporter
- the reporterXMLStreamException
- if writing anything failspublic static XmlElement getConfiguredContainerElement(IOProvider provider, XmlIndex targetIndex)
XmlWriterBase.PARAM_ROOT_ELEMENT_NAMESPACE
and
parameters for this.provider
- the I/O providertargetIndex
- the target XML indexnull
if it was not foundprotected XmlElement findDefaultContainter(XmlIndex targetIndex, IOReporter reporter)
targetIndex
- the target type indexreporter
- the reporter, may be null
null
protected DefinitionPath findMemberAttribute(TypeDefinition container, QName containerName, TypeDefinition memberType)
container
- the container typecontainerName
- the container element namememberType
- the member typenull
protected void writeMember(Instance instance, TypeDefinition type) throws XMLStreamException
instance
- the instance to writertype
- the feature type definitionXMLStreamException
- if writing the feature failsprotected StreamGeometryWriter getGeometryWriter()
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a