Bug 5596 Cleaning lifecycle conductor
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / LifecycleService.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
10
11 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
12 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
14 import org.opendaylight.openflowplugin.api.openflow.role.RoleContext;
15 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
16 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
17
18 /**
19  * Service for starting or stopping all services in plugin in cluster
20  */
21 public interface LifecycleService extends ClusterSingletonService, AutoCloseable {
22
23     void registerService(ClusterSingletonServiceProvider singletonServiceProvider);
24
25     void setDeviceContext(DeviceContext deviceContext);
26
27     void setRpcContext(RpcContext rpcContext);
28
29     void setRoleContext(RoleContext roleContext);
30
31     void setStatContext(StatisticsContext statContext);
32
33     /**
34      * Some services, contexts etc. still need to have access to device context,
35      * instead to push into them, here is the getter
36      * @return device context for this device
37      */
38     DeviceContext getDeviceContext();
39
40     /**
41      * if some services not started properly need to close connection
42      */
43     void closeConnection();
44 }