|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever
Retrieves cacheable objects through the file system. This is the default
retriever for FileTemplateCache
.
Field Summary | |
protected java.lang.String |
directoryRoot
The root directory where the retriever will get files. |
protected java.lang.String |
encoding
The text encoding of the template files. |
protected java.lang.String |
filenameSuffix
The filename suffix required for a file to be retrieved. |
protected TemplateRegistry |
registry
The template registry to use to instantiate objects. |
Constructor Summary | |
Freemarkerv1JarCacheRetriever(java.lang.ClassLoader loader)
Creates new FileRetriever. |
|
Freemarkerv1JarCacheRetriever(java.lang.String path,
java.lang.ClassLoader loader)
Constructs a FileRetriever with a directory in which it will look for template files. |
Method Summary | |
boolean |
connectionOk()
Corresponds to checkCacheDir for file-system implementations. |
boolean |
equals(java.lang.Object o)
Is this file retriever equal to another object? |
boolean |
exists(java.lang.String location)
Tests whether the object still exists in the template repository. |
java.lang.String |
getConnection()
Gets the connection for this retriever. |
java.lang.String |
getEncoding()
Returns the character encoding to be used when reading template files. |
java.lang.String |
getFilenameSuffix()
Returns the file suffix. |
java.io.File |
getPath()
Returns the root directory for this retriever. |
java.util.List |
getPreloadData()
Returns a list of objects ( String s) to pre-load the cache with. |
TemplateRegistry |
getTemplateRegistry()
Gets the current template registry implementation in use. |
int |
hashCode()
Retrieve the hash code for this object |
protected boolean |
isSuffixValid(java.lang.String name)
Determine whether the filename ends with the appropriate filename suffix. |
long |
lastModified(java.lang.String location)
Determines when the object in the template repository was last modified. |
Cacheable |
loadData(java.lang.String location,
java.lang.String type)
Retrieves the appropriate data to be stored in the cache. |
protected java.lang.String |
nameToFile(java.lang.String name)
Converts a cache element name to a File. |
protected void |
readDirectory(java.lang.String dir,
java.lang.String relativeDirPath,
java.util.List visitedFiles)
Recursively updates the cache from the files in a (sub)directory and its subdirectories. |
void |
setConnection(java.lang.String path)
Sets the root directory for this retriever. |
void |
setEncoding(java.lang.String encoding)
Sets the character encoding to be used when reading template files. |
void |
setFilenameSuffix(java.lang.String filenameSuffix)
Sets the file suffix. |
void |
setPath(java.io.File dir)
Sets the root directory for this retriever. |
void |
setTemplateRegistry(TemplateRegistry cRegistry)
Sets a template registry implementation to use when creating new templates. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String directoryRoot
protected java.lang.String filenameSuffix
protected java.lang.String encoding
protected TemplateRegistry registry
Constructor Detail |
public Freemarkerv1JarCacheRetriever(java.lang.ClassLoader loader)
public Freemarkerv1JarCacheRetriever(java.lang.String path, java.lang.ClassLoader loader)
path
- the absolute path of the directory containing
templates for this retriever
java.lang.IllegalArgumentException
- the root directory is nullMethod Detail |
public boolean connectionOk() throws TemplateException
true
if the connection is ok, otherwise false
TemplateException
- the directory no longer exists, or is not
a directorypublic void setConnection(java.lang.String path)
path
- the absolute path of the directory containing files
for this retriever.
java.lang.IllegalArgumentException
- the root directory is nullpublic java.lang.String getConnection()
public void setPath(java.io.File dir)
dir
- the root directory containing files for this retriever
java.lang.IllegalArgumentException
- the root directory is nullpublic java.io.File getPath()
public void setFilenameSuffix(java.lang.String filenameSuffix)
filenameSuffix
- the optional filename suffix of
files to be read for this retriever.public java.lang.String getFilenameSuffix()
public boolean exists(java.lang.String location)
location
- the location of the object to be tested
true
if the object still exists in the repository,
otherwise false
lastModified(java.lang.String)
public java.util.List getPreloadData() throws TemplateException
String
s) to pre-load the cache with.
List
of String
s to preload the
cache with
TemplateException
protected void readDirectory(java.lang.String dir, java.lang.String relativeDirPath, java.util.List visitedFiles) throws java.io.IOException
dir
- the directory to be read.relativeDirPath
- a string representing the directory's path
relative to the root cache directory.visitedFiles
- a List of files that have been visited so far.
java.io.IOException
public long lastModified(java.lang.String location) throws TemplateException
Determines when the object in the template repository was last modified.
TemplateException
- is thrown whenever the item:
protected boolean isSuffixValid(java.lang.String name) throws TemplateException
name
- the filename to be checked
TemplateException
- the suffix is invalidprotected java.lang.String nameToFile(java.lang.String name) throws TemplateException
name
- the filename relative to the directory root of the retriever
TemplateException
public Cacheable loadData(java.lang.String location, java.lang.String type) throws TemplateException
location
- the filename, relative to the root directory, of the
template data to loadtype
- the type of item to be loaded
TemplateException
public void setEncoding(java.lang.String encoding)
encoding
- the name of the encoding to be used; this will be
passed to the constructor of InputStreamReader.public java.lang.String getEncoding()
public void setTemplateRegistry(TemplateRegistry cRegistry)
public TemplateRegistry getTemplateRegistry()
public boolean equals(java.lang.Object o)
o
- the object to compare this object with
true
if the objects are equal, otherwise
false
public int hashCode()
public java.lang.String toString()
String
representation of the object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |