Drop use of ClusteredDataTreeChangeLister
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / ForwardingRulesCommiter.java
1 /*
2  * Copyright (c) 2014 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.openflowplugin.applications.frm;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.common.RpcResult;
16
17 /**
18  * forwardingrules-manager org.opendaylight.openflowplugin.applications.frm
19  *
20  * <p>
21  * ForwardingRulesCommiter It represent a contract between DataStore
22  * DataTreeModification and relevant SalRpcService for device. Every
23  * implementation has to be registered for Configurational/DS tree path.
24  */
25 public interface ForwardingRulesCommiter<D extends DataObject> extends DataTreeChangeListener<D>, AutoCloseable {
26     /**
27      * Method removes DataObject which is identified by InstanceIdentifier from
28      * device.
29      *
30      * @param identifier
31      *            - the whole path to DataObject
32      * @param del
33      *            - DataObject for removing
34      * @param nodeIdent
35      *            Node InstanceIdentifier
36      */
37     void remove(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
38
39     /**
40      * Method updates the original DataObject to the update DataObject in device.
41      * Both are identified by same InstanceIdentifier
42      *
43      * @param identifier
44      *            - the whole path to DataObject
45      * @param original
46      *            - original DataObject (for update)
47      * @param update
48      *            - changed DataObject (contain updates)
49      * @param nodeIdent
50      *            Node InstanceIdentifier
51      */
52     void update(InstanceIdentifier<D> identifier, D original, D update, InstanceIdentifier<FlowCapableNode> nodeIdent);
53
54     /**
55      * Method adds the DataObject which is identified by InstanceIdentifier to
56      * device.
57      *
58      * @param identifier
59      *            - the whole path to new DataObject
60      * @param add
61      *            - new DataObject
62      * @param nodeIdent
63      *            Node InstanceIdentifier
64      * @return A future associated with RPC task. {@code null} is set to the future
65      *         if this method does not invoke RPC.
66      */
67     ListenableFuture<? extends RpcResult<?>> add(InstanceIdentifier<D> identifier, D add,
68             InstanceIdentifier<FlowCapableNode> nodeIdent);
69
70     /**
71      * Method creates stale-marked DataObject which is identified by
72      * InstanceIdentifier from device.
73      *
74      * @param identifier
75      *            - the whole path to DataObject
76      * @param del
77      *            - DataObject removed. Stale-Mark object to be created from this
78      *            object
79      * @param nodeIdent
80      *            Node InstanceIdentifier
81      */
82     void createStaleMarkEntity(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
83
84     ListenableFuture<? extends RpcResult<?>> removeWithResult(InstanceIdentifier<D> identifier, D del,
85             InstanceIdentifier<FlowCapableNode> nodeIdent);
86
87 }