Bump upstreams
[netconf.git] / plugins / netconf-client-mdsal / src / main / java / org / opendaylight / netconf / client / mdsal / impl / RpcStructureTransformer.java
1 /*
2  * Copyright (c) 2016 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.client.mdsal.impl;
9
10 import java.util.List;
11 import java.util.Optional;
12 import javax.xml.transform.dom.DOMSource;
13 import org.opendaylight.netconf.api.EffectiveOperation;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.AnyxmlNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18
19 /**
20  * Transforms rpc structures to normalized nodes and vice versa.
21  */
22 interface RpcStructureTransformer {
23     /**
24      * Transforms data and path to the config element structure. It means creating of parent xml structure
25      * specified by path and appending data to the structure. Operation is set as attribute on data element.
26      *
27      * @param data data
28      * @param dataPath path, where data will be written
29      * @param operation operation
30      * @return config structure
31      */
32     AnyxmlNode<DOMSource> createEditConfigStructure(Optional<NormalizedNode> data, YangInstanceIdentifier dataPath,
33         Optional<EffectiveOperation> operation);
34
35     /**
36      * Transforms path to filter structure.
37      *
38      * @param path path
39      * @return filter structure
40      */
41     AnyxmlNode<?> toFilterStructure(YangInstanceIdentifier path);
42
43     /**
44      * Transforms list of fields filters to filter structure.
45      * Field paths are relative to parent query path.
46      *
47      * @param fieldsFilters list of: parent path and selection fields
48      * @return filter structure
49      */
50     AnyxmlNode<?> toFilterStructure(List<FieldsFilter> fieldsFilters);
51
52     /**
53      * Selects data specified by path from data node. Data must be product of get-config rpc with filter created by
54      * {@link #toFilterStructure(YangInstanceIdentifier)} or {@link #toFilterStructure(List)} )} with same path.
55      *
56      * @param data data
57      * @param path path to select
58      * @return selected data
59      */
60     Optional<NormalizedNode> selectFromDataStructure(DataContainerChild data, YangInstanceIdentifier path);
61 }