import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
+import org.opendaylight.openflowplugin.api.openflow.statistics.compatibility.Delegator;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
/**
* @author joe
*/
-public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService {
+public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService, Delegator<OpendaylightFlowStatisticsService> {
+
private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceImpl.class);
private final Function<RpcResult<List<MultipartReply>>, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> matchingConvertor =
public RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> apply(final RpcResult<List<MultipartReply>> input) {
final DeviceContext deviceContext = matchingFlowsInTable.getDeviceContext();
TranslatorLibrary translatorLibrary = deviceContext.oook();
- RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult;
+ final RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult;
if (input.isSuccessful()) {
MultipartReply reply = input.getResult().get(0);
final TranslatorKey translatorKey = new TranslatorKey(reply.getVersion(), MultipartReplyAggregateCase.class.getName());
}
};
- private final AggregateFlowsInTableService aggregateFlowsInTable;
private final MatchingFlowsInTableService matchingFlowsInTable;
- private final AllFlowsInAllTablesService allFlowsInAllTables;
- private final AllFlowsInTableService allFlowsInTable;
- private final FlowsInTableService flowsInTable;
+ private OpendaylightFlowStatisticsService delegate;
public OpendaylightFlowStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
- aggregateFlowsInTable = new AggregateFlowsInTableService(requestContextStack, deviceContext);
- allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext);
- allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext);
- flowsInTable = new FlowsInTableService(requestContextStack, deviceContext);
matchingFlowsInTable = new MatchingFlowsInTableService(requestContextStack, deviceContext);
}
@Override
+ public void setDelegate(OpendaylightFlowStatisticsService delegate) {
+ this.delegate = delegate;
+ }
+
+ /**
+ * @deprecated provided for Be-release as backward compatibility relic
+ */
+ @Override
+ @Deprecated
public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
- return aggregateFlowsInTable.handleServiceCall(input);
+ if (delegate != null) {
+ return delegate.getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
+ } else {
+ throw new IllegalAccessError("no delegate available - service is currently out of order");
+ }
}
@Override
return Futures.transform(matchingFlowsInTable.handleServiceCall(input), matchingConvertor);
}
+ /**
+ * @deprecated provided for Be-release as backward compatibility relic
+ */
@Override
+ @Deprecated
public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
final GetAllFlowStatisticsFromFlowTableInput input) {
- return allFlowsInTable.handleServiceCall(input);
+ if (delegate != null) {
+ return delegate.getAllFlowStatisticsFromFlowTable(input);
+ } else {
+ throw new IllegalAccessError("no delegate available - service is currently out of order");
+ }
}
+ /**
+ * @deprecated provided for Be-release as backward compatibility relic
+ */
@Override
+ @Deprecated
public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
- return allFlowsInAllTables.handleServiceCall(input);
+ if (delegate != null) {
+ return delegate.getAllFlowsStatisticsFromAllFlowTables(input);
+ } else {
+ throw new IllegalAccessError("no delegate available - service is currently out of order");
+ }
}
+ /**
+ * @deprecated provided for Be-release as backward compatibility relic
+ */
@Override
+ @Deprecated
public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
final GetFlowStatisticsFromFlowTableInput input) {
- return flowsInTable.handleServiceCall(input);
+ if (delegate != null) {
+ return delegate.getFlowStatisticsFromFlowTable(input);
+ } else {
+ throw new IllegalAccessError("no delegate available - service is currently out of order");
+ }
}
}