Java Code Examples for org.onosproject.cfg.ComponentConfigService#getProperties()

The following examples show how to use org.onosproject.cfg.ComponentConfigService#getProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinksWebResource.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Get useStaleLinkAge active status.
 * Returns current status of the VanishedStaleLink.
 *
 * @onos.rsModel VanishedLink
 * @return 200 ok with the VanishedStaleLink status.
 */
@GET
@Path("{usestalelinkage}")
@Produces(MediaType.APPLICATION_JSON)
public Response getVanishStaleLink() {
    ObjectNode root = mapper().createObjectNode();
    ComponentConfigService useStaleLink = get(ComponentConfigService.class);

    for (ConfigProperty prop : useStaleLink.getProperties("org.onosproject.provider.lldp.impl.LldpLinkProvider")) {
        if (prop.name().equals("useStaleLinkAge")) {
            root.put("active", Boolean.valueOf(prop.value()));
            break;
        }
    }
    return ok(root).build();
}
 
Example 2
Source File: ComponentPropertyNameCompleter.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
    // Delegate string completer
    StringsCompleter delegate = new StringsCompleter();

    // Component name is the previous argument.
    String componentName = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];
    ComponentConfigService service = get(ComponentConfigService.class);

    SortedSet<String> strings = delegate.getStrings();
    Set<ConfigProperty> properties =
            service.getProperties(componentName);
    if (properties != null) {
        properties.forEach(property -> strings.add(property.name()));
    }

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(session, commandLine, candidates);
}
 
Example 3
Source File: SettingsViewMessageHandler.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
protected void populateTable(TableModel tm, ObjectNode payload) {
    ComponentConfigService ccs = get(ComponentConfigService.class);
    for (String component : ccs.getComponentNames()) {
        for (ConfigProperty prop : ccs.getProperties(component)) {
            populateRow(tm.addRow(), component, prop);
        }
    }
}