Class DefaultResourceManagerBackend
- java.lang.Object
-
- org.pentaho.reporting.libraries.resourceloader.DefaultResourceManagerBackend
-
- All Implemented Interfaces:
ResourceManagerBackend
public class DefaultResourceManagerBackend extends Object implements ResourceManagerBackend
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceManagerBackend()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resourcecreate(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target)ResourceKeycreateKey(Object data, Map<? extends ParameterKey,?> parameters)ResourceKeyderiveKey(ResourceKey parent, String path, Map<? extends ParameterKey,?> parameters)Derives a new key from the given resource-key.ResourceKeydeserialize(ResourceKey bundleKey, String serializedKey)Converts a serialized version of aResourceKeyinto an actualResourceKeyby locating the properResourceLoaderthat can perform the deserialization.booleanisResourceUnchanged(ResourceManager frontEnd, Resource resource)ResourceDataloadRawData(ResourceManager frontEnd, ResourceKey key)ResourceBundleDataloadResourceBundle(ResourceManager frontEnd, ResourceKey key)Tries to find the first resource-bundle-loader that would be able to process the key.voidregisterBundleLoader(ResourceBundleLoader loader)voidregisterDefaultFactories()voidregisterDefaultLoaders()voidregisterFactory(ResourceFactory factory)voidregisterLoader(ResourceLoader loader)Stringserialize(ResourceKey bundleKey, ResourceKey key)Creates a String version of theResourceKeythat can be deserialized with thedeserialize()method.URLtoURL(ResourceKey key)
-
-
-
Method Detail
-
createKey
public ResourceKey createKey(Object data, Map<? extends ParameterKey,?> parameters) throws ResourceKeyCreationException
- Specified by:
createKeyin interfaceResourceManagerBackend- Throws:
ResourceKeyCreationException
-
deriveKey
public ResourceKey deriveKey(ResourceKey parent, String path, Map<? extends ParameterKey,?> parameters) throws ResourceKeyCreationException
Derives 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:
deriveKeyin 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
public URL toURL(ResourceKey key)
- Specified by:
toURLin interfaceResourceManagerBackend
-
create
public Resource create(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target) throws ResourceLoadingException, ResourceCreationException
- Specified by:
createin interfaceResourceManagerBackend- Throws:
ResourceLoadingExceptionResourceCreationException
-
isResourceUnchanged
public boolean isResourceUnchanged(ResourceManager frontEnd, Resource resource) throws ResourceLoadingException
- Specified by:
isResourceUnchangedin 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:
loadResourceBundlein 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:
loadRawDatain interfaceResourceManagerBackend- Throws:
UnrecognizedLoaderExceptionResourceLoadingException
-
registerDefaultFactories
public void registerDefaultFactories()
- Specified by:
registerDefaultFactoriesin interfaceResourceManagerBackend
-
registerDefaultLoaders
public void registerDefaultLoaders()
- Specified by:
registerDefaultLoadersin interfaceResourceManagerBackend
-
registerBundleLoader
public void registerBundleLoader(ResourceBundleLoader loader)
- Specified by:
registerBundleLoaderin interfaceResourceManagerBackend
-
registerLoader
public void registerLoader(ResourceLoader loader)
- Specified by:
registerLoaderin interfaceResourceManagerBackend
-
registerFactory
public void registerFactory(ResourceFactory factory)
- Specified by:
registerFactoryin interfaceResourceManagerBackend
-
deserialize
public ResourceKey deserialize(ResourceKey bundleKey, String serializedKey) throws ResourceKeyCreationException
Converts a serialized version of aResourceKeyinto an actualResourceKeyby locating the properResourceLoaderthat can perform the deserialization.- Specified by:
deserializein interfaceResourceManagerBackend- Parameters:
bundleKey-serializedKey- the String serialized key to be deserialized @returns theResourceKeythat has been deserialized- Throws:
ResourceKeyCreationException- indicates an error trying to create theResourceKeyfrom the deserialized version
-
serialize
public String serialize(ResourceKey bundleKey, ResourceKey key) throws ResourceException
Creates a String version of theResourceKeythat can be deserialized with thedeserialize()method.- Specified by:
serializein interfaceResourceManagerBackend- Parameters:
bundleKey-key-- Throws:
NullPointerException- indicates the supplied key isnullResourceException
-
-