ResourceManager (Velocity 1.4 API)
Keywords: org.apache.velocity.runtime.resource.ResourceManager interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.runtime.resource
Interface ResourceManager

All Known Implementing Classes:
  ResourceManagerImpl

public interface ResourceManager

Class to manage the text resource for the Velocity Runtime.

Version:
  $Id: ResourceManager.java,v 1.34.4.1 2004/03/03 23:23:01 geirm Exp $
Author:
  Jason van Zyl, Paulo Gaspar, Geir Magnusson Jr.

Field Summary
`static int` | `RESOURCE_CONTENT` A static content resource.
`static int` | `RESOURCE_TEMPLATE` A template resources.

Method Summary
`java.lang.String` | `getLoaderNameForResource(java.lang.String resourceName)` Determines is a template exists, and returns name of the loader that provides it.
`Resource` | `getResource(java.lang.String resourceName, int resourceType, java.lang.String encoding)` Gets the named resource.
`void` | `initialize(RuntimeServices rs)` Initialize the ResourceManager.

Field Detail

### RESOURCE_TEMPLATE

    public static final int RESOURCE_TEMPLATE

  A template resources.

  See Also:
    Constant Field Values

### RESOURCE_CONTENT

    public static final int RESOURCE_CONTENT

  A static content resource.

  See Also:
    Constant Field Values

Method Detail

### initialize

    public void initialize(RuntimeServices rs)
                    throws java.lang.Exception

  Initialize the ResourceManager.

  Throws:
    `java.lang.Exception`

### getResource

    public Resource getResource(java.lang.String resourceName,
                                int resourceType,
                                java.lang.String encoding)
                         throws ResourceNotFoundException,
                                ParseErrorException,
                                java.lang.Exception

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

### getLoaderNameForResource

    public java.lang.String getLoaderNameForResource(java.lang.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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 Apache Software Foundation. All Rights Reserved.