Example usage for org.apache.hadoop.conf Configuration getTrimmedStrings

List of usage examples for org.apache.hadoop.conf Configuration getTrimmedStrings

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration getTrimmedStrings.

Prototype

public String[] getTrimmedStrings(String name, String... defaultValue) 

Source Link

Document

Get the comma delimited values of the name property as an array of Strings, trimmed of the leading and trailing whitespace.

Usage

From source file:org.apache.sentry.hdfs.SentryAuthorizationInfo.java

License:Apache License

public SentryAuthorizationInfo(Configuration conf) throws Exception {
    String[] newPathPrefixes = conf.getTrimmedStrings(SentryAuthorizationConstants.HDFS_PATH_PREFIXES_KEY,
            SentryAuthorizationConstants.HDFS_PATH_PREFIXES_DEFAULT);
    if (newPathPrefixes.length == 0) {
        LOG.warn(// www  . jav  a  2  s. co  m
                "There are not HDFS path prefixes configured in [{}], "
                        + "Sentry authorization won't be enforced on any HDFS location",
                SentryAuthorizationConstants.HDFS_PATH_PREFIXES_KEY);
    } else {
        refreshIntervalMillisec = conf.getInt(SentryAuthorizationConstants.CACHE_REFRESH_INTERVAL_KEY,
                SentryAuthorizationConstants.CACHE_REFRESH_INTERVAL_DEFAULT);
        staleThresholdMillisec = conf.getInt(SentryAuthorizationConstants.CACHE_STALE_THRESHOLD_KEY,
                SentryAuthorizationConstants.CACHE_STALE_THRESHOLD_DEFAULT);
        retryWaitMillisec = conf.getInt(SentryAuthorizationConstants.CACHE_REFRESH_RETRY_WAIT_KEY,
                SentryAuthorizationConstants.CACHE_REFRESH_RETRY_WAIT_DEFAULT);

        LOG.info("Sentry authorization will enforced in the following HDFS locations: [{}]",
                StringUtils.arrayToString(newPathPrefixes));

        setPrefixPaths(newPathPrefixes);
        LOG.info("Refresh interval [{}]ms, retry wait [{}]", refreshIntervalMillisec, retryWaitMillisec);
        LOG.info("stale threshold [{}]ms", staleThresholdMillisec);

        authzPaths = new UpdateableAuthzPaths(newPathPrefixes);
        authzPermissions = new UpdateableAuthzPermissions();
        waitUntil = System.currentTimeMillis();
        lastStaleReport = 0;
        updater = new SentryUpdater(conf, this);
    }
}

From source file:org.apache.slider.core.launch.ClasspathConstructor.java

License:Apache License

/**
 * Get the list of JARs from the YARN settings
 * @param config configuration// w w w. j  av  a2s .  c  om
 */
public List<String> yarnApplicationClasspath(Configuration config) {
    String[] cp = config.getTrimmedStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH);
    return cp != null ? Arrays.asList(cp) : new ArrayList<String>(0);

}