Home » velocity-1.5 » org.apache » velocity » runtime » resource » [javadoc | source]
org.apache.velocity.runtime.resource
abstract public class: Resource [javadoc | source]
java.lang.Object
   org.apache.velocity.runtime.resource.Resource

Direct Known Subclasses:
    ContentResource, Template

This class represent a general text resource that may have been retrieved from any number of possible sources.
Field Summary
protected  RuntimeServices rsvc     
protected  ResourceLoader resourceLoader    The template loader that initially loaded the input stream for this template, and knows how to check the source of the input stream for modification. 
protected static final  long MILLIS_PER_SECOND    The number of milliseconds in a minute, used to calculate the check interval. 
protected  long modificationCheckInterval    How often the file modification time is checked (in seconds). 
protected  long lastModified    The file modification time (in milliseconds) for the cached template. 
protected  long nextCheck    The next time the file modification time will be checked (in milliseconds). 
protected  String name    Name of the resource 
protected  String encoding    Character encoding of this resource 
protected  Object data    Resource might require ancillary storage of some kind 
Constructor:
 public Resource() 
Method from org.apache.velocity.runtime.resource.Resource Summary:
getData,   getEncoding,   getLastModified,   getName,   getResourceLoader,   isSourceModified,   process,   requiresChecking,   setData,   setEncoding,   setLastModified,   setModificationCheckInterval,   setName,   setResourceLoader,   setRuntimeServices,   touch
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.velocity.runtime.resource.Resource Detail:
 public Object getData() 
    Get arbitrary data object that might be used by the resource.
 public String getEncoding() 
    get the encoding of this resource for example, "ISO-8859-1"
 public long getLastModified() 
    Return the lastModifed time of this resource.
 public String getName() 
    Get the name of this template.
 public ResourceLoader getResourceLoader() 
    Return the template loader that pulled in the template stream
 public boolean isSourceModified() 
 abstract public boolean process() throws Exception, ResourceNotFoundException, ParseErrorException
    Perform any subsequent processing that might need to be done by a resource. In the case of a template the actual parsing of the input stream needs to be performed.
 public boolean requiresChecking() 
    Is it time to check to see if the resource source has been updated?
 public  void setData(Object data) 
    Set arbitrary data object that might be used by the resource.
 public  void setEncoding(String encoding) 
    set the encoding of this resource for example, "ISO-8859-1"
 public  void setLastModified(long lastModified) 
    Set the last modified time for this resource.
 public  void setModificationCheckInterval(long modificationCheckInterval) 
    Set the modification check interval.
 public  void setName(String name) 
    Set the name of this resource, for example test.vm.
 public  void setResourceLoader(ResourceLoader resourceLoader) 
    Set the template loader for this template. Set when the Runtime determines where this template came from the list of possible sources.
 public  void setRuntimeServices(RuntimeServices rs) 
 public  void touch() 
    'Touch' this template and thereby resetting the nextCheck field.