* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.netconf.confignetconfconnector.operations;
-
-import java.util.HashMap;
-import java.util.Map;
+ package org.opendaylight.controller.netconf.confignetconfconnector.operations;
+import com.google.common.base.Optional;
import org.opendaylight.controller.config.util.ConfigRegistryClient;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import com.google.common.base.Optional;
+import java.util.HashMap;
+import java.util.Map;
+
public class DiscardChanges extends AbstractConfigNetconfOperation {
this.transactionProvider = transactionProvider;
}
- private static void fromXml(XmlElement xml) {
+ private static void fromXml(XmlElement xml) throws NetconfDocumentedException {
xml.checkName(DISCARD);
xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
}
@Override
protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws NetconfDocumentedException {
- try {
- fromXml(xml);
- } catch (final IllegalArgumentException e) {
- //FIXME where can IllegalStateException be thrown?
- logger.warn("Rpc error: {}", ErrorTag.bad_attribute, e);
- final Map<String, String> errorInfo = new HashMap<>();
- errorInfo.put(ErrorTag.bad_attribute.name(), e.getMessage());
- throw new NetconfDocumentedException(e.getMessage(), e, ErrorType.rpc, ErrorTag.bad_attribute,
- ErrorSeverity.error, errorInfo);
- }
-
+ fromXml(xml);
try {
this.transactionProvider.abortTransaction();
} catch (final IllegalStateException e) {
- //FIXME where can IllegalStateException be thrown?
logger.warn("Abort failed: ", e);
final Map<String, String> errorInfo = new HashMap<>();
errorInfo
}
logger.trace("Changes discarded successfully from datastore {}", Datastore.candidate);
+
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
}