2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.openflow.md.core.sal;
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;
15 import com.google.common.util.concurrent.SettableFuture;
18 * @param <T> input type
19 * @param <K> future output type
21 public abstract class OFRpcTask<T, K> implements Runnable {
23 private SwitchConnectionDistinguisher cookie;
24 private IMessageDispatchService messageService;
25 private SessionContext session;
27 private SettableFuture<K> result;
28 private NotificationProviderService rpcNotificationProviderService;
33 public SettableFuture<K> getResult() {
38 * @param result the result to set
40 public void setResult(SettableFuture<K> result) {
47 public SwitchConnectionDistinguisher getCookie() {
52 * @return the messageService
54 public IMessageDispatchService getMessageService() {
55 return messageService;
61 public SessionContext getSession() {
66 * @return protocol version
68 public Short getVersion() {
69 return session.getFeatures().getVersion();
73 * @param cookie the cookie to set
75 public void setCookie(SwitchConnectionDistinguisher cookie) {
80 * @param messageService the messageService to set
82 public void setMessageService(IMessageDispatchService messageService) {
83 this.messageService = messageService;
87 * @param session the session to set
89 public void setSession(SessionContext session) {
90 this.session = session;
101 * @param input the input to set
103 public void setInput(T input) {
108 * @param rpcNotificationProviderService
110 public void setRpcNotificationProviderService(
111 NotificationProviderService rpcNotificationProviderService) {
112 this.rpcNotificationProviderService = rpcNotificationProviderService;
116 * @return the rpcNotificationProviderService
118 public NotificationProviderService getRpcNotificationProviderService() {
119 return rpcNotificationProviderService;