Merge "BUG-4117: add support of Old Notif. for Statistics"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightMeterStatisticsServiceImpl.java
index ecee95ef785df4229edf5bcafe0ee42c70996a36..22f74d27672f5eea4c5bb0a9134a640085e1dc8e 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
@@ -26,32 +28,38 @@ public class OpendaylightMeterStatisticsServiceImpl implements OpendaylightMeter
     private final AllMeterStatsService allMeterStats;
     private final MeterFeaturesService meterFeatures;
     private final MeterStatsService meterStats;
+    private final NotificationPublishService notificationPublishService;
 
-    public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
-        allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext);
-        allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext);
-        meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext);
-        meterStats = new MeterStatsService(requestContextStack, deviceContext);
+    public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack,
+                                                  final DeviceContext deviceContext,
+                                                  final AtomicLong compatibilityXidSeed,
+                                                  final NotificationPublishService notificationPublishService) {
+        this.notificationPublishService = notificationPublishService;
+
+        allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
+        meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
     }
 
     @Override
     public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
             final GetAllMeterConfigStatisticsInput input) {
-        return allMeterConfig.handleServiceCall(input);
+        return allMeterConfig.handleAndNotify(input, notificationPublishService);
     }
 
     @Override
     public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
-        return allMeterStats.handleServiceCall(input);
+        return allMeterStats.handleAndNotify(input, notificationPublishService);
     }
 
     @Override
     public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
-        return meterFeatures.handleServiceCall(input);
+        return meterFeatures.handleAndNotify(input, notificationPublishService);
     }
 
     @Override
     public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
-        return meterStats.handleServiceCall(input);
+        return meterStats.handleAndNotify(input, notificationPublishService);
     }
 }