Package org.swisspush.gateleen.hook
Class LocalRouteRepository
- java.lang.Object
-
- org.swisspush.gateleen.hook.RouteRepositoryBase<Map<String,Route>>
-
- org.swisspush.gateleen.hook.LocalRouteRepository
-
- All Implemented Interfaces:
RouteRepository
public class LocalRouteRepository extends RouteRepositoryBase<Map<String,Route>> implements RouteRepository
Local in-memory implementation of a RouteRepository.- Author:
- https://github.com/ljucam [Mario Ljuca]
-
-
Constructor Summary
Constructors Constructor Description LocalRouteRepository()Creates a new instance of a local in-memory HookRouteRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRoute(String urlPattern, Route route)Adds a route for the given url pattern.Set<String>getCollections(String parentUri)Returns a set with collections (routes) contained in the given parent.RoutegetRoute(String url)Returns the route which is foreseen for the given url.Map<String,Route>getRoutes()Returns a copy of all routes.voidremoveRoute(String urlPattern)Removes the route for the url pattern.
-
-
-
Method Detail
-
addRoute
public void addRoute(String urlPattern, Route route)
Description copied from interface:RouteRepositoryAdds a route for the given url pattern.- Specified by:
addRoutein interfaceRouteRepository- Parameters:
urlPattern- - is used as a key.route- route
-
removeRoute
public void removeRoute(String urlPattern)
Description copied from interface:RouteRepositoryRemoves the route for the url pattern.- Specified by:
removeRoutein interfaceRouteRepository- Parameters:
urlPattern- urlPattern
-
getRoute
public Route getRoute(String url)
Description copied from interface:RouteRepositoryReturns the route which is foreseen for the given url. The repository checks if a url pattern is present for this url and then returns the corresponding route. If nothing is found, null is returned.- Specified by:
getRoutein interfaceRouteRepository- Parameters:
url- url- Returns:
- a route or null if no route is found
-
getRoutes
public Map<String,Route> getRoutes()
Description copied from interface:RouteRepositoryReturns a copy of all routes.- Specified by:
getRoutesin interfaceRouteRepository- Returns:
- a copy of all routes
-
getCollections
public Set<String> getCollections(String parentUri)
Description copied from interface:RouteRepositoryReturns a set with collections (routes) contained in the given parent. Only routes (collections) directly resided in the given parent will be returned. If no route could be found an empty set will be returned.- Specified by:
getCollectionsin interfaceRouteRepository- Parameters:
parentUri- the parent of which the routes should be listed- Returns:
- a set with routes
-
-