2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
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;
19 * Service for starting or stopping all services in plugin in cluster
21 public interface LifecycleService extends ClusterSingletonService, AutoCloseable {
24 * This method registers lifecycle service to the given provider
25 * @param singletonServiceProvider from md-sal binding
27 void registerService(final ClusterSingletonServiceProvider singletonServiceProvider);
30 * Setter for device context
31 * @param deviceContext actual device context created per device
33 void setDeviceContext(final DeviceContext deviceContext);
36 * Setter for rpc context
37 * @param rpcContext actual rpc context created per device
39 void setRpcContext(final RpcContext rpcContext);
42 * Setter for role context
43 * @param roleContext actual role context created per device
45 void setRoleContext(final RoleContext roleContext);
48 * Setter for statistics context
49 * @param statContext actual statistics context created per device
51 void setStatContext(final StatisticsContext statContext);
54 * Some services, contexts etc. still need to have access to device context,
55 * instead to push into them, here is the getter
56 * @return device context for this device
58 DeviceContext getDeviceContext();
61 * if some services not started properly need to close connection
63 void closeConnection();