gpt4 book ai didi

org.opendaylight.controller.netconf.util.xml.XmlElement.checkNamespace()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 13:03:05 26 4
gpt4 key购买 nike

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

XmlElement.checkNamespace介绍

暂无

代码示例

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

public static XmlElement fromDomElementWithExpected(Element element, String expectedName, String expectedNamespace) throws NetconfDocumentedException {
  XmlElement xmlElement = XmlElement.fromDomElementWithExpected(element, expectedName);
  xmlElement.checkNamespace(expectedNamespace);
  return xmlElement;
}

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

private static void checkXml(XmlElement xml) throws UnexpectedElementException, UnexpectedNamespaceException, MissingNameSpaceException {
  xml.checkName(XmlNetconfConstants.GET);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  // Filter option: ignore for now, TODO only load modules specified by the filter
}

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

private static void fromXml(XmlElement xml) throws NetconfDocumentedException {
  xml.checkName(DISCARD);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

private static void checkXml(XmlElement xml) throws NetconfDocumentedException {
  xml.checkName(XmlNetconfConstants.COMMIT);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

private static void validateInputRpc(final XmlElement xml, String operationName) throws NetconfDocumentedException{
  xml.checkName(operationName);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}

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

public XmlElement getOnlyChildElementWithSameNamespace() throws NetconfDocumentedException {
  XmlElement childElement = getOnlyChildElement();
  childElement.checkNamespace(getNamespace());
  return childElement;
}

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

private void checkXml(XmlElement xml) throws NetconfDocumentedException {
  xml.checkName(VALIDATE);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceElement = xml.getOnlyChildElement(XmlNetconfConstants.SOURCE_KEY,
      XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceChildNode = sourceElement.getOnlyChildElement();
  sourceChildNode.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  String datastoreValue = sourceChildNode.getName();
  Datastore sourceDatastore = Datastore.valueOf(datastoreValue);
  if (sourceDatastore != Datastore.candidate){
    throw new NetconfDocumentedException( "Only " + Datastore.candidate
        + " is supported as source for " + VALIDATE + " but was " + datastoreValue,ErrorType.application,ErrorTag.data_missing,ErrorSeverity.error);
  }
}

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

public static Datastore fromXml(XmlElement xml) throws UnexpectedNamespaceException, UnexpectedElementException, MissingNameSpaceException, NetconfDocumentedException {
  xml.checkName(GET_CONFIG);
  xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceElement = xml.getOnlyChildElement(XmlNetconfConstants.SOURCE_KEY,
      XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
  XmlElement sourceNode = sourceElement.getOnlyChildElement();
  String sourceParsed = sourceNode.getName();
  LOG.debug("Setting source datastore to '{}'", sourceParsed);
  Datastore sourceDatastore = Datastore.valueOf(sourceParsed);
  // Filter option: ignore for now, TODO only load modules specified by the filter
  return sourceDatastore;
}

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

@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws NetconfDocumentedException {
  operationElement.checkName(CREATE_SUBSCRIPTION);
  operationElement.checkNamespace(CreateSubscriptionInput.QNAME.getNamespace().toString());
  // FIXME reimplement using CODEC_REGISTRY and parse everything into generated class instance
  // Waiting ofr https://git.opendaylight.org/gerrit/#/c/13763/
  // FIXME filter could be supported same way as netconf server filters get and get-config results
  final Optional<XmlElement> filter = operationElement.getOnlyChildElementWithSameNamespaceOptionally("filter");
  Preconditions.checkArgument(filter.isPresent() == false, "Filter element not yet supported");
  // Replay not supported
  final Optional<XmlElement> startTime = operationElement.getOnlyChildElementWithSameNamespaceOptionally("startTime");
  Preconditions.checkArgument(startTime.isPresent() == false, "StartTime element not yet supported");
  // Stop time not supported
  final Optional<XmlElement> stopTime = operationElement.getOnlyChildElementWithSameNamespaceOptionally("stopTime");
  Preconditions.checkArgument(stopTime.isPresent() == false, "StopTime element not yet supported");
  final StreamNameType streamNameType = parseStreamIfPresent(operationElement);
  Preconditions.checkNotNull(netconfSession);
  // Premature streams are allowed (meaning listener can register even if no provider is available yet)
  if(notifications.isStreamAvailable(streamNameType) == false) {
    LOG.warn("Registering premature stream {}. No publisher available yet for session {}", streamNameType, getNetconfSessionIdForReporting());
  }
  final NotificationListenerRegistration notificationListenerRegistration =
      notifications.registerNotificationListener(streamNameType, new NotificationSubscription(netconfSession));
  subscriptions.add(notificationListenerRegistration);
  return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}

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

xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);

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