fix ServiceHandler SpotBugs false positives
[transportpce.git] / tests / honeynode / 2.2.1 / netconf-impl / src / main / java / org / opendaylight / netconf / impl / mapping / operations / DefaultStopExi.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 package org.opendaylight.netconf.impl.mapping.operations;
9
10 import org.opendaylight.netconf.api.xml.XmlElement;
11 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
12 import org.opendaylight.netconf.api.xml.XmlUtil;
13 import org.opendaylight.netconf.impl.NetconfServerSession;
14 import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17 import org.w3c.dom.Document;
18 import org.w3c.dom.Element;
19
20 public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
21
22     public static final String STOP_EXI = "stop-exi";
23     private NetconfServerSession netconfSession;
24
25     private static final Logger LOG = LoggerFactory
26             .getLogger(DefaultStopExi.class);
27
28     public DefaultStopExi(String netconfSessionIdForReporting) {
29         super(netconfSessionIdForReporting);
30     }
31
32     @Override
33     protected Element handleWithNoSubsequentOperations(Document document,
34                                                        XmlElement operationElement) {
35         LOG.debug("Received stop-exi message {} ", XmlUtil.toString(operationElement));
36
37         netconfSession.stopExiCommunication();
38
39         Element getSchemaResult = document.createElementNS(
40                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);
41         LOG.trace("{} operation successful", STOP_EXI);
42         return getSchemaResult;
43     }
44
45     @Override
46     protected String getOperationName() {
47         return STOP_EXI;
48     }
49
50     @Override
51     protected String getOperationNamespace() {
52         return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;
53     }
54
55     @Override
56     public void setNetconfSession(NetconfServerSession netconfServerSession) {
57         this.netconfSession = netconfServerSession;
58     }
59 }