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 javax.annotation.CheckForNull;
13 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListener;
14 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
15 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
16 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
17 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
18 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
19 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceRemovedHandler;
20 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
21 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
24 * Service for starting or stopping all services in plugin in cluster
26 public interface LifecycleService extends ClusterSingletonService, OFPContext {
29 * This method registers lifecycle service to the given provider
30 * @param singletonServiceProvider from md-sal binding
32 void registerService(final ClusterSingletonServiceProvider singletonServiceProvider);
35 * This method registers device removed handler what will be executed when device should be removed
37 * @param deviceRemovedHandler device removed handler
39 void registerDeviceRemovedHandler(final @CheckForNull DeviceRemovedHandler deviceRemovedHandler);
42 * Setter for device context
43 * @param deviceContext actual device context created per device
45 void setDeviceContext(final DeviceContext deviceContext);
48 * Setter for rpc context
49 * @param rpcContext actual rpc context created per device
51 void setRpcContext(final RpcContext rpcContext);
54 * Setter for statistics context
55 * @param statContext actual statistics context created per device
57 void setStatContext(final StatisticsContext statContext);
60 * Some services, contexts etc. still need to have access to device context,
61 * instead to push into them, here is the getter
62 * @return device context for this device
64 DeviceContext getDeviceContext();
67 * if some services not started properly need to close connection
69 void closeConnection();