UpdatePolicy
loads/updates the resources from arbitrary locations via okhttp3.OkHttpClient and stores them to the
format file cache. Default loading tasks can be configured within the javamoney.properties
file.
LoaderConfigurator, okhttp3.OkHttpClient
| Modifier and Type | Field and Description |
|---|---|
| private static final ResourceCache | CACHE
The local resource cache, to allow keeping current data on the local system. |
| private OkHttpLoaderServiceFacade | |
| private final ExecutorService | executors
The thread pool used for loading of data, triggered by the timer. |
| private final LoaderListener | |
| private static final Logger | LOG
Logger used. |
| private final Map | resources
The data resources managed by this instance. |
| private volatile Timer | timer
The timer used for schedules. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLoaderListener(LoaderService.
Implements org. Add a |
| public InputStream | getData(String resourceId)
Implements org. Access the input stream of the given data resource. |
| pack-priv static ResourceCache | |
| public Set | getResourceIds()
Implements org. Get a |
| public Map | getUpdateConfiguration(String resourceId)
Implements org. Get the update configuration for the given dataId. |
| public LoaderService. | getUpdatePolicy(String resourceId)
Implements org. Get the |
| pack-priv void | initialize()
This method reads initial loads from the javamoney.properties and installs the according timers. |
| public boolean | isResourceRegistered(String resourceId)
Implements org. Allows to check if a data resource with the given dataId is registered. |
| public boolean | loadData(String resourceId)
Implements org. Explicitly triggers the remote loading of the registered data, regardless
of its current |
| public Future | loadDataAsync(final String resourceId)
Implements org. Explicitly asynchronously triggers the remote loading of the registered
data, regardless of its current |
| public boolean | loadDataLocal(String resourceId)
Implements org. Explicitly triggers the loading of the registered data, regardless of its
current |
| private static ResourceCache | |
| public void | registerAndLoadData(LoadDataInformation loadDataInformation)
Implements org. Programmatically registers a remote resource |
| public void | registerAndLoadData(String resourceId, LoaderService.
Implements org.
|
| public void | registerData(LoadDataInformation loadDataInformation)
Implements org. Programmatically registers a remote resource |
| public void | registerData(String resourceId, LoaderService.
Implements org.
|
| public void | removeLoaderListener(LoaderService.
Implements org. Remove a registered |
| public void | resetData(String resourceId)
Implements org. Explicitly triggers the resetToFallback (loading of the registered data from the classpath backup resource). |
| public String | |
| public void |
| CACHE | back to summary |
|---|---|
| private static final ResourceCache CACHE The local resource cache, to allow keeping current data on the local system. | |
| defaultLoaderServiceFacade | back to summary |
|---|---|
| private OkHttpLoaderServiceFacade defaultLoaderServiceFacade | |
| executors | back to summary |
|---|---|
| private final ExecutorService executors The thread pool used for loading of data, triggered by the timer. | |
| listener | back to summary |
|---|---|
| private final LoaderListener listener The registered | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG Logger used. | |
| resources | back to summary |
|---|---|
| private final Map<String, LoadableHttpResource> resources The data resources managed by this instance. | |
| timer | back to summary |
|---|---|
| private volatile Timer timer The timer used for schedules. | |
| OkHttpLoaderService | back to summary |
|---|---|
| public OkHttpLoaderService() Constructor, initializing from config. | |
| addLoaderListener | back to summary |
|---|---|
| public void addLoaderListener(LoaderService. Implements org. Doc from org. Add a
| |
| getData | back to summary |
|---|---|
| public InputStream getData(String resourceId) throws IOException Implements org. Doc from org. Access the input stream of the given data resource. This method is called by the modules that depend on the given data item. The method always returns the most current data, either from the classpath or the local cache, depending which flavors are available and recently updated. The method must be thread safe and can be accessed in parallel. Hereby it is possible that, when an intermediate update of the data by update occurs, that different input stream content is returned.
| |
| getResourceCache | back to summary |
|---|---|
| pack-priv static ResourceCache getResourceCache() Get the resource cache loaded.
| |
| getResourceIds | back to summary |
|---|---|
| public Set Implements org. Doc from org. Get a
| |
| getUpdateConfiguration | back to summary |
|---|---|
| public Map Implements org. Doc from org. Get the update configuration for the given dataId.
| |
| getUpdatePolicy | back to summary |
|---|---|
| public LoaderService. Implements org. Doc from org. Get the
| |
| initialize | back to summary |
|---|---|
| pack-priv void initialize() This method reads initial loads from the javamoney.properties and installs the according timers. | |
| isResourceRegistered | back to summary |
|---|---|
| public boolean isResourceRegistered(String resourceId) Implements org. Doc from org. Allows to check if a data resource with the given dataId is registered.
| |
| loadData | back to summary |
|---|---|
| public boolean loadData(String resourceId) Implements org. Doc from org. Explicitly triggers the remote loading of the registered data, regardless
of its current
| |
| loadDataAsync | back to summary |
|---|---|
| public Future Implements org. Doc from org. Explicitly asynchronously triggers the remote loading of the registered
data, regardless of its current
| |
| loadDataLocal | back to summary |
|---|---|
| public boolean loadDataLocal(String resourceId) Implements org. Doc from org. Explicitly triggers the loading of the registered data, regardless of its
current
| |
| loadResourceCache | back to summary |
|---|---|
| private static ResourceCache loadResourceCache() Loads the cache to be used.
| |
| registerAndLoadData | back to summary |
|---|---|
| public void registerAndLoadData(LoadDataInformation loadDataInformation) Implements org. Doc from org. Programmatically registers a remote resource
| |
| registerAndLoadData | back to summary |
|---|---|
| public void registerAndLoadData(String resourceId, LoaderService. Implements org.
| |
| registerData | back to summary |
|---|---|
| public void registerData(LoadDataInformation loadDataInformation) Implements org. Doc from org. Programmatically registers a remote resource
| |
| registerData | back to summary |
|---|---|
| public void registerData(String resourceId, LoaderService. Implements org.
| |
| removeLoaderListener | back to summary |
|---|---|
| public void removeLoaderListener(LoaderService. Implements org. Doc from org. Remove a registered
| |
| resetData | back to summary |
|---|---|
| public void resetData(String resourceId) throws IOException Implements org. Doc from org. Explicitly triggers the resetToFallback (loading of the registered data from the classpath backup resource).
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| unload | back to summary |
|---|---|
| public void unload(String resourceId) Removes a resource managed.
| |