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


Java StringsCompleter类代码示例

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


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

示例1: complete

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

    HostService service = AbstractShellCommand.get(HostService.class);
    Iterator<Host> it = service.getHosts().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().id().toString());
    }

    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(buffer, cursor, candidates);

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

示例2: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    DeviceService service = AbstractShellCommand.get(DeviceService.class);

    // Generate the device ID/port number identifiers
    for (Device device : service.getDevices()) {
        SortedSet<String> strings = delegate.getStrings();
        for (Port port : service.getPorts(device.id())) {
            if (!port.number().isLogical()) {
                strings.add(device.id().toString() + "/" + port.number());
            }
        }
    }

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

示例3: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    TopologyService service = AbstractShellCommand.get(TopologyService.class);
    Topology topology = service.currentTopology();

    SortedSet<String> strings = delegate.getStrings();
    for (TopologyCluster cluster : service.getClusters(topology)) {
        strings.add(Integer.toString(cluster.id().index()));
    }

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

示例4: complete

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

    // Component name is the previous argument.
    ArgumentCompleter.ArgumentList list = getArgumentList();
    String componentName = list.getArguments()[list.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(buffer, cursor, candidates);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:ComponentPropertyNameCompleter.java

示例5: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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

示例6: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    IntentService service = AbstractShellCommand.get(IntentService.class);
    SortedSet<String> strings = delegate.getStrings();

    service.getIntents()
            .forEach(intent ->
                    strings.add(intent.appId().name()));

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

示例7: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    ClusterService service = AbstractShellCommand.get(ClusterService.class);
    Iterator<ControllerNode> it = service.getNodes().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().id().toString());
    }

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

示例8: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    DeviceService service = AbstractShellCommand.get(DeviceService.class);
    Iterator<Device> it = service.getDevices().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().id().toString());
    }

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

示例9: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    IntentService service = AbstractShellCommand.get(IntentService.class);
    Iterator<Intent> it = service.getIntents().iterator();
    SortedSet<String> strings = delegate.getStrings();
    while (it.hasNext()) {
        strings.add(it.next().key().toString());
    }

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

示例10: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    LinkService service = AbstractShellCommand.get(LinkService.class);

    // Link source the previous argument.
    ArgumentCompleter.ArgumentList list = getArgumentList();
    String srcArg = list.getArguments()[list.getCursorArgumentIndex() - 1];

    // Generate the device ID/port number identifiers
    SortedSet<String> strings = delegate.getStrings();
    try {
        ConnectPoint src = ConnectPoint.deviceConnectPoint(srcArg);
        service.getEgressLinks(src)
                .forEach(link -> strings.add(link.dst().elementId().toString() +
                                                     "/" + link.dst().port()));
    } catch (NumberFormatException e) {
        System.err.println("Invalid connect-point");
    }

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

示例11: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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
    LinkService service = AbstractShellCommand.get(LinkService.class);

    // Generate the device ID/port number identifiers
    SortedSet<String> strings = delegate.getStrings();
    service.getLinks()
            .forEach(link -> strings.add(link.src().elementId().toString() +
                                                 "/" + link.src().port()));

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

示例12: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的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

示例13: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的package包/类
/**
 * @param buffer
 *            the beginning string typed by the user
 * @param cursor
 *            the position of the cursor
 * @param candidates
 *            the list of completions proposed to the user
 */
@Override
public int complete(String buffer, int cursor, List<String> candidates) {

    String query = (buffer == null) ? ".*" : buffer;

    if (!query.contains("*")) {
        query = query.concat(".*");
    }

    StringsCompleter delegate = new StringsCompleter();

    for (Intent intent : provider.listIntents(true)) {
        String id = intent.getId().getValue();
        if (id.matches(query)) {
            candidates.add(id);
            delegate.getStrings().add(id);
        }
    }

    return delegate.complete(buffer, cursor, candidates);
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:30,代码来源:UuidCompleter.java

示例14: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
    final StringsCompleter delegate = new StringsCompleter();
    final UsesArtifactCommand.SearchType type = getType();
    for (Application application : _switchYard.getApplications()) {
        if (application.getConfig().getArtifacts() == null) {
            continue;
        }
        for (ArtifactModel artifact : application.getConfig().getArtifacts().getArtifacts()) {
            switch (type) {
            case name:
                delegate.getStrings().add(artifact.getName());
                break;
            case url:
                delegate.getStrings().add(artifact.getURL());
                break;
            }
        }
    }
    return delegate.complete(buffer, cursor, candidates);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:22,代码来源:ArtifactCompleter.java

示例15: complete

import org.apache.karaf.shell.console.completer.StringsCompleter; //导入依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<String> candidates) {
    final StringsCompleter delegate = new StringsCompleter();
    final Pattern applicationNamePattern = getApplicationNamePattern();
    final List<Application> applications = _switchYard.getApplications();
    for (Application application : applications) {
        if (applicationNamePattern.matcher(application.getName().toString()).find()) {
            for (Service service : application.getServices()) {
                delegate.getStrings().add(service.getName().toString());
            }
            for (Reference reference : application.getReferences()) {
                delegate.getStrings().add(reference.getName().toString());
            }
        }
    }
    return delegate.complete(buffer, cursor, candidates);
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:18,代码来源:ServiceReferenceNameCompleter.java


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