T - resource type.public abstract class AbstractCachingXmlProcessor<T> extends Object
Object... params),
instances of this class determine:
resourceLocation(Object...),
resourceParameters(Object...),
resourceCacheKey(Object...).
resource(Object...),
which takes over instantiation, initialization, caching, and other aspects of resource
lifecycle. For resource instantiation step, it calls the createResource(Object...)
method, which is truly resource-type specific and thus declared as abstract
in the given base class.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractCachingXmlProcessor.Loader<S> |
| Modifier and Type | Field and Description |
|---|---|
static String |
RESOURCE_LOCATION |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCachingXmlProcessor(ClassLoader classLoader)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createResource(Object... params)
Creates a ready-to-use resource (e.g.
|
protected abstract ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<T>> |
getCache() |
protected T |
resource(Object... params)
Retrieves from the cache and returns the resource with the given location and
further attributes.
|
protected String |
resourceCacheKey(Object... params)
Extracts (constructs) resource cache key validator/transmogrifier parameters.
|
protected StreamSource |
resourceContent(Object... params)
Loads the resource into memory and returns it as a Stream.
|
protected String |
resourceLocation(Object... params)
Extracts (constructs) resource location from validator/transmogrifier parameters.
|
protected Map<String,Object> |
resourceParameters(Object... params)
Extracts (constructs) resource creation/application parameters from
validator/transmogrifier parameters.
|
public static final String RESOURCE_LOCATION
protected AbstractCachingXmlProcessor(ClassLoader classLoader)
classLoader - class loader, may be null.protected abstract ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<T>> getCache()
protected String resourceLocation(Object... params)
params - validator/transmogrifier parameters.protected String resourceCacheKey(Object... params)
params - validator/transmogrifier parameters.protected Map<String,Object> resourceParameters(Object... params)
params - validator/transmogrifier parameters.null if not found.protected T resource(Object... params) throws Exception
createResource(Object...) and stores it into the cache.
The cache key is a combination of the location and further attributes.
This method MUST be re-entrant, its result MUST be thread-safe.params - validator/transmogrifier parameters.Exceptionprotected abstract T createResource(Object... params)
params - validator/transmogrifier parameters.protected StreamSource resourceContent(Object... params)
params - validator/transmogrifier parameters.Copyright © 2020 Open eHealth Foundation. All rights reserved.