Remove netconf from commons/opendaylight pom
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / operations / get / Get.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.confignetconfconnector.operations.get;
10
11 import org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacade;
12 import org.opendaylight.controller.config.util.xml.DocumentedException;
13 import org.opendaylight.controller.config.util.xml.XmlElement;
14 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
15 import org.opendaylight.controller.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18 import org.w3c.dom.Document;
19 import org.w3c.dom.Element;
20
21 public class Get extends AbstractConfigNetconfOperation {
22
23     private static final Logger LOG = LoggerFactory.getLogger(Get.class);
24
25     public Get(final ConfigSubsystemFacade configSubsystemFacade, final String netconfSessionIdForReporting) {
26         super(configSubsystemFacade, netconfSessionIdForReporting);
27     }
28
29     private static void checkXml(XmlElement xml) throws DocumentedException {
30         xml.checkName(XmlNetconfConstants.GET);
31         xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
32
33         // Filter option: ignore for now, TODO only load modules specified by the filter
34     }
35
36     @Override
37     protected String getOperationName() {
38         return XmlNetconfConstants.GET;
39     }
40
41     @Override
42     protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws DocumentedException {
43         checkXml(xml);
44         final Element element = getConfigSubsystemFacade().get(document);
45         LOG.trace("{} operation successful", XmlNetconfConstants.GET);
46         return element;
47     }
48 }