Introducing the Modification classses
[controller.git] / opendaylight / md-sal / remoterpc-routingtable / implementation / src / main / java / org / opendaylight / controller / sal / connector / remoterpc / api / RoutingTable.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.connector.remoterpc.api;
9
10 import java.util.Set;
11
12 public interface RoutingTable<I,R> {
13
14   /**
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.
18    *
19    *
20    * @param routeId route identifier
21    * @param route network address
22    * @throws DuplicateRouteException
23    * @throws RoutingTableException
24    */
25   public void addGlobalRoute(I routeId, R route) throws  RoutingTableException, SystemException;
26
27   /**
28    * Remove the route.
29    * This method would be used when registering a global service.
30    * @param routeId
31    * @throws RoutingTableException
32    * @throws SystemException
33    */
34   public void removeGlobalRoute(I routeId) throws RoutingTableException, SystemException;
35
36   /**
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.
40    *
41    *
42    * @param routeId route identifier
43    * @param route network address
44    * @throws DuplicateRouteException
45    * @throws RoutingTableException
46    */
47   public R getGlobalRoute(I routeId) throws  RoutingTableException, SystemException;
48
49   /**
50    * Adds a network address for the route. If address for route
51    * exists, appends the address to the list
52    *
53    * @param routeId route identifier
54    * @param route network address
55    * @throws RoutingTableException for any logical exception
56    * @throws SystemException
57    */
58   public void addRoute(I routeId, R route) throws RoutingTableException,SystemException;
59
60
61   /**
62    * Removes the network address for the route from routing table. If only
63    * one network address existed, remove the route as well.
64    * @param routeId
65    * @param route
66    */
67   public void removeRoute(I routeId, R route) throws RoutingTableException,SystemException;
68
69   /**
70    * Adds address for a set of route identifiers. If address for route
71    * exists, appends the address to the set.
72    *
73    * @param routeIds a set of routeIds
74    * @param route network address
75    * @throws RoutingTableException for any logical exception
76    * @throws SystemException
77    */
78   public void addRoutes(Set<I> routeIds, R route) throws  RoutingTableException,SystemException;
79
80   /**
81    * Removes address for a set of route identifiers.
82    *
83    * @param routeIds a set of routeIds
84    * @param route network address
85    * @throws RoutingTableException for any logical exception
86    * @throws SystemException
87    */
88   public void removeRoutes(Set<I> routeIds, R route) throws  RoutingTableException,SystemException;
89
90   /**
91    * Returns a set of network addresses associated with this route
92    * @param routeId
93    * @return
94    */
95   public Set<R> getRoutes(I routeId);
96
97
98   /**
99    * Returns the last inserted address from the list of network addresses
100    * associated with the route.
101    * @param routeId
102    * @return
103    */
104   public R getLastAddedRoute(I routeId);
105
106   public class DuplicateRouteException extends RoutingTableException {
107       public DuplicateRouteException(String message) {
108           super(message);
109       }
110
111   }
112
113 }