Search in sources :

Example 1 with ConfigurationValueOptions

use of alluxio.conf.ConfigurationValueOptions in project alluxio by Alluxio.

the class ConfigurationUtils method getConfiguration.

/**
 * Gets all configuration properties filtered by the specified scope.
 *
 * @param conf the configuration to use
 * @param scope the scope to filter by
 * @return the properties
 */
public static List<ConfigProperty> getConfiguration(AlluxioConfiguration conf, Scope scope) {
    ConfigurationValueOptions useRawDisplayValue = ConfigurationValueOptions.defaults().useDisplayValue(true);
    List<ConfigProperty> configs = new ArrayList<>();
    List<PropertyKey> selectedKeys = conf.keySet().stream().filter(key -> GrpcUtils.contains(key.getScope(), scope)).filter(key -> key.isValid(key.getName())).collect(toList());
    for (PropertyKey key : selectedKeys) {
        ConfigProperty.Builder configProp = ConfigProperty.newBuilder().setName(key.getName()).setSource(conf.getSource(key).toString());
        if (conf.isSet(key)) {
            configProp.setValue(String.valueOf(conf.get(key, useRawDisplayValue)));
        }
        configs.add(configProp.build());
    }
    return configs;
}
Also used : Arrays(java.util.Arrays) URL(java.net.URL) BiFunction(java.util.function.BiFunction) LoggerFactory(org.slf4j.LoggerFactory) PropertyKey(alluxio.conf.PropertyKey) MetaMasterConfigurationServiceGrpc(alluxio.grpc.MetaMasterConfigurationServiceGrpc) GrpcChannel(alluxio.grpc.GrpcChannel) Map(java.util.Map) Splitter(com.google.common.base.Splitter) ServiceType(alluxio.util.network.NetworkAddressUtils.ServiceType) UnauthenticatedException(alluxio.exception.status.UnauthenticatedException) GrpcServerAddress(alluxio.grpc.GrpcServerAddress) CommandUtils(alluxio.cli.CommandUtils) Set(java.util.Set) ConfigProperty(alluxio.grpc.ConfigProperty) GuardedBy(javax.annotation.concurrent.GuardedBy) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) AlluxioProperties(alluxio.conf.AlluxioProperties) Sets(com.google.common.collect.Sets) FileNotFoundException(java.io.FileNotFoundException) List(java.util.List) Source(alluxio.conf.Source) InstancedConfiguration(alluxio.conf.InstancedConfiguration) RuntimeConstants(alluxio.RuntimeConstants) UnavailableException(alluxio.exception.status.UnavailableException) GetConfigurationPOptions(alluxio.grpc.GetConfigurationPOptions) HashMap(java.util.HashMap) NetworkAddressUtils(alluxio.util.network.NetworkAddressUtils) Scope(alluxio.grpc.Scope) ArrayList(java.util.ArrayList) PathUtils(alluxio.util.io.PathUtils) GetConfigurationPResponse(alluxio.grpc.GetConfigurationPResponse) Lists(com.google.common.collect.Lists) Constants(alluxio.Constants) GrpcUtils(alluxio.grpc.GrpcUtils) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) AlluxioStatusException(alluxio.exception.status.AlluxioStatusException) Nullable(javax.annotation.Nullable) ConfigurationValueOptions(alluxio.conf.ConfigurationValueOptions) Logger(org.slf4j.Logger) Properties(java.util.Properties) PathConfiguration(alluxio.conf.path.PathConfiguration) ExceptionMessage(alluxio.exception.ExceptionMessage) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) Collectors.toList(java.util.stream.Collectors.toList) GrpcChannelBuilder(alluxio.grpc.GrpcChannelBuilder) Preconditions(com.google.common.base.Preconditions) InputStream(java.io.InputStream) ConfigurationValueOptions(alluxio.conf.ConfigurationValueOptions) ConfigProperty(alluxio.grpc.ConfigProperty) ArrayList(java.util.ArrayList) PropertyKey(alluxio.conf.PropertyKey)

Aggregations

Constants (alluxio.Constants)1 RuntimeConstants (alluxio.RuntimeConstants)1 CommandUtils (alluxio.cli.CommandUtils)1 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 AlluxioProperties (alluxio.conf.AlluxioProperties)1 ConfigurationValueOptions (alluxio.conf.ConfigurationValueOptions)1 InstancedConfiguration (alluxio.conf.InstancedConfiguration)1 PropertyKey (alluxio.conf.PropertyKey)1 Source (alluxio.conf.Source)1 PathConfiguration (alluxio.conf.path.PathConfiguration)1 ExceptionMessage (alluxio.exception.ExceptionMessage)1 AlluxioStatusException (alluxio.exception.status.AlluxioStatusException)1 UnauthenticatedException (alluxio.exception.status.UnauthenticatedException)1 UnavailableException (alluxio.exception.status.UnavailableException)1 ConfigProperty (alluxio.grpc.ConfigProperty)1 GetConfigurationPOptions (alluxio.grpc.GetConfigurationPOptions)1 GetConfigurationPResponse (alluxio.grpc.GetConfigurationPResponse)1 GrpcChannel (alluxio.grpc.GrpcChannel)1 GrpcChannelBuilder (alluxio.grpc.GrpcChannelBuilder)1 GrpcServerAddress (alluxio.grpc.GrpcServerAddress)1