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.impl.mapping.operations;
11 import org.opendaylight.controller.netconf.api.NetconfSession;
12 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
13 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
14 import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;
15 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
16 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;
17 import org.opendaylight.controller.netconf.util.xml.XmlElement;
18 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
19 import org.w3c.dom.Document;
20 import org.w3c.dom.Element;
22 public class DefaultCloseSession extends AbstractNetconfOperation implements DefaultNetconfOperation {
23 public static final String CLOSE_SESSION = "close-session";
24 private NetconfSession netconfSession;
26 public DefaultCloseSession(String netconfSessionIdForReporting) {
27 super(netconfSessionIdForReporting);
31 protected HandlingPriority canHandle(String operationName, String netconfOperationNamespace) {
32 if (operationName.equals(CLOSE_SESSION) == false)
33 return HandlingPriority.CANNOT_HANDLE;
34 if (netconfOperationNamespace.equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0) == false)
35 return HandlingPriority.CANNOT_HANDLE;
37 return HandlingPriority.HANDLE_WITH_MAX_PRIORITY;
41 * Close netconf operation router associated to this session, which in turn
42 * closes NetconfOperationServiceSnapshot with all NetconfOperationService
46 protected Element handle(Document document, XmlElement operationElement, NetconfOperationRouter opRouter)
47 throws NetconfDocumentedException {
49 return document.createElement(XmlNetconfConstants.OK);
53 public void setNetconfSession(NetconfSession s) {
54 this.netconfSession = s;
57 public NetconfSession getNetconfSession() {
58 return netconfSession;