Remove unused routedRpcRegistration
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / compatibility / OpendaylightFlowStatisticsServiceDelegateImpl.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.atomic.AtomicLong;
12 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
15 import org.opendaylight.openflowplugin.impl.statistics.services.AggregateFlowsInTableService;
16 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInAllTablesService;
17 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInTableService;
18 import org.opendaylight.openflowplugin.impl.statistics.services.FlowsInTableService;
19 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
31 import org.opendaylight.yangtools.yang.common.RpcResult;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34
35 public class OpendaylightFlowStatisticsServiceDelegateImpl implements OpendaylightFlowStatisticsService {
36
37     private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceDelegateImpl.class);
38
39     private final AggregateFlowsInTableService aggregateFlowsInTable;
40     private final AllFlowsInAllTablesService allFlowsInAllTables;
41     private final AllFlowsInTableService allFlowsInTable;
42     private final FlowsInTableService flowsInTable;
43     private final NotificationPublishService notificationService;
44
45     public OpendaylightFlowStatisticsServiceDelegateImpl(final RequestContextStack requestContextStack,
46                                                          final DeviceContext deviceContext,
47                                                          final NotificationPublishService notificationService,
48                                                          final AtomicLong compatibilityXidSeed,
49                                                          final ConvertorExecutor convertorExecutor) {
50         this.notificationService = notificationService;
51         aggregateFlowsInTable =
52                 AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
53         allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack,
54                                                              deviceContext,
55                                                              compatibilityXidSeed,
56                                                              convertorExecutor);
57         allFlowsInTable =
58                 new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
59         flowsInTable =
60                 new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
61     }
62
63     /**
64      * Get statistics for the given match.
65      *
66      * @deprecated this is the only method with real implementation provided, in delegate it makes no sense.
67      */
68     @Override
69     @Deprecated
70     public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
71         getAggregateFlowStatisticsFromFlowTableForGivenMatch(
72             final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
73         throw new IllegalAccessError("unsupported by backward compatibility delegate service "
74                 + "- this rpc is always provided by default service implementation");
75     }
76
77     @Override
78     public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
79         getAggregateFlowStatisticsFromFlowTableForAllFlows(
80             final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
81         return aggregateFlowsInTable.handleAndNotify(input, notificationService);
82     }
83
84     @Override
85     public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
86             final GetAllFlowStatisticsFromFlowTableInput input) {
87         return allFlowsInTable.handleAndNotify(input, notificationService);
88     }
89
90     @Override
91     public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>
92         getAllFlowsStatisticsFromAllFlowTables(final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
93         return allFlowsInAllTables.handleAndNotify(input, notificationService);
94     }
95
96     @Override
97     public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
98             final GetFlowStatisticsFromFlowTableInput input) {
99         return flowsInTable.handleAndNotify(input, notificationService);
100     }
101 }