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

Java ApplicationService类代码示例

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

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



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

示例1: populateRow

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
private void populateRow(TableModel.Row row, Application app,
                         ApplicationService as) {
    ApplicationId id = app.id();
    ApplicationState state = as.getState(id);
    String iconId = state == ACTIVE ? ICON_ID_ACTIVE : ICON_ID_INACTIVE;

    row.cell(STATE, state)
            .cell(STATE_IID, iconId)
            .cell(ID, id.name())
            .cell(ICON, id.name())
            .cell(VERSION, app.version())
            .cell(CATEGORY, app.category())
            .cell(ORIGIN, app.origin())
            .cell(TITLE, app.title())
            .cell(DESC, app.description())
            .cell(URL, app.url());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:ApplicationViewMessageHandler.java


示例2: complete

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
    public int complete(String buffer, int cursor, List<String> candidates) {
        // Delegate string completer
        StringsCompleter delegate = new StringsCompleter();

        ApplicationService service = get(ApplicationService.class);
        Iterator<Application> it = service.getApplications().iterator();
        SortedSet<String> strings = delegate.getStrings();
        while (it.hasNext()) {
            Application app = it.next();
            ApplicationState state = service.getState(app.id());
//            if (previousApps.contains(app.id().name())) {
//                continue;
//            }
            if (state == INSTALLED) {
                strings.add(app.id().name());
            }
        }

        // Now let the completer do the work for figuring out what to offer.
        return delegate.complete(buffer, cursor, candidates);
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:ReviewApplicationNameCompleter.java


示例3: choices

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
public List<String> choices() {

    // Fetch the service and return the list of app names
    ApplicationService service = get(ApplicationService.class);
    Iterator<Application> it = service.getApplications().iterator();

    // Filter the list of apps, selecting only the installed ones.
    // Add each app name to the list of choices.
    return
        StreamSupport.stream(
            Spliterators.spliteratorUnknownSize(it, Spliterator.ORDERED), false)
                .filter(app -> service.getState(app.id()) == INSTALLED)
                .map(app -> app.id().name())
                .collect(toList());

}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:AllApplicationNamesCompleter.java


示例4: process

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
public void process(ObjectNode message) {
    ObjectNode payload = payload(message);
    String sortCol = string(payload, "sortCol", "id");
    String sortDir = string(payload, "sortDir", "asc");

    ApplicationService service = get(ApplicationService.class);
    TableRow[] rows = generateTableRows(service);
    RowComparator rc =
            new RowComparator(sortCol, RowComparator.direction(sortDir));
    Arrays.sort(rows, rc);
    ArrayNode applications = generateArrayNode(rows);
    ObjectNode rootNode = mapper.createObjectNode();
    rootNode.set("apps", applications);

    connection().sendMessage("appDataResponse", 0, rootNode);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:ApplicationViewMessageHandler.java


示例5: complete

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();

    // Fetch our service and feed it's offerings to the string completer
    ApplicationService service = AbstractShellCommand.get(ApplicationService.class);
    Iterator<Application> it = service.getApplications().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().id().name());
    }

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(buffer, cursor, candidates);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:17,代码来源:ApplicationNameCompleter.java


示例6: encode

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
public ObjectNode encode(Application app, CodecContext context) {
    checkNotNull(app, "Application cannot be null");
    ApplicationService service = context.get(ApplicationService.class);
    ObjectNode result = context.mapper().createObjectNode()
            .put("name", app.id().name())
            .put("id", app.id().id())
            .put("version", app.version().toString())
            .put("description", app.description())
            .put("origin", app.origin())
            .put("permissions", app.permissions().toString())
            .put("featuresRepo", app.featuresRepo().isPresent() ?
                    app.featuresRepo().get().toString() : "")
            .put("features", app.features().toString())
            .put("state", service.getState(app.id()).toString());
    return result;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:18,代码来源:ApplicationCodec.java


示例7: getFlowByAppId

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
/**
 * Gets flow rules generated by an application.
 * Returns the flow rule specified by the application id.
 *
 * @param appId application identifier
 * @return 200 OK with a collection of flows of given application id
 * @onos.rsModel FlowRules
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("application/{appId}")
public Response getFlowByAppId(@PathParam("appId") String appId) {
    final ApplicationService appService = get(ApplicationService.class);
    final ApplicationId idInstant = nullIsNotFound(appService.getId(appId), APP_ID_NOT_FOUND);
    final Iterable<FlowRule> flowRules = service.getFlowRulesById(idInstant);

    flowRules.forEach(flow -> flowsNode.add(codec(FlowRule.class).encode(flow, this)));
    return ok(root).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:FlowsWebResource.java


示例8: removeFlowByAppId

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
/**
 * Removes flow rules by application ID.
 * Removes a collection of flow rules generated by the given application.
 *
 * @param appId application identifier
 * @return 204 NO CONTENT
 */
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("application/{appId}")
public Response removeFlowByAppId(@PathParam("appId") String appId) {
    final ApplicationService appService = get(ApplicationService.class);
    final ApplicationId idInstant = nullIsNotFound(appService.getId(appId), APP_ID_NOT_FOUND);
    service.removeFlowRulesById(idInstant);
    return Response.noContent().build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:FlowsWebResource.java


示例9: setUpMocks

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpMocks() {
    appService = createMock(ApplicationAdminService.class);
    coreService = createMock(CoreService.class);

    expect(appService.getId("one"))
            .andReturn(id1)
            .anyTimes();
    expect(appService.getId("two"))
            .andReturn(id2)
            .anyTimes();
    expect(appService.getId("three"))
            .andReturn(id3)
            .anyTimes();
    expect(appService.getId("four"))
            .andReturn(id4)
            .anyTimes();

    expect(appService.getApplication(id3))
            .andReturn(app3)
            .anyTimes();
    expect(appService.getState(isA(ApplicationId.class)))
            .andReturn(ApplicationState.ACTIVE)
            .anyTimes();

    // Register the services needed for the test
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(ApplicationAdminService.class, appService)
                    .add(ApplicationService.class, appService)
                    .add(CoreService.class, coreService)
                    .add(CodecService.class, codecService);

    BaseResource.setServiceDirectory(testDirectory);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:ApplicationsResourceTest.java


示例10: setUpTest

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    // Mock device service
    expect(mockDeviceService.getDevice(deviceId1))
            .andReturn(device1);
    expect(mockDeviceService.getDevice(deviceId2))
            .andReturn(device2);
    expect(mockDeviceService.getDevices())
            .andReturn(ImmutableSet.of(device1, device2));

    // Mock Core Service
    expect(mockCoreService.getAppId(anyShort()))
            .andReturn(NetTestTools.APP_ID).anyTimes();
    expect(mockCoreService.getAppId(anyString()))
            .andReturn(NetTestTools.APP_ID).anyTimes();
    expect(mockCoreService.registerApplication(FlowRuleCodec.REST_APP_ID))
            .andReturn(APP_ID).anyTimes();
    replay(mockCoreService);

    // Register the services needed for the test
    final CodecManager codecService =  new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(FlowRuleService.class, mockFlowService)
                    .add(DeviceService.class, mockDeviceService)
                    .add(CodecService.class, codecService)
                    .add(CoreService.class, mockCoreService)
                    .add(ApplicationService.class, mockApplicationService);

    BaseResource.setServiceDirectory(testDirectory);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:FlowsResourceTest.java


示例11: populateTable

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
    ApplicationService as = get(ApplicationService.class);
    for (Application app : as.getApplications()) {
        populateRow(tm.addRow(), app, as);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:ApplicationViewMessageHandler.java


示例12: execute

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
protected void execute() {
    ApplicationService service = get(ApplicationService.class);
    List<Application> apps = newArrayList(service.getApplications());
    Collections.sort(apps, Comparators.APP_COMPARATOR);

    if (outputJson()) {
        print("%s", json(service, apps));
    } else {
        for (Application app : apps) {
            boolean isActive = service.getState(app.id()) == ACTIVE;
            if (activeOnly && isActive || !activeOnly) {
                if (shortOnly) {
                    String shortDescription = app.title().equals(app.id().name()) ?
                            app.description().replaceAll("[\\r\\n]", " ").replaceAll(" +", " ") :
                            app.title();
                    print(SHORT_FMT, isActive ? "*" : " ",
                          app.id().id(), app.id().name(), app.version(), shortDescription);
                } else {
                    print(FMT, isActive ? "*" : " ",
                          app.id().id(), app.id().name(), app.version(), app.origin(),
                          app.category(), app.description(), app.features(),
                          app.featuresRepo().map(URI::toString).orElse(""),
                          app.requiredApps(), app.permissions(), app.url());
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:ApplicationsListCommand.java


示例13: json

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
private JsonNode json(ApplicationService service, List<Application> apps) {
    ObjectMapper mapper = new ObjectMapper();
    ArrayNode result = mapper.createArrayNode();
    for (Application app : apps) {
        boolean isActive = service.getState(app.id()) == ACTIVE;
        if (activeOnly && isActive || !activeOnly) {
            result.add(jsonForEntity(app, Application.class));
        }
    }
    return result;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:ApplicationsListCommand.java


示例14: complete

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
    public int complete(String buffer, int cursor, List<String> candidates) {
        // Delegate string completer
        StringsCompleter delegate = new StringsCompleter();

        // Command name is the second argument.
        ArgumentCompleter.ArgumentList list = getArgumentList();
        String cmd = list.getArguments()[1];

        // Grab apps already on the command (to prevent tab-completed duplicates)
        // FIXME: This does not work.
//        final Set previousApps;
//        if (list.getArguments().length > 2) {
//            previousApps = Sets.newHashSet(
//                    Arrays.copyOfRange(list.getArguments(), 2, list.getArguments().length));
//        } else {
//            previousApps = Collections.emptySet();
//        }

        // Fetch our service and feed it's offerings to the string completer
        ApplicationService service = get(ApplicationService.class);
        Iterator<Application> it = service.getApplications().iterator();
        SortedSet<String> strings = delegate.getStrings();
        while (it.hasNext()) {
            Application app = it.next();
            ApplicationState state = service.getState(app.id());
//            if (previousApps.contains(app.id().name())) {
//                continue;
//            }
            if (cmd.equals("uninstall") ||
                    (cmd.equals("activate") && state == INSTALLED) ||
                    (cmd.equals("deactivate") && state == ACTIVE)) {
                strings.add(app.id().name());
            }
        }

        // Now let the completer do the work for figuring out what to offer.
        return delegate.complete(buffer, cursor, candidates);
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:40,代码来源:ApplicationNameCompleter.java


示例15: setUp

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    applicationService = createMock(ApplicationService.class);

    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(APP_NAME))
            .andReturn(APPID);
    replay(coreService);

    hostsAvailable = Sets.newHashSet();
    hostService = new TestHostService(hostsAvailable);

    intentService = new TestIntentService();

    TestIntentSynchronizer intentSynchronizer =
            new TestIntentSynchronizer(intentService);

    interfaceService = createMock(InterfaceService.class);
    interfaceService.addListener(anyObject(InterfaceListener.class));
    expectLastCall().anyTimes();
    addIntfConfig();

    vpls = new Vpls();
    vpls.applicationService = applicationService;
    vpls.coreService = coreService;
    vpls.hostService = hostService;
    vpls.intentService = intentService;
    vpls.interfaceService = interfaceService;
    vpls.intentSynchronizer = intentSynchronizer;
    vpls.intentSynchronizerAdmin = intentSynchronizer;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:VplsTest.java


示例16: encode

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
public ObjectNode encode(Application app, CodecContext context) {
    checkNotNull(app, "Application cannot be null");
    ApplicationService service = context.getService(ApplicationService.class);

    ArrayNode permissions = context.mapper().createArrayNode();
    ArrayNode features = context.mapper().createArrayNode();
    ArrayNode requiredApps = context.mapper().createArrayNode();

    app.permissions().forEach(p -> permissions.add(p.toString()));
    app.features().forEach(f -> features.add(f));
    app.requiredApps().forEach(a -> requiredApps.add(a));

    ObjectNode result = context.mapper().createObjectNode()
            .put("name", app.id().name())
            .put("id", app.id().id())
            .put("version", app.version().toString())
            .put("category", app.category())
            .put("description", StringEscapeUtils.escapeJson(app.description()))
            .put("readme", StringEscapeUtils.escapeJson(app.readme()))
            .put("origin", app.origin())
            .put("url", app.url())
            .put("featuresRepo", app.featuresRepo().map(URI::toString).orElse(""))
            .put("state", service.getState(app.id()).toString());

    result.set("features", features);
    result.set("permissions", permissions);
    result.set("requiredApps", requiredApps);

    return result;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:ApplicationCodec.java


示例17: setUpMocks

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
/**
 * Initializes test mocks and environment.
 */
@Before
public void setUpMocks() {
    service = createMock(ApplicationAdminService.class);

    expect(service.getId("one"))
            .andReturn(id1)
            .anyTimes();
    expect(service.getId("two"))
            .andReturn(id2)
            .anyTimes();
    expect(service.getId("three"))
            .andReturn(id3)
            .anyTimes();
    expect(service.getId("four"))
            .andReturn(id4)
            .anyTimes();

    expect(service.getApplication(id3))
            .andReturn(app3)
            .anyTimes();
    expect(service.getState(isA(ApplicationId.class)))
            .andReturn(ApplicationState.ACTIVE)
            .anyTimes();

    // Register the services needed for the test
    CodecManager codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(ApplicationAdminService.class, service)
                    .add(ApplicationService.class, service)
                    .add(CodecService.class, codecService);

    BaseResource.setServiceDirectory(testDirectory);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:39,代码来源:ApplicationsResourceTest.java


示例18: ApplicationTableRow

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
public ApplicationTableRow(ApplicationService service, Application app) {
    ApplicationState state = service.getState(app.id());
    String iconId = state == ACTIVE ? ICON_ID_ACTIVE : ICON_ID_INACTIVE;

    add(STATE, state.toString());
    add(STATE_IID, iconId);
    add(ID, app.id().name());
    add(VERSION, app.version().toString());
    add(ORIGIN, app.origin());
    add(DESC, app.description());
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:12,代码来源:ApplicationViewMessageHandler.java


示例19: execute

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
@Override
protected void execute() {
    ApplicationService service = get(ApplicationService.class);
    List<Application> apps = newArrayList(service.getApplications());
    Collections.sort(apps, Comparators.APP_COMPARATOR);

    if (outputJson()) {
        print("%s", json(service, apps));
    } else {
        for (Application app : apps) {
            boolean isActive = service.getState(app.id()) == ACTIVE;
            if (activeOnly && isActive || !activeOnly) {
                if (shortOnly) {
                    print(SHORT_FMT, isActive ? "*" : " ",
                          app.id().id(), app.id().name(), app.version(),
                          app.origin(), app.description());
                } else {
                    print(FMT, isActive ? "*" : " ",
                          app.id().id(), app.id().name(), app.version(), app.origin(),
                          app.description(), app.features(),
                          app.featuresRepo().isPresent() ? app.featuresRepo().get().toString() : "",
                          app.permissions());
                }
            }
        }
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:28,代码来源:ApplicationsListCommand.java


示例20: json

import org.onosproject.app.ApplicationService; //导入依赖的package包/类
private JsonNode json(ApplicationService service, List<Application> apps) {
    ObjectMapper mapper = new ObjectMapper();
    ArrayNode result = mapper.createArrayNode();
    for (Application app : apps) {
        boolean isActive = service.getState(app.id()) == ACTIVE;
        if (activeOnly && isActive || !activeOnly) {
            result.add(json(service, mapper, app));
        }
    }
    return result;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:12,代码来源:ApplicationsListCommand.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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