protected ClusterManager clusterManager;
protected GroupManager groupManager;
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
Map<String, Group> groups = groupManager.listGroups();
if (groups != null && !groups.isEmpty()) {
for (String groupName : groups.keySet()) {
Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP + Configurations.SEPARATOR + groupName);
if (configurationTable != null && !configurationTable.isEmpty()) {
for (String pid : configurationTable.keySet()) {
if (delegate.getStrings() != null && !delegate.getStrings().contains(pid)) {
delegate.getStrings().add(pid);
}
}
}
}
}
} catch (Exception e) {
// Ignore
}
return delegate.complete(buffer, cursor, candidates);
}