use of alluxio.conf.AlluxioProperties in project alluxio by Alluxio.
the class ShowCommand method run.
@Override
public int run(CommandLine cl) throws IOException {
String targetPath = cl.getArgs()[0];
Configuration configuration = mMetaConfigClient.getConfiguration(GetConfigurationPOptions.getDefaultInstance());
if (cl.hasOption(ALL_OPTION_NAME)) {
Map<String, AlluxioConfiguration> pathConfMap = new HashMap<>();
configuration.getPathConf().forEach((path, conf) -> {
AlluxioProperties properties = new AlluxioProperties();
conf.forEach(property -> {
PropertyKey key = PropertyKey.fromString(property.getName());
properties.set(key, property.getValue());
});
pathConfMap.put(path, new InstancedConfiguration(properties));
});
PathConfiguration pathConf = PathConfiguration.create(pathConfMap);
AlluxioURI targetUri = new AlluxioURI(targetPath);
List<PropertyKey> propertyKeys = new ArrayList<>(pathConf.getPropertyKeys(targetUri));
propertyKeys.sort(Comparator.comparing(PropertyKey::getName));
propertyKeys.forEach(key -> {
pathConf.getConfiguration(targetUri, key).ifPresent(conf -> {
mPrintStream.println(format(key.getName(), conf.get(key)));
});
});
} else if (configuration.getPathConf().containsKey(targetPath)) {
List<Property> properties = configuration.getPathConf().get(targetPath);
properties.sort(Comparator.comparing(Property::getName));
properties.forEach(property -> {
mPrintStream.println(format(property.getName(), property.getValue()));
});
}
return 0;
}
Aggregations