Bug 1081 - Deprecate non-asynchronous Data Broker API
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / api / data / DataModificationTransaction.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.sal.binding.api.data;
9
10 import java.util.EventListener;
11 import java.util.concurrent.Future;
12
13 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
14 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
15 import org.opendaylight.yangtools.concepts.ListenerRegistration;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19
20 /**
21  *
22  *
23  * @deprecated Replaced by more specific transaction types. Please use
24  *          {@link org.opendaylight.controller.md.sal.binding.api.DataBroker#newReadOnlyTransaction(),
25  *          {@link org.opendaylight.controller.md.sal.binding.api.DataBroker#newReadWriteTransaction()
26  *          or
27  *          {@link org.opendaylight.controller.md.sal.binding.api.DataBroker#newWriteOnlyTransaction().
28  *
29  *
30  */
31 @Deprecated
32 public interface DataModificationTransaction extends DataModification<InstanceIdentifier<? extends DataObject>, DataObject> {
33     /**
34      * Returns an unique identifier for transaction
35      *
36      */
37     @Override
38     Object getIdentifier();
39
40     /**
41      * Initiates a two-phase commit of candidate data.
42      *
43      * <p>
44      * The {@link Consumer} could initiate a commit of candidate data
45      *
46      * <p>
47      * The successful commit changes the state of the system and may affect
48      * several components.
49      *
50      * <p>
51      * The effects of successful commit of data are described in the
52      * specifications and YANG models describing the {@link Provider} components
53      * of controller. It is assumed that {@link Consumer} has an understanding
54      * of this changes.
55      *
56      *
57      * @see org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler for further information how two-phase commit is
58      *      processed.
59      * @param store
60      *            Identifier of the store, where commit should occur.
61      * @return Result of the commit, containing success information or list of
62      *         encountered errors, if commit was not successful.
63      */
64     @Override
65     Future<RpcResult<TransactionStatus>> commit();
66
67     /**
68      * Register a listener for transaction
69      *
70      * @param listener
71      * @return
72      */
73     ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener);
74
75     /**
76      * Listener for transaction state changes
77      */
78     public interface DataTransactionListener extends EventListener {
79         /**
80          * Callback is invoked after each transaction status change.
81          *
82          * @param transaction Transaction
83          * @param status New status
84          */
85         void onStatusUpdated(DataModificationTransaction transaction,TransactionStatus status);
86     }
87 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.