C# Class NVelocity.Runtime.Resource.ResourceManagerImpl

Class to manage the text resource for the Velocity Runtime.
Inheritance: IResourceManager
显示文件 Open project: rasmus-toftdahl-olesen/NVelocity

Protected Properties

Property Type Description
globalCache ResourceCache
resourceLoaders System.Collections.ArrayList
runtimeServices IRuntimeServices

Public Methods

Method Description
GetLoaderNameForResource ( String resourceName ) : String

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.

GetResource ( String resourceName, ResourceType resourceType ) : Resource

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

GetResource ( string resourceName, ResourceType resourceType, string encoding ) : Resource

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

Initialize ( IRuntimeServices rs ) : void

Initialize the ResourceManager.

ResourceManagerImpl ( ) : System

Protected Methods

Method Description
LoadResource ( String resourceName, ResourceType resourceType, String encoding ) : Resource

Loads a resource from the current set of resource loaders

RefreshResource ( Resource resource, String encoding ) : void

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. *

Private Methods

Method Description
AssembleResourceLoaderInitializers ( ) : void

This will produce a List of Hashtables, each hashtable contains the initialization info for a particular resource loader. This Hashtable will be passed in when initializing the the template loader.

Method Details

GetLoaderNameForResource() public method

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.
public GetLoaderNameForResource ( String resourceName ) : String
resourceName String Name of template or content resource ///
return String

GetResource() public method

Gets the named resource. Returned class type corresponds to specified type (i.e. Template to Template). *
public GetResource ( String resourceName, ResourceType resourceType ) : Resource
resourceName String The name of the resource to retrieve. ///
resourceType ResourceType The type of resource (Template, /// Content, etc.). ///
return Resource

GetResource() public method

Gets the named resource. Returned class type corresponds to specified type (i.e. Template to Template). *
public GetResource ( string resourceName, ResourceType resourceType, string encoding ) : Resource
resourceName string The name of the resource to retrieve. ///
resourceType ResourceType The type of resource (Template, /// Content, etc.). ///
encoding string The character encoding to use. ///
return Resource

Initialize() public method

Initialize the ResourceManager.
public Initialize ( IRuntimeServices rs ) : void
rs IRuntimeServices
return void

LoadResource() protected method

Loads a resource from the current set of resource loaders
protected LoadResource ( String resourceName, ResourceType resourceType, String encoding ) : Resource
resourceName String The name of the resource to retrieve.
resourceType ResourceType The type of resource (Template, /// Content, etc.). ///
encoding String The character encoding to use.
return Resource

RefreshResource() protected method

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. *
protected RefreshResource ( Resource resource, String encoding ) : void
resource 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 /// ///
encoding String
return void

ResourceManagerImpl() public method

public ResourceManagerImpl ( ) : System
return System

Property Details

globalCache protected_oe property

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

resourceLoaders protected_oe property

The List of templateLoaders that the Runtime will use to locate the InputStream source of a template.
protected ArrayList,System.Collections resourceLoaders
return System.Collections.ArrayList

runtimeServices protected_oe property

protected IRuntimeServices runtimeServices
return IRuntimeServices