3 * Copyright (c) 2013 Ericsson , Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.forwardingrulesmanager_mdsal.consumer.impl;
13 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.controller.sal.binding.api.NotificationService;
16 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
17 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 public class FRMConsumerImpl extends AbstractBindingAwareProvider {
23 protected static final Logger logger = LoggerFactory.getLogger(FRMConsumerImpl.class);
24 private static ProviderContext p_session;
25 private static DataBrokerService dataBrokerService;
26 private static NotificationService notificationService;
27 private FlowConsumerImpl flowImplRef;
28 private GroupConsumerImpl groupImplRef;
29 private static DataProviderService dataProviderService;
32 public void onSessionInitiated(ProviderContext session) {
34 FRMConsumerImpl.p_session = session;
36 if (null != session) {
37 notificationService = session.getSALService(NotificationService.class);
39 if (null != notificationService) {
40 dataBrokerService = session.getSALService(DataBrokerService.class);
42 if (null != dataBrokerService) {
43 dataProviderService = session.getSALService(DataProviderService.class);
45 if (null != dataProviderService) {
46 flowImplRef = new FlowConsumerImpl();
47 groupImplRef = new GroupConsumerImpl();
50 logger.error("Data Provider Service is down or NULL. " +
51 "Accessing data from configuration data store will not be possible");
52 System.out.println("Data Broker Service is down or NULL.");
57 logger.error("Data Broker Service is down or NULL.");
58 System.out.println("Data Broker Service is down or NULL.");
62 logger.error("Notification Service is down or NULL.");
63 System.out.println("Notification Service is down or NULL.");
67 logger.error("Consumer session is NULL. Please check if provider is registered");
68 System.out.println("Consumer session is NULL. Please check if provider is registered");
73 public static DataProviderService getDataProviderService() {
74 return dataProviderService;
77 public FlowConsumerImpl getFlowImplRef() {
81 public GroupConsumerImpl getGroupImplRef() {
85 public static ProviderContext getProviderSession() {
89 public static NotificationService getNotificationService() {
90 return notificationService;
93 public static DataBrokerService getDataBrokerService() {
94 return dataBrokerService;