gpt4 book ai didi

org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter.create()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 11:33:05 34 4
gpt4 key购买 nike

本文整理了Java中org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter.create()方法的一些代码示例,展示了XMLStreamNormalizedNodeStreamWriter.create()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamNormalizedNodeStreamWriter.create()方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter
类名称:XMLStreamNormalizedNodeStreamWriter
方法名:create

XMLStreamNormalizedNodeStreamWriter.create介绍

暂无

代码示例

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

private RestconfNormalizedNodeWriter createNormalizedNodeWriter(XMLStreamWriter xmlWriter,
                                  SchemaContext schemaContext, SchemaPath schemaPath, Optional<Integer> depth) {
  NormalizedNodeStreamWriter xmlStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter, schemaContext, schemaPath);
  if (depth.isPresent()) {
    return DepthAwareNormalizedNodeWriter.forStreamWriter(xmlStreamWriter, depth.get());
  } else {
    return RestconfDelegatingNormalizedNodeWriter.forStreamWriter(xmlStreamWriter);
  }
}

代码示例来源:origin: org.opendaylight.netconf/netconf-util

public static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result, final SchemaPath schemaPath, final SchemaContext context)
      throws IOException, XMLStreamException {
    final XMLStreamWriter writer = XML_FACTORY.createXMLStreamWriter(result);
    try (
       final NormalizedNodeStreamWriter normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, context, schemaPath);
       final NormalizedNodeWriter normalizedNodeWriter =  NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter)
    ) {
      normalizedNodeWriter.write(normalized);
      normalizedNodeWriter.flush();
    } finally {
      try {
        if(writer != null) {
          writer.close();
        }
      } catch (final Exception e) {
        LOG.warn("Unable to close resource properly", e);
      }
    }
  }
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector

protected Node transformNormalizedNode(final Document document, final NormalizedNode<?, ?> data, final YangInstanceIdentifier dataRoot) {
  final DOMResult result = new DOMResult(document.createElement(XmlNetconfConstants.DATA_KEY));
  final XMLStreamWriter xmlWriter = getXmlStreamWriter(result);
  final NormalizedNodeStreamWriter nnStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,
      schemaContext.getCurrentContext(), getSchemaPath(dataRoot));
  final NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(nnStreamWriter, true);
  writeRootElement(xmlWriter, nnWriter, (ContainerNode) data);
  return result.getNode();
}

代码示例来源:origin: org.opendaylight.controller/mdsal-netconf-connector

protected Node transformNormalizedNode(final Document document, final NormalizedNode<?, ?> data, final YangInstanceIdentifier dataRoot) {
  final DOMResult result = new DOMResult(document.createElement(XmlNetconfConstants.DATA_KEY));
  final XMLStreamWriter xmlWriter = getXmlStreamWriter(result);
  final NormalizedNodeStreamWriter nnStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,
      schemaContext.getCurrentContext(), getSchemaPath(dataRoot));
  final NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(nnStreamWriter, true);
  writeRootElement(xmlWriter, nnWriter, (ContainerNode) data);
  return result.getNode();
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector

private Node transformNormalizedNode(final Document document, final NormalizedNode<?, ?> data, final SchemaPath rpcOutputPath) {
  final DOMResult result = new DOMResult(document.createElement(XmlMappingConstants.RPC_REPLY_KEY));
  final XMLStreamWriter xmlWriter = getXmlStreamWriter(result);
  final NormalizedNodeStreamWriter nnStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,
      schemaContext.getCurrentContext(), rpcOutputPath);
  final SchemaOrderedNormalizedNodeWriter nnWriter =
      new SchemaOrderedNormalizedNodeWriter(nnStreamWriter, schemaContext.getCurrentContext(), rpcOutputPath);
  writeRootElement(xmlWriter, nnWriter, (ContainerNode) data);
  try {
    nnStreamWriter.close();
    xmlWriter.close();
  } catch (IOException | XMLStreamException e) {
    LOG.warn("Error while closing streams", e);
  }
  return result.getNode();
}

