X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2Fservices%2FOpendaylightFlowStatisticsServiceImpl.java;h=cd127d6e16f68a03b3ba742049742e70c15a17e1;hb=1bad84906fffbc4c3a901712f8a803680bcd064f;hp=7879447c15176ee4db8e0164f0a4d56f7d9766ff;hpb=6c52fa23e21997ac76636b65ec492156b0832360;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java index 7879447c15..cd127d6e16 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java @@ -17,6 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator; 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; @@ -40,7 +41,8 @@ import org.slf4j.LoggerFactory; /** * @author joe */ -public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService { +public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService, Delegator { + private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceImpl.class); private final Function>, RpcResult> matchingConvertor = @@ -49,7 +51,7 @@ public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowSt public RpcResult apply(final RpcResult> input) { final DeviceContext deviceContext = matchingFlowsInTable.getDeviceContext(); TranslatorLibrary translatorLibrary = deviceContext.oook(); - RpcResult rpcResult; + final RpcResult rpcResult; if (input.isSuccessful()) { MultipartReply reply = input.getResult().get(0); final TranslatorKey translatorKey = new TranslatorKey(reply.getVersion(), MultipartReplyAggregateCase.class.getName()); @@ -79,24 +81,30 @@ public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowSt } }; - 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> 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 @@ -105,21 +113,45 @@ public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowSt return Futures.transform(matchingFlowsInTable.handleServiceCall(input), matchingConvertor); } + /** + * @deprecated provided for Be-release as backward compatibility relic + */ @Override + @Deprecated public Future> 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> 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> 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"); + } } }