NVelocity.Runtime.Resource
Class ResourceManagerImpl

Class to manage the text resource for the Velocity Runtime. *

Field Summary
NVelocity.Runtime.Resource.ResourceCache globalCache
         Object implementing ResourceCache to be our resource manager's Resource cache.
int RESOURCE_CONTENT
         A static content resource.
int RESOURCE_TEMPLATE
         A template resources.
System.Collections.ArrayList resourceLoaders
         The List of templateLoaders that the Runtime will use to locate the InputStream source of a template.
NVelocity.Runtime.RuntimeServices rsvc

Constructor Summary
ResourceManagerImpl()
        Initializes a new instance of the ResourceManagerImpl class.

Method Summary
string getLoaderNameForResource(string resourceName)
         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. *
NVelocity.Runtime.Resource.Resource getResource(string resourceName, int resourceType, string encoding)
         Gets the named resource. Returned class type corresponds to specified type (i.e.
Template
to
RESOURCE_TEMPLATE
). *
NVelocity.Runtime.Resource.Resource getResource(string resourceName, int resourceType)
         Gets the named resource. Returned class type corresponds to specified type (i.e.
Template
to
RESOURCE_TEMPLATE
). *
void initialize(NVelocity.Runtime.RuntimeServices rs)
         Initialize the ResourceManager. It is assumed that assembleSourceInitializers() has been called before this is run.
NVelocity.Runtime.Resource.Resource loadResource(string resourceName, int resourceType, string encoding)
         Loads a resource from the current set of resource loaders
void refreshResource(NVelocity.Runtime.Resource.Resource resource, string encoding)
         Takes an existing resource, and 'refreshes' it. This generally means that the source of the resource is checked for changes according to some cache/check algorithm and if the resource changed, then the resource data is reloaded and re-parsed. *

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

globalCache

protected internal NVelocity.Runtime.Resource.ResourceCache globalCache

Object implementing ResourceCache to be our resource manager's Resource cache.


RESOURCE_CONTENT

public int RESOURCE_CONTENT

A static content resource.


RESOURCE_TEMPLATE

public int RESOURCE_TEMPLATE

A template resources.


resourceLoaders

protected internal System.Collections.ArrayList resourceLoaders

The List of templateLoaders that the Runtime will use to locate the InputStream source of a template.


rsvc

protected internal NVelocity.Runtime.RuntimeServices rsvc

Constructor Detail

ResourceManagerImpl

public ResourceManagerImpl()

Initializes a new instance of the ResourceManagerImpl class.

Method Detail

getLoaderNameForResource

public string getLoaderNameForResource(string resourceName)

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

getResource

public NVelocity.Runtime.Resource.Resource getResource(string resourceName,
                                                       int resourceType,
                                                       string encoding)

Gets the named resource. Returned class type corresponds to specified type (i.e.

Template
to
RESOURCE_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. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if a problem in parse

getResource

public NVelocity.Runtime.Resource.Resource getResource(string resourceName,
                                                       int resourceType)

Gets the named resource. Returned class type corresponds to specified type (i.e.

Template
to
RESOURCE_TEMPLATE
). *

Parameters:
resourceName - The name of the resource to retrieve.
resourceType - The type of resource (
RESOURCE_TEMPLATE
,
RESOURCE_CONTENT
, etc.).
Returns:
Resource with the template parsed and ready. @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if a problem in parse *

initialize

public void initialize(NVelocity.Runtime.RuntimeServices rs)

Initialize the ResourceManager. It is assumed that assembleSourceInitializers() has been called before this is run.


loadResource

protected internal NVelocity.Runtime.Resource.Resource loadResource(string resourceName,
                                                                 int resourceType,
                                                                 string encoding)

Loads a resource from the current set of resource loaders

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. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if a problem in parse

refreshResource

protected internal void refreshResource(NVelocity.Runtime.Resource.Resource resource,
                                        string encoding)

Takes an existing resource, and 'refreshes' it. This generally means that the source of the resource is checked for changes according to some cache/check algorithm and if the resource changed, then the resource data is reloaded and re-parsed. *

Parameters:
resource - resource to refresh * @throws ResourceNotFoundException if template not found from current source for this Resource @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if a problem in parse