Package org.apache.sis.xml
Class PooledUnmarshaller
java.lang.Object
org.apache.sis.xml.Pooled
org.apache.sis.xml.PooledUnmarshaller
- All Implemented Interfaces:
Unmarshaller
Wraps a
Unmarshaller in order to have some control on the modifications applied on it.
This wrapper serves three purposes:
- Save properties before modification, in order to restore them to their original values when the unmarshaller is recycled.
- Constructs a SIS
Contextobject on unmarshalling, in order to give additional information to the SIS object being unmarshalled. - Wraps the input stream in a
TransformingReaderif the document GML version in not the SIS native GML version.
- Since:
- 0.3
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.xml.bind.Unmarshaller
Unmarshaller.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UnmarshallerThe wrapped marshaller which does the real work.Fields inherited from class org.apache.sis.xml.Pooled
initialProperties, resetTime -
Constructor Summary
ConstructorsConstructorDescriptionPooledUnmarshaller(Unmarshaller unmarshaller, Pooled template) Creates a pooled unmarshaller wrapping the given one. -
Method Summary
Modifier and TypeMethodDescription<A extends XmlAdapter>
AgetAdapter(Class<A> type) Delegates to the wrapped unmarshaller.Delegates to the wrapped unmarshaller.Delegates to the wrapped unmarshaller.Delegates to the wrapped marshaller.Delegates to the wrapped unmarshaller.(package private) ObjectgetStandardProperty(String name) Delegates to the wrapped unmarshaller.Delegates to the wrapped unmarshaller.booleanDeprecated.protected voidResets the given unmarshaller property to its initial state.<A extends XmlAdapter>
voidsetAdapter(Class<A> type, A adapter) Delegates to the wrapped unmarshaller.voidDelegates to the wrapped unmarshaller.voidsetEventHandler(ValidationEventHandler handler) Delegates to the wrapped unmarshaller.voidsetListener(Unmarshaller.Listener listener) Delegates to the wrapped marshaller.voidDelegates to the wrapped unmarshaller.(package private) voidsetStandardProperty(String name, Object value) Delegates to the wrapped unmarshaller.voidsetValidating(boolean validating) Deprecated.Replaced bysetSchema(javax.xml.validation.Schema)in JAXB 2.0.Delegates the unmarshalling to the wrapped unmarshaller.unmarshal(InputStream input) Delegates the unmarshalling to the wrapped unmarshaller.Delegates the unmarshalling to the wrapped unmarshaller.Delegates the unmarshalling to the wrapped unmarshaller.unmarshal(XMLEventReader input) Delegates the unmarshalling to the wrapped unmarshaller.<T> JAXBElement<T>unmarshal(XMLEventReader input, Class<T> declaredType) Delegates the unmarshalling to the wrapped unmarshaller.private Objectunmarshal(XMLEventReader input, TransformVersion version) Unmarshals to the given input with on-the-fly substitution of namespaces.private <T> JAXBElement<T>unmarshal(XMLEventReader input, TransformVersion version, Class<T> declaredType) Same asunmarshal(XMLEventReader, TransformVersion), but delegating to the unmarshaller methods returning a JAXB element instead of the one returning the object.unmarshal(XMLStreamReader input) Delegates the unmarshalling to the wrapped unmarshaller.<T> JAXBElement<T>unmarshal(XMLStreamReader input, Class<T> declaredType) Delegates the unmarshalling to the wrapped unmarshaller.Delegates the unmarshalling to the wrapped unmarshaller.<T> JAXBElement<T>Delegates the unmarshalling to the wrapped unmarshaller.Delegates the unmarshalling to the wrapped unmarshaller.<T> JAXBElement<T>Delegates the unmarshalling to the wrapped unmarshaller.unmarshal(InputSource input) Delegates the unmarshalling to the wrapped unmarshaller.Methods inherited from class org.apache.sis.xml.Pooled
begin, getProperty, getRootAdapters, getTransformVersion, initialize, isPropertySaved, reset, saveProperty, setAdapter, setProperty, specificBitMasksMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.xml.bind.Unmarshaller
getProperty, setAdapter, setProperty
-
Field Details
-
unmarshaller
The wrapped marshaller which does the real work.
-
-
Constructor Details
-
PooledUnmarshaller
PooledUnmarshaller(Unmarshaller unmarshaller, Pooled template) throws JAXBException Creates a pooled unmarshaller wrapping the given one. Callers shall invokePooled.reset(Pooled)after construction for completing the initialization.- Parameters:
unmarshaller- the unmarshaller to use for the actual work.template- thePooledTemplatefrom which to get the initial values.- Throws:
JAXBException- if an error occurred while setting a property.
-
-
Method Details
-
reset
Resets the given unmarshaller property to its initial state. This method is invoked automatically byPooled.reset(Pooled).- Specified by:
resetin classPooled- Parameters:
key- the property to reset.value- the saved initial value to give to the property.- Throws:
JAXBException- if an error occurred while restoring a property.
-
unmarshal
private Object unmarshal(XMLEventReader input, TransformVersion version) throws XMLStreamException, JAXBException Unmarshals to the given input with on-the-fly substitution of namespaces. This method is invoked when we may marshal a different GML or metadata version than the one supported natively by SIS, i.e. whenPooled.getTransformVersion()returns a non-null value.- Parameters:
input- the reader created by SIS (not the reader given by the user).version- identify the namespace substitutions to perform.- Returns:
- the unmarshalled object.
- Throws:
XMLStreamExceptionJAXBException
-
unmarshal
private <T> JAXBElement<T> unmarshal(XMLEventReader input, TransformVersion version, Class<T> declaredType) throws XMLStreamException, JAXBException Same asunmarshal(XMLEventReader, TransformVersion), but delegating to the unmarshaller methods returning a JAXB element instead of the one returning the object.- Throws:
XMLStreamExceptionJAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLStreamReader input, Class<T> declaredType) throws JAXBException Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
unmarshal
public <T> JAXBElement<T> unmarshal(XMLEventReader input, Class<T> declaredType) throws JAXBException Delegates the unmarshalling to the wrapped unmarshaller.- Specified by:
unmarshalin interfaceUnmarshaller- Throws:
JAXBException
-
getUnmarshallerHandler
Delegates to the wrapped unmarshaller.- Specified by:
getUnmarshallerHandlerin interfaceUnmarshaller
-
setStandardProperty
Delegates to the wrapped unmarshaller. This method is invoked by the parent class if the given name was not one of theXMLconstants.- Specified by:
setStandardPropertyin classPooled- Throws:
PropertyException
-
getStandardProperty
Delegates to the wrapped unmarshaller. This method is invoked by the parent class if the given name was not one of theXMLconstants.- Specified by:
getStandardPropertyin classPooled- Throws:
PropertyException
-
setAdapter
Delegates to the wrapped unmarshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setAdapterin interfaceUnmarshaller- Overrides:
setAdapterin classPooled
-
getAdapter
Delegates to the wrapped unmarshaller.- Specified by:
getAdapterin interfaceUnmarshaller- Specified by:
getAdapterin classPooled
-
setValidating
Deprecated.Replaced bysetSchema(javax.xml.validation.Schema)in JAXB 2.0.Delegates to the wrapped unmarshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setValidatingin interfaceUnmarshaller- Throws:
JAXBException
-
isValidating
Deprecated.Replaced bygetSchema()in JAXB 2.0.Delegates to the wrapped unmarshaller.- Specified by:
isValidatingin interfaceUnmarshaller- Throws:
JAXBException
-
setSchema
Delegates to the wrapped unmarshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setSchemain interfaceUnmarshaller- Overrides:
setSchemain classPooled
-
getSchema
Delegates to the wrapped unmarshaller.- Specified by:
getSchemain interfaceUnmarshaller- Specified by:
getSchemain classPooled
-
setEventHandler
Delegates to the wrapped unmarshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setEventHandlerin interfaceUnmarshaller- Overrides:
setEventHandlerin classPooled- Throws:
JAXBException
-
getEventHandler
Delegates to the wrapped unmarshaller.- Specified by:
getEventHandlerin interfaceUnmarshaller- Specified by:
getEventHandlerin classPooled- Throws:
JAXBException
-
setAttachmentUnmarshaller
Delegates to the wrapped unmarshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setAttachmentUnmarshallerin interfaceUnmarshaller
-
getAttachmentUnmarshaller
Delegates to the wrapped unmarshaller.- Specified by:
getAttachmentUnmarshallerin interfaceUnmarshaller
-
setListener
Delegates to the wrapped marshaller. The initial state will be saved if it was not already done, for future restoration byPooled.reset(Pooled).- Specified by:
setListenerin interfaceUnmarshaller
-
getListener
Delegates to the wrapped marshaller.- Specified by:
getListenerin interfaceUnmarshaller
-
getSchema()in JAXB 2.0.