public static TopoEdgeUpdate toTopoEdgeUpdate(final Edge e,final UpdateType type,final TypeSafeDataReader reader) { return new TopoEdgeUpdate(e, toAdEdgeProperties(e, reader), type); }
private void edgeUpdateClusterWide(Edge e, UpdateType type, Set<Property> props, boolean isLocal) { TopoEdgeUpdate upd = new TopoEdgeUpdate(e, props, type); upd.setLocal(isLocal); notifyQ.add(upd); }
public void addEdge(Edge edge, Set<Property> properties, UpdateType updateType){ List<TopoEdgeUpdate > topoedgeupdateList = new ArrayList<TopoEdgeUpdate>(); topoedgeupdateList.add(new TopoEdgeUpdate(edge, properties, updateType)); this.pluginOutTopologyService.edgeUpdate(topoedgeupdateList); } }
private void notifyEdge(String container, Edge edge, UpdateType type, Set<Property> props) { boolean notifyListeners; // Update local cache notifyListeners = updateLocalEdgeMap(container, edge, type, props); // Prepare to update TopologyService if (notifyListeners) { notifyQ.add(new NotifyEntry(container, new TopoEdgeUpdate(edge, props, type))); logger.trace("notifyEdge: {} Edge {} in container {}", new Object[] { type.getName(), edge, container });//lg.dbug-trc } }
private void notifyEdge(String container, Edge edge, UpdateType type, Set<Property> props) { boolean notifyListeners; // Update local cache notifyListeners = updateLocalEdgeMap(container, edge, type, props); // Prepare to update TopologyService if (notifyListeners) { notifyQ.add(new NotifyEntry(container, new TopoEdgeUpdate(edge, props, type))); logger.debug("notifyEdge: {} Edge {} in container {}", new Object[] { type.getName(), edge, container }); } }
return; }else{ teuList.add(new TopoEdgeUpdate(edgeProps.getLeft(), null, UpdateType.REMOVED)); teuList.add(new TopoEdgeUpdate(edgeProps.getLeft(), null, UpdateType.REMOVED));
private void removeNodeConnector(String container, NodeConnector nodeConnector) { List<TopoEdgeUpdate> teuList = new ArrayList<TopoEdgeUpdate>(); Map<NodeConnector, Pair<Edge, Set<Property>>> edgePropsMap = edgeMap .get(container); if (edgePropsMap == null) { return; } // Remove edge in one direction Pair<Edge, Set<Property>> edgeProps = edgePropsMap.get(nodeConnector); if (edgeProps == null) { return; } teuList.add(new TopoEdgeUpdate(edgeProps.getLeft(), null, UpdateType.REMOVED)); // Remove edge in another direction edgeProps = edgePropsMap .get(edgeProps.getLeft().getHeadNodeConnector()); if (edgeProps == null) { return; } teuList.add(new TopoEdgeUpdate(edgeProps.getLeft(), null, UpdateType.REMOVED)); // Update in one shot notifyEdge(container, teuList); }
if (edgeProps != null) { i++; teuList.add(new TopoEdgeUpdate(edgeProps.getLeft(), edgeProps .getRight(), UpdateType.ADDED)); logger.trace("Add edge {}", edgeProps.getLeft());
/** * 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); }
if (edgeProp != null) { i++; teuList.add(new TopoEdgeUpdate(edgeProp.getLeft(), edgeProp .getRight(), UpdateType.ADDED)); logger.trace("Add edge {}", edgeProp.getLeft());
private void addNodeConnector(String container, NodeConnector nodeConnector) { // Use the global edge map for the newly added port in a container Map<NodeConnector, Pair<Edge, Set<Property>>> globalEdgeMap = edgeMap.get(GlobalConstants.DEFAULT .toString()); if (globalEdgeMap == null) { return; } // Get the edge and update local cache in the container Edge edge1, edge2; edge1 = addEdge(container, nodeConnector, globalEdgeMap); if (edge1 == null) { return; } // Get the edge in reverse direction and update local cache in the container NodeConnector peerConnector = edge1.getHeadNodeConnector(); edge2 = addEdge(container, peerConnector, globalEdgeMap); // Send notification upwards in one shot List<TopoEdgeUpdate> teuList = new ArrayList<TopoEdgeUpdate>(); teuList.add(new TopoEdgeUpdate(edge1, null, UpdateType.ADDED)); logger.debug("Notify edge1: {} in container {}", edge1, container); if (edge2 != null) { teuList.add(new TopoEdgeUpdate(edge2, null, UpdateType.ADDED)); logger.debug("Notify edge2: {} in container {}", edge2, container); } notifyEdge(container, teuList); }
break; return new TopoEdgeUpdate(e, props, type);