Class DataProvidersManager
- java.lang.Object
-
- org.orekit.data.DataProvidersManager
-
public class DataProvidersManager extends Object
This class manages supporteddata providers.This class is the primary point of access for all data loading features. It is used for example to load Earth Orientation Parameters used by IERS frames, to load UTC leap seconds used by time scales, to load planetary ephemerides...
It is user-customizable: users can add their own data providers at will. This allows them for example to use a database or an existing data loading library in order to embed an Orekit enabled application in a global system with its own data handling mechanisms. There is no upper limitation on the number of providers, but often each application will use only a few.
If the list of providers is empty when attempting to
feeda file loader, theaddDefaultProviders()method is called automatically to set up a default configuration. This default configuration contains onedata providerfor each component of the path-like list specified by the java propertyorekit.data.path. See thefeedmethod documentation for further details. The default providers configuration is not set up if the list is not empty. If users want to have both the default providers and additional providers, they must call explicitly theaddDefaultProviders()method.The default configuration uses a predefined set of
data filtersthat already handled gzip-compressed files (recognized by the.gzsuffix), Unix-compressed files (recognized by the.Zsuffix) and Hatanaka compressed RINEX files. Users can access thefilters managerto set up custom filters for handling specific types of filters (decompression, deciphering...).- Author:
- Luc Maisonobe
- See Also:
DirectoryCrawler,ClasspathCrawler
-
-
Field Summary
Fields Modifier and Type Field Description static StringOREKIT_DATA_PATHName of the property defining the root directories or zip/jar files path for default configuration.
-
Constructor Summary
Constructors Constructor Description DataProvidersManager()Build an instance with default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultProviders()Add the default providers configuration.voidaddProvider(DataProvider provider)Add a data provider to the supported list.voidclearLoadedDataNames()Clear the set of data file names that have been loaded.voidclearProviders()Remove all data providers.booleanfeed(String supportedNames, DataLoader loader)Feed a data file loader by browsing all data providers.FiltersManagergetFiltersManager()Get the manager for filters.Set<String>getLoadedDataNames()Get an unmodifiable view of the set of data file names that have been loaded.List<DataProvider>getProviders()Get an unmodifiable view of the list of supported providers.booleanisSupported(DataProvider provider)Check if some provider is supported.DataProviderremoveProvider(DataProvider provider)Remove one provider.voidresetFiltersToDefault()Reset all filters to default.
-
-
-
Field Detail
-
OREKIT_DATA_PATH
public static final String OREKIT_DATA_PATH
Name of the property defining the root directories or zip/jar files path for default configuration.- See Also:
- Constant Field Values
-
-
Method Detail
-
getFiltersManager
public FiltersManager getFiltersManager()
Get the manager for filters.- Returns:
- filters manager
- Since:
- 11.0
-
resetFiltersToDefault
public void resetFiltersToDefault()
Reset all filters to default.This method
clearsthefilter managerand thenaddsback the default filters- Since:
- 11.0
-
addDefaultProviders
public void addDefaultProviders()
Add the default providers configuration.The default configuration contains one
data providerfor each component of the path-like list specified by the java propertyorekit.data.path.If the property is not set or is null, no data will be available to the library (for example no pole corrections will be applied and only predefined UTC steps will be taken into account). No errors will be triggered in this case.
If the property is set, it must contains a list of existing directories or zip/jar archives. One
DirectoryCrawlerinstance will be set up for each directory and oneZipJarCrawlerinstance (configured to look for the archive in the filesystem) will be set up for each zip/jar archive. The list elements in the java property are separated using the standard path separator for the operating system as returned bySystem.getProperty("path.separator"). This standard path separator is ":" on Linux and Unix type systems and ";" on Windows types systems.
-
addProvider
public void addProvider(DataProvider provider)
Add a data provider to the supported list.- Parameters:
provider- data provider to add- See Also:
removeProvider(DataProvider),clearProviders(),isSupported(DataProvider),getProviders()
-
removeProvider
public DataProvider removeProvider(DataProvider provider)
Remove one provider.- Parameters:
provider- provider instance to remove- Returns:
- instance removed (null if the provider was not already present)
- Since:
- 5.1
- See Also:
addProvider(DataProvider),clearProviders(),isSupported(DataProvider),getProviders()
-
clearProviders
public void clearProviders()
Remove all data providers.
-
isSupported
public boolean isSupported(DataProvider provider)
Check if some provider is supported.- Parameters:
provider- provider to check- Returns:
- true if the specified provider instance is already in the supported list
- Since:
- 5.1
- See Also:
addProvider(DataProvider),removeProvider(DataProvider),clearProviders(),getProviders()
-
getProviders
public List<DataProvider> getProviders()
Get an unmodifiable view of the list of supported providers.- Returns:
- unmodifiable view of the list of supported providers
- See Also:
addProvider(DataProvider),removeProvider(DataProvider),clearProviders(),isSupported(DataProvider)
-
getLoadedDataNames
public Set<String> getLoadedDataNames()
Get an unmodifiable view of the set of data file names that have been loaded.The names returned are exactly the ones that were given to the
DataLoader.loadDatamethod.- Returns:
- unmodifiable view of the set of data file names that have been loaded
- See Also:
feed(String, DataLoader),clearLoadedDataNames()
-
clearLoadedDataNames
public void clearLoadedDataNames()
Clear the set of data file names that have been loaded.- See Also:
getLoadedDataNames()
-
feed
public boolean feed(String supportedNames, DataLoader loader)
Feed a data file loader by browsing all data providers.If this method is called with an empty list of providers, a default providers configuration is set up. This default configuration contains only one
data provider: aDirectoryCrawlerinstance that loads data from files located somewhere in a directory hierarchy. This default provider is not added if the list is not empty. If users want to have both the default provider and other providers, they must add it explicitly.The providers are used in the order in which they were
added. As soon as one provider is able to feed the data loader, the loop is stopped. If no provider is able to feed the data loader, then the last error triggered is thrown.- Parameters:
supportedNames- regular expression for file names supported by the visitorloader- data loader to use- Returns:
- true if some data has been loaded
-
-