Class ExtractResourcesProcessor

java.lang.Object
net.sf.basedb.util.extensions.manager.processor.ExtractResourcesProcessor
All Implemented Interfaces:
ExtensionsFileProcessor

public class ExtractResourcesProcessor
extends Object
implements ExtensionsFileProcessor
A file processor implementation that extracts resources from JAR files. The main target directory must be specified when an instance is constructed. Each processed JAR file is extracted into a subdirectory with the same name as the JAR file. Existing files are always overwritten.

The filter (in the form of a regular expressions pattern) can be specified to limit which files are extracted from the JAR file. The filter is also used to re-write target file names if they need to be different from the file names in the JAR file.

Note! It is recommended that this processor is paired with a ValidAndNewOrModifiedFilter since it is usually no point in extracting resources from invalid extensions.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2019-03-12 07:53:27 +0100 (tis, 12 mars 2019) $
  • Field Details

    • log

      private static final org.slf4j.Logger log
    • mainDir

      private final File mainDir
    • filter

      private final Pattern filter
    • replacement

      private final String replacement
    • results

      private final ProcessResults results
    • numFiles

      private int numFiles
    • numError

      private int numError
    • numTotalExtracted

      private int numTotalExtracted
  • Constructor Details

    • ExtractResourcesProcessor

      public ExtractResourcesProcessor​(File mainDir, ProcessResults results)
      Create a new processor.
      Parameters:
      mainDir - The main directory to where the resources should be extracted
    • ExtractResourcesProcessor

      public ExtractResourcesProcessor​(File mainDir, Pattern filter, String replacement, ProcessResults results)
      Create a new processor.
      Parameters:
      mainDir - The main directory to where the resources should be extracted
      filter - A regular expression filter that must match the file name in the JAR file
      replacement - A replacement string to create a new file name using Matcher.replaceAll(String).
  • Method Details