• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UiExtensionService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.onosproject.ui.UiExtensionService的典型用法代码示例。如果您正苦于以下问题:Java UiExtensionService类的具体用法?Java UiExtensionService怎么用?Java UiExtensionService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UiExtensionService类属于org.onosproject.ui包,在下文中一共展示了UiExtensionService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMainModule

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@GET
@Produces(SCRIPT)
public Response getMainModule() throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    InputStream jsTemplate = getClass().getClassLoader().getResourceAsStream(MAIN_JS);
    String js = new String(toByteArray(jsTemplate));

    int p1s = split(js, 0, INJECT_VIEW_IDS_START) - INJECT_VIEW_IDS_START.length();
    int p1e = split(js, 0, INJECT_VIEW_IDS_END);
    int p2s = split(js, p1e, null);

    StreamEnumeration streams =
            new StreamEnumeration(of(stream(js, 0, p1s),
                                     includeViewIds(service),
                                     stream(js, p1e, p2s)));

    return Response.ok(new SequenceInputStream(streams)).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:MainModuleResource.java


示例2: getNavigation

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public Response getNavigation() throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    InputStream navTemplate =
            getClass().getClassLoader().getResourceAsStream(NAV_HTML);
    String html = new String(toByteArray(navTemplate));

    int p1s = split(html, 0, INJECT_VIEW_ITEMS_START);
    int p1e = split(html, 0, INJECT_VIEW_ITEMS_END);
    int p2s = split(html, p1e, null);

    StreamEnumeration streams =
            new StreamEnumeration(of(stream(html, 0, p1s),
                                     includeNavItems(service),
                                     stream(html, p1e, p2s)));

    return Response.ok(new SequenceInputStream(streams)).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:MainNavResource.java


