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;
12 public interface RoutingTable<I,R> {
15 * Adds a network address for the route. If the route already exists,
16 * it throws <code>DuplicateRouteException</code>.
17 * This method would be used when registering a global service.
20 * @param routeId route identifier
21 * @param route network address
22 * @throws DuplicateRouteException
23 * @throws RoutingTableException
25 public void addGlobalRoute(I routeId, R route) throws RoutingTableException, SystemException;
29 * This method would be used when registering a global service.
31 * @throws RoutingTableException
32 * @throws SystemException
34 public void removeGlobalRoute(I routeId) throws RoutingTableException, SystemException;
37 * Adds a network address for the route. If the route already exists,
38 * it throws <code>DuplicateRouteException</code>.
39 * This method would be used when registering a global service.
42 * @param routeId route identifier
43 * @param route network address
44 * @throws DuplicateRouteException
45 * @throws RoutingTableException
47 public R getGlobalRoute(I routeId) throws RoutingTableException, SystemException;
50 * Adds a network address for the route. If address for route
51 * exists, appends the address to the list
53 * @param routeId route identifier
54 * @param route network address
55 * @throws RoutingTableException for any logical exception
56 * @throws SystemException
58 public void addRoute(I routeId, R route) throws RoutingTableException,SystemException;
62 * Removes the network address for the route from routing table. If only
63 * one network address existed, remove the route as well.
67 public void removeRoute(I routeId, R route) throws RoutingTableException,SystemException;
70 * Adds address for a set of route identifiers. If address for route
71 * exists, appends the address to the set.
73 * @param routeIds a set of routeIds
74 * @param route network address
75 * @throws RoutingTableException for any logical exception
76 * @throws SystemException
78 public void addRoutes(Set<I> routeIds, R route) throws RoutingTableException,SystemException;
81 * Removes address for a set of route identifiers.
83 * @param routeIds a set of routeIds
84 * @param route network address
85 * @throws RoutingTableException for any logical exception
86 * @throws SystemException
88 public void removeRoutes(Set<I> routeIds, R route) throws RoutingTableException,SystemException;
91 * Returns a set of network addresses associated with this route
95 public Set<R> getRoutes(I routeId);
99 * Returns the last inserted address from the list of network addresses
100 * associated with the route.
104 public R getLastAddedRoute(I routeId);
106 public class DuplicateRouteException extends RoutingTableException {
107 public DuplicateRouteException(String message) {