Deprecate org.opendaylight.controller.sal.common.util.Futures 80/5480/1
authorRobert Varga <rovarga@cisco.com>
Thu, 27 Feb 2014 11:11:34 +0000 (12:11 +0100)
committerRobert Varga <rovarga@cisco.com>
Thu, 27 Feb 2014 12:00:20 +0000 (13:00 +0100)
We use guava throughout -- and those are better.

Change-Id: I0013f8fc0c10742791159abdf151662eaae5629f
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Futures.java

index 84508ca03e99475b7a95fcc0a0e676082e227f04..01d75acfe6332b3e6574683ad49736efdf58655f 100644 (file)
@@ -8,10 +8,8 @@
 package org.opendaylight.controller.sal.compatibility.adsal;
 
 import java.math.BigInteger;
-import java.util.concurrent.Future;
 
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sal.compatibility.InventoryMapping;
 import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils;
@@ -37,6 +35,9 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
 public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(FlowServiceAdapter.class);
@@ -59,7 +60,7 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen
     }
 
     @Override
-    public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+    public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
 
         Flow flow = ToSalConversionsUtils.toFlow(input, null);
         @SuppressWarnings("unchecked")
@@ -73,7 +74,7 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen
     }
 
     @Override
-    public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+    public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
 
         Flow flow = ToSalConversionsUtils.toFlow(input, null);
         @SuppressWarnings("unchecked")
@@ -88,7 +89,7 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen
     }
 
     @Override
-    public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+    public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
         @SuppressWarnings("unchecked")
         org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
                 .getNode().getValue());
index 4bc23fe33b0b9a7c1709d5440700f7b56d28c0ed..c5cbecabedae35c96eb1fd0cad2ae5059253d074 100644 (file)
@@ -13,7 +13,6 @@ import java.util.List;
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sal.compatibility.FromSalConversionsUtils;
 import org.opendaylight.controller.sal.compatibility.InventoryMapping;
@@ -64,6 +63,9 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
 public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService, IReadServiceListener{
 
     private static final Logger LOG = LoggerFactory.getLogger(FlowStatisticsAdapter.class);
@@ -73,7 +75,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
             GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
-        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and
         // generating aggregate flow statistics out of those individual flow stats.
         return null;
     }
@@ -81,13 +83,13 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
             GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
-        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and
         // generating aggregate flow statistics out of those individual flow stats.
         return null;
     }
 
     @Override
-    public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+    public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
             GetAllFlowStatisticsFromFlowTableInput input) {
         GetAllFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
@@ -99,7 +101,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
             GetAllFlowStatisticsFromFlowTableOutputBuilder builder = new GetAllFlowStatisticsFromFlowTableOutputBuilder();
             builder.setTransactionId(new TransactionId(new BigInteger("0")));
             rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
-            
+
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -112,9 +114,9 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
      * Essentially this API will return the same result as getAllFlowStatisticsFromFlowTable
      */
     @Override
-    public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
+    public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
             GetAllFlowsStatisticsFromAllFlowTablesInput input) {
-        
+
         GetAllFlowsStatisticsFromAllFlowTablesOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
@@ -125,7 +127,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
             GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder builder = new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
             builder.setTransactionId(new TransactionId(new BigInteger("0")));
             rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
-            
+
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -135,7 +137,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     @Override
-    public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+    public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
             GetFlowStatisticsFromFlowTableInput input) {
         GetFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
@@ -170,7 +172,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     public void nodeConnectorStatisticsUpdated(Node node, List<NodeConnectorStatistics> ncStatsList) {
         NodeConnectorStatisticsUpdateBuilder nodeConnectorStatisticsUpdateBuilder = new NodeConnectorStatisticsUpdateBuilder();
         List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatistics = toOdNodeConnectorStatistics(ncStatsList);
-        
+
         nodeConnectorStatisticsUpdateBuilder.setNodeConnectorStatisticsAndPortNumberMap(nodeConnectorStatistics);
         nodeConnectorStatisticsUpdateBuilder.setMoreReplies(false);
         nodeConnectorStatisticsUpdateBuilder.setTransactionId(null);
@@ -180,9 +182,9 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
 
     @Override
     public void nodeTableStatisticsUpdated(Node node, List<NodeTableStatistics> tableStatsList) {
-        
-        FlowTableStatisticsUpdateBuilder flowTableStatisticsUpdateBuilder = new FlowTableStatisticsUpdateBuilder();  
-        
+
+        FlowTableStatisticsUpdateBuilder flowTableStatisticsUpdateBuilder = new FlowTableStatisticsUpdateBuilder();
+
         List<FlowTableAndStatisticsMap>  flowTableStatistics = toOdFlowTableStatistics(tableStatsList);
         flowTableStatisticsUpdateBuilder.setFlowTableAndStatisticsMap(flowTableStatistics);
         flowTableStatisticsUpdateBuilder.setMoreReplies(false);
@@ -194,7 +196,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         @Override
     public void descriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) {
             // TODO which *StatisticsUpdated interface should be used?
-        
+
     }
 
     private List<FlowAndStatisticsMapList> toOdFlowsStatistics(List<FlowOnNode> flowsOnNode) {
@@ -234,7 +236,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     private List<FlowTableAndStatisticsMap> toOdFlowTableStatistics(List<NodeTableStatistics> tableStatsList) {
-        
+
         List<FlowTableAndStatisticsMap> flowTableStatsMap = new ArrayList<FlowTableAndStatisticsMap>();
         for (NodeTableStatistics nodeTableStatistics : tableStatsList) {
             FlowTableAndStatisticsMapBuilder flowTableAndStatisticsMapBuilder = new FlowTableAndStatisticsMapBuilder();
@@ -245,7 +247,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
             flowTableAndStatisticsMapBuilder.setTableId(new TableId((short)nodeTableStatistics.getNodeTable().getID()));
             flowTableStatsMap.add(flowTableAndStatisticsMapBuilder.build());
         }
-        
+
         return flowTableStatsMap;
     }
 
@@ -254,7 +256,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsList = new ArrayList<NodeConnectorStatisticsAndPortNumberMap>();
         for(NodeConnectorStatistics ofNodeConnectorStatistics : ncStatsList){
             NodeConnectorStatisticsAndPortNumberMapBuilder nodeConnectorStatisticsAndPortNumberMapBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
-            
+
             nodeConnectorStatisticsAndPortNumberMapBuilder.setBytes(extractBytes(ofNodeConnectorStatistics));
             nodeConnectorStatisticsAndPortNumberMapBuilder.setCollisionCount(toBI(ofNodeConnectorStatistics.getCollisionCount()));
             nodeConnectorStatisticsAndPortNumberMapBuilder.setDuration(null);
@@ -268,7 +270,7 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
             nodeConnectorStatisticsAndPortNumberMapBuilder.setTransmitErrors(toBI(ofNodeConnectorStatistics.getTransmitErrorCount()));
             nodeConnectorStatisticsList.add(nodeConnectorStatisticsAndPortNumberMapBuilder.build());
         }
-        
+
         return nodeConnectorStatisticsList;
     }
 
index 42b00ba03d113dbcf0eb67958f068d5370491792..3384e8fb20037d0e9da1e020bf9ae2e744cc24a8 100644 (file)
@@ -12,6 +12,10 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
+/**
+ * @deprecated Use {@link com.google.common.util.concurrent.Futures} instead.
+ */
+@Deprecated
 public class Futures {
 
     private Futures() {