Class DefaultResourceManagerBackend
java.lang.Object
org.pentaho.reporting.libraries.resourceloader.DefaultResourceManagerBackend
- All Implemented Interfaces:
ResourceManagerBackend
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target) createKey
(Object data, Map<? extends ParameterKey, ?> parameters) deriveKey
(ResourceKey parent, String path, Map<? extends ParameterKey, ?> parameters) Derives a new key from the given resource-key.deserialize
(ResourceKey bundleKey, String serializedKey) Converts a serialized version of aResourceKey
into an actualResourceKey
by locating the properResourceLoader
that can perform the deserialization.boolean
isResourceUnchanged
(ResourceManager frontEnd, Resource resource) loadRawData
(ResourceManager frontEnd, ResourceKey key) loadResourceBundle
(ResourceManager frontEnd, ResourceKey key) Tries to find the first resource-bundle-loader that would be able to process the key.void
void
void
void
registerFactory
(ResourceFactory factory) void
registerLoader
(ResourceLoader loader) serialize
(ResourceKey bundleKey, ResourceKey key) Creates a String version of theResourceKey
that can be deserialized with thedeserialize()
method.toURL
(ResourceKey key)
-
Constructor Details
-
DefaultResourceManagerBackend
public DefaultResourceManagerBackend()
-
-
Method Details
-
createKey
public ResourceKey createKey(Object data, Map<? extends ParameterKey, ?> parameters) throws ResourceKeyCreationException- Specified by:
createKey
in interfaceResourceManagerBackend
- Throws:
ResourceKeyCreationException
-
deriveKey
public ResourceKey deriveKey(ResourceKey parent, String path, Map<? extends ParameterKey, ?> parameters) throws ResourceKeyCreationExceptionDerives a new key from the given resource-key. Only keys for a hierarchical storage system (like file-systems or URLs) can have derived keys. Since LibLoader 0.3.0 only hierarchical keys can be derived. For that, the deriving path must be given as String. The optional parameter-map will be applied to the derived key after the parent's parameters have been copied to the new key. Before trying to derive the key, the system tries to interpret the path as absolute key-value.- Specified by:
deriveKey
in interfaceResourceManagerBackend
- Parameters:
parent
- the parent key, or null to interpret the path as absolute key.path
- the relative path, that is used to derive the key.parameters
- a optional map containing resource-key parameters.- Returns:
- the derived key.
- Throws:
ResourceKeyCreationException
- if deriving the key failed.
-
toURL
- Specified by:
toURL
in interfaceResourceManagerBackend
-
create
public Resource create(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target) throws ResourceLoadingException, ResourceCreationException - Specified by:
create
in interfaceResourceManagerBackend
- Throws:
ResourceLoadingException
ResourceCreationException
-
isResourceUnchanged
public boolean isResourceUnchanged(ResourceManager frontEnd, Resource resource) throws ResourceLoadingException - Specified by:
isResourceUnchanged
in interfaceResourceManagerBackend
- Throws:
ResourceLoadingException
-
loadResourceBundle
public ResourceBundleData loadResourceBundle(ResourceManager frontEnd, ResourceKey key) throws ResourceLoadingException Tries to find the first resource-bundle-loader that would be able to process the key.- Specified by:
loadResourceBundle
in interfaceResourceManagerBackend
- Parameters:
key
- the resource-key.- Returns:
- the resourceloader for that key, or null, if no resource-loader is able to process the key.
- Throws:
ResourceLoadingException
- if an error occured.
-
loadRawData
public ResourceData loadRawData(ResourceManager frontEnd, ResourceKey key) throws UnrecognizedLoaderException, ResourceLoadingException - Specified by:
loadRawData
in interfaceResourceManagerBackend
- Throws:
UnrecognizedLoaderException
ResourceLoadingException
-
registerDefaultFactories
public void registerDefaultFactories()- Specified by:
registerDefaultFactories
in interfaceResourceManagerBackend
-
registerDefaultLoaders
public void registerDefaultLoaders()- Specified by:
registerDefaultLoaders
in interfaceResourceManagerBackend
-
registerBundleLoader
- Specified by:
registerBundleLoader
in interfaceResourceManagerBackend
-
registerLoader
- Specified by:
registerLoader
in interfaceResourceManagerBackend
-
registerFactory
- Specified by:
registerFactory
in interfaceResourceManagerBackend
-
deserialize
public ResourceKey deserialize(ResourceKey bundleKey, String serializedKey) throws ResourceKeyCreationException Converts a serialized version of aResourceKey
into an actualResourceKey
by locating the properResourceLoader
that can perform the deserialization.- Specified by:
deserialize
in interfaceResourceManagerBackend
- Parameters:
bundleKey
-serializedKey
- the String serialized key to be deserialized @returns theResourceKey
that has been deserialized- Throws:
ResourceKeyCreationException
- indicates an error trying to create theResourceKey
from the deserialized version
-
serialize
Creates a String version of theResourceKey
that can be deserialized with thedeserialize()
method.- Specified by:
serialize
in interfaceResourceManagerBackend
- Parameters:
bundleKey
-key
-- Throws:
NullPointerException
- indicates the supplied key isnull
ResourceException
-