use of org.apache.karaf.shell.support.completers.StringsCompleter in project camel by apache.
the class CamelContextCompleter method complete.
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
try {
StringsCompleter delegate = new StringsCompleter();
List<CamelContext> camelContexts = getLocalCamelContexts();
for (CamelContext camelContext : camelContexts) {
delegate.getStrings().add(camelContext.getName());
}
return delegate.complete(session, commandLine, candidates);
} catch (Exception e) {
// nothing to do, no completion
}
return 0;
}
use of org.apache.karaf.shell.support.completers.StringsCompleter in project camel by apache.
the class RouteCompleter method complete.
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
try {
StringsCompleter delegate = new StringsCompleter();
List<Map<String, String>> routes = getRoutes(null);
for (Map<String, String> row : routes) {
delegate.getStrings().add(row.get("routeId"));
}
return delegate.complete(session, commandLine, candidates);
} catch (Exception e) {
// nothing to do, no completion
}
return 0;
}
use of org.apache.karaf.shell.support.completers.StringsCompleter in project opennms by OpenNMS.
the class AliasCompleter method complete.
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
// Gather the list of known aliases
delegate.getStrings().addAll(secureCredentialsVault.getAliases());
return delegate.complete(session, commandLine, candidates);
}
use of org.apache.karaf.shell.support.completers.StringsCompleter in project karaf by apache.
the class CommandNamesCompleter method complete.
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// TODO: optimize
List<Command> list = session.getRegistry().getCommands();
Set<String> names = new HashSet<>();
for (Command command : list) {
names.add(command.getScope() + ":" + command.getName());
names.add(command.getName());
}
int res = new StringsCompleter(names).complete(session, commandLine, candidates);
Collections.sort(candidates);
return res;
}
use of org.apache.karaf.shell.support.completers.StringsCompleter in project karaf by apache.
the class ServicesIdCompleter method complete.
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
Bundle[] bundles = bundleContext.getBundles();
for (Bundle bundle : bundles) {
ServiceReference[] references = bundle.getRegisteredServices();
if (references != null) {
for (ServiceReference reference : references) {
if (reference.getProperty(Constants.SERVICE_ID) != null) {
delegate.getStrings().add(reference.getProperty(Constants.SERVICE_ID).toString());
}
}
}
}
return delegate.complete(session, commandLine, candidates);
}
Aggregations