Encapsulate OpenFlowPlugin configuration
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / ContextChainHolder.java
1 /*
2  * Copyright (c) 2016 Pantheon Technologies s.r.o. 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.api.openflow.lifecycle;
9
10 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
11 import org.opendaylight.openflowplugin.api.openflow.OFPManager;
12 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
14 import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager;
15 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
16 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
17 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcManager;
18 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
19
20 /**
21  * Generic interface for context chain holder, hold all created context chains.
22  */
23 public interface ContextChainHolder extends
24         DeviceConnectedHandler,
25         MastershipChangeListener,
26         DeviceDisconnectedHandler,
27         EntityOwnershipListener,
28         AutoCloseable {
29
30     /**
31      * Managers need to be added before.
32      * {@link DeviceManager}
33      * {@link RpcManager}
34      * {@link StatisticsManager}
35      * @param manager a child class of {@link OFPManager}
36      * @param <T> {@link OFPManager}
37      */
38     <T extends OFPManager> void addManager(T manager);
39
40     /**
41      * Create a new context chain.
42      * @param connectionContext new connection
43      * @return {@link ContextChain}
44      */
45     ContextChain createContextChain(ConnectionContext connectionContext);
46
47     /**
48      * Called if connection needs to be destroyed.
49      * @param deviceInfo {@link DeviceInfo}
50      */
51     void destroyContextChain(DeviceInfo deviceInfo);
52
53     @Override
54     void close() throws Exception;
55
56 }