use of org.onosproject.ui.impl.topo.Topo2OverlayCache in project onos by opennetworkinglab.
the class UiWebSocket method createHandlersAndOverlays.
// Creates new message handlers.
private synchronized void createHandlersAndOverlays() {
log.debug("Creating handlers and overlays...");
handlers = new HashMap<>();
overlayCache = new TopoOverlayCache();
overlay2Cache = new Topo2OverlayCache();
Map<Class<?>, UiMessageHandler> handlerInstances = new HashMap<>();
UiExtensionService service = directory.get(UiExtensionService.class);
lionBundleMap = generateLionMap(service);
service.getExtensions().forEach(ext -> {
UiMessageHandlerFactory factory = ext.messageHandlerFactory();
if (factory != null) {
factory.newHandlers().forEach(handler -> {
try {
handler.init(this, directory);
injectLionBundles(handler, lionBundleMap);
handler.messageTypes().forEach(type -> handlers.put(type, handler));
handlerInstances.put(handler.getClass(), handler);
} catch (Exception e) {
log.warn("Unable to setup handler {} due to", handler, e);
}
});
}
registerOverlays(ext);
});
handlerCrossConnects(handlerInstances);
overlay2Cache.switchOverlay(null, Traffic2Overlay.OVERLAY_ID);
log.debug("#handlers = {}, #overlays = Topo: {}, Topo2: {}", handlers.size(), overlayCache.size(), overlay2Cache.size());
}
Aggregations