protected ClusterManager clusterManager;
protected GroupManager groupManager;
@Override
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> clusterConfigurations = clusterManager.getMap(Constants.CONFIGURATION_MAP + Configurations.SEPARATOR + groupName);
if (clusterConfigurations != null && !clusterConfigurations.isEmpty()) {
for (String clusterConfiguration : clusterConfigurations.keySet()) {
if (delegate.getStrings() != null && !delegate.getStrings().contains(clusterConfiguration)) {
delegate.getStrings().add(clusterConfiguration);
}
}
}
}
}
} catch (Exception e) {
// nothing to do
}
return delegate.complete(buffer, cursor, candidates);
}