Package io.lighty.codecs
Class XmlNodeConverter
- java.lang.Object
-
- io.lighty.codecs.XmlNodeConverter
-
- All Implemented Interfaces:
NodeConverter
@Deprecated(forRemoval=true) public class XmlNodeConverter extends Object implements NodeConverter
Deprecated, for removal: This API element is subject to removal in a future version.This class is moved to lighty-codecs-util.The implementation ofNodeConverter
which serializes and deserializes binding independent representation into/from XML representation.- See Also:
JsonNodeConverter
-
-
Constructor Summary
Constructors Constructor Description XmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext)
Deprecated, for removal: This API element is subject to removal in a future version.The only constructor will create an instance ofXmlNodeConverter
with the givenSchemaContext
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
closeQuietly(XMLStreamReader xmlStreamReader)
Deprecated, for removal: This API element is subject to removal in a future version.This method is similar to theCloseables.closeQuietly(Reader)
or other 'closeQuietly methods.org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>
deserialize(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, Reader inputData)
Deprecated, for removal: This API element is subject to removal in a future version.This method deserializes the provided XML string representation (viaReader
) interface intoNormalizedNode
s.Writer
serializeData(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode)
Deprecated, for removal: This API element is subject to removal in a future version.This method serializes the givenNormalizedNode
into its XML string representation.Writer
serializeRpc(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode)
Deprecated, for removal: This API element is subject to removal in a future version.This method serializes the input or output of a RPC given asNormalizedNode
representation into XML string representation.
-
-
-
Constructor Detail
-
XmlNodeConverter
public XmlNodeConverter(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext effectiveModelContext)
Deprecated, for removal: This API element is subject to removal in a future version.The only constructor will create an instance ofXmlNodeConverter
with the givenSchemaContext
. This schema context will be used for proper RPC and Node resolution- Parameters:
effectiveModelContext
- initial schema context
-
-
Method Detail
-
serializeData
public Writer serializeData(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode) throws SerializationException
Deprecated, for removal: This API element is subject to removal in a future version.This method serializes the givenNormalizedNode
into its XML string representation.- Specified by:
serializeData
in interfaceNodeConverter
- Parameters:
schemaNode
- the parent schema node where the nodes existnormalizedNode
-NormalizedNode
to be serialized- Returns:
StringWriter
implementation ofWriter
is returned- Throws:
SerializationException
- if it was not possible to serialize the normalized nodes into XML- See Also:
NodeConverter.serializeData(SchemaNode, NormalizedNode)
-
serializeRpc
public Writer serializeRpc(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> normalizedNode) throws SerializationException
Deprecated, for removal: This API element is subject to removal in a future version.This method serializes the input or output of a RPC given asNormalizedNode
representation into XML string representation.To obtain correct
SchemaNode
useConverterUtils.loadRpc(SchemaContext, QName)
method.- Specified by:
serializeRpc
in interfaceNodeConverter
- Parameters:
schemaNode
- input or outputSchemaNode
normalizedNode
-NormalizedNode
representation of input or output- Returns:
- XML string representation of provided BI nodes. It utilizes the
StringWriter
- Throws:
SerializationException
- may be thrown if there was a problem during serialization- See Also:
ConverterUtils.rpcAsInput(XmlElement)
,ConverterUtils.rpcAsOutput(XmlElement)
,ConverterUtils.getRpcQName(XmlElement)
-
deserialize
public org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> deserialize(org.opendaylight.yangtools.yang.model.api.SchemaNode schemaNode, Reader inputData) throws SerializationException
Deprecated, for removal: This API element is subject to removal in a future version.This method deserializes the provided XML string representation (viaReader
) interface intoNormalizedNode
s. During deserialization of RPC input and output a properSchemaNode
(given for input or output) must be passed. This may be obtained viaConverterUtils.loadRpc(SchemaContext, QName)
.- Specified by:
deserialize
in interfaceNodeConverter
- Parameters:
schemaNode
- parent schema node which contains information about the input datainputData
- XML input- Returns:
- an
Optional
representation ofNormalizedNode
. If the deserialization process finished incorrectly an empty value will be present - Throws:
SerializationException
- if it was not possible to deserialize the input dataIllegalArgumentException
- if a problem occurs during reading the input- See Also:
ConverterUtils.loadRpc(SchemaContext, QName)
,ConverterUtils.rpcAsInput(XmlElement)
,ConverterUtils.rpcAsOutput(XmlElement)
-
closeQuietly
public static void closeQuietly(XMLStreamReader xmlStreamReader)
Deprecated, for removal: This API element is subject to removal in a future version.This method is similar to theCloseables.closeQuietly(Reader)
or other 'closeQuietly methods. It takes theXMLStreamReader
as parameter checks for null and tries to close it while consuming theIOException
. If theIOException
occurs it will be logged.- Parameters:
xmlStreamReader
- the givenXMLStreamReader
may be null
-
-