Class AntPatternArchiveEntryFilter
- java.lang.Object
-
- com.levigo.jadice.server.archive.worker.filter.AntPatternArchiveEntryFilter
-
- All Implemented Interfaces:
ArchiveEntryFilter
public class AntPatternArchiveEntryFilter extends Object implements ArchiveEntryFilter
Filters file entries depending on the provided filter rules (ant pattern).- Since:
- jadice server 5.7.1.0
-
-
Constructor Summary
Constructors Constructor Description AntPatternArchiveEntryFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(String dir, String name, long size)
Tests if a specified archive entry should be extracted.static boolean
antMatches(List<String> rules, String name, org.springframework.util.AntPathMatcher antPathMatcher)
Match rules against a given filenameorg.springframework.util.AntPathMatcher
getAntPathMatcher()
List<String>
getAntPatternFilterRules()
URI
getAntPatternFilterRulesURI()
Retrieve the current file name filter URI.static List<String>
readInputStreamByLineAndFilterComments(InputStream inputStream)
Read rules line by line into a rules list.void
setRulesetURI(URI rulesetURI)
Provide a new file name filter URI.
-
-
-
Method Detail
-
accept
public boolean accept(String dir, String name, long size)
Description copied from interface:ArchiveEntryFilter
Tests if a specified archive entry should be extracted.- Specified by:
accept
in interfaceArchiveEntryFilter
- Parameters:
dir
- the directory in which the archive entry was found.name
- the name of the archive entry.size
- the size of the unpacked file (according to the archive metadata)- Returns:
true
iff the archive entry should be extracted.
-
getAntPatternFilterRulesURI
public URI getAntPatternFilterRulesURI()
Retrieve the current file name filter URI.- Returns:
- the current file name filter URI.
-
setRulesetURI
public void setRulesetURI(URI rulesetURI) throws IOException
Provide a new file name filter URI.- Parameters:
rulesetURI
- the new file name filter URI.- Throws:
IOException
- if the configuration couldn't be read from the provided URI.
-
readInputStreamByLineAndFilterComments
public static List<String> readInputStreamByLineAndFilterComments(InputStream inputStream)
Read rules line by line into a rules list.- Parameters:
inputStream
- data stream containing the rule set.- Returns:
- parsed rules as list.
-
antMatches
public static boolean antMatches(List<String> rules, String name, org.springframework.util.AntPathMatcher antPathMatcher)
Match rules against a given filename- Parameters:
rules
- the parsed rules from the rule set.name
- the filename.antPathMatcher
- provided antPathMatcher instance. This allows us to use a antPathMatcher instance that already cached some patterns.- Returns:
true
if a rule matches for the given file name, otherwisefalse
.
-
getAntPathMatcher
public org.springframework.util.AntPathMatcher getAntPathMatcher()
-
-