2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.connector.remoterpc.api;
13 public interface RoutingTable<I,R> {
18 * Adds a network address for the route. If address for route
19 * exists, appends the address to the list
21 * @param routeId route identifier
22 * @param route network address
23 * @throws RoutingTableException for any logical exception
24 * @throws SystemException
26 public void addRoute(I routeId, R route) throws RoutingTableException,SystemException;
29 * Adds a network address for the route. If the route already exists,
30 * it throws <code>DuplicateRouteException</code>.
31 * This method would be used when registering a global service.
34 * @param routeId route identifier
35 * @param route network address
36 * @throws DuplicateRouteException
37 * @throws RoutingTableException
39 public void addGlobalRoute(I routeId, R route) throws RoutingTableException, SystemException;
45 * Removes the network address for the route from routing table. If only
46 * one network address existed, remove the route as well.
50 public void removeRoute(I routeId, R route);
55 * This method would be used when registering a global service.
57 * @throws RoutingTableException
58 * @throws SystemException
60 public void removeGlobalRoute(I routeId) throws RoutingTableException, SystemException;
63 * Returns a set of network addresses associated with this route
67 public Set<R> getRoutes(I routeId);
70 * Returns all network addresses stored in the table
73 public Set<Map.Entry> getAllRoutes();
76 * Returns only one address from the list of network addresses
77 * associated with the route. The algorithm to determine that
78 * one address is upto the implementer
82 public R getARoute(I routeId);
86 * This will be removed after listeners
87 * have made change on their end to use whiteboard pattern
91 public void registerRouteChangeListener(RouteChangeListener listener);
93 public class DuplicateRouteException extends RoutingTableException {
94 public DuplicateRouteException(String message) {