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


Java UiExtensionService类代码示例

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


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


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