- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.opendaylight.controller.config.util.xml.XmlUtil
类的一些代码示例,展示了XmlUtil
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtil
类的具体详情如下:
包路径:org.opendaylight.controller.config.util.xml.XmlUtil
类名称:XmlUtil
暂无
代码示例来源:origin: org.opendaylight.controller/config-util
public static Element createTextElement(final Document document, final String qName, final String content, final Optional<String> namespaceURI) {
Element typeElement = createElement(document, qName, namespaceURI);
typeElement.appendChild(document.createTextNode(content));
return typeElement;
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static Document createDocumentCopy(final Document original) {
final Document copiedDocument = newDocument();
final Node copiedRoot = copiedDocument.importNode(original.getDocumentElement(), true);
copiedDocument.appendChild(copiedRoot);
return copiedDocument;
}
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static String toString(final Element xml) {
return toString(xml, false);
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static Element createTextElementWithNamespacedContent(final Document document, final String qName, final String prefix,
final String namespace, final String contentWithoutPrefix, final Optional<String> namespaceURI) {
String content = createPrefixedValue(XmlMappingConstants.PREFIX, contentWithoutPrefix);
Element element = createTextElement(document, qName, content, namespaceURI);
String prefixedNamespaceAttr = createPrefixedValue(XMLNS_ATTRIBUTE_KEY, prefix);
element.setAttributeNS(XMLNS_URI, prefixedNamespaceAttr, namespace);
return element;
}
代码示例来源:origin: org.opendaylight.netconf/netconf-util
@Override
public Document handle(final Document requestMessage,
final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
XmlElement requestElement = getRequestElementWithCheck(requestMessage);
Document document = XmlUtil.newDocument();
XmlElement operationElement = requestElement.getOnlyChildElement();
Map<String, Attr> attributes = requestElement.getAttributes();
Element response = handle(document, operationElement, subsequentOperation);
Element rpcReply = XmlUtil.createElement(document, XmlMappingConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
if(XmlElement.fromDomElement(response).hasNamespace()) {
rpcReply.appendChild(response);
} else {
Element responseNS = XmlUtil.createElement(document, response.getNodeName(), Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
NodeList list = response.getChildNodes();
while(list.getLength()!=0) {
responseNS.appendChild(list.item(0));
}
rpcReply.appendChild(responseNS);
}
for (Attr attribute : attributes.values()) {
rpcReply.setAttributeNode((Attr) document.importNode(attribute, true));
}
document.appendChild(rpcReply);
return document;
}
代码示例来源:origin: org.opendaylight.controller/blueprint
ValidationException, ConflictingVersionException {
Document document = XmlUtil.newDocument();
Element dataElement = XmlUtil.createElement(document, XmlMappingConstants.DATA_KEY, Optional.<String>absent());
Element modulesElement = XmlUtil.createElement(document, XmlMappingConstants.MODULES_KEY,
Optional.of(XmlMappingConstants.URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG));
dataElement.appendChild(modulesElement);
LOG.debug("Pushing config xml: {}", XmlUtil.toString(dataElement));
代码示例来源:origin: org.opendaylight.controller/config-util
public static Element readXmlToElement(final InputStream xmlContent) throws SAXException, IOException {
Document doc = readXmlToDocument(xmlContent);
return doc.getDocumentElement();
}
代码示例来源:origin: org.opendaylight.netconf/netconf-monitoring
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws DocumentedException {
final GetSchemaEntry entry;
entry = new GetSchemaEntry(xml);
final String schema;
try {
schema = cap.getSchemaForCapability(entry.identifier, entry.version);
} catch (final IllegalStateException e) {
final Map<String, String> errorInfo = Maps.newHashMap();
errorInfo.put(entry.identifier, e.getMessage());
LOG.warn("Rpc error: {}", DocumentedException.ErrorTag.operation_failed, e);
throw new DocumentedException(e.getMessage(), DocumentedException.ErrorType.application,
DocumentedException.ErrorTag.operation_failed,
DocumentedException.ErrorSeverity.error, errorInfo);
}
final Element getSchemaResult;
getSchemaResult = XmlUtil.createTextElement(document, XmlNetconfConstants.DATA_KEY, schema,
Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING));
LOG.trace("{} operation successful", GET_SCHEMA);
return getSchemaResult;
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@Override
public Document handle(final Document requestMessage,
final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
final XmlElement requestElement = getRequestElementWithCheck(requestMessage);
final Document document = XmlUtil.newDocument();
final XmlElement operationElement = requestElement.getOnlyChildElement();
final Map<String, Attr> attributes = requestElement.getAttributes();
final Element response = handle(document, operationElement, subsequentOperation);
final Element rpcReply = XmlUtil.createElement(document, XmlMappingConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
if(XmlElement.fromDomElement(response).hasNamespace()) {
rpcReply.appendChild(response);
} else {
final NodeList list = response.getChildNodes();
if (list.getLength() == 0) {
rpcReply.appendChild(response);
} else {
while (list.getLength() != 0) {
rpcReply.appendChild(list.item(0));
}
}
}
for (Attr attribute : attributes.values()) {
rpcReply.setAttributeNode((Attr) document.importNode(attribute, true));
}
document.appendChild(rpcReply);
return document;
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static Element readXmlToElement(final String xmlContent) throws SAXException, IOException {
Document doc = readXmlToDocument(xmlContent);
return doc.getDocumentElement();
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
boolean commitStatus = transactionProvider.commitTransaction();
LOG.trace("Commit completed successfully {}", commitStatus);
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
代码示例来源:origin: org.opendaylight.netconf/messagebus-netconf
private AnyXmlNode encapsulate(final DOMNotification body) {
// FIXME: Introduce something like YangModeledAnyXmlNode in Yangtools
final Document doc = XmlUtil.newDocument();
final Optional<String> namespace = Optional.of(PAYLOAD_ARG.getNodeType().getNamespace().toString());
final Element element = XmlUtil.createElement(doc, "payload", namespace);
final DOMResult result = new DOMResult(element);
final SchemaContext context = mount.getSchemaContext();
final SchemaPath schemaPath = body.getType();
try {
NetconfUtil.writeNormalizedNode(body.getBody(), result, schemaPath, context);
return Builders.anyXmlBuilder().withNodeIdentifier(PAYLOAD_ARG).withValue(new DOMSource(element)).build();
} catch (IOException | XMLStreamException e) {
LOG.error("Unable to encapsulate notification.", e);
throw Throwables.propagate(e);
}
}
代码示例来源:origin: org.opendaylight.netconf/netconf-util
private static Document filtered(XmlElement filter, Document originalReplyDocument) throws DocumentedException {
Document result = XmlUtil.newDocument();
// even if filter is empty, copy /rpc/data
Element rpcReply = originalReplyDocument.getDocumentElement();
Node rpcReplyDst = result.importNode(rpcReply, false);
result.appendChild(rpcReplyDst);
XmlElement dataSrc = XmlElement.fromDomElement(rpcReply).getOnlyChildElement("data", XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
Element dataDst = (Element) result.importNode(dataSrc.getDomElement(), false);
rpcReplyDst.appendChild(dataDst);
addSubtree(filter, dataSrc, XmlElement.fromDomElement(dataDst));
return result;
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static String toString(final Document document) {
return toString(document.getDocumentElement());
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
return readXmlToDocument(new ByteArrayInputStream(xmlContent.getBytes(StandardCharsets.UTF_8)));
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
try {
transactionProvider.abortTransaction();
} catch (IllegalStateException e) {
LOG.warn("Abort failed ", e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo
.put(ErrorTag.operation_failed.name(),
"Operation failed. Use 'get-config' or 'edit-config' before triggering 'discard-changes' operation");
throw new DocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed,
ErrorSeverity.error, errorInfo);
}
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
代码示例来源:origin: org.opendaylight.netconf/netconf-netty-util
public static NetconfStartExiMessage create(final EXIOptions exiOptions, final String messageId) {
final Document doc = XmlUtil.newDocument();
final Element rpcElement = doc.createElementNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0,
XmlNetconfConstants.RPC_KEY);
rpcElement.setAttributeNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0,
XmlNetconfConstants.MESSAGE_ID, messageId);
// TODO draft http://tools.ietf.org/html/draft-varga-netconf-exi-capability-02#section-3.5.1 has no namespace for start-exi element in xml
final Element startExiElement = doc.createElementNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0,
START_EXI);
addAlignment(exiOptions, doc, startExiElement);
addFidelity(exiOptions, doc, startExiElement);
rpcElement.appendChild(startExiElement);
doc.appendChild(rpcElement);
return new NetconfStartExiMessage(doc);
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static String toString(final Document doc, final boolean addXmlDeclaration) {
return toString(doc.getDocumentElement(), addXmlDeclaration);
}
代码示例来源:origin: org.opendaylight.controller/config-util
public static Element readXmlToElement(final File xmlFile) throws SAXException, IOException {
return readXmlToDocument(new FileInputStream(xmlFile)).getDocumentElement();
}
代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-connector
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws DocumentedException {
final Datastore targetDatastore = extractTargetParameter(operationElement);
if (targetDatastore == Datastore.candidate) {
LOG.debug("Locking candidate datastore on session: {}", getNetconfSessionIdForReporting());
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
throw new DocumentedException("Unable to lock " + targetDatastore + " datastore", DocumentedException.ErrorType.application,
DocumentedException.ErrorTag.operation_not_supported, DocumentedException.ErrorSeverity.error);
}
我在 pom.xml 中添加了以下依赖 org.opendaylight.yangtools yang-parser-impl
OpenDaylight 氧气 Maven 3.3.9 Ubuntu 16.04 Karaf 4 ~/.m2/settings.xml - cp -n ~/.m2/settings.xml{,.ori
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev1309
我是一名优秀的程序员,十分优秀!