Package org.orekit.data
Class AbstractListCrawler<T>
- java.lang.Object
-
- org.orekit.data.AbstractListCrawler<T>
-
- Type Parameters:
T
- The type of resource, e.g. File or URL.
- All Implemented Interfaces:
DataProvider
- Direct Known Subclasses:
FilesListCrawler
,NetworkCrawler
public abstract class AbstractListCrawler<T> extends Object implements DataProvider
Provider for data files defined in a list.All
registered
filters
are applied.Zip archives entries are supported recursively.
- Since:
- 10.1
- Author:
- Luc Maisonobe
- See Also:
DataProvidersManager
,NetworkCrawler
,FilesListCrawler
-
-
Field Summary
-
Fields inherited from interface org.orekit.data.DataProvider
ZIP_ARCHIVE_PATTERN
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractListCrawler(T... inputs)
Build a data classpath crawler.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
AbstractListCrawler
@SafeVarargs protected AbstractListCrawler(T... inputs)
Build a data classpath crawler.- Parameters:
inputs
- list of inputs (may be empty ifaddInput
is called later)
-
-
Method Detail
-
addInput
public void addInput(T input)
Add an input to the supported list.- Parameters:
input
- input to add
-
getInputs
public List<T> getInputs()
Get the list of inputs supported by the instance.- Returns:
- unmodifiable view of the list of inputs supported by the instance
-
getCompleteName
protected abstract String getCompleteName(T input)
Get the complete name of a input.- Parameters:
input
- input to consider- Returns:
- complete name of the input
-
getBaseName
protected abstract String getBaseName(T input)
Get the base name of an input.- Parameters:
input
- input to consider- Returns:
- base name of the input
-
getZipJarCrawler
protected abstract ZipJarCrawler getZipJarCrawler(T input)
Get a zip/jar crawler for an input.- Parameters:
input
- input to consider- Returns:
- zip/jar crawler for an input
-
getStream
protected abstract InputStream getStream(T input) throws IOException
Get the stream to read from an input.- Parameters:
input
- input to read from- Returns:
- stream to read the content of the input
- Throws:
IOException
- if the input cannot be opened for reading
-
feed
public boolean feed(Pattern supported, DataLoader visitor, DataProvidersManager manager)
Feed a data file loader by browsing the data collection.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 thedata loader
.- Specified by:
feed
in interfaceDataProvider
- Parameters:
supported
- pattern for file names supported by the visitorvisitor
- data file visitor to usemanager
- with the filters to apply to the resources.- Returns:
- true if some data has been loaded
-
-