T
- The type of resource, e.g. File or URL.public abstract class AbstractListCrawler<T> extends Object implements DataProvider
All registered
filters
are applied.
Zip archives entries are supported recursively.
DataProvidersManager
,
NetworkCrawler
,
FilesListCrawler
ZIP_ARCHIVE_PATTERN
Modifier | Constructor and Description |
---|---|
protected |
AbstractListCrawler(T... inputs)
Build a data classpath crawler.
|
Modifier and Type | Method and Description |
---|---|
void |
addInput(T input)
Add an input to the supported list.
|
boolean |
feed(Pattern supported,
DataLoader visitor,
DataProvidersManager manager)
Feed a data file loader by browsing the data collection.
|
protected abstract String |
getBaseName(T input)
Get the base name of an input.
|
protected abstract String |
getCompleteName(T input)
Get the complete name of a input.
|
List<T> |
getInputs()
Get the list of inputs supported by the instance.
|
protected abstract InputStream |
getStream(T input)
Get the stream to read from an input.
|
protected abstract ZipJarCrawler |
getZipJarCrawler(T input)
Get a zip/jar crawler for an input.
|
@SafeVarargs protected AbstractListCrawler(T... inputs)
inputs
- list of inputs (may be empty if addInput
is called later)public void addInput(T input)
input
- input to addpublic List<T> getInputs()
protected abstract String getCompleteName(T input)
input
- input to considerprotected abstract String getBaseName(T input)
input
- input to considerprotected abstract ZipJarCrawler getZipJarCrawler(T input)
input
- input to considerprotected abstract InputStream getStream(T input) throws IOException
input
- input to read fromIOException
- if the input cannot be opened for readingpublic boolean feed(Pattern supported, DataLoader visitor, DataProvidersManager manager)
The method crawls all files referenced in the instance (for example all files in a directories tree) and for each file supported by the file loader it asks the file loader to load it.
If the method completes without exception, then the data loader
is considered to have been fed successfully and the top level
data providers manager
will return
immediately without attempting to use the next configured providers.
If the method completes abruptly with an exception, then the top level
data providers manager
will try to use
the next configured providers, in case another one can feed the
data loader
.
feed
in interface DataProvider
supported
- pattern for file names supported by the visitorvisitor
- data file visitor to usemanager
- with the filters to apply to the resources.Copyright © 2002-2022 CS GROUP. All rights reserved.