Search in sources :

Example 1 with ForwardingNormalizedNodeStreamWriter

use of org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter in project netconf by opendaylight.

the class RestconfDocumentedExceptionMapper method toJsonResponseBody.

private static Object toJsonResponseBody(final NormalizedNodeContext errorsNode, final DataNodeContainer errorsSchemaNode) {
    final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    NormalizedNode data = errorsNode.getData();
    final InstanceIdentifierContext<?> context = errorsNode.getInstanceIdentifierContext();
    final DataSchemaNode schema = (DataSchemaNode) context.getSchemaNode();
    final OutputStreamWriter outputWriter = new OutputStreamWriter(outStream, StandardCharsets.UTF_8);
    if (data == null) {
        throw new RestconfDocumentedException(Response.Status.NOT_FOUND);
    }
    boolean isDataRoot = false;
    XMLNamespace initialNs = null;
    SchemaPath path;
    if (context.getSchemaNode() instanceof SchemaContext) {
        isDataRoot = true;
        path = SchemaPath.ROOT;
    } else {
        final List<QName> qNames = context.getInstanceIdentifier().getPathArguments().stream().filter(arg -> !(arg instanceof NodeIdentifierWithPredicates)).filter(arg -> !(arg instanceof AugmentationIdentifier)).map(PathArgument::getNodeType).collect(Collectors.toList());
        path = SchemaPath.of(Absolute.of(qNames)).getParent();
    }
    if (!schema.isAugmenting() && !(schema instanceof SchemaContext)) {
        initialNs = schema.getQName().getNamespace();
    }
    final JsonWriter jsonWriter = JsonWriterFactory.createJsonWriter(outputWriter);
    final NormalizedNodeStreamWriter jsonStreamWriter = JSONNormalizedNodeStreamWriter.createExclusiveWriter(JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(context.getSchemaContext()), path, initialNs, jsonWriter);
    // We create a delegating writer to special-case error-info as error-info is defined as an empty
    // container in the restconf yang schema but we create a leaf node so we can output it. The delegate
    // stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
    // the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
    // for error-info.
    final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {

        private boolean inOurLeaf;

        @Override
        protected NormalizedNodeStreamWriter delegate() {
            return jsonStreamWriter;
        }

        @Override
        public void startLeafNode(final NodeIdentifier name) throws IOException {
            if (name.getNodeType().equals(RestConfModule.ERROR_INFO_QNAME)) {
                inOurLeaf = true;
                jsonWriter.name(RestConfModule.ERROR_INFO_QNAME.getLocalName());
            } else {
                super.startLeafNode(name);
            }
        }

        @Override
        public void scalarValue(final Object value) throws IOException {
            if (inOurLeaf) {
                jsonWriter.value(value.toString());
            } else {
                super.scalarValue(value);
            }
        }

        @Override
        public void endNode() throws IOException {
            if (inOurLeaf) {
                inOurLeaf = false;
            } else {
                super.endNode();
            }
        }
    };
    final NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(streamWriter);
    try {
        if (isDataRoot) {
            writeDataRoot(outputWriter, nnWriter, (ContainerNode) data);
        } else {
            if (data instanceof MapEntryNode) {
                data = ImmutableNodes.mapNodeBuilder(data.getIdentifier().getNodeType()).withChild((MapEntryNode) data).build();
            }
            nnWriter.write(data);
        }
        nnWriter.flush();
        outputWriter.flush();
    } catch (final IOException e) {
        LOG.warn("Error writing error response body", e);
    }
    try {
        streamWriter.close();
    } catch (IOException e) {
        LOG.warn("Failed to close stream writer", e);
    }
    return outStream.toString(StandardCharsets.UTF_8);
}
Also used : JSONNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter) JSONCodecFactorySupplier(org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier) Provider(javax.ws.rs.ext.Provider) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) SchemaContext(org.opendaylight.yangtools.yang.model.api.SchemaContext) ExceptionMapper(javax.ws.rs.ext.ExceptionMapper) LoggerFactory(org.slf4j.LoggerFactory) XMLNamespace(org.opendaylight.yangtools.yang.common.XMLNamespace) Absolute(org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ERRORS_CONTAINER_QNAME(org.opendaylight.netconf.sal.rest.api.Draft02.RestConfModule.ERRORS_CONTAINER_QNAME) MediaType(javax.ws.rs.core.MediaType) NormalizedNodeWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter) XMLStreamException(javax.xml.stream.XMLStreamException) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) CollectionNodeBuilder(org.opendaylight.yangtools.yang.data.api.schema.builder.CollectionNodeBuilder) Context(javax.ws.rs.core.Context) ListSchemaNode(org.opendaylight.yangtools.yang.model.api.ListSchemaNode) ContainerSchemaNode(org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) ErrorTags(org.opendaylight.restconf.common.ErrorTags) XMLStreamNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter) List(java.util.List) HttpHeaders(javax.ws.rs.core.HttpHeaders) Response(javax.ws.rs.core.Response) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) ImmutableNodes(org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) Iterables(com.google.common.collect.Iterables) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) ByteArrayOutputStream(java.io.ByteArrayOutputStream) InstanceIdentifierContext(org.opendaylight.restconf.common.context.InstanceIdentifierContext) ArrayList(java.util.ArrayList) RestConfModule(org.opendaylight.netconf.sal.rest.api.Draft02.RestConfModule) JsonWriterFactory(org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory) Objects.requireNonNull(java.util.Objects.requireNonNull) OutputStreamWriter(java.io.OutputStreamWriter) SystemMapNode(org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode) XMLConstants(javax.xml.XMLConstants) JsonWriter(com.google.gson.stream.JsonWriter) Status(javax.ws.rs.core.Response.Status) SchemaAwareBuilders(org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders) Logger(org.slf4j.Logger) DataContainerNodeBuilder(org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder) IOException(java.io.IOException) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) RestconfError(org.opendaylight.restconf.common.errors.RestconfError) QName(org.opendaylight.yangtools.yang.common.QName) FactoryConfigurationError(javax.xml.stream.FactoryConfigurationError) XMLOutputFactory(javax.xml.stream.XMLOutputFactory) DataNodeContainer(org.opendaylight.yangtools.yang.model.api.DataNodeContainer) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) DataSchemaNode(org.opendaylight.yangtools.yang.model.api.DataSchemaNode) ControllerContext(org.opendaylight.netconf.sal.restconf.impl.ControllerContext) RestconfDocumentedException(org.opendaylight.restconf.common.errors.RestconfDocumentedException) AugmentationIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) LeafSchemaNode(org.opendaylight.yangtools.yang.model.api.LeafSchemaNode) RestconfDocumentedException(org.opendaylight.restconf.common.errors.RestconfDocumentedException) AugmentationIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier) DataSchemaNode(org.opendaylight.yangtools.yang.model.api.DataSchemaNode) NormalizedNodeWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter) QName(org.opendaylight.yangtools.yang.common.QName) JSONNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) XMLStreamNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) JsonWriter(com.google.gson.stream.JsonWriter) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) XMLNamespace(org.opendaylight.yangtools.yang.common.XMLNamespace) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) OutputStreamWriter(java.io.OutputStreamWriter) SchemaContext(org.opendaylight.yangtools.yang.model.api.SchemaContext) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)

