Search in sources :

Example 6 with JsonParserStream

use of org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream in project opennms-opendaylight-plugin by OpenNMS.

the class OpendaylightRestconfClient method streamJsonToNode.

private NormalizedNode<?, ?> streamJsonToNode(String json, DataSchemaNode parentNode) {
    final NormalizedNodeResult result = new NormalizedNodeResult();
    final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
    final JsonParserStream jsonParser = JsonParserStream.create(streamWriter, s_schemaContext, parentNode);
    jsonParser.parse(new JsonReader(new StringReader(json)));
    return result.getResult();
}
Also used : JsonParserStream(org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream) NormalizedNodeResult(org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult) StringReader(java.io.StringReader) ImmutableNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) JsonReader(com.google.gson.stream.JsonReader)

Aggregations

JsonReader (com.google.gson.stream.JsonReader)6 JsonParserStream (org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream)6 NormalizedNodeResult (org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult)6 NormalizedNodeStreamWriter (org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter)5 ImmutableNormalizedNodeStreamWriter (org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter)5 InputStreamReader (java.io.InputStreamReader)3 StringReader (java.io.StringReader)3 Throwables (com.google.common.base.Throwables)2 Iterables (com.google.common.collect.Iterables)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 StandardCharsets (java.nio.charset.StandardCharsets)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Consumes (javax.ws.rs.Consumes)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 MediaType (javax.ws.rs.core.MediaType)2 Provider (javax.ws.rs.ext.Provider)2 InstanceIdentifierContext (org.opendaylight.restconf.common.context.InstanceIdentifierContext)2 RestconfDocumentedException (org.opendaylight.restconf.common.errors.RestconfDocumentedException)2