15cc7bcff6ec29e5c0ca3ec0475e9d31f9d9c936
[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.NetconfDocumentedException;\r
11 import org.opendaylight.controller.netconf.api.NetconfSession;\r
12 import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;\r
13 import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
14 import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
15 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;\r
16 import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
17 import org.slf4j.Logger;\r
18 import org.slf4j.LoggerFactory;\r
19 import org.w3c.dom.Document;\r
20 import org.w3c.dom.Element;\r
21 \r
22 import com.google.common.base.Optional;\r
23 \r
24 public class DefaultStartExi extends AbstractSingletonNetconfOperation 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 String getOperationName() {\r
38         return START_EXI;\r
39     }\r
40 \r
41     @Override\r
42     protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {\r
43 \r
44         Element getSchemaResult = XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));\r
45 \r
46         throw new UnsupportedOperationException("Not implemented");\r
47 \r
48         /*\r
49         try {\r
50             ExiParameters exiParams = new ExiParameters();\r
51             exiParams.setParametersFromXmlElement(operationElement);\r
52 \r
53             netconfSession.addExiDecoder(ExiDecoderHandler.HANDLER_NAME, new ExiDecoderHandler(exiParams));\r
54             netconfSession.addExiEncoderAfterMessageSent(ExiEncoderHandler.HANDLER_NAME,new ExiEncoderHandler(exiParams));\r
55 \r
56         } catch (EXIException e) {\r
57             getSchemaResult = document\r
58                     .createElement(XmlNetconfConstants.RPC_ERROR);\r
59         }\r
60 \r
61         logger.trace("{} operation successful", START_EXI);\r
62         logger.debug("received start-exi message {} ", XmlUtil.toString(document));\r
63         return getSchemaResult;\r
64         */\r
65     }\r
66 \r
67     @Override\r
68     public void setNetconfSession(NetconfSession s) {\r
69         netconfSession = s;\r
70     }\r
71 \r
72     public NetconfSession getNetconfSession() {\r
73         return netconfSession;\r
74     }\r
75 \r
76 \r
77 }\r