2 * Copyright (c) 2013 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
8 package org.opendaylight.md.controller.topology.manager
10 import org.opendaylight.controller.sal.binding.api.NotificationProviderService
11 import org.opendaylight.controller.sal.binding.api.data.DataProviderService
12 import org.opendaylight.yangtools.concepts.Registration
13 import org.opendaylight.yangtools.yang.binding.NotificationListener
14 import org.slf4j.LoggerFactory
15 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
16 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
17 import org.osgi.framework.BundleContext;
19 class FlowCapableTopologyProvider extends AbstractBindingAwareProvider implements AutoCloseable {
23 static val LOG = LoggerFactory.getLogger(FlowCapableTopologyProvider);
26 DataProviderService dataService;
29 NotificationProviderService notificationService;
31 val FlowCapableTopologyExporter exporter = new FlowCapableTopologyExporter();
33 Registration<NotificationListener> listenerRegistration
36 LOG.info("FlowCapableTopologyProvider stopped.");
37 listenerRegistration?.close();
41 * Gets called on start of a bundle.
44 override onSessionInitiated(ProviderContext session) {
45 dataService = session.getSALService(DataProviderService)
46 notificationService = session.getSALService(NotificationProviderService)
47 exporter.setDataService(dataService);
49 listenerRegistration = notificationService.registerNotificationListener(exporter);
53 * Gets called during stop bundle
54 * @param context The execution context of the bundle being stopped.
56 override stopImpl(BundleContext context) {