copyright header added
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / NotificationPopListener.java
1 /**
2  * Copyright (c) 2013 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.openflowplugin.openflow.md.core;
9
10 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
11 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
12 import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
13 import org.opendaylight.yangtools.yang.binding.Notification;
14
15 public class NotificationPopListener<T> implements PopListener<T> {
16
17
18     @Override
19     public void onPop(T processedMessage) {
20         if(processedMessage instanceof Notification) {
21             //TODO: create via factory, inject service
22             NotificationProviderService notificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
23             notificationProviderService.publish((Notification) processedMessage);
24         }
25     }
26
27 }