This is the default retriever for FileTemplateCache
.
Definition at line 45 of file Freemarkerv1JarCacheRetriever.java.
Public Member Functions | |
Freemarkerv1JarCacheRetriever (ClassLoader loader) | |
Creates new FileRetriever. | |
Freemarkerv1JarCacheRetriever (String path, ClassLoader loader) | |
Constructs a FileRetriever with a directory in which it will look for template files. | |
boolean | connectionOk () throws TemplateException |
Corresponds to checkCacheDir for file-system implementations. | |
void | setConnection (String path) |
Sets the root directory for this retriever. | |
String | getConnection () |
Gets the connection for this retriever. | |
void | setPath (File dir) |
Sets the root directory for this retriever. | |
File | getPath () |
Returns the root directory for this retriever. | |
void | setFilenameSuffix (String filenameSuffix) |
Sets the file suffix. | |
String | getFilenameSuffix () |
Returns the file suffix. | |
boolean | exists (String location) |
Tests whether the object still exists in the template repository. | |
List | getPreloadData () throws TemplateException |
Returns a list of objects (String s) to pre-load the cache with. | |
long | lastModified (String location) throws TemplateException |
Cacheable | loadData (String location, String type) throws TemplateException |
Retrieves the appropriate data to be stored in the cache. | |
void | setEncoding (String encoding) |
Sets the character encoding to be used when reading template files. | |
String | getEncoding () |
Returns the character encoding to be used when reading template files. | |
void | setTemplateRegistry (TemplateRegistry cRegistry) |
Sets a template registry implementation to use when creating new templates. | |
TemplateRegistry | getTemplateRegistry () |
Gets the current template registry implementation in use. | |
boolean | equals (Object o) |
Is this file retriever equal to another object? | |
int | hashCode () |
Retrieve the hash code for this object. | |
String | toString () |
Returns a string representation of the object. | |
Protected Member Functions | |
void | readDirectory (String dir, String relativeDirPath, List visitedFiles) throws IOException |
Recursively updates the cache from the files in a (sub)directory and its subdirectories. | |
boolean | isSuffixValid (String name) throws TemplateException |
Determine whether the filename ends with the appropriate filename suffix. | |
String | nameToFile (final String name) throws TemplateException |
Converts a cache element name to a File . | |
Protected Attributes | |
String | directoryRoot |
The root directory where the retriever will get files. | |
String | filenameSuffix |
The filename suffix required for a file to be retrieved. | |
String | encoding |
The text encoding of the template files. | |
TemplateRegistry | registry |
The template registry to use to instantiate objects. |
org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.Freemarkerv1JarCacheRetriever | ( | ClassLoader | loader | ) |
org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.Freemarkerv1JarCacheRetriever | ( | String | path, | |
ClassLoader | loader | |||
) |
Constructs a FileRetriever with a directory in which it will look for template files.
path | the absolute path of the directory containing templates for this retriever |
IllegalArgumentException | the root directory is null |
Definition at line 74 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setConnection().
boolean org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.connectionOk | ( | ) | throws TemplateException |
Corresponds to checkCacheDir for file-system implementations.
true
if the connection is ok, otherwise false
TemplateException | the directory no longer exists, or is not a directory |
Definition at line 86 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot.
void org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setConnection | ( | String | path | ) |
Sets the root directory for this retriever.
path | the absolute path of the directory containing files for this retriever. |
IllegalArgumentException | the root directory is null |
Definition at line 100 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.Freemarkerv1JarCacheRetriever().
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getConnection | ( | ) |
Gets the connection for this retriever.
Corresponds to getPath for file-system implementations.
Definition at line 111 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot.
void org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setPath | ( | File | dir | ) |
Sets the root directory for this retriever.
dir | the root directory containing files for this retriever |
IllegalArgumentException | the root directory is null |
Definition at line 124 of file Freemarkerv1JarCacheRetriever.java.
File org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getPath | ( | ) |
Returns the root directory for this retriever.
Definition at line 136 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot.
void org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setFilenameSuffix | ( | String | filenameSuffix | ) |
Sets the file suffix.
If set, files that do not have this suffix will be ignored when read into the cache.
filenameSuffix | the optional filename suffix of files to be read for this retriever. |
Definition at line 147 of file Freemarkerv1JarCacheRetriever.java.
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getFilenameSuffix | ( | ) |
Returns the file suffix.
If set, files that do not have this suffix will be ignored when read into the cache.
Definition at line 158 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix.
boolean org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.exists | ( | String | location | ) |
Tests whether the object still exists in the template repository.
This may be redundant. Instead, lastModified could throw an appropriate exception.
location | the location of the object to be tested |
true
if the object still exists in the repository, otherwise false
Definition at line 172 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.nameToFile().
List org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getPreloadData | ( | ) | throws TemplateException |
Returns a list of objects (String
s) to pre-load the cache with.
List
of String
s to preload the cache with Definition at line 188 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot, and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.readDirectory().
void org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.readDirectory | ( | String | dir, | |
String | relativeDirPath, | |||
List | visitedFiles | |||
) | throws IOException [protected] |
Recursively updates the cache from the files in a (sub)directory and its subdirectories.
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. |
Definition at line 208 of file Freemarkerv1JarCacheRetriever.java.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getPreloadData().
long org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.lastModified | ( | String | location | ) | throws TemplateException |
Determines when the object in the template repository was last modified.
TemplateException | is thrown whenever the item:
|
Definition at line 222 of file Freemarkerv1JarCacheRetriever.java.
boolean org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.isSuffixValid | ( | String | name | ) | throws TemplateException [protected] |
Determine whether the filename ends with the appropriate filename suffix.
name | the filename to be checked |
TemplateException | the suffix is invalid |
Definition at line 233 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix.
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.nameToFile | ( | final String | name | ) | throws TemplateException [protected] |
Converts a cache element name to a File
.
name | the filename relative to the directory root of the retriever |
Definition at line 247 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.exists(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.loadData().
Cacheable org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.loadData | ( | String | location, | |
String | type | |||
) | throws TemplateException |
Retrieves the appropriate data to be stored in the cache.
location | the filename, relative to the root directory, of the template data to load | |
type | the type of item to be loaded |
Definition at line 259 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.nameToFile(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.registry.
void org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setEncoding | ( | String | encoding | ) |
Sets the character encoding to be used when reading template files.
encoding | the name of the encoding to be used; this will be passed to the constructor of InputStreamReader . |
Definition at line 287 of file Freemarkerv1JarCacheRetriever.java.
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getEncoding | ( | ) |
Returns the character encoding to be used when reading template files.
InputStreamReader
. Definition at line 297 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding.
boolean org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.equals | ( | Object | o | ) |
Is this file retriever equal to another object?
o | the object to compare this object with |
true
if the objects are equal, otherwise false
Definition at line 323 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix, and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.registry.
int org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.hashCode | ( | ) |
Retrieve the hash code for this object.
Definition at line 356 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix, and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.registry.
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.toString | ( | ) |
Returns a string representation of the object.
String
representation of the object Definition at line 370 of file Freemarkerv1JarCacheRetriever.java.
References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding, org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix, and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.registry.
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.directoryRoot [protected] |
The root directory where the retriever will get files.
Definition at line 49 of file Freemarkerv1JarCacheRetriever.java.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.connectionOk(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.equals(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getConnection(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getPath(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getPreloadData(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.hashCode(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.nameToFile(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setConnection(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.toString().
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.filenameSuffix [protected] |
The filename suffix required for a file to be retrieved.
Definition at line 51 of file Freemarkerv1JarCacheRetriever.java.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.equals(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getFilenameSuffix(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.hashCode(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.isSuffixValid(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.toString().
String org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.encoding [protected] |
The text encoding of the template files.
Definition at line 53 of file Freemarkerv1JarCacheRetriever.java.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.equals(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getEncoding(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.hashCode(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.loadData(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.toString().
TemplateRegistry org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.registry [protected] |
The template registry to use to instantiate objects.
Definition at line 55 of file Freemarkerv1JarCacheRetriever.java.
Referenced by org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.equals(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.getTemplateRegistry(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.hashCode(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.loadData(), org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setTemplateRegistry(), and org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.toString().