package org.opendaylight.openflowplugin.api.openflow.connection;
import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
/**
+ * <p>
* Each OpenFlow session is tracked by a Connection Context. These attach to a particular Device Context in such a way,
* that there is at most one primary session associated with a Device Context.
- * <p>
+ * </p>
* Created by Martin Bobak <mbobak@cisco.com> on 25.2.2015.
*/
-public interface ConnectionContext {
+public interface ConnectionContext extends AutoCloseable {
/**
* distinguished connection states
/**
* setter for nodeId
+ *
* @param nodeId
*/
void setNodeId(NodeId nodeId);
*/
ConnectionAdapter getConnectionAdapter();
+ /**
+ * Returns reference to OFJava outbound queue provider. Outbound queue is used for outbound messages processing.
+ *
+ * @return
+ */
+ OutboundQueue getOutboundQueueProvider();
+ /**
+ * Method sets reference to OFJava outbound queue provider.
+ *
+ */
+ void setOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider);
/**
* Method returns current connection state.
* @return featureReply as received from device during handshake
*/
FeaturesReply getFeatures();
+
+ /**
+ * Method sets handler for handling closing connections.
+ *
+ * @param deviceDisconnectedHandler
+ */
+ void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler);
+
+ /**
+ * Method provides propagates info about closed connection to handler for handling closing connections.
+ */
+ void propagateClosingConnection();
+
+ void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider> outboundQueueHandlerRegistration);
+
+ @Override
+ void close();
}