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.NetconfDocumentedException;
12 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
13 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
14 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;
15 import org.opendaylight.controller.netconf.util.xml.XmlElement;
16 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
17 import org.w3c.dom.Document;
18 import org.w3c.dom.Element;
20 public class DefaultCloseSession extends AbstractNetconfOperation {
21 public static final String CLOSE_SESSION = "close-session";
23 public DefaultCloseSession(String netconfSessionIdForReporting) {
24 super(netconfSessionIdForReporting);
28 protected HandlingPriority canHandle(String operationName, String netconfOperationNamespace) {
29 if (operationName.equals(CLOSE_SESSION) == false)
30 return HandlingPriority.CANNOT_HANDLE;
31 if (netconfOperationNamespace.equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0) == false)
32 return HandlingPriority.CANNOT_HANDLE;
34 return HandlingPriority.HANDLE_WITH_MAX_PRIORITY;
38 * Close netconf operation router associated to this session, which in turn
39 * closes NetconfOperationServiceSnapshot with all NetconfOperationService
43 protected Element handle(Document document, XmlElement operationElement, NetconfOperationRouter opRouter)
44 throws NetconfDocumentedException {
46 return document.createElement(XmlNetconfConstants.OK);