Example 2 with ForwardingNormalizedNodeStreamWriter

use of org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter in project yangtools by opendaylight.

the class ImmutableMountPointNormalizedNodeStreamWriter method startMountPoint.

@Override
public final NormalizedNodeStreamWriter startMountPoint(final MountPointIdentifier mountId, final MountPointContext mountCtx) {
    final NormalizedNodeResult mountResult = new NormalizedNodeResult();
    final NormalizedNodeStreamWriter mountDelegate = ImmutableNormalizedNodeStreamWriter.from(mountResult);
    return new ForwardingNormalizedNodeStreamWriter() {

        @Override
        protected NormalizedNodeStreamWriter delegate() {
            return mountDelegate;
        }

        @Override
        public void close() throws IOException {
            super.close();
            final NormalizedNode data = mountResult.getResult();
            if (!(data instanceof ContainerNode)) {
                throw new IOException("Unhandled mount data " + data);
            }
            writeChild(ImmutableMountPointNode.of(mountId, mountCtx, (ContainerNode) data));
        }
    };
}
Also used : ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) IOException(java.io.IOException) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)

Example 3 with ForwardingNormalizedNodeStreamWriter

use of org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter in project netconf by opendaylight.

the class RestconfDocumentedExceptionMapper method toXMLResponseBody.

