Switch to MD-SAL APIs
[openflowplugin.git] / applications / notification-supplier / src / main / java / org / opendaylight / openflowplugin / applications / notification / supplier / impl / item / MeterNotificationSupplierImpl.java
index badd371c308e078cecb5021e0458889d51d8fe47..ecd1fd51f2aaf3a915d8cf26be7a714ef777f0e2 100644 (file)
@@ -5,15 +5,13 @@
  * 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.openflowplugin.applications.notification.supplier.impl.item;
 
 import com.google.common.base.Preconditions;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
@@ -30,38 +28,39 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public class MeterNotificationSupplierImpl extends
         AbstractNotificationSupplierForItem<Meter, MeterAdded, MeterUpdated, MeterRemoved> {
 
-    private static final InstanceIdentifier<Meter> wildCardedInstanceIdent = getNodeWildII().augmentation(FlowCapableNode.class).child(Meter.class);
+    private static final InstanceIdentifier<Meter> METER_INSTANCE_IDENTIFIER
+            = getNodeWildII().augmentation(FlowCapableNode.class).child(Meter.class);
 
     /**
-     * Constructor register supplier as DataChangeLister and create wildCarded InstanceIdentifier.
+     * Constructor register supplier as DataTreeChangeListener and create wildCarded InstanceIdentifier.
      *
-     * @param notifProviderService - {@link NotificationProviderService}
+     * @param notifProviderService - {@link NotificationPublishService}
      * @param db - {@link DataBroker}
      */
-    public MeterNotificationSupplierImpl(final NotificationProviderService notifProviderService, final DataBroker db) {
+    public MeterNotificationSupplierImpl(final NotificationPublishService notifProviderService, final DataBroker db) {
         super(notifProviderService, db, Meter.class);
     }
 
     @Override
     public InstanceIdentifier<Meter> getWildCardPath() {
-        return wildCardedInstanceIdent;
+        return METER_INSTANCE_IDENTIFIER;
     }
 
     @Override
-    public MeterAdded createNotification(final Meter o, final InstanceIdentifier<Meter> path) {
-        Preconditions.checkArgument(o != null);
+    public MeterAdded createNotification(final Meter dataTreeItemObject, final InstanceIdentifier<Meter> path) {
+        Preconditions.checkArgument(dataTreeItemObject != null);
         Preconditions.checkArgument(path != null);
-        final MeterAddedBuilder builder = new MeterAddedBuilder(o);
+        final MeterAddedBuilder builder = new MeterAddedBuilder(dataTreeItemObject);
         builder.setMeterRef(new MeterRef(path));
         builder.setNode(createNodeRef(path));
         return builder.build();
     }
 
     @Override
-    public MeterUpdated updateNotification(final Meter o, final InstanceIdentifier<Meter> path) {
-        Preconditions.checkArgument(o != null);
+    public MeterUpdated updateNotification(final Meter meter, final InstanceIdentifier<Meter> path) {
+        Preconditions.checkArgument(meter != null);
         Preconditions.checkArgument(path != null);
-        final MeterUpdatedBuilder builder = new MeterUpdatedBuilder(o);
+        final MeterUpdatedBuilder builder = new MeterUpdatedBuilder(meter);
         builder.setMeterRef(new MeterRef(path));
         builder.setNode(createNodeRef(path));
         return builder.build();
@@ -71,7 +70,7 @@ public class MeterNotificationSupplierImpl extends
     public MeterRemoved deleteNotification(final InstanceIdentifier<Meter> path) {
         Preconditions.checkArgument(path != null);
         final MeterRemovedBuilder builder = new MeterRemovedBuilder();
-        builder.setMeterId(path.firstKeyOf(Meter.class, MeterKey.class).getMeterId());
+        builder.setMeterId(path.firstKeyOf(Meter.class).getMeterId());
         builder.setMeterRef(new MeterRef(path));
         builder.setNode(createNodeRef(path));
         return builder.build();