Interface ResourceManager
- All Known Implementing Classes:
ResourceManagerImpl
public interface ResourceManager
Class to manage the text resource for the Velocity
Runtime.
- Version:
- $Id$
- Author:
- Jason van Zyl, Paulo Gaspar, Geir Magnusson Jr.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA static content resource.static final intA template resources. -
Method Summary
Modifier and TypeMethodDescriptiongetLoaderNameForResource(String resourceName) Determines is a template exists, and returns name of the loader that provides it.getResource(String resourceName, int resourceType, String encoding) Gets the named resource.voidInitialize the ResourceManager.
-
Field Details
-
RESOURCE_TEMPLATE
static final int RESOURCE_TEMPLATEA template resources.- See Also:
-
RESOURCE_CONTENT
static final int RESOURCE_CONTENTA static content resource.- See Also:
-
-
Method Details
-
initialize
Initialize the ResourceManager.- Parameters:
rs-
-
getResource
Resource getResource(String resourceName, int resourceType, String encoding) throws ResourceNotFoundException, ParseErrorException Gets the named resource. Returned class type corresponds to specified type (i.e.TemplatetoRESOURCE_TEMPLATE).- Parameters:
resourceName- The name of the resource to retrieve.resourceType- The type of resource (RESOURCE_TEMPLATE,RESOURCE_CONTENT, etc.).encoding- The character encoding to use.- Returns:
- Resource with the template parsed and ready.
- Throws:
ResourceNotFoundException- if template not found from any available source.ParseErrorException- if template cannot be parsed due to syntax (or other) error.
-
getLoaderNameForResource
Determines is a template exists, and returns name of the loader that provides it. This is a slightly less hokey way to support the Velocity.templateExists() utility method, which was broken when per-template encoding was introduced. We can revisit this.- Parameters:
resourceName- Name of template or content resource- Returns:
- class name of loader than can provide it
-