Package org.n52.svalbard.write
Class AbstractOmV20XmlStreamWriter
- java.lang.Object
-
- org.n52.svalbard.write.XmlStreamWriter<OmObservation>
-
- org.n52.svalbard.write.AbstractOmV20XmlStreamWriter
-
- Direct Known Subclasses:
OmV20XmlStreamWriter,TsmlTDREncoderv10XmlStreamWriter,TsmlTVPEncoderv10XmlStreamWriter,WmlTDREncoderv20XmlStreamWriter,WmlTVPEncoderv20XmlStreamWriter
public abstract class AbstractOmV20XmlStreamWriter extends XmlStreamWriter<OmObservation>
Abstract implementation ofXmlStreamWriterfor writingOmObservations to stream- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from class org.n52.svalbard.write.XmlStreamWriter
XML_FRAGMENT
-
-
Constructor Summary
Constructors Constructor Description AbstractOmV20XmlStreamWriter(EncodingContext context, OutputStream outputStream, OmObservation element)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancheck(org.apache.xmlbeans.XmlObject result)Check the encoded om:result content for ...PropertyTypeprotected voidcheckAndWriteDescription()protected voidcheckAndWriteIdentifier()protected voidcheckAndWriteName()protected abstract Optional<String>getDefaultFeatureEncodingNamespace()protected EncodingContextgetDocumentAdditionalHelperValues()Get additional values map with document helper valueprotected QNamegetDocumentName()protected StringgetTimeString(Time time)Parses the ITime object to a time representation as Stringvoidwrite()Encode and write element to theOutputStream.protected abstract voidwriteAddtitionalNamespaces()protected voidwriteDescription(String description)Write description as gml:descritpion to streamprotected voidwriteFeatureOfIntererst()Write om:featureOfInterest encoded or as xlink:href to streamprotected voidwriteIdentifier(CodeWithAuthority identifier)WriteCodeWithAuthorityas gml:identifier to streamprotected voidwriteMetadata(Map<String,NamedValue<?>> map, QName element)Write extension informationprotected voidwriteMetaDataProperty(List<AbstractMetaData> metaDataProperty)protected voidwriteName(CodeType name)protected voidwriteObservableProperty()Write om:observedProperty to streamprotected voidwriteObservation(OmObservation observation)WriteOmObservationXML encoded to streamprotected voidwriteObservationType(String observationType)Write observation typ as om:type to streamprotected voidwriteParameter()Write om:parameter to streamprotected voidwritePhenomenonTime(Time time)WriteTimeas om:phenomenonTime to streamprotected voidwriteProcedure()Write om:procedure encoded or as xlink:href to streamprotected voidwriteResult()write om:result to streamprotected voidwriteResultTime()Write om:resultTime to streamprotected voidwriteValidTime(TimePeriod validTime)-
Methods inherited from class org.n52.svalbard.write.XmlStreamWriter
addXlinkHrefAttr, addXlinkTitleAttr, attr, attr, attr, chars, chars, empty, end, end, endInline, finish, flush, getContext, getElement, getEncodeNamespace, getEncoder, getEncoder, getEncoder, getOutputStream, getReplacement, getXmlOptions, isAddSchemaLocation, namespace, rawText, schemaLocation, start, start, time, time, tryGetEncoder, writeXmlObject, writeXmlObject
-
-
-
-
Constructor Detail
-
AbstractOmV20XmlStreamWriter
public AbstractOmV20XmlStreamWriter(EncodingContext context, OutputStream outputStream, OmObservation element) throws XMLStreamException
- Throws:
XMLStreamException
-
-
Method Detail
-
writeAddtitionalNamespaces
protected abstract void writeAddtitionalNamespaces() throws XMLStreamException- Throws:
XMLStreamException
-
write
public void write() throws XMLStreamException, EncodingExceptionDescription copied from class:XmlStreamWriterEncode and write element to theOutputStream.- Specified by:
writein classXmlStreamWriter<OmObservation>- Throws:
XMLStreamException- If an error occurs when writing toOutputStreamEncodingException- If an encoding error occurs
-
writeObservation
protected void writeObservation(OmObservation observation) throws XMLStreamException, EncodingException
WriteOmObservationXML encoded to stream- Parameters:
observation- the observation- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written If an error occurs when creating elements to be written
-
checkAndWriteIdentifier
protected void checkAndWriteIdentifier() throws XMLStreamException, EncodingException- Throws:
XMLStreamExceptionEncodingException
-
checkAndWriteName
protected void checkAndWriteName() throws XMLStreamException, EncodingException- Throws:
XMLStreamExceptionEncodingException
-
checkAndWriteDescription
protected void checkAndWriteDescription() throws XMLStreamException- Throws:
XMLStreamException
-
writeIdentifier
protected void writeIdentifier(CodeWithAuthority identifier) throws EncodingException, XMLStreamException
WriteCodeWithAuthorityas gml:identifier to stream- Parameters:
identifier-CodeWithAuthorityto write- Throws:
EncodingException- If an error occurs when creating elements to be writtenXMLStreamException- If an error occurs when writing to stream
-
writeName
protected void writeName(CodeType name) throws XMLStreamException, EncodingException
- Throws:
XMLStreamExceptionEncodingException
-
writeDescription
protected void writeDescription(String description) throws XMLStreamException
Write description as gml:descritpion to stream- Parameters:
description- Description to write- Throws:
XMLStreamException- If an error occurs when writing to stream
-
writeMetadata
protected void writeMetadata(Map<String,NamedValue<?>> map, QName element) throws XMLStreamException, EncodingException
Write extension information- Parameters:
map- Map with valueselement- element name- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written
-
writeMetaDataProperty
protected void writeMetaDataProperty(List<AbstractMetaData> metaDataProperty) throws XMLStreamException, EncodingException
- Throws:
XMLStreamExceptionEncodingException
-
writeObservationType
protected void writeObservationType(String observationType) throws XMLStreamException
Write observation typ as om:type to stream- Parameters:
observationType- Observation type to write- Throws:
XMLStreamException- If an error occurs when writing to stream
-
writePhenomenonTime
protected void writePhenomenonTime(Time time) throws EncodingException, XMLStreamException
WriteTimeas om:phenomenonTime to stream- Parameters:
time-Timeto write as om:phenomenonTime to stream- Throws:
EncodingException- If an error occurs when creating elements to be writtenXMLStreamException- If an error occurs when writing to stream
-
writeValidTime
protected void writeValidTime(TimePeriod validTime) throws EncodingException, XMLStreamException
- Throws:
EncodingExceptionXMLStreamException
-
writeResultTime
protected void writeResultTime() throws XMLStreamException, EncodingExceptionWrite om:resultTime to stream- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written
-
writeProcedure
protected void writeProcedure() throws XMLStreamException, EncodingExceptionWrite om:procedure encoded or as xlink:href to stream- Throws:
XMLStreamException- If an error occurs when writing to streamUnsupportedEncoderInputException- If the procedure could not be encodedEncodingException- If an error occurs when creating elements to be written
-
writeParameter
protected void writeParameter() throws XMLStreamException, EncodingExceptionWrite om:parameter to stream- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written
-
writeObservableProperty
protected void writeObservableProperty() throws XMLStreamExceptionWrite om:observedProperty to stream- Throws:
XMLStreamException- If an error occurs when writing to stream
-
writeFeatureOfIntererst
protected void writeFeatureOfIntererst() throws XMLStreamException, EncodingExceptionWrite om:featureOfInterest encoded or as xlink:href to stream- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written
-
getDefaultFeatureEncodingNamespace
protected abstract Optional<String> getDefaultFeatureEncodingNamespace()
-
writeResult
protected void writeResult() throws XMLStreamException, EncodingExceptionwrite om:result to stream- Throws:
XMLStreamException- If an error occurs when writing to streamEncodingException- If an error occurs when creating elements to be written
-
getDocumentAdditionalHelperValues
protected EncodingContext getDocumentAdditionalHelperValues()
Get additional values map with document helper value- Returns:
- The encoding context
-
getTimeString
protected String getTimeString(Time time) throws DateTimeFormatException
Parses the ITime object to a time representation as String- Parameters:
time- SOS ITime object- Returns:
- Time as String
- Throws:
DateTimeFormatException- If a formatting error occurs
-
getDocumentName
protected QName getDocumentName()
-
check
protected boolean check(org.apache.xmlbeans.XmlObject result)
Check the encoded om:result content for ...PropertyType- Parameters:
result- Encoded om:result content to check- Returns:
true, if content contains ...PropertyType
-
-