Example usage for org.apache.hadoop.fs GlobPattern compile

List of usage examples for org.apache.hadoop.fs GlobPattern compile

Introduction

In this page you can find the example usage for org.apache.hadoop.fs GlobPattern compile.

Prototype

public static Pattern compile(String globPattern) 

Source Link

Document

Compile glob pattern string

Usage

From source file:org.apache.gobblin.data.management.retention.profile.ConfigurableGlobDatasetFinder.java

License:Apache License

public ConfigurableGlobDatasetFinder(FileSystem fs, Properties jobProps, Config config) {
    for (String property : requiredProperties()) {
        Preconditions.checkArgument(config.hasPath(property) || config.hasPath(DEPRECATIONS.get(property)),
                String.format("Missing required property %s", property));
    }/*ww  w.ja v  a  2 s. c om*/

    if (ConfigUtils.hasNonEmptyPath(config, DATASET_BLACKLIST_KEY)) {
        this.blacklist = Optional.of(Pattern.compile(config.getString(DATASET_BLACKLIST_KEY)));
    } else if (ConfigUtils.hasNonEmptyPath(config, DATASET_FINDER_BLACKLIST_KEY)) {
        this.blacklist = Optional.of(Pattern.compile(config.getString(DATASET_FINDER_BLACKLIST_KEY)));
    } else {
        this.blacklist = Optional.absent();
    }

    if (ConfigUtils.hasNonEmptyPath(config, DATASET_FINDER_GLOB_BLACKLIST_KEY)) {
        this.globPatternBlacklist = Optional
                .of(GlobPattern.compile(config.getString(DATASET_FINDER_GLOB_BLACKLIST_KEY)));
    } else {
        this.globPatternBlacklist = Optional.absent();
    }

    this.fs = fs;

    Path tmpDatasetPattern;
    if (config.hasPath(DATASET_FINDER_PATTERN_KEY)) {
        tmpDatasetPattern = new Path(config.getString(DATASET_FINDER_PATTERN_KEY));
    } else {
        tmpDatasetPattern = new Path(config.getString(DATASET_PATTERN_KEY));
    }
    this.datasetPattern = tmpDatasetPattern.isAbsolute() ? tmpDatasetPattern
            : new Path(this.fs.getWorkingDirectory(), tmpDatasetPattern);

    this.commonRoot = PathUtils.deepestNonGlobPath(this.datasetPattern);
    this.props = jobProps;
}