X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-dom-demo%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdemo%2FDemoConsumerImpl.java;fp=opendaylight%2Fmd-sal%2Fsal-dom-demo%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdemo%2FDemoConsumerImpl.java;h=0000000000000000000000000000000000000000;hb=d6c7e80b4372f994640863af3066039527c8d3e9;hp=e0752dca0297c4ebed4d537ec508149131ff20a7;hpb=8baeda4ab8d240f847cd530ef6af7c7c1c2d4d13;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-demo/src/main/java/org/opendaylight/controller/sal/demo/DemoConsumerImpl.java b/opendaylight/md-sal/sal-dom-demo/src/main/java/org/opendaylight/controller/sal/demo/DemoConsumerImpl.java deleted file mode 100644 index e0752dca02..0000000000 --- a/opendaylight/md-sal/sal-dom-demo/src/main/java/org/opendaylight/controller/sal/demo/DemoConsumerImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.sal.demo; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.opendaylight.controller.sal.core.api.Consumer; -import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession; -import org.opendaylight.controller.sal.core.api.notify.NotificationListener; -import org.opendaylight.controller.sal.core.api.notify.NotificationService; -import org.opendaylight.controller.yang.common.QName; -import org.opendaylight.controller.yang.data.api.CompositeNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class DemoConsumerImpl implements Consumer { - - private ConsumerSession session; - private NotificationService notificationService; - private final String name; - private static Logger log = LoggerFactory.getLogger("AlertLogger"); - - private boolean changeAware; - - public DemoConsumerImpl(String name) { - this.name = name; - } - - private NotificationListener alertLogger = new NotificationListener() { - - @Override - public void onNotification(CompositeNode notification) { - System.out.println(name - + ": Received alert: " - + notification.getFirstSimpleByName( - DemoUtils.contentNodeName).getValue()); - log.info("AlertLogger: Received notification: " + notification); - } - - @Override - public Set getSupportedNotifications() { - Set supported = new HashSet(); - supported.add(DemoUtils.alertNotification); - return supported; - } - }; - - private NotificationListener changeLogger = new NotificationListener() { - - @Override - public void onNotification(CompositeNode notification) { - System.out.println(name - + ": Received change: " - + notification.getFirstSimpleByName( - DemoUtils.contentNodeName).getValue()); - log.info("ChangeLogger: Received notification: " + notification); - } - - @Override - public Set getSupportedNotifications() { - Set supported = new HashSet(); - supported.add(DemoUtils.alertNotification); - return supported; - } - }; - - @Override - public void onSessionInitiated(ConsumerSession session) { - this.session = session; - this.notificationService = session - .getService(NotificationService.class); - notificationService.addNotificationListener( - DemoUtils.alertNotification, alertLogger); - if (isChangeAware()) { - notificationService.addNotificationListener( - DemoUtils.changeNotification, changeLogger); - } - } - - @Override - public Collection getConsumerFunctionality() { - Set func = new HashSet(); - func.add(alertLogger); - return func; - } - - public void closeSession() { - session.close(); - } - - public boolean isChangeAware() { - return changeAware; - } - - public void setChangeAware(boolean changeAware) { - this.changeAware = changeAware; - } - -}