Merge "Bug: 627 Added RESTConf API Explorer that dynamically generates API documentat...
[controller.git] / opendaylight / md-sal / inventory-manager / src / main / java / org / opendaylight / controller / md / inventory / manager / InventoryActivator.java
1 /**
2  * Copyright (c) 2014 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 package org.opendaylight.controller.md.inventory.manager;
9
10 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
12 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
13 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
14 import org.osgi.framework.BundleContext;
15
16 public class InventoryActivator extends AbstractBindingAwareProvider {
17
18     private static FlowCapableInventoryProvider provider = new FlowCapableInventoryProvider();
19
20     @Override
21     public void onSessionInitiated(final ProviderContext session) {
22         DataProviderService salDataService = session.<DataProviderService> getSALService(DataProviderService.class);
23         NotificationProviderService salNotifiService =
24                 session.<NotificationProviderService> getSALService(NotificationProviderService.class);
25         InventoryActivator.provider.setDataService(salDataService);
26         InventoryActivator.provider.setNotificationService(salNotifiService);
27         InventoryActivator.provider.start();
28     }
29
30     @Override
31     protected void stopImpl(final BundleContext context) {
32         InventoryActivator.provider.close();
33     }
34 }