Bug 488: Removed BundleContext usage for registering to DOM Components.
[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.concepts.Path;
14 import org.opendaylight.yangtools.yang.common.RpcResult;
15
16 public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>, DataReader<P, D> {
17     /**
18      * Returns transaction identifier
19      *
20      * @return Transaction identifier
21      */
22     Object getIdentifier();
23
24     TransactionStatus getStatus();
25
26     /**
27      * Store a piece of data at specified path. This acts as a merge operation,
28      * which is to say that any pre-existing data which is not explicitly
29      * overwritten will be preserved. This means that if you store a container,
30      * its child lists will be merged. Performing the following put operations:
31      *
32      * 1) container { list [ a ] }
33      * 2) container { list [ b ] }
34      *
35      * will result in the following data being present:
36      *
37      * container { list [ a, b ] }
38      *
39      * This also means that storing the container will preserve any augmentations
40      * which have been attached to it.
41      *
42      * If you require an explicit replace operation, perform
43      * {@link removeOperationalData} first.
44      */
45     void putOperationalData(P path, D data);
46
47     /**
48      * Store a piece of data at specified path. This acts as a merge operation,
49      * which is to say that any pre-existing data which is not explicitly
50      * overwritten will be preserved. This means that if you store a container,
51      * its child lists will be merged. Performing the following put operations:
52      *
53      * 1) container { list [ a ] }
54      * 2) container { list [ b ] }
55      *
56      * will result in the following data being present:
57      *
58      * container { list [ a, b ] }
59      *
60      * This also means that storing the container will preserve any augmentations
61      * which have been attached to it.
62      *
63      * If you require an explicit replace operation, perform
64      * {@link removeConfigurationData} first.
65      */
66     void putConfigurationData(P path, D data);
67
68     void removeOperationalData(P path);
69
70     void removeConfigurationData(P path);
71
72     /**
73      * Initiates a two-phase commit of modification.
74      *
75      * <p>
76      * The successful commit changes the state of the system and may affect
77      * several components.
78      *
79      * <p>
80      * The effects of successful commit of data are described in the
81      * specifications and YANG models describing the Provider components of
82      * controller. It is assumed that Consumer has an understanding of this
83      * changes.
84      *
85      *
86      * @see DataCommitHandler for further information how two-phase commit is
87      *      processed.
88      * @param store
89      *            Identifier of the store, where commit should occur.
90      * @return Result of the Commit, containing success information or list of
91      *         encountered errors, if commit was not successful. The Future
92      *         blocks until {@link TransactionStatus#COMMITED} or
93      *         {@link TransactionStatus#FAILED} is reached.
94      */
95     Future<RpcResult<TransactionStatus>> commit();
96 }