示例3: includeNavItems

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeNavItems(UiExtensionService service) {
    List<UiExtension> extensions = service.getExtensions();
    StringBuilder sb = new StringBuilder("\n");

    for (UiView.Category cat : UiView.Category.values()) {
        if (cat == UiView.Category.HIDDEN) {
            continue;
        }

        List<UiView> catViews = getViewsForCat(extensions, cat);
        if (!catViews.isEmpty()) {
            addCatHeader(sb, cat);
            addCatItems(sb, catViews);
        }
    }

    return new ByteArrayInputStream(sb.toString().getBytes());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:MainNavResource.java


示例4: getMainModule

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@GET
@Produces(SCRIPT)
public Response getMainModule() throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    InputStream jsTemplate = getClass().getClassLoader().getResourceAsStream(MAIN_JS);
    String js = new String(toByteArray(jsTemplate));

    int p1s = split(js, 0, INJECT_VIEW_IDS_START);
    int p1e = split(js, 0, INJECT_VIEW_IDS_END);
    int p2s = split(js, p1e, null);

    StreamEnumeration streams =
            new StreamEnumeration(of(stream(js, 0, p1s),
                                     includeViewIds(service),
                                     stream(js, p1e, p2s)));

    return Response.ok(new SequenceInputStream(streams)).build();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:MainModuleResource.java


示例5: getNavigation

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public Response getNavigation() throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    InputStream navTemplate = getClass().getClassLoader().getResourceAsStream(NAV_HTML);
    String js = new String(toByteArray(navTemplate));

    int p1s = split(js, 0, INJECT_VIEW_ITEMS_START);
    int p1e = split(js, 0, INJECT_VIEW_ITEMS_END);
    int p2s = split(js, p1e, null);

    StreamEnumeration streams =
            new StreamEnumeration(of(stream(js, 0, p1s),
                                     includeNavItems(service),
                                     stream(js, p1e, p2s)));

    return Response.ok(new SequenceInputStream(streams)).build();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:MainNavResource.java


示例6: includeNavItems

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeNavItems(UiExtensionService service) {
    List<UiExtension> extensions = service.getExtensions();
    LionBundle navLion = service.getNavLionBundle();
    StringBuilder sb = new StringBuilder("\n");

    for (UiView.Category cat : UiView.Category.values()) {
        if (cat == UiView.Category.HIDDEN) {
            continue;
        }

        List<UiView> catViews = getViewsForCat(extensions, cat);
        if (!catViews.isEmpty()) {
            addCatHeader(sb, cat, navLion);
            addCatItems(sb, catViews);
        }
    }

    return new ByteArrayInputStream(sb.toString().getBytes());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:20,代码来源:MainNavResource.java


示例7: Topo2Jsonifier

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
/**
 * Creates an instance with a reference to the services directory, so that
 * additional information about network elements may be looked up on
 * on the fly.
 *
 * @param directory service directory
 * @param userName  logged in user name
 */
public Topo2Jsonifier(ServiceDirectory directory, String userName) {
    this.directory = checkNotNull(directory, "Directory cannot be null");
    this.userName = checkNotNull(userName, "User name cannot be null");

    clusterService = directory.get(ClusterService.class);
    deviceService = directory.get(DeviceService.class);
    linkService = directory.get(LinkService.class);
    hostService = directory.get(HostService.class);
    mastershipService = directory.get(MastershipService.class);
    intentService = directory.get(IntentService.class);
    flowService = directory.get(FlowRuleService.class);
    flowStatsService = directory.get(StatisticService.class);
    portStatsService = directory.get(PortStatisticsService.class);
    topologyService = directory.get(TopologyService.class);
    tunnelService = directory.get(TunnelService.class);
    uiextService = directory.get(UiExtensionService.class);
    prefService = directory.get(UiPreferencesService.class);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:Topo2Jsonifier.java


示例8: sendUberLionBundle

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private void sendUberLionBundle() {
    UiExtensionService service = directory.get(UiExtensionService.class);
    ObjectNode lion = objectNode();

    service.getExtensions().forEach(ext -> {
        ext.lionBundles().forEach(lb -> {
            ObjectNode lionMap = objectNode();
            lb.getItems().forEach(item -> lionMap.put(item.key(), item.value()));
            lion.set(lb.id(), lionMap);
        });
    });

    ObjectNode payload = objectNode();
    payload.set(LION, lion);
    payload.put(LOCALE, Locale.getDefault().toString());
    sendMessage(UBERLION, payload);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:18,代码来源:UiWebSocket.java


示例9: includeViewIds

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeViewIds(UiExtensionService service) {
    StringBuilder sb = new StringBuilder("\n");
    for (UiExtension extension : service.getExtensions()) {
        for (UiView view : extension.views()) {
            sb.append(PREFIX).append(view.id()).append(SUFFIX);
        }
    }
    return new ByteArrayInputStream(sb.toString().getBytes());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:MainModuleResource.java


示例10: includeJs

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeJs(UiExtensionService service) {
    Builder<InputStream> builder = ImmutableList.builder();
    service.getExtensions().forEach(ext -> {
        add(builder, ext.js());
        add(builder, new NewlineInputStream());
    });
    return new SequenceInputStream(new StreamEnumeration(builder.build()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:MainIndexResource.java


示例11: includeCss

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeCss(UiExtensionService service) {
    Builder<InputStream> builder = ImmutableList.builder();
    service.getExtensions().forEach(ext -> {
        add(builder, ext.css());
        add(builder, new NewlineInputStream());
    });
    return new SequenceInputStream(new StreamEnumeration(builder.build()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:MainIndexResource.java


示例12: getViewResource

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@Path("{view}/{resource}")
@GET
public Response getViewResource(@PathParam("view") String viewId,
                                @PathParam("resource") String resource) throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    UiExtension extension = service.getViewExtension(viewId);
    return extension != null ?
            Response.ok(extension.resource(viewId, resource))
                    .header(CONTENT_TYPE, contentType(resource)).build() :
            Response.status(Response.Status.NOT_FOUND).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:MainViewResource.java


示例13: mapsJson

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private ObjectNode mapsJson() {

        ObjectNode payload = objectNode();
        ArrayNode order = arrayNode();
        ObjectNode maps = objectNode();
        payload.set(ORDER, order);
        payload.set(MAPS, maps);

        UiExtensionService service = get(UiExtensionService.class);
        service.getExtensions().forEach(ext -> {
            UiTopoMapFactory mapFactory = ext.topoMapFactory();

            if (mapFactory != null) {
                List<UiTopoMap> topoMaps = mapFactory.newMaps();

                topoMaps.forEach(m -> {
                    maps.set(m.getId(), objectNode().put(MAP_ID, m.getId())
                            .put(DESCRIPTION, m.getDescription())
                            .put(FILE_PATH, m.getFilePath())
                            .put(SCALE, m.getScale()));
                    order.add(m.getId());
                });
            }
        });

        return payload;
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:MapSelectorMessageHandler.java


示例14: createHandlersAndOverlays

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private synchronized void createHandlersAndOverlays() {
    log.debug("Creating handlers and overlays...");
    handlers = new HashMap<>();
    overlayCache = new TopoOverlayCache();

    UiExtensionService service = directory.get(UiExtensionService.class);
    service.getExtensions().forEach(ext -> {
        UiMessageHandlerFactory factory = ext.messageHandlerFactory();
        if (factory != null) {
            factory.newHandlers().forEach(handler -> {
                try {
                    handler.init(this, directory);
                    handler.messageTypes().forEach(type -> handlers.put(type, handler));

                    // need to inject the overlay cache into topology message handler
                    if (handler instanceof TopologyViewMessageHandler) {
                        ((TopologyViewMessageHandler) handler).setOverlayCache(overlayCache);
                    }
                } catch (Exception e) {
                    log.warn("Unable to setup handler {} due to", handler, e);
                }
            });
        }

        UiTopoOverlayFactory overlayFactory = ext.topoOverlayFactory();
        if (overlayFactory != null) {
            overlayFactory.newOverlays().forEach(overlayCache::add);
        }
    });
    log.debug("#handlers = {}, #overlays = {}", handlers.size(),
              overlayCache.size());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:UiWebSocket.java


示例15: execute

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@Override
protected void execute() {
    UiExtensionService service = get(UiExtensionService.class);
    if (outputJson()) {
        print("%s", json(service.getExtensions()));
    } else {
        service.getExtensions().forEach(ext -> ext.views()
                .forEach(v -> print(FMT, v.id(), v.category().label(),
                                    v.label(), v.iconId())));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:UiViewListCommand.java


示例16: includeViewIds

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeViewIds(UiExtensionService service) {
    StringBuilder sb = new StringBuilder("\n");
    for (UiExtension extension : service.getExtensions()) {
        for (UiView view : extension.views()) {
            sb.append("        '").append(view.id()).append("',");
        }
    }
    return new ByteArrayInputStream(sb.toString().getBytes());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:10,代码来源:MainModuleResource.java


示例17: includeNavItems

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeNavItems(UiExtensionService service) {
    StringBuilder sb = new StringBuilder("\n");
    for (UiExtension extension : service.getExtensions()) {
        for (UiView view : extension.views()) {
            sb.append(String.format(NAV_FORMAT, view.id(), view.label()));
        }
    }
    return new ByteArrayInputStream(sb.toString().getBytes());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:10,代码来源:MainNavResource.java


示例18: getMainIndex

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public Response getMainIndex() throws IOException {
    UiExtensionService service = get(UiExtensionService.class);
    InputStream indexTemplate = getClass().getClassLoader().getResourceAsStream(INDEX);
    String index = new String(toByteArray(indexTemplate));

    int p1s = split(index, 0, INJECT_JS_START);
    int p1e = split(index, p1s, INJECT_JS_END);
    int p2s = split(index, p1e, INJECT_CSS_START);
    int p2e = split(index, p2s, INJECT_CSS_END);
    int p3s = split(index, p2e, null);

    StreamEnumeration streams =
            new StreamEnumeration(of(stream(index, 0, p1s),
                                     includeJs(service),
                                     stream(index, p1e, p2s),
                                     includeCss(service),
                                     stream(index, p2e, p3s)));

    return Response.ok(new SequenceInputStream(streams)).build();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:23,代码来源:MainIndexResource.java


示例19: includeCss

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeCss(UiExtensionService service) {
    ImmutableList.Builder<InputStream> builder = ImmutableList.builder();
    for (UiExtension extension : service.getExtensions()) {
        builder.add(extension.css());
    }
    return new SequenceInputStream(new StreamEnumeration(builder.build()));
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:8,代码来源:MainIndexResource.java


示例20: includeJs

import org.onosproject.ui.UiExtensionService; //导入依赖的package包/类
private InputStream includeJs(UiExtensionService service) {
    ImmutableList.Builder<InputStream> builder = ImmutableList.builder();
    for (UiExtension extension : service.getExtensions()) {
        builder.add(extension.js());
    }
    return new SequenceInputStream(new StreamEnumeration(builder.build()));
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:8,代码来源:MainIndexResource.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DateUtils类代码示例发布时间:2022-05-22
下一篇:
Java NullColor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap