Merge "Cleaned up dom-api and dom-broker from legacy concepts."
[mdsal.git] / binding / mdsal-binding-dom-codec / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / BindingNormalizedNodeSerializer.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.mdsal.binding.dom.codec.api;
9
10 import java.util.Map.Entry;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.binding.DataContainer;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.binding.Notification;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21
22 /**
23  * Serialization service, which provides two-way serialization between Java
24  * Binding Data representation and NormalizedNode representation.
25  */
26 public interface BindingNormalizedNodeSerializer extends
27         org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer {
28
29     /**
30      * Translates supplied Binding Instance Identifier into NormalizedNode
31      * instance identifier.
32      *
33      * @param binding
34      *            Binding Instance Identifier
35      * @return DOM Instance Identifier
36      * @throws IllegalArgumentException
37      *             If supplied Instance Identifier is not valid.
38      */
39     @Override
40     YangInstanceIdentifier toYangInstanceIdentifier(@Nonnull InstanceIdentifier<?> binding);
41
42     /**
43      * Translates supplied YANG Instance Identifier into Binding instance
44      * identifier.
45      *
46      * @param dom
47      *            YANG Instance Identifier
48      * @return Binding Instance Identifier, or null if the instance identifier
49      *         is not representable.
50      */
51     @Override
52     @Nullable
53     InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
54
55     /**
56      * Translates supplied Binding Instance Identifier and data into
57      * NormalizedNode representation.
58      *
59      * @param path
60      *            Binding Instance Identifier pointing to data
61      * @param data
62      *            Data object representing data
63      * @return NormalizedNode representation
64      * @throws IllegalArgumentException
65      *             If supplied Instance Identifier is not valid.
66      */
67     @Override
68     <T extends DataObject> Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
69             InstanceIdentifier<T> path, T data);
70
71     /**
72      * Translates supplied YANG Instance Identifier and NormalizedNode into
73      * Binding data.
74      *
75      * @param path Binding Instance Identifier
76      * @param data NormalizedNode representing data
77      * @return DOM Instance Identifier
78      */
79     @Override
80     @Nullable
81     Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(@Nonnull YangInstanceIdentifier path,
82             NormalizedNode<?, ?> data);
83
84     /**
85      * Translates supplied NormalizedNode Notification into Binding data.
86      *
87      * @param path Schema Path of Notification, schema path is absolute, and consists of Notification QName.
88      * @param data NormalizedNode representing data
89      * @return Binding representation of Notification
90      */
91     @Override
92     @Nullable Notification fromNormalizedNodeNotification(@Nonnull SchemaPath path,@Nonnull ContainerNode data);
93
94     /**
95      * Translates supplied NormalizedNode RPC input or output into Binding data.
96      *
97      * @param path Schema path of RPC data, Schema path consists of rpc QName and input / output QName.
98      * @param data NormalizedNode representing data
99      * @return Binding representation of RPC data
100      */
101     @Override
102     @Nullable DataObject fromNormalizedNodeRpcData(@Nonnull SchemaPath path,@Nonnull ContainerNode data);
103
104     /**
105      * Translates supplied Binding Notification or output into NormalizedNode notification.
106      *
107      * @param data NormalizedNode representing notification data
108      * @return NormalizedNode representation of notification
109      */
110     @Override
111     @Nonnull ContainerNode toNormalizedNodeNotification(@Nonnull Notification data);
112
113     /**
114      * Translates supplied Binding RPC input or output into NormalizedNode data.
115      *
116      * @param data NormalizedNode representing rpc data
117      * @return NormalizedNode representation of rpc data
118      */
119     @Override
120     @Nonnull ContainerNode toNormalizedNodeRpcData(@Nonnull DataContainer data);
121 }