38c1a447e4ba7e3613df52e7dff3bf67cfe4f9be
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / mapping / operations / DefaultStartExi.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\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
7  */\r
8 package org.opendaylight.controller.netconf.impl.mapping.operations;\r
9 \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.opendaylight.controller.netconf.util.xml.XmlUtil;\r
19 import org.slf4j.Logger;\r
20 import org.slf4j.LoggerFactory;\r
21 import org.w3c.dom.Document;\r
22 import org.w3c.dom.Element;\r
23 \r
24 public class DefaultStartExi extends AbstractNetconfOperation implements DefaultNetconfOperation {\r
25 \r
26     public static final String START_EXI = "start-exi";\r
27 \r
28     private NetconfSession netconfSession;\r
29 \r
30     private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);\r
31 \r
32     public DefaultStartExi(String netconfSessionIdForReporting) {\r
33         super(netconfSessionIdForReporting);\r
34     }\r
35 \r
36     @Override\r
37     protected HandlingPriority canHandle(String operationName,\r
38             String netconfOperationNamespace) {\r
39         if (operationName.equals(START_EXI) == false)\r
40             return HandlingPriority.CANNOT_HANDLE;\r
41         if (netconfOperationNamespace\r
42                 .equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0) == false)\r
43             return HandlingPriority.CANNOT_HANDLE;\r
44 \r
45         return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY;\r
46     }\r
47 \r
48     @Override\r
49     protected Element handle(Document document, XmlElement operationElement,\r
50             NetconfOperationRouter opRouter) throws NetconfDocumentedException {\r
51 \r
52 \r
53         Element getSchemaResult = document\r
54                 .createElement(XmlNetconfConstants.OK);\r
55         XmlUtil.addNamespaceAttr(getSchemaResult,\r
56                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);\r
57 \r
58 \r
59         throw new UnsupportedOperationException("Not implemented");\r
60 \r
61         /*\r
62         try {\r
63             ExiParameters exiParams = new ExiParameters();\r
64             exiParams.setParametersFromXmlElement(operationElement);\r
65 \r
66             netconfSession.addExiDecoder(ExiDecoderHandler.HANDLER_NAME, new ExiDecoderHandler(exiParams));\r
67             netconfSession.addExiEncoderAfterMessageSent(ExiEncoderHandler.HANDLER_NAME,new ExiEncoderHandler(exiParams));\r
68 \r
69         } catch (EXIException e) {\r
70             getSchemaResult = document\r
71                     .createElement(XmlNetconfConstants.RPC_ERROR);\r
72         }\r
73 \r
74         logger.trace("{} operation successful", START_EXI);\r
75         logger.debug("received start-exi message {} ", XmlUtil.toString(document));\r
76         return getSchemaResult;\r
77         */\r
78     }\r
79 \r
80     @Override\r
81     public void setNetconfSession(NetconfSession s) {\r
82         netconfSession = s;\r
83     }\r
84 \r
85     public NetconfSession getNetconfSession() {\r
86         return netconfSession;\r
87     }\r
88 \r
89 \r
90 }\r