本文整理汇总了Java中org.onosproject.ui.UiMessageHandler类的典型用法代码示例。如果您正苦于以下问题:Java UiMessageHandler类的具体用法?Java UiMessageHandler怎么用?Java UiMessageHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UiMessageHandler类属于org.onosproject.ui包,在下文中一共展示了UiMessageHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
@Override
public void onMessage(String data) {
log.debug("onMessage: {}", data);
lastActive = System.currentTimeMillis();
try {
ObjectNode message = (ObjectNode) mapper.reader().readTree(data);
String type = message.path(EVENT).asText(UNKNOWN);
UiMessageHandler handler = handlers.get(type);
if (handler != null) {
handler.process(message);
} else {
log.warn("No GUI message handler for type {}", type);
}
} catch (Exception e) {
log.warn("Unable to parse GUI message {} due to {}", data, e);
log.debug("Boom!!!", e);
}
}
示例2: onMessage
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
@Override
public void onMessage(String data) {
lastActive = System.currentTimeMillis();
try {
ObjectNode message = (ObjectNode) mapper.reader().readTree(data);
String type = message.path("event").asText("unknown");
UiMessageHandler handler = handlers.get(type);
if (handler != null) {
handler.process(message);
} else {
log.warn("No GUI message handler for type {}", type);
}
} catch (Exception e) {
log.warn("Unable to parse GUI message {} due to {}", data, e);
log.debug("Boom!!!", e);
}
}
示例3: onMessage
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
@Override
public void onMessage(String data) {
lastActive = System.currentTimeMillis();
try {
ObjectNode message = (ObjectNode) mapper.reader().readTree(data);
String type = message.path(EVENT).asText(UNKNOWN);
if (sessionToken == null) {
authenticate(type, message);
} else {
UiMessageHandler handler = handlers.get(type);
if (handler != null) {
log.debug("RX message: {}", message);
handler.process(message);
} else {
log.warn("No GUI message handler for type {}", type);
}
}
} catch (Exception e) {
log.warn("Unable to parse GUI message {} due to {}", data, e);
log.debug("Boom!!!", e);
}
}
示例4: handlerCrossConnects
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
private void handlerCrossConnects(Map<Class<?>, UiMessageHandler> handlers) {
TopologyViewMessageHandler topomh = (TopologyViewMessageHandler)
handlers.get(TopologyViewMessageHandler.class);
if (topomh != null) {
topomh.setOverlayCache(overlayCache);
}
Topo2ViewMessageHandler topo2mh = (Topo2ViewMessageHandler)
handlers.get(Topo2ViewMessageHandler.class);
if (topo2mh != null) {
topo2mh.setOverlayCache(overlay2Cache);
// We also need a link to Topo2Traffic
Topo2TrafficMessageHandler topo2traffic = (Topo2TrafficMessageHandler)
handlers.get(Topo2TrafficMessageHandler.class);
if (topo2traffic != null) {
topo2mh.setTrafficHandler(topo2traffic);
} else {
log.error("No topo2 traffic handler found");
}
}
}
示例5: createHandlersAndOverlays
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
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);
log.debug("#handlers = {}, #overlays = {}",
handlers.size(), overlayCache.size());
}
示例6: injectLionBundles
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
private void injectLionBundles(UiMessageHandler handler,
Map<String, LionBundle> lionBundleMap) {
handler.requiredLionBundles().forEach(lbid -> {
LionBundle lb = lionBundleMap.get(lbid);
if (lb != null) {
handler.cacheLionBundle(lb);
} else {
log.warn("handler {}: Lion bundle {} non existent!",
handler.getClass().getName(), lbid);
}
});
}
示例7: newHandlers
import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
private Collection<UiMessageHandler> newHandlers() {
return ImmutableList.of(new StreamingControl());
}