package org.opendaylight.controller.sal.connector.remoterpc;
-import com.google.common.base.Optional;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
import org.opendaylight.controller.sal.connector.api.RpcRouter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
public class RemoteRpcProvider implements
RpcImplementation,
AutoCloseable,
Provider {
- private Logger _logger = LoggerFactory.getLogger(RemoteRpcProvider.class);
+ private final Logger _logger = LoggerFactory.getLogger(RemoteRpcProvider.class);
private final ServerImpl server;
private final ClientImpl client;
private ProviderSession brokerSession;
private RpcProvisionRegistry rpcProvisionRegistry;
private BundleContext context;
- private ServiceTracker clusterTracker;
+ private ServiceTracker<?, ?> clusterTracker;
public RemoteRpcProvider(ServerImpl server, ClientImpl client) {
this.server = server;
}
@Override
- public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input) {
+ public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input) {
return client.invokeRpc(rpc, input);
}
@Override
- public RpcResult<CompositeNode> invokeRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input) {
+ public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input) {
return client.invokeRpc(rpc, identifier, input);
}
}
- private RoutingTable<RpcRouter.RouteIdentifier, String> getRoutingTable(){
- Optional<RoutingTable<RpcRouter.RouteIdentifier, String>> routingTable =
+ private RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> getRoutingTable(){
+ Optional<RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String>> routingTable =
routingTableProvider.getRoutingTable();
- checkNotNull(routingTable.isPresent(), "Routing table is null");
+ checkState(routingTable.isPresent(), "Routing table is null");
return routingTable.get();
}
RouteIdentifierImpl routeId = new RouteIdentifierImpl();
routeId.setType(rpc);
- RoutingTable<RpcRouter.RouteIdentifier, String> routingTable = getRoutingTable();
+ RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable = getRoutingTable();
try {
routingTable.addGlobalRoute(routeId, server.getServerAddress());
RouteIdentifierImpl routeId = new RouteIdentifierImpl();
routeId.setType(rpc);
- RoutingTable<RpcRouter.RouteIdentifier, String> routingTable = getRoutingTable();
+ RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable = getRoutingTable();
try {
routingTable.removeGlobalRoute(routeId);
*
* @param announcements
*/
- private void announce(Set<RpcRouter.RouteIdentifier> announcements) {
+ private void announce(Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements) {
_logger.debug("Announcing [{}]", announcements);
- RoutingTable<RpcRouter.RouteIdentifier, String> routingTable = getRoutingTable();
+ RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable = getRoutingTable();
try {
routingTable.addRoutes(announcements, server.getServerAddress());
} catch (RoutingTableException | SystemException e) {
*
* @param removals
*/
- private void remove(Set<RpcRouter.RouteIdentifier> removals){
+ private void remove(Set<RpcRouter.RouteIdentifier<?, ?, ?>> removals){
_logger.debug("Removing [{}]", removals);
- RoutingTable<RpcRouter.RouteIdentifier, String> routingTable = getRoutingTable();
+ RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable = getRoutingTable();
try {
routingTable.removeRoutes(removals, server.getServerAddress());
} catch (RoutingTableException | SystemException e) {
* @param changes
* @return
*/
- private Set<RpcRouter.RouteIdentifier> getRouteIdentifiers(Map<RpcRoutingContext, Set<InstanceIdentifier>> changes) {
+ private Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRouteIdentifiers(Map<RpcRoutingContext, Set<InstanceIdentifier>> changes) {
RouteIdentifierImpl routeId = null;
- Set<RpcRouter.RouteIdentifier> routeIdSet = new HashSet<RpcRouter.RouteIdentifier>();
+ Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIdSet = new HashSet<>();
for (RpcRoutingContext context : changes.keySet()){
routeId = new RouteIdentifierImpl();
return routeIdSet;
}
-
-
}
-
}