Merge "Fix typo in match types yang model"
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / DataModification.java
1 /*
2  * Copyright (c) 2013 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.controller.md.sal.common.api.data;
9
10 import java.util.concurrent.Future;
11
12 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
13 import org.opendaylight.yangtools.yang.common.RpcResult;
14
15 //FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
16 //import org.opendaylight.yangtools.concepts.Path;
17 public interface DataModification<P/* extends Path<P> */, D> extends DataChange<P, D>, DataReader<P, D> {
18
19     /**
20      * Returns transaction identifier
21      *
22      * @return Transaction identifier
23      */
24     Object getIdentifier();
25
26     TransactionStatus getStatus();
27
28     /**
29      *
30      * @deprecated Use {@link #putOperationalData(Object, Object)} instead.
31      *
32      * @param path
33      * @param data
34      */
35     @Deprecated
36     void putRuntimeData(P path, D data);
37
38     /**
39      * Store a piece of data at specified path. This acts as a merge operation,
40      * which is to say that any pre-existing data which is not explicitly
41      * overwritten will be preserved. This means that if you store a container,
42      * its child lists will be merged. Performing the following put operations:
43      *
44      * 1) container { list [ a ] }
45      * 2) container { list [ b ] }
46      *
47      * will result in the following data being present:
48      *
49      * container { list [ a, b ] }
50      *
51      * This also means that storing the container will preserve any augmentations
52      * which have been attached to it.
53      *
54      * If you require an explicit replace operation, perform
55      * {@link removeOperationalData} first.
56      */
57     void putOperationalData(P path, D data);
58
59     /**
60      * Store a piece of data at specified path. This acts as a merge operation,
61      * which is to say that any pre-existing data which is not explicitly
62      * overwritten will be preserved. This means that if you store a container,
63      * its child lists will be merged. Performing the following put operations:
64      *
65      * 1) container { list [ a ] }
66      * 2) container { list [ b ] }
67      *
68      * will result in the following data being present:
69      *
70      * container { list [ a, b ] }
71      *
72      * This also means that storing the container will preserve any augmentations
73      * which have been attached to it.
74      *
75      * If you require an explicit replace operation, perform
76      * {@link removeConfigurationData} first.
77      */
78     void putConfigurationData(P path, D data);
79
80     /**
81      * @deprecated Use {@link #removeOperationalData(Object)}
82      *
83      * @param path
84      */
85     @Deprecated
86     void removeRuntimeData(P path);
87
88     void removeOperationalData(P path);
89
90     void removeConfigurationData(P path);
91
92     /**
93      * Initiates a two-phase commit of modification.
94      *
95      * <p>
96      * The successful commit changes the state of the system and may affect
97      * several components.
98      *
99      * <p>
100      * The effects of successful commit of data are described in the
101      * specifications and YANG models describing the Provider components of
102      * controller. It is assumed that Consumer has an understanding of this
103      * changes.
104      *
105      *
106      * @see DataCommitHandler for further information how two-phase commit is
107      *      processed.
108      * @param store
109      *            Identifier of the store, where commit should occur.
110      * @return Result of the Commit, containing success information or list of
111      *         encountered errors, if commit was not successful. The Future
112      *         blocks until {@link TransactionStatus#COMMITED} or
113      *         {@link TransactionStatus#FAILED} is reached.
114      */
115     Future<RpcResult<TransactionStatus>> commit();
116
117 }