2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.netconf.impl.mapping.operations;
\r
10 import org.opendaylight.controller.netconf.api.NetconfSession;
\r
11 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
\r
12 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
\r
13 import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;
\r
14 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
\r
15 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;
\r
16 import org.opendaylight.controller.netconf.util.xml.XmlElement;
\r
17 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
\r
18 import org.slf4j.Logger;
\r
19 import org.slf4j.LoggerFactory;
\r
20 import org.w3c.dom.Document;
\r
21 import org.w3c.dom.Element;
\r
23 public class DefaultStopExi extends AbstractNetconfOperation implements DefaultNetconfOperation {
\r
25 public static final String STOP_EXI = "stop-exi";
\r
26 private NetconfSession netconfSession;
\r
28 private static final Logger logger = LoggerFactory
\r
29 .getLogger(DefaultStartExi.class);
\r
31 public DefaultStopExi(String netconfSessionIdForReporting) {
\r
32 super(netconfSessionIdForReporting);
\r
36 protected HandlingPriority canHandle(String operationName,
\r
37 String netconfOperationNamespace) {
\r
38 if (operationName.equals(STOP_EXI) == false)
\r
39 return HandlingPriority.CANNOT_HANDLE;
\r
40 if (netconfOperationNamespace
\r
41 .equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0) == false)
\r
42 return HandlingPriority.CANNOT_HANDLE;
\r
44 return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY;
\r
48 protected Element handle(Document document, XmlElement operationElement,
\r
49 NetconfOperationRouter opRouter) throws NetconfDocumentedException {
\r
50 throw new UnsupportedOperationException("Not implemented");
\r
52 netconfSession.remove(ExiDecoderHandler.class);
\r
53 netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME);
\r
55 Element getSchemaResult = document.createElement(XmlNetconfConstants.OK);
\r
56 XmlUtil.addNamespaceAttr(getSchemaResult,
\r
57 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
\r
58 logger.trace("{} operation successful", STOP_EXI);
\r
59 logger.debug("received stop-exi message {} ", XmlUtil.toString(document));
\r
60 return getSchemaResult;
\r
65 public void setNetconfSession(NetconfSession s) {
\r
66 this.netconfSession = s;
\r
69 public NetconfSession getNetconfSession() {
\r
70 return netconfSession;
\r