public class RemoteResourceHandler extends AbstractRemoteResourceHandler
It is used to implement atomic or incremental variant to periodically reload remote resources.
AbstractRemoteResourceHandler.AtomicTupleReference
atomicTupleReference, builder, logger, requiredResource, resourceUuid
Constructor and Description |
---|
RemoteResourceHandler(String resourceUuid,
String url,
IResourceBuilder builder,
String cron,
boolean requiredResource,
boolean silent,
org.thales.punch.libraries.metrics.api.IMetricContext mc)
Ctor
|
Modifier and Type | Method and Description |
---|---|
protected static InputStreamReader |
getFileStream(String path) |
protected static Tuple |
getResourceFromFile(String resourceUrl,
IResourceBuilder builder) |
protected static Tuple |
getResourceFromHttp(String resourceUrl,
IResourceBuilder builder) |
void |
reload() |
static Tuple |
testGetResourceFromFile(String resourceUrl,
IResourceBuilder builder)
Test method to fetch files.
|
clear, get, loadingFailures, loadingSuccess, run, start, startLoading, stop, stopLoading
public RemoteResourceHandler(String resourceUuid, String url, IResourceBuilder builder, String cron, boolean requiredResource, boolean silent, org.thales.punch.libraries.metrics.api.IMetricContext mc)
resourceUrl
- the remote or local resource URLcron
- the CRON expression. If null no thread is launched.builder
- the resource builder in charge of transforming the loaded resourcesrequiredResource
- true to make it mandatory to load the resource firstmc
- the metrics contextprotected static Tuple getResourceFromHttp(String resourceUrl, IResourceBuilder builder) throws org.apache.http.client.ClientProtocolException, IOException
org.apache.http.client.ClientProtocolException
IOException
protected static InputStreamReader getFileStream(String path) throws IOException
IOException
protected static Tuple getResourceFromFile(String resourceUrl, IResourceBuilder builder) throws IOException
resourceUrl
- the url of a resource file.builder
- the resource builderIOException
public static Tuple testGetResourceFromFile(String resourceUrl, IResourceBuilder builder) throws IOException
resourceUrl
- builder
- IOException
public void reload() throws IOException
reload
in class AbstractRemoteResourceHandler
IOException
Copyright © 2023. All rights reserved.