代码示例来源:origin: org.opendaylight.controller/mdsal-netconf-connector

private Node transformNormalizedNode(final Document document, final NormalizedNode<?, ?> data, final SchemaPath rpcOutputPath) {
  final DOMResult result = new DOMResult(document.createElement(XmlNetconfConstants.RPC_REPLY_KEY));
  final XMLStreamWriter xmlWriter = getXmlStreamWriter(result);
  final NormalizedNodeStreamWriter nnStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,
      schemaContext.getCurrentContext(), rpcOutputPath);
  final OrderedNormalizedNodeWriter nnWriter = new OrderedNormalizedNodeWriter(nnStreamWriter, schemaContext.getCurrentContext(), rpcOutputPath);
  writeRootElement(xmlWriter, nnWriter, (ContainerNode) data);
  try {
    nnStreamWriter.close();
    xmlWriter.close();
  } catch (IOException | XMLStreamException e) {
    LOG.warn("Error while closing streams", e);
  }
  return result.getNode();
}

代码示例来源:origin: org.opendaylight.controller/sal-netconf-connector

private void writeNormalizedRpc(final ContainerNode normalized, final DOMResult result, final SchemaPath schemaPath, final SchemaContext baseNetconfCtx) throws IOException, XMLStreamException {
  final OrderedNormalizedNodeWriter normalizedNodeWriter;
  NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
  XMLStreamWriter writer = null;
  try {
    writer = NetconfMessageTransformUtil.XML_FACTORY.createXMLStreamWriter(result);
    normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, baseNetconfCtx, schemaPath);
    normalizedNodeWriter = new OrderedNormalizedNodeWriter(normalizedNodeStreamWriter, baseNetconfCtx, schemaPath);
    Collection<DataContainerChild<?, ?>> value = (Collection) normalized.getValue();
    normalizedNodeWriter.write(value);
    normalizedNodeWriter.flush();
  } finally {
    try {
      if(normalizedNodeStreamWriter != null) {
        normalizedNodeStreamWriter.close();
      }
      if(writer != null) {
        writer.close();
      }
    } catch (final Exception e) {
      LOG.warn("Unable to close resource properly", e);
    }
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-netconf-connector

public static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result, final SchemaPath schemaPath, final SchemaContext context)
      throws IOException, XMLStreamException {
    NormalizedNodeWriter normalizedNodeWriter = null;
    NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
    XMLStreamWriter writer = null;
    try {
      writer = XML_FACTORY.createXMLStreamWriter(result);
      normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, context, schemaPath);
      normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter);

      normalizedNodeWriter.write(normalized);

      normalizedNodeWriter.flush();
    } finally {
      try {
        if(normalizedNodeWriter != null) {
          normalizedNodeWriter.close();
        }
        if(normalizedNodeStreamWriter != null) {
          normalizedNodeStreamWriter.close();
        }
        if(writer != null) {
          writer.close();
        }
      } catch (final Exception e) {
        LOG.warn("Unable to close resource properly", e);
      }
    }
  }
}

代码示例来源:origin: org.opendaylight.controller/netconf-notifications-impl

static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result, final SchemaPath schemaPath) throws IOException, XMLStreamException {
  NormalizedNodeWriter normalizedNodeWriter = null;
  NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
  XMLStreamWriter writer = null;
  try {
    writer = XML_FACTORY.createXMLStreamWriter(result);
    normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, NOTIFICATIONS_SCHEMA_CTX, schemaPath);
    normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter);
    normalizedNodeWriter.write(normalized);
    normalizedNodeWriter.flush();
  } finally {
    try {
      if(normalizedNodeWriter != null) {
        normalizedNodeWriter.close();
      }
      if(normalizedNodeStreamWriter != null) {
        normalizedNodeStreamWriter.close();
      }
      if(writer != null) {
        writer.close();
      }
    } catch (final Exception e) {
      LOG.warn("Unable to close resource properly", e);
    }
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

final NormalizedNodeStreamWriter xmlStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,
    pathContext.getSchemaContext(), schemaPath);

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, context, nodePath);
normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter);

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com