c3e35491c18f09acd05d25939715d2caf2cd24ea
[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.device.handlers.ClusterInitializationPhaseHandler;
15 import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterLifecycleSupervisor;
16 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
17 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
18
19 /**
20  * Service for starting or stopping all services in plugin in cluster
21  */
22 public interface LifecycleService extends ClusterSingletonService, AutoCloseable, ClusterLifecycleSupervisor, ClusterInitializationPhaseHandler {
23
24     /**
25      * This method registers lifecycle service to the given provider
26      * @param singletonServiceProvider from md-sal binding
27      */
28     void registerService(final ClusterSingletonServiceProvider singletonServiceProvider);
29
30     /**
31      * Setter for device context
32      * @param deviceContext actual device context created per device
33      */
34     void setDeviceContext(final DeviceContext deviceContext);
35
36     /**
37      * Setter for rpc context
38      * @param rpcContext actual rpc context created per device
39      */
40     void setRpcContext(final RpcContext rpcContext);
41
42     /**
43      * Setter for statistics context
44      * @param statContext actual statistics context created per device
45      */
46     void setStatContext(final StatisticsContext statContext);
47
48     /**
49      * Some services, contexts etc. still need to have access to device context,
50      * instead to push into them, here is the getter
51      * @return device context for this device
52      */
53     DeviceContext getDeviceContext();
54
55     /**
56      * if some services not started properly need to close connection
57      */
58     void closeConnection();
59 }