当前位置: 首页>>代码示例>>Java>>正文


Java UiMessageHandler类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:UiWebSocket.java

示例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);
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:UiWebSocket.java

示例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);
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:UiWebSocket.java

示例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");
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:UiWebSocket.java

示例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());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:34,代码来源:UiWebSocket.java

示例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);
        }
    });
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:13,代码来源:UiWebSocket.java

示例7: newHandlers

import org.onosproject.ui.UiMessageHandler; //导入依赖的package包/类
private Collection<UiMessageHandler> newHandlers() {
    return ImmutableList.of(new StreamingControl());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:4,代码来源:IntentPerfUi.java


注:本文中的org.onosproject.ui.UiMessageHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。