public class DefaultResourceManagerBackend extends java.lang.Object implements ResourceManagerBackend
Constructor and Description |
---|
DefaultResourceManagerBackend() |
Modifier and Type | Method and Description |
---|---|
Resource |
create(ResourceManager frontEnd,
ResourceData data,
ResourceKey context,
java.lang.Class[] target) |
ResourceKey |
createKey(java.lang.Object data,
java.util.Map parameters) |
ResourceKey |
deriveKey(ResourceKey parent,
java.lang.String path,
java.util.Map parameters)
Derives a new key from the given resource-key.
|
ResourceKey |
deserialize(ResourceKey bundleKey,
java.lang.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) |
java.lang.String |
serialize(ResourceKey bundleKey,
ResourceKey key)
Creates a String version of the
ResourceKey that can be deserialized with the
deserialize() method. |
java.net.URL |
toURL(ResourceKey key) |
public ResourceKey createKey(java.lang.Object data, java.util.Map parameters) throws ResourceKeyCreationException
createKey
in interface ResourceManagerBackend
ResourceKeyCreationException
public ResourceKey deriveKey(ResourceKey parent, java.lang.String path, java.util.Map parameters) throws ResourceKeyCreationException
deriveKey
in interface ResourceManagerBackend
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.ResourceKeyCreationException
- if deriving the key failed.public java.net.URL toURL(ResourceKey key)
toURL
in interface ResourceManagerBackend
public Resource create(ResourceManager frontEnd, ResourceData data, ResourceKey context, java.lang.Class[] target) throws ResourceLoadingException, ResourceCreationException
create
in interface ResourceManagerBackend
ResourceLoadingException
ResourceCreationException
public boolean isResourceUnchanged(ResourceManager frontEnd, Resource resource) throws ResourceLoadingException
isResourceUnchanged
in interface ResourceManagerBackend
ResourceLoadingException
public ResourceBundleData loadResourceBundle(ResourceManager frontEnd, ResourceKey key) throws ResourceLoadingException
loadResourceBundle
in interface ResourceManagerBackend
key
- the resource-key.ResourceLoadingException
- if an error occured.public ResourceData loadRawData(ResourceManager frontEnd, ResourceKey key) throws UnrecognizedLoaderException, ResourceLoadingException
loadRawData
in interface ResourceManagerBackend
UnrecognizedLoaderException
ResourceLoadingException
public void registerDefaultFactories()
registerDefaultFactories
in interface ResourceManagerBackend
public void registerDefaultLoaders()
registerDefaultLoaders
in interface ResourceManagerBackend
public void registerBundleLoader(ResourceBundleLoader loader)
registerBundleLoader
in interface ResourceManagerBackend
public void registerLoader(ResourceLoader loader)
registerLoader
in interface ResourceManagerBackend
public void registerFactory(ResourceFactory factory)
registerFactory
in interface ResourceManagerBackend
public ResourceKey deserialize(ResourceKey bundleKey, java.lang.String serializedKey) throws ResourceKeyCreationException
ResourceKey
into an actual ResourceKey
by locating the proper ResourceLoader
that can perform the deserialization.deserialize
in interface ResourceManagerBackend
bundleKey
- serializedKey
- the String serialized key to be deserialized @returns the ResourceKey
that has been deserializedResourceKeyCreationException
public java.lang.String serialize(ResourceKey bundleKey, ResourceKey key) throws ResourceException
ResourceKey
that can be deserialized with the
deserialize()
method.serialize
in interface ResourceManagerBackend
bundleKey
- key
- @throw ResourceException indicates an error trying to serialize the keyResourceException