org.pentaho.reporting.libraries.resourceloader

Class DefaultResourceManagerBackend

public class DefaultResourceManagerBackend extends Object implements ResourceManagerBackend

Todo: Document Me

Author: Thomas Morgner

Constructor Summary
DefaultResourceManagerBackend()
Method Summary
Resourcecreate(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target)
ResourceKeycreateKey(Object data, Map parameters)
ResourceKeyderiveKey(ResourceKey parent, String path, Map parameters)
Derives a new key from the given resource-key.
ResourceKeydeserialize(ResourceKey bundleKey, String serializedKey)
Converts a serialized version of a ResourceKey into an actual ResourceKey by locating the proper ResourceLoader that 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 the ResourceKey that can be deserialized with the deserialize() method.
URLtoURL(ResourceKey key)

Constructor Detail

DefaultResourceManagerBackend

public DefaultResourceManagerBackend()

Method Detail

create

public Resource create(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target)

createKey

public ResourceKey createKey(Object data, Map parameters)

deriveKey

public ResourceKey deriveKey(ResourceKey parent, String path, Map parameters)
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.

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.

deserialize

public ResourceKey deserialize(ResourceKey bundleKey, String serializedKey)
Converts a serialized version of a ResourceKey into an actual ResourceKey by locating the proper ResourceLoader that can perform the deserialization.

Parameters: bundleKey serializedKey the String serialized key to be deserialized @returns the ResourceKey that has been deserialized

UNKNOWN: ResourceKeyCreationException indicates an error trying to create the ResourceKey from the deserialized version

isResourceUnchanged

public boolean isResourceUnchanged(ResourceManager frontEnd, Resource resource)

loadRawData

public ResourceData loadRawData(ResourceManager frontEnd, ResourceKey key)

loadResourceBundle

public ResourceBundleData loadResourceBundle(ResourceManager frontEnd, ResourceKey key)
Tries to find the first resource-bundle-loader that would be able to process the key.

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.

registerBundleLoader

public void registerBundleLoader(ResourceBundleLoader loader)

registerDefaultFactories

public void registerDefaultFactories()

registerDefaultLoaders

public void registerDefaultLoaders()

registerFactory

public void registerFactory(ResourceFactory factory)

registerLoader

public void registerLoader(ResourceLoader loader)

serialize

public String serialize(ResourceKey bundleKey, ResourceKey key)
Creates a String version of the ResourceKey that can be deserialized with the deserialize() method.

Parameters: bundleKey key @throw ResourceException indicates an error trying to serialize the key

UNKNOWN: NullPointerException indicates the supplied key is null

toURL

public URL toURL(ResourceKey key)