org.apache.velocity.runtime.resource.loader

Class ResourceLoader

public abstract class ResourceLoader extends Object

This is abstract class the all text resource loaders should extend.

Version: $Id: ResourceLoader.java,v 1.14.4.1 2004/03/03 23:23:02 geirm Exp $

Author: Jason van Zyl Geir Magnusson Jr.

Field Summary
protected StringclassName
Class name for this loader, for logging/debuggin purposes.
protected booleanisCachingOn
Does this loader want templates produced with it cached in the Runtime.
protected longmodificationCheckInterval
This property will be passed on to the templates that are created with this loader.
protected RuntimeServicesrsvc
Method Summary
voidcommonInit(RuntimeServices rs, ExtendedProperties configuration)
This initialization is used by all resource loaders and must be called to set up common properties shared by all resource loaders
StringgetClassName()
Return the class name of this resource Loader
abstract longgetLastModified(Resource resource)
Get the last modified time of the InputStream source that was used to create the template.
longgetModificationCheckInterval()
Get the interval at which the InputStream source should be checked for modifications.
abstract InputStreamgetResourceStream(String source)
Get the InputStream that the Runtime will parse to create a template.
abstract voidinit(ExtendedProperties configuration)
Initialize the template loader with a a resources class.
booleanisCachingOn()
The Runtime uses this to find out whether this template loader wants the Runtime to cache templates created with InputStreams provided by this loader.
abstract booleanisSourceModified(Resource resource)
Given a template, check to see if the source of InputStream has been modified.
voidsetCachingOn(boolean value)
Set the caching state.
voidsetModificationCheckInterval(long modificationCheckInterval)
Set the interval at which the InputStream source should be checked for modifications.

Field Detail

className

protected String className
Class name for this loader, for logging/debuggin purposes.

isCachingOn

protected boolean isCachingOn
Does this loader want templates produced with it cached in the Runtime.

modificationCheckInterval

protected long modificationCheckInterval
This property will be passed on to the templates that are created with this loader.

rsvc

protected RuntimeServices rsvc

Method Detail

commonInit

public void commonInit(RuntimeServices rs, ExtendedProperties configuration)
This initialization is used by all resource loaders and must be called to set up common properties shared by all resource loaders

getClassName

public String getClassName()
Return the class name of this resource Loader

getLastModified

public abstract long getLastModified(Resource resource)
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.

getModificationCheckInterval

public long getModificationCheckInterval()
Get the interval at which the InputStream source should be checked for modifications.

getResourceStream

public abstract InputStream getResourceStream(String source)
Get the InputStream that the Runtime will parse to create a template.

init

public abstract void init(ExtendedProperties configuration)
Initialize the template loader with a a resources class.

isCachingOn

public boolean isCachingOn()
The Runtime uses this to find out whether this template loader wants the Runtime to cache templates created with InputStreams provided by this loader.

isSourceModified

public abstract boolean isSourceModified(Resource resource)
Given a template, check to see if the source of InputStream has been modified.

setCachingOn

public void setCachingOn(boolean value)
Set the caching state. If true, then this loader would like the Runtime to cache templates that have been created with InputStreams provided by this loader.

setModificationCheckInterval

public void setModificationCheckInterval(long modificationCheckInterval)
Set the interval at which the InputStream source should be checked for modifications.
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.