2 * Copyright (c) 2015 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.impl.connection;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import com.google.common.util.concurrent.SettableFuture;
12 import java.util.Collection;
13 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
14 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
15 import org.opendaylight.openflowplugin.api.openflow.connection.MultiMsgCollector;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
23 public class ConnectionContextImpl implements ConnectionContext {
25 private final ConnectionAdapter connectionAdapter;
26 private CONNECTION_STATE connectionState;
27 private FeaturesReply featuresReply;
28 private final MultiMsgCollector multipartCollector;
31 * @param connectionAdapter
33 public ConnectionContextImpl(final ConnectionAdapter connectionAdapter) {
34 this.connectionAdapter = connectionAdapter;
35 multipartCollector = new MultiMsgCollectorImpl();
39 public ConnectionAdapter getConnectionAdapter() {
40 return connectionAdapter;
44 public CONNECTION_STATE getConnectionState() {
45 return connectionState;
49 public NodeId getNodeId() {
50 // TODO Auto-generated method stub
55 public void setConnectionState(final CONNECTION_STATE connectionState) {
56 this.connectionState = connectionState;
60 public FeaturesReply getFeatures() {
65 public void setFeatures(final FeaturesReply featuresReply) {
66 this.featuresReply = featuresReply;
71 public ListenableFuture<Collection<MultipartReply>> registerMultipartMsg(final long xid) {
72 return multipartCollector.registerMultipartMsg(xid);
76 public void addMultipartMsg(final MultipartReply reply) {
77 multipartCollector.addMultipartMsg(reply);
81 public void registerMultipartFutureMsg(final long xid, final SettableFuture<Collection<MultipartReply>> future) {
82 multipartCollector.registerMultipartFutureMsg(xid, future);