X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-remoterpc-connector%2Fimplementation%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnector%2Fremoterpc%2FRoutingTableProvider.java;h=71bab288e6ce3c38c555a036cf3a6b05c35af4de;hb=1f2754487ab1e3a37c830909806f90cd54180c7b;hp=cfdf98638d450830f65b04772a9ea14111430a1c;hpb=9e85339874f4a57af8cf6d0b3a60e144596e32e5;p=controller.git diff --git a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java index cfdf98638d..71bab288e6 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java +++ b/opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/RoutingTableProvider.java @@ -1,27 +1,52 @@ +/* + * 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 com.google.common.base.Optional; +import org.opendaylight.controller.sal.connector.api.RpcRouter; +import org.opendaylight.controller.sal.connector.remoterpc.api.RouteChangeListener; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable; +import org.opendaylight.controller.sal.connector.remoterpc.dto.RouteIdentifierImpl; +import org.opendaylight.controller.sal.connector.remoterpc.impl.RoutingTableImpl; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.ServiceTracker; -import com.google.common.base.Optional; - public class RoutingTableProvider implements AutoCloseable { @SuppressWarnings("rawtypes") final ServiceTracker tracker; + + private RoutingTableImpl routingTableImpl = null; + + //final private RouteChangeListener routeChangeListener; - public RoutingTableProvider(BundleContext ctx) { + public RoutingTableProvider(BundleContext ctx){//,RouteChangeListener rcl) { @SuppressWarnings("rawtypes") ServiceTracker rawTracker = new ServiceTracker<>(ctx, RoutingTable.class, null); tracker = rawTracker; tracker.open(); + + //routeChangeListener = rcl; } - public Optional> getRoutingTable() { + public Optional> getRoutingTable() { @SuppressWarnings("unchecked") - RoutingTable tracked = tracker.getService(); + RoutingTable tracked = tracker.getService(); + + if(tracked instanceof RoutingTableImpl){ + if(routingTableImpl != tracked){ + routingTableImpl= (RoutingTableImpl)tracked; + //routingTableImpl.setRouteChangeListener(routeChangeListener); + } + } + return Optional.fromNullable(tracked); }