Merge "Add some log messages in case controller failed to add connected node."
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / StatisticsManagerActivator.java
1 /*
2  * Copyright IBM Corporation, 2013.  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.controller.md.statistics.manager;
10
11 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
13 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
14 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
15 import org.osgi.framework.BundleContext;
16
17 public class StatisticsManagerActivator extends AbstractBindingAwareProvider {
18
19     private static ProviderContext pSession;
20     
21     private static StatisticsProvider statsProvider = new StatisticsProvider();
22    
23     @Override
24     public void onSessionInitiated(ProviderContext session) {
25         
26         pSession = session;
27         DataProviderService dps = session.<DataProviderService>getSALService(DataProviderService.class);
28         StatisticsManagerActivator.statsProvider.setDataService(dps);
29         NotificationProviderService nps = session.<NotificationProviderService>getSALService(NotificationProviderService.class);
30         StatisticsManagerActivator.statsProvider.setNotificationService(nps);
31         StatisticsManagerActivator.statsProvider.start();
32
33     }
34     
35     @Override
36     protected void stopImpl(BundleContext context) {
37         StatisticsManagerActivator.statsProvider.close();
38     }
39     
40     public static ProviderContext getProviderContext(){
41         return pSession;
42     }
43
44 }