Class RepositoryResourceBundleLoader

java.lang.Object
org.pentaho.reporting.libraries.docbundle.bundleloader.RepositoryResourceBundleLoader
All Implemented Interfaces:
org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader

public class RepositoryResourceBundleLoader extends Object implements org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
A internal resource-bundle loader that handles all requests for loading resources from the current repository.
Author:
Thomas Morgner
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RepositoryResourceBundleLoader(org.pentaho.reporting.libraries.repository.Repository repository, org.pentaho.reporting.libraries.resourceloader.ResourceKey outsideContextKey)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.pentaho.reporting.libraries.resourceloader.ResourceKey
    deriveKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey parent, String path, Map<? extends org.pentaho.reporting.libraries.resourceloader.ParameterKey,? extends Object> factoryKeys)
    Derives a new resource key from the given key.
    org.pentaho.reporting.libraries.resourceloader.ResourceKey
    deserialize(org.pentaho.reporting.libraries.resourceloader.ResourceKey bundleKey, String stringKey)
    Creates a ResourceKey based off the String representation of the key.
    boolean
     
    org.pentaho.reporting.libraries.resourceloader.ResourceKey
     
    int
     
    boolean
     
    boolean
    isSupportedKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
    Checks, whether this resource loader implementation was responsible for creating this key.
    org.pentaho.reporting.libraries.resourceloader.ResourceBundleData
    loadBundle(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
    Tries to load the bundle.
    serialize(org.pentaho.reporting.libraries.resourceloader.ResourceKey bundleKey, org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
    Serializes the resource key to a String representation which can be recreated using the deserialize(ResourceKey) method.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SCHEMA

      public static final String SCHEMA
  • Constructor Details

    • RepositoryResourceBundleLoader

      public RepositoryResourceBundleLoader(org.pentaho.reporting.libraries.repository.Repository repository, org.pentaho.reporting.libraries.resourceloader.ResourceKey outsideContextKey)
  • Method Details

    • loadBundle

      public org.pentaho.reporting.libraries.resourceloader.ResourceBundleData loadBundle(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager, org.pentaho.reporting.libraries.resourceloader.ResourceKey key) throws org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException
      Tries to load the bundle. If the key does not point to a usable resource-bundle, this method returns null. The Exception is only thrown if the bundle is not readable because of IO-Errors.

      A resource-bundle loader should only load the bundle for the key itself, never for any of the derived subkeys. It is the ResourceManager's responsibility to search the key's hierachy for the correct key.

      Specified by:
      loadBundle in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Parameters:
      key - the resource key pointing to the bundle.
      Returns:
      the loaded bundle or null, if the resource was not understood.
      Throws:
      org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException - if something goes wrong.
    • getMainKey

      public org.pentaho.reporting.libraries.resourceloader.ResourceKey getMainKey()
    • isSupportedKey

      public boolean isSupportedKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
      Checks, whether this resource loader implementation was responsible for creating this key.
      Specified by:
      isSupportedKey in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Parameters:
      key - the key that should be tested.
      Returns:
      true, if the key is supported.
    • deriveKey

      public org.pentaho.reporting.libraries.resourceloader.ResourceKey deriveKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey parent, String path, Map<? extends org.pentaho.reporting.libraries.resourceloader.ParameterKey,? extends Object> factoryKeys) throws org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException
      Derives a new resource key from the given key. If neither a path nor new factory-keys are given, the parent key is returned.
      Specified by:
      deriveKey in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Parameters:
      parent - the parent
      path - the derived path (can be null).
      factoryKeys - the optional factory keys (can be null).
      Returns:
      the derived key.
      Throws:
      org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException - if the key cannot be derived for any reason.
    • serialize

      public String serialize(org.pentaho.reporting.libraries.resourceloader.ResourceKey bundleKey, org.pentaho.reporting.libraries.resourceloader.ResourceKey key) throws org.pentaho.reporting.libraries.resourceloader.ResourceException
      Serializes the resource key to a String representation which can be recreated using the deserialize(ResourceKey) method.
      Specified by:
      serialize in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Parameters:
      bundleKey -
      key -
      Returns:
      a String which is a serialized version of the ResourceKey
      Throws:
      org.pentaho.reporting.libraries.resourceloader.ResourceException - indicates an error serializing the resource key
    • deserialize

      public org.pentaho.reporting.libraries.resourceloader.ResourceKey deserialize(org.pentaho.reporting.libraries.resourceloader.ResourceKey bundleKey, String stringKey) throws org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException
      Creates a ResourceKey based off the String representation of the key. The String should have been created using the serialize method.
      Specified by:
      deserialize in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Parameters:
      bundleKey -
      stringKey - the String representation of the ResourceKey @return a ResourceKey which matches the String representation
      Throws:
      org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException - indicates an error occurred in the creation or deserialization of the ResourceKey
    • isSupportedDeserializer

      public boolean isSupportedDeserializer(String data) throws org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException
      Specified by:
      isSupportedDeserializer in interface org.pentaho.reporting.libraries.resourceloader.ResourceBundleLoader
      Throws:
      org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object