+ /**
+ * Function called by the dependency manager when all the required
+ * dependencies are satisfied
+ *
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void init() {
+ log.debug("Routing init() is called");
+ this.topologyBWAware = (ConcurrentMap<Short, Graph<Node, Edge>>) new ConcurrentHashMap();
+ this.sptBWAware = (ConcurrentMap<Short, DijkstraShortestPath<Node, Edge>>) new ConcurrentHashMap();
+ // Now create the default topology, which doesn't consider the
+ // BW, also create the corresponding Dijkstra calculation
+ Graph<Node, Edge> g = new SparseMultigraph();
+ Short sZero = Short.valueOf((short) 0);
+ this.topologyBWAware.put(sZero, g);
+ this.sptBWAware.put(sZero, new DijkstraShortestPath(g));
+ // Topologies for other BW will be added on a needed base
+ }
+
+ /**
+ * Function called by the dependency manager when at least one dependency
+ * become unsatisfied or when the component is shutting down because for
+ * example bundle is being stopped.
+ *
+ */
+ void destroy() {
+ log.debug("Routing destroy() is called");
+ }
+
+ /**
+ * Function called by dependency manager after "init ()" is called and after
+ * the services provided by the class are registered in the service registry
+ *
+ */
+ void start() {
+ log.debug("Routing start() is called");
+ // build the routing database from the topology if it exists.
+ Map<Edge, Set<Property>> edges = topologyManager.getEdges();
+ if (edges.isEmpty()) {
+ return;
+ }
+ List<TopoEdgeUpdate> topoedgeupdateList = new ArrayList<TopoEdgeUpdate>();
+ log.debug("Creating routing database from the topology");
+ for (Iterator<Map.Entry<Edge, Set<Property>>> i = edges.entrySet()
+ .iterator(); i.hasNext();) {
+ Map.Entry<Edge, Set<Property>> entry = i.next();
+ Edge e = entry.getKey();
+ Set<Property> props = entry.getValue();
+ TopoEdgeUpdate topoedgeupdate = new TopoEdgeUpdate(e, props,
+ UpdateType.ADDED);
+ topoedgeupdateList.add(topoedgeupdate);
+ }
+ edgeUpdate(topoedgeupdateList);