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