Class 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 Detail

      • AntPatternArchiveEntryFilter

        public AntPatternArchiveEntryFilter()
    • 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 interface ArchiveEntryFilter
        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, otherwise false.
      • getAntPatternFilterRules

        public List<String> getAntPatternFilterRules()
      • getAntPathMatcher

        public org.springframework.util.AntPathMatcher getAntPathMatcher()