Fix checkstyle
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / GroupStatsService.java
index e8defee795f1a05e56677b51cf71a1b417a35d6d..14f1e5ba5f422915cb74c6a5fa3a378fdc541b29 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,23 +7,40 @@
  */
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
-import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.impl.services.util.RequestInputUtils;
+import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
+import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.GroupStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
 
-final class GroupStatsService extends AbstractSimpleService<GetGroupStatisticsInput, GetGroupStatisticsOutput> {
-    GroupStatsService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
-        super(requestContextStack, deviceContext, GetGroupStatisticsOutput.class);
+final class GroupStatsService extends AbstractCompatibleStatService<GetGroupStatisticsInput,
+                                                                    GetGroupStatisticsOutput,
+                                                                    GroupStatisticsUpdated> {
+
+    private final ConvertorExecutor convertorExecutor;
+
+    GroupStatsService(RequestContextStack requestContextStack,
+                             DeviceContext deviceContext,
+                             AtomicLong compatibilityXidSeed,
+                             ConvertorExecutor convertorExecutor) {
+        super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -39,4 +56,17 @@ final class GroupStatsService extends AbstractSimpleService<GetGroupStatisticsIn
         mprInput.setMultipartRequestBody(caseBuilder.build());
         return mprInput.build();
     }
+
+    @Override
+    public GetGroupStatisticsOutput buildTxCapableResult(TransactionId emulatedTxId) {
+        return new GetGroupStatisticsOutputBuilder().setTransactionId(emulatedTxId).build();
+    }
+
+    @Override
+    public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
+        return GroupStatisticsToNotificationTransformer.transformToNotification(result,
+                                                                                getDeviceInfo(),
+                                                                                emulatedTxId,
+                                                                                convertorExecutor);
+    }
 }