Prepare netconf to support YANG 1.1 actions
[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.controller.md.sal.dom.api.DOMNotification;
11 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
12 import org.opendaylight.mdsal.dom.api.DOMActionResult;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16
17 public interface MessageTransformer<M> {
18
19     DOMNotification toNotification(M message);
20
21     M toRpcRequest(SchemaPath rpc, NormalizedNode<?, ?> node);
22
23     DOMRpcResult toRpcResult(M message, SchemaPath rpc);
24
25     /**
26      * Parse action into message for request.
27      *
28      * @param action - action schema path
29      * @param domDataTreeIdentifier - identifier of action
30      * @param payload - input of action
31      * @return message
32      */
33     default M toActionRequest(SchemaPath action, DOMDataTreeIdentifier domDataTreeIdentifier, NormalizedNode<?,
34             ?> payload) {
35         throw new UnsupportedOperationException();
36     }
37
38     /**
39      * Parse result of invoking action into DOM result.
40      *
41      * @param action - action schema path
42      * @param message - message to parsing
43      * @return {@link DOMActionResult}
44      */
45     default DOMActionResult toActionResult(SchemaPath action, M message) {
46         throw new UnsupportedOperationException();
47     }
48 }