Package org.pentaho.reporting.libraries.resourceloader

# Class DefaultResourceManagerBackend

java.lang.Object
org.pentaho.reporting.libraries.resourceloader.DefaultResourceManagerBackend

All Implemented Interfaces:
  `ResourceManagerBackend`

public class DefaultResourceManagerBackend extends Object implements ResourceManagerBackend
Todo: Document Me

Author:
  Thomas Morgner

## Constructor Summary

Constructors
Constructor
Description
`DefaultResourceManagerBackend()`

## Method Summary

Modifier and Type
Method
Description
`Resource`
`create(ResourceManager frontEnd, ResourceData data, ResourceKey context, Class[] target)`
`ResourceKey`
`createKey(Object data, Map parameters)`
`ResourceKey`
`deriveKey(ResourceKey parent, String path, Map parameters)`
Derives a new key from the given resource-key.
`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.
`boolean`
`isResourceUnchanged(ResourceManager frontEnd, Resource resource)`
`ResourceData`
`loadRawData(ResourceManager frontEnd, ResourceKey key)`
`ResourceBundleData`
`loadResourceBundle(ResourceManager frontEnd, ResourceKey key)`
Tries to find the first resource-bundle-loader that would be able to process the key.
`void`
`registerBundleLoader(ResourceBundleLoader loader)`
`void`
`registerDefaultFactories()`
`void`
`registerDefaultLoaders()`
`void`
`registerFactory(ResourceFactory factory)`
`void`
`registerLoader(ResourceLoader loader)`
`String`
`serialize(ResourceKey bundleKey, ResourceKey key)`
Creates a String version of the `ResourceKey` that can be deserialized with the `deserialize()` method.
`URL`
`toURL(ResourceKey key)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DefaultResourceManagerBackend

public DefaultResourceManagerBackend()

## Method Details

### createKey

public ResourceKey createKey(Object data, Map parameters) throws ResourceKeyCreationException

Specified by:
  `createKey` in interface `ResourceManagerBackend`
Throws:
  `ResourceKeyCreationException`

### deriveKey

public ResourceKey deriveKey(ResourceKey parent, String path, Map 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:
  `deriveKey` in interface `ResourceManagerBackend`
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:
  `toURL` in interface `ResourceManagerBackend`

### create

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

Specified by:
  `create` in interface `ResourceManagerBackend`
Throws:
  `ResourceLoadingException`
  `ResourceCreationException`

### isResourceUnchanged

public boolean isResourceUnchanged(ResourceManager frontEnd, Resource resource) throws ResourceLoadingException

Specified by:
  `isResourceUnchanged` in interface `ResourceManagerBackend`
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 interface `ResourceManagerBackend`
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 interface `ResourceManagerBackend`
Throws:
  `UnrecognizedLoaderException`
  `ResourceLoadingException`

### registerDefaultFactories

public void registerDefaultFactories()

Specified by:
  `registerDefaultFactories` in interface `ResourceManagerBackend`

### registerDefaultLoaders

public void registerDefaultLoaders()

Specified by:
  `registerDefaultLoaders` in interface `ResourceManagerBackend`

### registerBundleLoader

public void registerBundleLoader(ResourceBundleLoader loader)

Specified by:
  `registerBundleLoader` in interface `ResourceManagerBackend`

### registerLoader

public void registerLoader(ResourceLoader loader)

Specified by:
  `registerLoader` in interface `ResourceManagerBackend`

### registerFactory

public void registerFactory(ResourceFactory factory)

Specified by:
  `registerFactory` in interface `ResourceManagerBackend`

### deserialize

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

Specified by:
  `deserialize` in interface `ResourceManagerBackend`
Parameters:
  `bundleKey` -
  `serializedKey` - the String serialized key to be deserialized @returns the `ResourceKey` that has been deserialized
Throws:
  `ResourceKeyCreationException`

### serialize

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

Specified by:
  `serialize` in interface `ResourceManagerBackend`
Parameters:
  `bundleKey` -
  `key` - @throw ResourceException indicates an error trying to serialize the key
Throws:
  `ResourceException`