FileResourceLoader (Velocity 1.4 API)
Keywords: org.apache.velocity.runtime.resource.loader.FileResourceLoader class

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.loader
Class FileResourceLoader

    java.lang.Object
      org.apache.velocity.runtime.resource.loader.ResourceLoader
          org.apache.velocity.runtime.resource.loader.FileResourceLoader

public class FileResourceLoader
extends ResourceLoader

A loader for templates stored on the file system.

Version:
  $Id: FileResourceLoader.java,v 1.19.4.1 2004/03/03 23:23:02 geirm Exp $
Author:
  Jason van Zyl

Field Summary
`private java.util.Vector` | `paths` The paths to search for templates.
`private java.util.Hashtable` | `templatePaths` Used to map the path that a template was found on so that we can properly check the modification times of the files.

Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
`className, isCachingOn, modificationCheckInterval, rsvc`

Constructor Summary
`FileResourceLoader()`

Method Summary
`private java.io.InputStream` | `findTemplate(java.lang.String path, java.lang.String template)` Try to find a template given a normalized path.
`long` | `getLastModified(Resource resource)` Get the last modified time of the InputStream source that was used to create the template.
`java.io.InputStream` | `getResourceStream(java.lang.String templateName)` Get an InputStream so that the Runtime can build a template with it.
`void` | `init(org.apache.commons.collections.ExtendedProperties configuration)` Initialize the template loader with a a resources class.
`boolean` | `isSourceModified(Resource resource)` How to keep track of all the modified times across the paths.

Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
`commonInit, getClassName, getModificationCheckInterval, isCachingOn, setCachingOn, setModificationCheckInterval`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### paths

    private java.util.Vector paths

  The paths to search for templates.

### templatePaths

    private java.util.Hashtable templatePaths

  Used to map the path that a template was found on so that we can properly check the modification times of the files.

Constructor Detail

### FileResourceLoader

    public FileResourceLoader()

Method Detail

### init

    public void init(org.apache.commons.collections.ExtendedProperties configuration)

  Description copied from class: `ResourceLoader`
  Initialize the template loader with a a resources class.

  Specified by:
    `init` in class `ResourceLoader`

### getResourceStream

    public java.io.InputStream getResourceStream(java.lang.String templateName)
                                          throws ResourceNotFoundException

  Get an InputStream so that the Runtime can build a template with it.

  Specified by:
    `getResourceStream` in class `ResourceLoader`
  Returns:
    InputStream containing the template
  Throws:
    `ResourceNotFoundException` - if template not found in the file template path.

### findTemplate

    private java.io.InputStream findTemplate(java.lang.String path,
                                             java.lang.String template)

  Try to find a template given a normalized path.

  Returns:
    InputStream input stream that will be parsed

### isSourceModified

    public boolean isSourceModified(Resource resource)

  How to keep track of all the modified times across the paths. Note that a file might have appeared in a directory which is earlier in the path; so we should search the path and see if the file we find that way is the same as the one that we have cached.

  Specified by:
    `isSourceModified` in class `ResourceLoader`

### getLastModified

    public long getLastModified(Resource resource)

  Description copied from class: `ResourceLoader`
  Get the last modified time of the InputStream source that was used to create the template. We need the template here because we have to extract the name of the template in order to locate the InputStream source.

  Specified by:
    `getLastModified` in class `ResourceLoader`

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.