private static Object toXMLResponseBody(final NormalizedNodeContext errorsNode, final DataNodeContainer errorsSchemaNode) {
    final InstanceIdentifierContext<?> pathContext = errorsNode.getInstanceIdentifierContext();
    final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    final XMLStreamWriter xmlWriter;
    try {
        xmlWriter = XML_FACTORY.createXMLStreamWriter(outStream, StandardCharsets.UTF_8.name());
    } catch (final XMLStreamException | FactoryConfigurationError e) {
        throw new IllegalStateException(e);
    }
    NormalizedNode data = errorsNode.getData();
    SchemaPath schemaPath;
    boolean isDataRoot = false;
    if (pathContext.getSchemaNode() instanceof SchemaContext) {
        isDataRoot = true;
        schemaPath = SchemaPath.ROOT;
    } else {
        final List<QName> qNames = pathContext.getInstanceIdentifier().getPathArguments().stream().filter(arg -> !(arg instanceof NodeIdentifierWithPredicates)).filter(arg -> !(arg instanceof AugmentationIdentifier)).map(PathArgument::getNodeType).collect(Collectors.toList());
        schemaPath = SchemaPath.of(Absolute.of(qNames)).getParent();
    }
    final NormalizedNodeStreamWriter xmlStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter, pathContext.getSchemaContext(), schemaPath);
    // We create a delegating writer to special-case error-info as error-info is defined as an empty
    // container in the restconf yang schema but we create a leaf node so we can output it. The delegate
    // stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
    // the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
    // for error-info.
    final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {

        private boolean inOurLeaf;

        @Override
        protected NormalizedNodeStreamWriter delegate() {
            return xmlStreamWriter;
        }

        @Override
        public void startLeafNode(final NodeIdentifier name) throws IOException {
            if (name.getNodeType().equals(RestConfModule.ERROR_INFO_QNAME)) {
                String ns = RestConfModule.ERROR_INFO_QNAME.getNamespace().toString();
                try {
                    xmlWriter.writeStartElement(XMLConstants.DEFAULT_NS_PREFIX, RestConfModule.ERROR_INFO_QNAME.getLocalName(), ns);
                } catch (XMLStreamException e) {
                    throw new IOException("Error writing error-info", e);
                }
                inOurLeaf = true;
            } else {
                super.startLeafNode(name);
            }
        }

        @Override
        public void scalarValue(final Object value) throws IOException {
            if (inOurLeaf) {
                try {
                    xmlWriter.writeCharacters(value.toString());
                } catch (XMLStreamException e) {
                    throw new IOException("Error writing error-info", e);
                }
            } else {
                super.scalarValue(value);
            }
        }

        @Override
        public void endNode() throws IOException {
            if (inOurLeaf) {
                try {
                    xmlWriter.writeEndElement();
                } catch (XMLStreamException e) {
                    throw new IOException("Error writing error-info", e);
                }
                inOurLeaf = false;
            } else {
                super.endNode();
            }
        }
    };
    final NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(streamWriter);
    try {
        if (isDataRoot) {
            writeRootElement(xmlWriter, nnWriter, (ContainerNode) data);
        } else {
            if (data instanceof MapEntryNode) {
                // Restconf allows returning one list item. We need to wrap it
                // in map node in order to serialize it properly
                data = ImmutableNodes.mapNodeBuilder(data.getIdentifier().getNodeType()).addChild((MapEntryNode) data).build();
            }
            nnWriter.write(data);
            nnWriter.flush();
        }
    } catch (final IOException e) {
        LOG.warn("Error writing error response body.", e);
    }
    return outStream.toString(StandardCharsets.UTF_8);
}
Also used : JSONNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter) JSONCodecFactorySupplier(org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier) Provider(javax.ws.rs.ext.Provider) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) SchemaContext(org.opendaylight.yangtools.yang.model.api.SchemaContext) ExceptionMapper(javax.ws.rs.ext.ExceptionMapper) LoggerFactory(org.slf4j.LoggerFactory) XMLNamespace(org.opendaylight.yangtools.yang.common.XMLNamespace) Absolute(org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ERRORS_CONTAINER_QNAME(org.opendaylight.netconf.sal.rest.api.Draft02.RestConfModule.ERRORS_CONTAINER_QNAME) MediaType(javax.ws.rs.core.MediaType) NormalizedNodeWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter) XMLStreamException(javax.xml.stream.XMLStreamException) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) CollectionNodeBuilder(org.opendaylight.yangtools.yang.data.api.schema.builder.CollectionNodeBuilder) Context(javax.ws.rs.core.Context) ListSchemaNode(org.opendaylight.yangtools.yang.model.api.ListSchemaNode) ContainerSchemaNode(org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode) DataContainerChild(org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) ErrorTags(org.opendaylight.restconf.common.ErrorTags) XMLStreamNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter) List(java.util.List) HttpHeaders(javax.ws.rs.core.HttpHeaders) Response(javax.ws.rs.core.Response) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) ImmutableNodes(org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) Iterables(com.google.common.collect.Iterables) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) ByteArrayOutputStream(java.io.ByteArrayOutputStream) InstanceIdentifierContext(org.opendaylight.restconf.common.context.InstanceIdentifierContext) ArrayList(java.util.ArrayList) RestConfModule(org.opendaylight.netconf.sal.rest.api.Draft02.RestConfModule) JsonWriterFactory(org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory) Objects.requireNonNull(java.util.Objects.requireNonNull) OutputStreamWriter(java.io.OutputStreamWriter) SystemMapNode(org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode) XMLConstants(javax.xml.XMLConstants) JsonWriter(com.google.gson.stream.JsonWriter) Status(javax.ws.rs.core.Response.Status) SchemaAwareBuilders(org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders) Logger(org.slf4j.Logger) DataContainerNodeBuilder(org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder) IOException(java.io.IOException) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) RestconfError(org.opendaylight.restconf.common.errors.RestconfError) QName(org.opendaylight.yangtools.yang.common.QName) FactoryConfigurationError(javax.xml.stream.FactoryConfigurationError) XMLOutputFactory(javax.xml.stream.XMLOutputFactory) DataNodeContainer(org.opendaylight.yangtools.yang.model.api.DataNodeContainer) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) DataSchemaNode(org.opendaylight.yangtools.yang.model.api.DataSchemaNode) ControllerContext(org.opendaylight.netconf.sal.restconf.impl.ControllerContext) RestconfDocumentedException(org.opendaylight.restconf.common.errors.RestconfDocumentedException) AugmentationIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) LeafSchemaNode(org.opendaylight.yangtools.yang.model.api.LeafSchemaNode) AugmentationIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier) NormalizedNodeWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter) QName(org.opendaylight.yangtools.yang.common.QName) JSONNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) XMLStreamNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) XMLStreamException(javax.xml.stream.XMLStreamException) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ForwardingNormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter) SchemaContext(org.opendaylight.yangtools.yang.model.api.SchemaContext) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) FactoryConfigurationError(javax.xml.stream.FactoryConfigurationError)

Aggregations

IOException (java.io.IOException)3 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)3 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)2 Iterables (com.google.common.collect.Iterables)2 JsonWriter (com.google.gson.stream.JsonWriter)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 StandardCharsets (java.nio.charset.StandardCharsets)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2 Collectors (java.util.stream.Collectors)2 Context (javax.ws.rs.core.Context)2 HttpHeaders (javax.ws.rs.core.HttpHeaders)2 MediaType (javax.ws.rs.core.MediaType)2 Response (javax.ws.rs.core.Response)2 Status (javax.ws.rs.core.Response.Status)2 ExceptionMapper (javax.ws.rs.ext.ExceptionMapper)2 Provider (javax.ws.rs.ext.Provider)2