Do not use JdkFutureAdapters
[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.ClusteredDataTreeChangeListener;
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>
26         extends AutoCloseable, ClusteredDataTreeChangeListener<D> {
27
28     /**
29      * Method removes DataObject which is identified by InstanceIdentifier from
30      * device.
31      *
32      * @param identifier
33      *            - the whole path to DataObject
34      * @param del
35      *            - DataObject for removing
36      * @param nodeIdent
37      *            Node InstanceIdentifier
38      */
39     void remove(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
40
41     /**
42      * Method updates the original DataObject to the update DataObject in device.
43      * Both are identified by same InstanceIdentifier
44      *
45      * @param identifier
46      *            - the whole path to DataObject
47      * @param original
48      *            - original DataObject (for update)
49      * @param update
50      *            - changed DataObject (contain updates)
51      * @param nodeIdent
52      *            Node InstanceIdentifier
53      */
54     void update(InstanceIdentifier<D> identifier, D original, D update, InstanceIdentifier<FlowCapableNode> nodeIdent);
55
56     /**
57      * Method adds the DataObject which is identified by InstanceIdentifier to
58      * device.
59      *
60      * @param identifier
61      *            - the whole path to new DataObject
62      * @param add
63      *            - new DataObject
64      * @param nodeIdent
65      *            Node InstanceIdentifier
66      * @return A future associated with RPC task. {@code null} is set to the future
67      *         if this method does not invoke RPC.
68      */
69     ListenableFuture<? extends RpcResult<?>> add(InstanceIdentifier<D> identifier, D add,
70             InstanceIdentifier<FlowCapableNode> nodeIdent);
71
72     /**
73      * Method creates stale-marked DataObject which is identified by
74      * InstanceIdentifier from device.
75      *
76      * @param identifier
77      *            - the whole path to DataObject
78      * @param del
79      *            - DataObject removed. Stale-Mark object to be created from this
80      *            object
81      * @param nodeIdent
82      *            Node InstanceIdentifier
83      */
84     void createStaleMarkEntity(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
85
86     ListenableFuture<? extends RpcResult<?>> removeWithResult(InstanceIdentifier<D> identifier, D del,
87             InstanceIdentifier<FlowCapableNode> nodeIdent);
88
89 }