org.apache.velocity.runtime.resource
public abstract class Resource extends Object
Version: $Id: Resource.java,v 1.12.4.1 2004/03/03 23:23:01 geirm Exp $
Field Summary | |
---|---|
protected Object | data
Resource might require ancillary storage of some kind |
protected String | encoding
Character encoding of this resource |
protected long | lastModified
The file modification time (in milliseconds) for the cached template. |
protected long | modificationCheckInterval
How often the file modification time is checked (in seconds). |
protected static long | MILLIS_PER_SECOND
The number of milliseconds in a minute, used to calculate the
check interval. |
protected String | name
Name of the resource |
protected long | nextCheck
The next time the file modification time will be checked (in
milliseconds). |
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 RuntimeServices | rsvc |
Constructor Summary | |
---|---|
Resource()
Default constructor |
Method Summary | |
---|---|
Object | getData()
Get arbitrary data object that might be used
by the resource. |
String | getEncoding()
get the encoding of this resource
for example, "ISO-8859-1" |
long | getLastModified()
Return the lastModifed time of this
template. |
String | getName()
Get the name of this template. |
ResourceLoader | getResourceLoader()
Return the template loader that pulled
in the template stream |
boolean | isSourceModified() |
abstract boolean | process()
Perform any subsequent processing that might need
to be done by a resource. |
boolean | requiresChecking()
Is it time to check to see if the resource
source has been updated? |
void | setData(Object data)
Set arbitrary data object that might be used
by the resource. |
void | setEncoding(String encoding)
set the encoding of this resource
for example, "ISO-8859-1" |
void | setLastModified(long lastModified)
Set the last modified time for this
template. |
void | setModificationCheckInterval(long modificationCheckInterval)
Set the modification check interval. |
void | setName(String name)
Set the name of this resource, for example
test.vm. |
void | setResourceLoader(ResourceLoader resourceLoader)
Set the template loader for this template. |
void | setRuntimeServices(RuntimeServices rs) |
void | touch()
'Touch' this template and thereby resetting
the nextCheck field. |
Returns: Whether the resource could be processed successfully. For a Template or ContentResource, this indicates whether the resource could be read.
Throws: ResourceNotFoundException Similar in semantics as
returning false
.
Parameters: interval The interval (in seconds).