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


Java ApplicationService类代码示例

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


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


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