|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.util.velocity.ConfigurableResourceManager
public class ConfigurableResourceManager
Class to manage the text resource for the Velocity Runtime.
This is a copy of the Velocity 1.5 ResourceManagerImpl with the
following changes for Confluence:
getResource(java.lang.String, int, java.lang.String) method
getLoaderNameForResource(String) is more useful. It returns the ID of the loader rather than the class name
Ideally we would replace the entire implementation, making use of a richer resource loader interface.
| Nested Class Summary | |
|---|---|
protected static interface |
ConfigurableResourceManager.ResourceFactory
Factory methods for Velocity resource objects |
| Field Summary | |
|---|---|
protected org.apache.velocity.runtime.resource.ResourceCache |
globalCache
Object implementing ResourceCache to be our resource manager's Resource cache. |
protected org.apache.velocity.runtime.log.Log |
log
Logging. |
static int |
RESOURCE_CONTENT
A static content resource. |
static int |
RESOURCE_TEMPLATE
A template resources. |
protected List<org.apache.velocity.runtime.resource.loader.ResourceLoader> |
resourceLoaders
The List of templateLoaders that the Runtime will use to locate the InputStream source of a template. |
protected org.apache.velocity.runtime.RuntimeServices |
rsvc
The internal RuntimeServices object. |
| Constructor Summary | |
|---|---|
ConfigurableResourceManager()
|
|
| Method Summary | |
|---|---|
String |
getLoaderNameForResource(String resourceName)
Determines if a template exists, and returns name of the loader that provides it. |
org.apache.velocity.runtime.resource.Resource |
getResource(String resourceName,
int resourceType)
Deprecated. since 2.9 Use getResource(String resourceName, int resourceType, String encoding ) |
org.apache.velocity.runtime.resource.Resource |
getResource(String resourceName,
int resourceType,
String encoding)
Gets the named resource. |
protected ConfigurableResourceManager.ResourceFactory |
getResourceFactory()
Template method for provisioning a ConfigurableResourceManager.ResourceFactory. |
void |
initialize(org.apache.velocity.runtime.RuntimeServices rsvc)
Initialize the ResourceManager. |
protected org.apache.velocity.runtime.resource.Resource |
loadResource(String resourceName,
int resourceType,
String encoding)
Loads a resource from the current set of resource loaders. |
protected org.apache.velocity.runtime.resource.loader.ResourceLoader |
postProcessLoader(org.apache.velocity.runtime.resource.loader.ResourceLoader loader,
org.apache.commons.collections.ExtendedProperties properties)
Template method to allow subclasses to post process and possibly wrap a resource loader before it is added to the loader list. |
protected void |
refreshResource(org.apache.velocity.runtime.resource.Resource resource,
String encoding)
Takes an existing resource, and 'refreshes' it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int RESOURCE_TEMPLATE
public static final int RESOURCE_CONTENT
protected org.apache.velocity.runtime.resource.ResourceCache globalCache
protected final List<org.apache.velocity.runtime.resource.loader.ResourceLoader> resourceLoaders
protected org.apache.velocity.runtime.RuntimeServices rsvc
protected org.apache.velocity.runtime.log.Log log
| Constructor Detail |
|---|
public ConfigurableResourceManager()
| Method Detail |
|---|
public void initialize(org.apache.velocity.runtime.RuntimeServices rsvc)
throws Exception
initialize in interface org.apache.velocity.runtime.resource.ResourceManagerrsvc - The Runtime Services object which is associated with this Resource Manager.
Exception
public org.apache.velocity.runtime.resource.Resource getResource(String resourceName,
int resourceType,
String encoding)
throws org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
Exception
Template to
RESOURCE_TEMPLATE).
The original version of this class logs and rethrows virtually any exception thrown. This logging has been removed since these exceptions are often expected.
getResource in interface org.apache.velocity.runtime.resource.ResourceManagerresourceName - The name of the resource to retrieve.resourceType - The type of resource (RESOURCE_TEMPLATE, RESOURCE_CONTENT, etc.).encoding - The character encoding to use.
org.apache.velocity.exception.ResourceNotFoundException - if template not found from any available source.
org.apache.velocity.exception.ParseErrorException - if template cannot be parsed due to syntax (or other) error.
Exception - if a problem in parse
protected org.apache.velocity.runtime.resource.Resource loadResource(String resourceName,
int resourceType,
String encoding)
throws org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
Exception
resourceName - The name of the resource to retrieve.resourceType - The type of resource (RESOURCE_TEMPLATE, RESOURCE_CONTENT, etc.).encoding - The character encoding to use.
org.apache.velocity.exception.ResourceNotFoundException - if template not found from any available source.
org.apache.velocity.exception.ParseErrorException - if template cannot be parsed due to syntax (or other) error.
Exception - if a problem in parse
protected void refreshResource(org.apache.velocity.runtime.resource.Resource resource,
String encoding)
throws org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
Exception
resource - resource to refreshencoding - character encoding of the resource to refresh.
org.apache.velocity.exception.ResourceNotFoundException - if template not found from current source for this Resource
org.apache.velocity.exception.ParseErrorException - if template cannot be parsed due to syntax (or other) error.
Exception - if a problem in parse
public org.apache.velocity.runtime.resource.Resource getResource(String resourceName,
int resourceType)
throws org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
Exception
getResource(String resourceName, int resourceType, String encoding )
Template to
RESOURCE_TEMPLATE).
resourceName - The name of the resource to retrieve.resourceType - The type of resource (RESOURCE_TEMPLATE, RESOURCE_CONTENT, etc.).
org.apache.velocity.exception.ResourceNotFoundException - if template not found from any available source.
org.apache.velocity.exception.ParseErrorException - if template cannot be parsed due to syntax (or other) error.
Exception - if a problem in parsepublic String getLoaderNameForResource(String resourceName)
getLoaderNameForResource in interface org.apache.velocity.runtime.resource.ResourceManagerresourceName - Name of template or content resource
protected org.apache.velocity.runtime.resource.loader.ResourceLoader postProcessLoader(org.apache.velocity.runtime.resource.loader.ResourceLoader loader,
org.apache.commons.collections.ExtendedProperties properties)
loader - Resource loader to processproperties - Configured properties for the resource loader
protected ConfigurableResourceManager.ResourceFactory getResourceFactory()
Template method for provisioning a ConfigurableResourceManager.ResourceFactory. Subclasses may customise this factory where
necessary.
This implementation returns a strategy that delegates to the default Velocity resource factory methods.
ConfigurableResourceManager.DefaultResourceFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||