Merge "Fix checkstyle API."
[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 com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
12 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
13 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
14 import org.opendaylight.openflowplugin.api.openflow.OFPManager;
15 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
16 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
17 import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager;
18 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
19 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
20 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcManager;
21 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
22
23 /**
24  * Generic interface for context chain holder, hold all created context chains.
25  */
26 public interface ContextChainHolder extends
27         DeviceConnectedHandler,
28         MastershipChangeListener,
29         DeviceDisconnectedHandler,
30         EntityOwnershipListener,
31         AutoCloseable {
32
33     /**
34      * Managers need to be added before.
35      * {@link DeviceManager}
36      * {@link RpcManager}
37      * {@link StatisticsManager}
38      * @param manager a child class of {@link OFPManager}
39      * @param <T> {@link OFPManager}
40      */
41     <T extends OFPManager> void addManager(T manager);
42
43     /**
44      * Create a new context chain.
45      * @param connectionContext new connection
46      * @return {@link ContextChain}
47      */
48     ContextChain createContextChain(ConnectionContext connectionContext);
49
50     /**
51      * Called if connection needs to be destroyed.
52      * @param deviceInfo {@link DeviceInfo}
53      */
54     ListenableFuture<Void> destroyContextChain(DeviceInfo deviceInfo);
55
56     /**
57      * Provider is needed to register cluster singleton service.
58      * @param singletonServicesProvider provider
59      */
60     void addSingletonServicesProvider(ClusterSingletonServiceProvider singletonServicesProvider);
61
62     /**
63      * Register EOS listener.
64      * @param entityOwnershipService EOS services
65      */
66     void changeEntityOwnershipService(EntityOwnershipService entityOwnershipService);
67
68     @Override
69     void close() throws Exception;
70
71 }