Class LocalFetcher
- All Implemented Interfaces:
Configurable<LocalFetcherConfig>,EventListener<Event>,Fetcher,EventListener,Consumer<Event>
Fetcher for a local file system, backed by the JDK's default
FileSystemProvider. Mounted file systems and
mapped drives not requiring special configuration to access can also be
considered "local". Paths starting with any of the following will be
recognized as local file system:
file:///some/directoryfile:///C:/some/directory/some/directoryC:\some\directoryC:/some/directory
Access Control List (ACL)
When asked to (see LocalFetcherConfig.setAcl(AclFetchMode)), this
fetcher writes who may read each file in the standard
crawler.acl field:
- Windows: the file's ACL, inherited entries included. An entry allowing or denying the read-data right is an allow or a deny.
- Linux and macOS: the owner, group and mode bits and, with
AclFetchMode.EXTENDED, the file's extended ACL (read from the operating system through JNA). Apathlevel says who may go through every folder above the file, which reading it also needs. Users and groups are numbers (uid, gid) of the directoryunix:<host>, with their names.
When extended ACLs cannot be read on the host, one warning is logged for the crawl and the files' ACLs are partial.
Archive files as file systems
Archive files (zip, tar, jar, etc.) are no longer handled by this fetcher.
Use ArchiveFetcher
instead, which supports both local and remote archives and provides
credential configuration for inner remote file systems.
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptRequest(@NonNull FetchRequest fetchRequest) Optional method for subclasses to override when in need for additional acceptance logic beyond reference filters (which this abstract class provides).protected booleanbooleanprotected voidfetcherShutdown(CrawlerSession crawler) Invoked once per fetcher when the crawler ends.protected voidfetchMetadata(Doc doc, @NonNull Path path, @NonNull BasicFileAttributes attrs) inthashCode()protected PathresolvePath(String reference) Resolves a crawler reference (as found onDoc.getReference()) into a NIO.2Path.toString()Methods inherited from class com.norconex.crawler.fs.fetch.impl.AbstractNioFetcher
fetch, fetchChildPaths, fetchContent, fetchFileObject, fetchFolderMetadata, getOrOpenFileSystemMethods inherited from class com.norconex.crawler.core.fetch.AbstractFetcher
accept, accept, fetcherStartup
-
Constructor Details
-
LocalFetcher
public LocalFetcher()
-
-
Method Details
-
acceptRequest
Description copied from class:AbstractFetcherOptional method for subclasses to override when in need for additional acceptance logic beyond reference filters (which this abstract class provides). This method is only invoked if there are no reference filters configured on this class, or all of them accepts the request document. Default implementation does nothing (always returntrue).- Overrides:
acceptRequestin classAbstractFetcher<LocalFetcherConfig>- Parameters:
fetchRequest- the fetch request to evaluate (nevernull)- Returns:
trueif accepted
-
resolvePath
Description copied from class:AbstractNioFetcherResolves a crawler reference (as found onDoc.getReference()) into a NIO.2Path.- Specified by:
resolvePathin classAbstractNioFetcher<LocalFetcherConfig>- Parameters:
reference- the reference to resolve- Returns:
- the resolved path
-
fetcherShutdown
Description copied from class:AbstractFetcherInvoked once per fetcher when the crawler ends. Default implementation does nothing.- Overrides:
fetcherShutdownin classAbstractNioFetcher<LocalFetcherConfig>- Parameters:
crawler- crawler
-
fetchMetadata
protected void fetchMetadata(Doc doc, @NonNull @NonNull Path path, @NonNull @NonNull BasicFileAttributes attrs) throws IOException - Overrides:
fetchMetadatain classAbstractNioFetcher<LocalFetcherConfig>- Throws:
IOException
-
toString
- Overrides:
toStringin classAbstractNioFetcher<LocalFetcherConfig>
-
equals
- Overrides:
equalsin classAbstractNioFetcher<LocalFetcherConfig>
-
canEqual
- Overrides:
canEqualin classAbstractNioFetcher<LocalFetcherConfig>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractNioFetcher<LocalFetcherConfig>
-
getConfiguration
-