HONEYCOMB-130: Separate v3po plugin from HC infra
[honeycomb.git] / infra / data-api / src / main / java / io / fd / honeycomb / v3po / data / DataModification.java
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package io.fd.honeycomb.v3po.data;
18
19 import com.google.common.annotations.Beta;
20 import io.fd.honeycomb.v3po.translate.TranslationException;
21 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
22 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
23 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
24
25 /**
26  * Modification of a {@link ModifiableDataManager}.
27  */
28 @Beta
29 public interface DataModification extends ReadableDataManager {
30
31     /**
32      * Delete the node at specified path.
33      *
34      * @param path Node path
35      */
36     void delete(YangInstanceIdentifier path);
37
38     /**
39      * Merge the specified data with the currently-present data
40      * at specified path.
41      *
42      * @param path Node path
43      * @param data Data to be merged
44      */
45     void merge(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
46
47     /**
48      * Replace the data at specified path with supplied data.
49      *
50      * @param path Node path
51      * @param data New node data
52      */
53     void write(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
54
55     /**
56      * Alters data tree using this modification.
57      *
58      * @throws DataValidationFailedException if modification data is not valid
59      * @throws TranslationException if failed while updating data tree state
60      */
61     void commit() throws DataValidationFailedException, TranslationException;
62
63     /**
64      * Validate and prepare modification before commit. Besides commit, no further operation is expected after validate
65      * and the behaviour is undefined.
66      *
67      * @throws DataValidationFailedException if modification data is not valid
68      */
69     void validate() throws DataValidationFailedException;
70 }