2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.confignetconfconnector.operations;
11 import org.opendaylight.controller.config.util.ConfigRegistryClient;
12 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
13 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
14 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
15 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;
16 import org.opendaylight.controller.netconf.util.xml.XmlElement;
17 import org.w3c.dom.Document;
18 import org.w3c.dom.Element;
20 public abstract class AbstractConfigNetconfOperation extends AbstractNetconfOperation {
22 protected final ConfigRegistryClient configRegistryClient;
24 protected AbstractConfigNetconfOperation(ConfigRegistryClient configRegistryClient,
25 String netconfSessionIdForReporting) {
26 super(netconfSessionIdForReporting);
27 this.configRegistryClient = configRegistryClient;
31 protected HandlingPriority canHandle(String operationName, String operationNamespace) {
32 // TODO check namespace
33 return operationName.equals(getOperationName()) ? HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY
34 : HandlingPriority.CANNOT_HANDLE;
37 protected abstract String getOperationName();
40 protected Element handle(Document document, XmlElement operationElement, NetconfOperationRouter opRouter)
41 throws NetconfDocumentedException {
42 return handle(document, operationElement);
45 protected abstract Element handle(Document document, XmlElement operationElement) throws NetconfDocumentedException;