public interface LoaderService
URIs. Initial version are
loaded from the classpath, or other fallback URL.
This class is used for managing/updating/reloading of data sources, e.g. data streams for exchange rates, additional currency data, historical currency data and so on.
Note: this class is implementation specific and not part of the official JSR's API.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
LoaderService.LoaderListener
Callback that can be registered to be informed, when a data item was
loaded/updated or resetToFallback.
|
static class |
LoaderService.UpdatePolicy
Platform RI: The update policy defines how and when the
LoaderService tries to update the local cache with newest version of
the registered data resources, accessing the configured remote
URIs. |
| Modifier and Type | Method and Description |
|---|---|
void |
addLoaderListener(LoaderService.LoaderListener l,
String... resourceIds)
Add a
LoaderService.LoaderListener callback that is informed when a data
resource was update from remote, or resetToFallback. |
InputStream |
getData(String resourceId)
Access the input stream of the given data resource.
|
Set<String> |
getResourceIds()
Get a
Set of all registered data resource identifiers. |
Map<String,String> |
getUpdateConfiguration(String resourceId)
Get the update configuration for the given dataId.
|
LoaderService.UpdatePolicy |
getUpdatePolicy(String resourceId)
Get the
LoaderService.UpdatePolicy in place for the given dataId. |
boolean |
isResourceRegistered(String resourceId)
Allows to check if a data resource with the given dataId is registered.
|
boolean |
loadData(String resourceId)
Explicitly triggers the remote loading of the registered data, regardless
of its current
LoaderService.UpdatePolicy configured. |
Future<Boolean> |
loadDataAsync(String resourceId)
Explicitly asynchronously triggers the remote loading of the registered
data, regardless of its current
LoaderService.UpdatePolicy configured. |
boolean |
loadDataLocal(String resourceId)
Explicitly triggers the loading of the registered data, regardless of its
current
LoaderService.UpdatePolicy configured, from the fallback/local
resource. |
void |
registerAndLoadData(LoadDataInformation loadDataInformation)
Programmatically registers a remote resource
resourceLocation,
backed up by a classpath resource backupResource, reachable as
dataId and (synchronously) loads the data. |
void |
registerAndLoadData(String resourceId,
LoaderService.UpdatePolicy updatePolicy,
Map<String,String> properties,
LoaderService.LoaderListener loaderListener,
URI backupResource,
URI... resourceLocations)
Deprecated.
|
void |
registerData(LoadDataInformation loadDataInformation)
Programmatically registers a remote resource
resourceLocation,
backed up by a classpath resource backupResource, reachable as
dataId. |
void |
registerData(String resourceId,
LoaderService.UpdatePolicy updatePolicy,
Map<String,String> properties,
LoaderService.LoaderListener loaderListener,
URI backupResource,
URI... resourceLocations)
Deprecated.
|
void |
removeLoaderListener(LoaderService.LoaderListener l,
String... resourceIds)
Remove a registered
LoaderService.LoaderListener callback. |
void |
resetData(String resourceId)
Explicitly triggers the resetToFallback (loading of the registered data from the
classpath backup resource).
|
void registerData(LoadDataInformation loadDataInformation)
resourceLocation,
backed up by a classpath resource backupResource, reachable as
dataId.
resourceId The unique identifier of the resource that must also be used
for accessing the resource, not null.
resourceLocations The remote resource locations, not null.
backupResource The backup resource location in the classpath, not
null.
loaderListener An (optional) LoaderListener to be registered.void registerAndLoadData(LoadDataInformation loadDataInformation)
resourceLocation,
backed up by a classpath resource backupResource, reachable as
dataId and (synchronously) loads the data.
resourceId The unique identifier of the resource that must also be used
for accessing the resource, not null.
resourceLocations The remote resource locations, not null.
backupResource The backup resource location in the classpath, not
null.
loaderListener An (optional) LoaderListener to be registered.@Deprecated void registerAndLoadData(String resourceId, LoaderService.UpdatePolicy updatePolicy, Map<String,String> properties, LoaderService.LoaderListener loaderListener, URI backupResource, URI... resourceLocations)
@Deprecated void registerData(String resourceId, LoaderService.UpdatePolicy updatePolicy, Map<String,String> properties, LoaderService.LoaderListener loaderListener, URI backupResource, URI... resourceLocations)
LoaderService.UpdatePolicy getUpdatePolicy(String resourceId)
LoaderService.UpdatePolicy in place for the given dataId.resourceId - the resource's id, not nullLoaderService.UpdatePolicy, not nullIllegalArgumentException - if no such dataId is available.Map<String,String> getUpdateConfiguration(String resourceId)
resourceId - the dataId, not nullnullIllegalArgumentException - if no such dataId is available.void addLoaderListener(LoaderService.LoaderListener l, String... resourceIds)
LoaderService.LoaderListener callback that is informed when a data
resource was update from remote, or resetToFallback. Passing an empty String or
null sa dataId allows to register a listener for all data
resources registered. loadData(String)
resetData(String)resourceIds - The unique identifiers of the resource, not null.l - The listener to be addedremoveLoaderListener(LoaderListener, String...)void removeLoaderListener(LoaderService.LoaderListener l, String... resourceIds)
LoaderService.LoaderListener callback.resourceIds - The unique identifier of the resource, not null.l - The listener to be removedaddLoaderListener(LoaderListener, String...)boolean isResourceRegistered(String resourceId)
resourceId - The unique identifier of the resource, not null.true, if such a data resource is registered.Set<String> getResourceIds()
Set of all registered data resource identifiers.Set of all registered data resource identifiers, never
null.InputStream getData(String resourceId) throws IOException
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.
resourceId - The unique identifier of the resource, not null.InputStream for reading the data.IOException - if a problem occurred.boolean loadDataLocal(String resourceId)
LoaderService.UpdatePolicy configured, from the fallback/local
resource.resourceId - The unique identifier of the resource, not null.boolean loadData(String resourceId) throws IOException
LoaderService.UpdatePolicy configured.resourceId - The unique identifier of the resource, not null.IOException - if a problem occurred.Future<Boolean> loadDataAsync(String resourceId)
LoaderService.UpdatePolicy configured.resourceId - The unique identifier of the resource, not null.void resetData(String resourceId) throws IOException
resourceId - The unique identifier of the resource, not null.IOException - if a problem occurred.Copyright © 2012-2016 JavaMoney. All Rights Reserved.