public abstract class ResourceLoader extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
className
Class name for this loader, for logging/debuggin
purposes.
|
protected boolean |
isCachingOn
Does this loader want templates produced with it
cached in the Runtime.
|
protected org.slf4j.Logger |
log |
protected long |
modificationCheckInterval
This property will be passed on to the templates
that are created with this loader.
|
protected RuntimeServices |
rsvc |
| Constructor and Description |
|---|
ResourceLoader() |
| Modifier and Type | Method and Description |
|---|---|
protected Reader |
buildReader(InputStream rawStream,
String encoding)
Builds a Reader given a raw InputStream and an encoding.
|
void |
commonInit(RuntimeServices rs,
ExtProperties configuration)
This initialization is used by all resource
loaders and must be called to set up common
properties shared by all resource loaders
|
String |
getClassName()
Return the class name of this resource Loader
|
abstract long |
getLastModified(Resource resource)
Get the last modified time of the InputStream source
that was used to create the template.
|
long |
getModificationCheckInterval()
Get the interval at which the InputStream source
should be checked for modifications.
|
abstract Reader |
getResourceReader(String source,
String encoding)
Get the Reader that the Runtime will parse
to create a template.
|
abstract void |
init(ExtProperties configuration)
Initialize the template loader with a
a resources class.
|
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.
|
abstract boolean |
isSourceModified(Resource resource)
Given a template, check to see if the source of InputStream
has been modified.
|
boolean |
resourceExists(String resourceName)
Check whether any given resource exists.
|
void |
setCachingOn(boolean value)
Set the caching state.
|
void |
setModificationCheckInterval(long modificationCheckInterval)
Set the interval at which the InputStream source
should be checked for modifications.
|
protected boolean isCachingOn
protected long modificationCheckInterval
protected String className
protected RuntimeServices rsvc
protected org.slf4j.Logger log
public void commonInit(RuntimeServices rs, ExtProperties configuration)
rs - configuration - public abstract void init(ExtProperties configuration)
configuration - public abstract Reader getResourceReader(String source, String encoding) throws ResourceNotFoundException
source - encoding - ResourceNotFoundExceptionpublic abstract boolean isSourceModified(Resource resource)
resource - public abstract long getLastModified(Resource resource)
resource - public String getClassName()
public void setCachingOn(boolean value)
value - public boolean isCachingOn()
public void setModificationCheckInterval(long modificationCheckInterval)
modificationCheckInterval - public long getModificationCheckInterval()
public boolean resourceExists(String resourceName)
resourceName - The name of a resource.protected Reader buildReader(InputStream rawStream, String encoding) throws IOException
rawStream - The raw input stream.encoding - The asked encoding.IOExceptionUnsupportedEncodingExceptionCopyright © 2000–2020 The Apache Software Foundation. All rights reserved.