import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
import org.slf4j.Logger;
boolean commitStatus = transactionProvider.commitTransaction();
LOG.trace("Commit completed successfully {}", commitStatus);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
ErrorTag.BAD_ELEMENT,
ErrorSeverity.ERROR);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
private void copyToCandidate(final XmlElement operationElement)
import org.opendaylight.netconf.api.DocumentedException.ErrorType;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
import org.slf4j.Logger;
throw new DocumentedException(e.getMessage(), e, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED,
ErrorSeverity.ERROR, errorInfo);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
import org.opendaylight.netconf.api.DocumentedException.ErrorType;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.opendaylight.netconf.mdsal.connector.ops.DataTreeChangeTracker.DataTreeChange;
executeOperations(changeTracker);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
private void executeOperations(final DataTreeChangeTracker changeTracker) throws DocumentedException {
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final Datastore targetDatastore = extractTargetParameter(operationElement);
if (targetDatastore == Datastore.candidate) {
LOG.debug("Locking candidate datastore on session: {}", getNetconfSessionIdForReporting());
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
throw new DocumentedException("Unable to lock " + targetDatastore + " datastore",
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final Datastore targetDatastore = Lock.extractTargetParameter(operationElement);
if (targetDatastore == Datastore.candidate) {
LOG.debug("Unlocking candidate datastore on session: {}", getNetconfSessionIdForReporting());
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
throw new DocumentedException("Unable to unlock " + targetDatastore + " datastore",
import org.opendaylight.netconf.api.DocumentedException.ErrorType;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
transactionProvider.validateTransaction();
LOG.trace("<validate> request completed successfully on session {}", getNetconfSessionIdForReporting());
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
protected static Datastore extractSourceParameter(final XmlElement operationElement, final String operationName)
import org.opendaylight.netconf.api.DocumentedException.ErrorType;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.opendaylight.netconf.mdsal.connector.ops.Datastore;
final Optional<YangInstanceIdentifier> dataRootOptional = getDataRootFromFilter(operationElement);
if (!dataRootOptional.isPresent()) {
- return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ return document.createElement(XmlNetconfConstants.DATA_KEY);
}
final YangInstanceIdentifier dataRoot = dataRootOptional.get();
transactionProvider.abortRunningTransaction(rwTx);
if (!normalizedNodeOptional.isPresent()) {
- return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ return document.createElement(XmlNetconfConstants.DATA_KEY);
}
return serializeNodeWithParentStructure(document, dataRoot, normalizedNodeOptional.get());
import org.opendaylight.netconf.api.DocumentedException.ErrorType;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
import org.opendaylight.netconf.mdsal.connector.ops.Datastore;
final Optional<YangInstanceIdentifier> dataRootOptional = getDataRootFromFilter(operationElement);
if (!dataRootOptional.isPresent()) {
- return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ return document.createElement(XmlNetconfConstants.DATA_KEY);
}
final YangInstanceIdentifier dataRoot = dataRootOptional.get();
}
if (!normalizedNodeOptional.isPresent()) {
- return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ return document.createElement(XmlNetconfConstants.DATA_KEY);
}
return serializeNodeWithParentStructure(document, dataRoot, normalizedNodeOptional.get());
return DEFAULT_DOM_BUILDER.get().newDocument();
}
- public static Element createElement(final Document document, final String qname) {
- return createElement(document, qname, Optional.empty());
- }
-
public static Element createElement(final Document document, final String qname,
final Optional<String> namespaceURI) {
- if (namespaceURI.isPresent()) {
- final Element element = document.createElementNS(namespaceURI.get(), qname);
- String name = XMLNS_ATTRIBUTE;
- if (element.getPrefix() != null) {
- name += ":" + element.getPrefix();
- }
- element.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI, name, namespaceURI.get());
- return element;
+ if (!namespaceURI.isPresent()) {
+ return document.createElement(qname);
}
- return document.createElement(qname);
+
+ final String uri = namespaceURI.get();
+ final Element element = document.createElementNS(uri, qname);
+ String name = XMLNS_ATTRIBUTE;
+ if (element.getPrefix() != null) {
+ name += ":" + element.getPrefix();
+ }
+ element.setAttributeNS(XMLNS_ATTRIBUTE_NS_URI, name, uri);
+ return element;
}
public static Element createTextElement(final Document document, final String qname, final String content,
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.impl.NetconfServerSession;
import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
import org.slf4j.Logger;
DocumentedException.ErrorSeverity.ERROR, Collections.singletonMap(
DocumentedException.ErrorSeverity.ERROR.toString(), e.getMessage()));
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
import org.opendaylight.netconf.api.NetconfSession;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.mapping.api.SessionAwareNetconfOperation;
import org.opendaylight.netconf.notifications.NetconfNotification;
import org.opendaylight.netconf.notifications.NetconfNotificationListener;
.registerNotificationListener(streamNameType, new NotificationSubscription(netconfSession, filter));
subscriptions.add(notificationListenerRegistration);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
private static StreamNameType parseStreamIfPresent(final XmlElement operationElement) throws DocumentedException {
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
}, delayAggregator, TimeUnit.SECONDS);
}
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
private static NetconfMessage parseNetconfNotification(String content) {
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
storage.setConfigList(configElementData.getChildElements());
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ final Element element = document.createElement(XmlNetconfConstants.DATA_KEY);
for (final XmlElement e : storage.getConfigList()) {
final Element domElement = e.getDomElement();
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
+ final Element element = document.createElement(XmlNetconfConstants.DATA_KEY);
for (final XmlElement e : storage.getConfigList()) {
final Element domElement = e.getDomElement();
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override
import org.opendaylight.netconf.api.xml.XmlElement;
import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.api.xml.XmlUtil;
import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@Override
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
- return XmlUtil.createElement(document, XmlNetconfConstants.OK);
+ return document.createElement(XmlNetconfConstants.OK);
}
@Override