From d25003ee40fe824091bb15c3c6c5d73a5c681762 Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Thu, 8 Dec 2011 20:10:41 +0000 Subject: [PATCH] Merge -r 1186959:1186960 from trunk to branch. FIXES: HADOOP-7758 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1212080 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop-common/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/fs/GlobFilter.java | 28 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index fc69a3b095e..93347cc5be4 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -36,6 +36,8 @@ Release 0.23.1 - Unreleased HADOOP-6886. LocalFileSystem Needs createNonRecursive API. (Nicolas Spiegelberg and eli via eli) + HADOOP-7758. Make GlobFilter class public. (tucu) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java index b5c04f004f2..5afa9e911d7 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobFilter.java @@ -21,8 +21,15 @@ package org.apache.hadoop.fs; import java.util.regex.PatternSyntaxException; import java.io.IOException; - // A class that could decide if a string matches the glob or not -class GlobFilter implements PathFilter { +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; + +/** + * A filter for POSIX glob pattern with brace expansions. + */ +@InterfaceAudience.Public +@InterfaceStability.Evolving +public class GlobFilter implements PathFilter { private final static PathFilter DEFAULT_FILTER = new PathFilter() { public boolean accept(Path file) { return true; @@ -32,11 +39,24 @@ class GlobFilter implements PathFilter { private PathFilter userFilter = DEFAULT_FILTER; private GlobPattern pattern; - GlobFilter(String filePattern) throws IOException { + /** + * Creates a glob filter with the specified file pattern. + * + * @param filePattern the file pattern. + * @throws IOException thrown if the file pattern is incorrect. + */ + public GlobFilter(String filePattern) throws IOException { init(filePattern, DEFAULT_FILTER); } - GlobFilter(String filePattern, PathFilter filter) throws IOException { + /** + * Creates a glob filter with the specified file pattern and an user filter. + * + * @param filePattern the file pattern. + * @param filter user filter in addition to the glob pattern. + * @throws IOException thrown if the file pattern is incorrect. + */ + public GlobFilter(String filePattern, PathFilter filter) throws IOException { init(filePattern, filter); }