-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.demo;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.data.util.Nodes;\r
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;\r
-import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;\r
-import org.opendaylight.controller.yang.data.api.Node;\r
-\r
-\r
-public class DemoProviderImpl implements\r
- org.opendaylight.controller.sal.core.api.Provider {\r
-\r
- private ProviderSession session;\r
- private NotificationProviderService notifier;\r
-\r
- @Override\r
- public void onSessionInitiated(ProviderSession session) {\r
- this.session = session;\r
- notifier = session.getService(NotificationProviderService.class);\r
- }\r
-\r
- @Override\r
- public Collection<ProviderFunctionality> getProviderFunctionality() {\r
- return Collections.emptySet();\r
- }\r
-\r
- public void sendAlertNotification(String content) {\r
- List<Node<?>> nodes = new ArrayList<Node<?>>();\r
- nodes.add(DemoUtils.contentNode(content));\r
-\r
- if (notifier == null) {\r
- System.out.println("Provider: Error: Session not available");\r
- System.out\r
- .println(" Notification Service not available");\r
- return;\r
- }\r
- notifier.sendNotification(Nodes.containerNode(\r
- DemoUtils.alertNotification, nodes));\r
- }\r
-\r
- public void sendChangeNotification(String content) {\r
- List<Node<?>> nodes = new ArrayList<Node<?>>();\r
- nodes.add(DemoUtils.contentNode(content));\r
-\r
- if (notifier == null) {\r
- System.out.println("Provider: Error: Session not available");\r
- System.out\r
- .println(" Notification Service not available");\r
- return;\r
- }\r
- notifier.sendNotification(Nodes.containerNode(\r
- DemoUtils.changeNotification, nodes));\r
- }\r
-\r
- public void closeSession() {\r
- session.close();\r
- }\r
-}\r
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;
+import org.opendaylight.controller.yang.data.api.Node;
+import org.opendaylight.controller.yang.data.util.Nodes;
+
+
+public class DemoProviderImpl implements
+ org.opendaylight.controller.sal.core.api.Provider {
+
+ private ProviderSession session;
+ private NotificationProviderService notifier;
+
+ @Override
+ public void onSessionInitiated(ProviderSession session) {
+ this.session = session;
+ notifier = session.getService(NotificationProviderService.class);
+ }
+
+ @Override
+ public Collection<ProviderFunctionality> getProviderFunctionality() {
+ return Collections.emptySet();
+ }
+
+ public void sendAlertNotification(String content) {
+ List<Node<?>> nodes = new ArrayList<Node<?>>();
+ nodes.add(DemoUtils.contentNode(content));
+
+ if (notifier == null) {
+ System.out.println("Provider: Error: Session not available");
+ System.out
+ .println(" Notification Service not available");
+ return;
+ }
+ notifier.sendNotification(Nodes.containerNode(
+ DemoUtils.alertNotification, nodes));
+ }
+
+ public void sendChangeNotification(String content) {
+ List<Node<?>> nodes = new ArrayList<Node<?>>();
+ nodes.add(DemoUtils.contentNode(content));
+
+ if (notifier == null) {
+ System.out.println("Provider: Error: Session not available");
+ System.out
+ .println(" Notification Service not available");
+ return;
+ }
+ notifier.sendNotification(Nodes.containerNode(
+ DemoUtils.changeNotification, nodes));
+ }
+
+ public void closeSession() {
+ session.close();
+ }
+}