Merge "BUG-509: remove unused code"
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / implementation / src / main / java / org / opendaylight / controller / sal / connector / remoterpc / RoutingTableProvider.java
index cfdf98638d450830f65b04772a9ea14111430a1c..d960303fcf4b45c5ec5ac7d35ccff04f2fee4a3b 100644 (file)
@@ -1,6 +1,16 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.sal.connector.remoterpc;
 
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
 import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable;
+import org.opendaylight.controller.sal.connector.remoterpc.impl.RoutingTableImpl;
 import org.osgi.framework.BundleContext;
 import org.osgi.util.tracker.ServiceTracker;
 
@@ -10,18 +20,32 @@ public class RoutingTableProvider implements AutoCloseable {
 
     @SuppressWarnings("rawtypes")
     final ServiceTracker<RoutingTable,RoutingTable> tracker;
-    
-    
-    public RoutingTableProvider(BundleContext ctx) {
+
+    private RoutingTableImpl<?, ?> routingTableImpl = null;
+
+    //final private RouteChangeListener routeChangeListener;
+
+
+    public RoutingTableProvider(BundleContext ctx){//,RouteChangeListener rcl) {
         @SuppressWarnings("rawtypes")
         ServiceTracker<RoutingTable, RoutingTable> rawTracker = new ServiceTracker<>(ctx, RoutingTable.class, null);
         tracker = rawTracker;
         tracker.open();
+
+        //routeChangeListener = rcl;
     }
-    
-    public Optional<RoutingTable<String, String>> getRoutingTable() {
+
+    public Optional<RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String>> getRoutingTable() {
         @SuppressWarnings("unchecked")
-        RoutingTable<String,String> tracked = tracker.getService();
+        RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> tracked = tracker.getService();
+
+        if(tracked instanceof RoutingTableImpl){
+            if(routingTableImpl != tracked){
+             routingTableImpl= (RoutingTableImpl<?, ?>)tracked;
+             //routingTableImpl.setRouteChangeListener(routeChangeListener);
+            }
+        }
+
         return Optional.fromNullable(tracked);
     }