org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever Class Reference

List of all members.


Detailed Description

Retrieves cacheable objects through the file system.

This is the default retriever for FileTemplateCache.

Version:
Id
FileRetriever.java,v 1.17 2004/10/24 09:14:42 run2000 Exp

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 (Strings) 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.

Constructor & Destructor Documentation

org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.Freemarkerv1JarCacheRetriever ( ClassLoader  loader  ) 

Creates new FileRetriever.

Definition at line 61 of file Freemarkerv1JarCacheRetriever.java.

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.

Parameters:
path the absolute path of the directory containing templates for this retriever
Exceptions:
IllegalArgumentException the root directory is null

Definition at line 74 of file Freemarkerv1JarCacheRetriever.java.

References org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.setConnection().


Member Function Documentation

boolean org.openmobileis.embedded.webserver.templates.Freemarkerv1JarCacheRetriever.connectionOk (  )  throws TemplateException

Corresponds to checkCacheDir for file-system implementations.

Returns:
true if the connection is ok, otherwise false
Exceptions:
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.

Parameters:
path the absolute path of the directory containing files for this retriever.
Exceptions:
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.

Parameters:
dir the root directory containing files for this retriever
Exceptions:
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.

Returns:
the root directory containing files 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.

Parameters:
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.

Returns:
the optional filename suffix of files to be read for this retriever.

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.

Parameters:
location the location of the object to be tested
Returns:
true if the object still exists in the repository, otherwise false
See also:
lastModified

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 (Strings) to pre-load the cache with.

Returns:
a List of Strings 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.

Parameters:
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.

Exceptions:
TemplateException is thrown whenever the item:
  • does not exist
  • is the wrong type (eg. directory, not file)
  • has an invalid file suffix

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.

Parameters:
name the filename to be checked
Returns:
is the filename suffix ok?
Exceptions:
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.

Parameters:
name the filename relative to the directory root of the retriever
Returns:
the fully qualified filename

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.

Parameters:
location the filename, relative to the root directory, of the template data to load
type the type of item to be loaded
Returns:
the template data

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.

Parameters:
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.

Returns:
the name of the encoding to be used; this will be passed to the constructor of 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?

Parameters:
o the object to compare this object with
Returns:
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.

Returns:
the hash code

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.

Returns:
a 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.


Member Data Documentation

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().


The documentation for this class was generated from the following file:
Generated on Mon Jan 14 17:29:53 2008 for OpenMobileIS by  doxygen 1.5.4