Specialize MessageTransformer to NetconfMessage
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / api / MessageTransformer.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.sal.connect.api;
9
10 import org.opendaylight.mdsal.dom.api.DOMActionResult;
11 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
12 import org.opendaylight.mdsal.dom.api.DOMNotification;
13 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
14 import org.opendaylight.netconf.api.NetconfMessage;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
18
19 public interface MessageTransformer {
20
21     DOMNotification toNotification(NetconfMessage message);
22
23     NetconfMessage toRpcRequest(QName rpc, NormalizedNode node);
24
25     DOMRpcResult toRpcResult(NetconfMessage message, QName rpc);
26
27     /**
28      * Parse action into message for request.
29      *
30      * @param action - action schema path
31      * @param domDataTreeIdentifier - identifier of action
32      * @param payload - input of action
33      * @return message
34      */
35     default NetconfMessage toActionRequest(final Absolute action, final DOMDataTreeIdentifier domDataTreeIdentifier,
36             final NormalizedNode payload) {
37         throw new UnsupportedOperationException();
38     }
39
40     /**
41      * Parse result of invoking action into DOM result.
42      *
43      * @param action - action schema path
44      * @param message - message to parsing
45      * @return {@link DOMActionResult}
46      */
47     default DOMActionResult toActionResult(final Absolute action, final NetconfMessage message) {
48         throw new UnsupportedOperationException();
49     }
50 }