Class FileSystemFetcher

java.lang.Object
org.apache.tika.pipes.fetcher.AbstractFetcher
org.apache.tika.pipes.fetcher.fs.FileSystemFetcher
All Implemented Interfaces:
Initializable, Fetcher

public class FileSystemFetcher extends AbstractFetcher implements Initializable
  • Constructor Details

    • FileSystemFetcher

      public FileSystemFetcher()
    • FileSystemFetcher

      public FileSystemFetcher(FileSystemFetcherConfig fileSystemFetcherConfig)
  • Method Details

    • fetch

      public InputStream fetch(String fetchKey, Metadata metadata, ParseContext parseContext) throws IOException, TikaException
      Specified by:
      fetch in interface Fetcher
      Throws:
      IOException
      TikaException
    • getBasePath

      public Path getBasePath()
      Returns:
      the basePath or null if no base path was set
    • setBasePath

      @Field public void setBasePath(String basePath)
      Default behavior si that clients will send in relative paths, this must be set to allow this fetcher to fetch the full path.
      Parameters:
      basePath -
    • setExtractFileSystemMetadata

      @Field public void setExtractFileSystemMetadata(boolean extractFileSystemMetadata)
      Extract file system metadata (created, modified, accessed) when fetching file. The default is false.
      Parameters:
      extractFileSystemMetadata -
    • setAllowAbsolutePaths

      @Field public void setAllowAbsolutePaths(boolean allowAbsolutePaths)
      If true, allows fetchKey to be an absolute path when basePath is not set. This explicitly acknowledges the security risk of unrestricted file access. The default is false.
      Parameters:
      allowAbsolutePaths -
    • isAllowAbsolutePaths

      public boolean isAllowAbsolutePaths()
    • initialize

      public void initialize(Map<String,Param> params) throws TikaConfigException
      Specified by:
      initialize in interface Initializable
      Parameters:
      params - params to use for initialization
      Throws:
      TikaConfigException
    • checkInitialization

      public void checkInitialization(InitializableProblemHandler problemHandler) throws TikaConfigException
      Specified by:
      checkInitialization in interface Initializable
      Parameters:
      problemHandler - if there is a problem and no custom initializableProblemHandler has been configured via Initializable parameters, this is called to respond.
      Throws:
      TikaConfigException