BUG-1006 - removal of bulkTransactionCache
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / OFRpcTask.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.openflowplugin.openflow.md.core.sal;
9
10 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
11 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
12 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
13 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
14
15 import com.google.common.util.concurrent.SettableFuture;
16
17 /**
18  * @param <T> input type
19  * @param <K> future output type
20  */
21 public abstract class OFRpcTask<T, K> implements Runnable {
22     
23     private SwitchConnectionDistinguisher cookie;
24     private IMessageDispatchService messageService;
25     private SessionContext session;
26     private T input;
27     private SettableFuture<K> result;
28     private NotificationProviderService rpcNotificationProviderService;
29     
30     /**
31      * @return the result
32      */
33     public SettableFuture<K> getResult() {
34         return result;
35     }
36     
37     /**
38      * @param result the result to set
39      */
40     public void setResult(SettableFuture<K> result) {
41         this.result = result;
42     }
43
44     /**
45      * @return the cookie
46      */
47     public SwitchConnectionDistinguisher getCookie() {
48         return cookie;
49     }
50
51     /**
52      * @return the messageService
53      */
54     public IMessageDispatchService getMessageService() {
55         return messageService;
56     }
57
58     /**
59      * @return the session
60      */
61     public SessionContext getSession() {
62         return session;
63     }
64     
65     /**
66      * @return protocol version
67      */
68     public Short getVersion() {
69         return session.getFeatures().getVersion();
70     }
71
72     /**
73      * @param cookie the cookie to set
74      */
75     public void setCookie(SwitchConnectionDistinguisher cookie) {
76         this.cookie = cookie;
77     }
78
79     /**
80      * @param messageService the messageService to set
81      */
82     public void setMessageService(IMessageDispatchService messageService) {
83         this.messageService = messageService;
84     }
85
86     /**
87      * @param session the session to set
88      */
89     public void setSession(SessionContext session) {
90         this.session = session;
91     }
92
93     /**
94      * @return the input
95      */
96     public T getInput() {
97         return input;
98     }
99
100     /**
101      * @param input the input to set
102      */
103     public void setInput(T input) {
104         this.input = input;
105     }
106
107     /**
108      * @param rpcNotificationProviderService
109      */
110     public void setRpcNotificationProviderService(
111             NotificationProviderService rpcNotificationProviderService) {
112                 this.rpcNotificationProviderService = rpcNotificationProviderService;
113     }
114     
115     /**
116      * @return the rpcNotificationProviderService
117      */
118     public NotificationProviderService getRpcNotificationProviderService() {
119         return rpcNotificationProviderService;
120     }
121 }