|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RuntimeServices
Interface for internal runtime services that are needed by the various components w/in Velocity. This was taken from the old Runtime singleton, and anything not necessary was removed. Currently implemented by RuntimeInstance.
Method Summary | |
---|---|
void |
addProperty(String key,
Object value)
Add a property to the configuration. |
boolean |
addVelocimacro(String name,
String macro,
String[] argArray,
String sourceTemplate,
int line,
int column)
Adds a new Velocimacro. |
void |
clearProperty(String key)
Clear the values pertaining to a particular property. |
boolean |
dumpVMNamespace(String namespace)
tells the vmFactory to dump the specified namespace. |
Object |
getApplicationAttribute(Object key)
Return the specified applcation attribute. |
boolean |
getBoolean(String key,
boolean def)
Boolean property accessor method to hide the configuration implementation. |
org.apache.commons.collections.ExtendedProperties |
getConfiguration()
Return the velocity runtime configuration object. |
ContentResource |
getContent(String name)
Returns a static content resource from the resource manager. |
ContentResource |
getContent(String name,
String encoding)
Returns a static content resource from the resource manager. |
int |
getInt(String key)
Int property accessor method to hide the configuration implementation. |
int |
getInt(String key,
int defaultValue)
Int property accessor method to hide the configuration implementation. |
Introspector |
getIntrospector()
Returns the configured method introspection/reflection implemenation. |
String |
getLoaderNameForResource(String resourceName)
Determines is a template exists, and returns name of the loader that provides it. |
Object |
getProperty(String key)
Allows an external caller to get a property. |
String |
getString(String key)
String property accessor method to hide the configuration implementation |
String |
getString(String key,
String defaultValue)
String property accessor method with default to hide the configuration implementation. |
Template |
getTemplate(String name)
Returns a Template from the resource manager. |
Template |
getTemplate(String name,
String encoding)
Returns a Template from the resource manager |
Uberspect |
getUberspect()
Returns the configured class introspection/reflection implemenation. |
Directive |
getVelocimacro(String vmName,
String templateName)
Returns the appropriate VelocimacroProxy object if strVMname is a valid current Velocimacro. |
void |
init()
|
void |
init(Properties p)
Initialize the Velocity Runtime with a Properties object. |
void |
init(String configurationFile)
Initialize the Velocity Runtime with the name of ExtendedProperties object. |
boolean |
isVelocimacro(String vmName,
String templateName)
Checks to see if a VM exists |
SimpleNode |
parse(Reader reader,
String templateName)
Parse the input and return the root of AST node structure. |
SimpleNode |
parse(Reader reader,
String templateName,
boolean dumpNamespace)
Parse the input and return the root of the AST node structure. |
void |
setConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
Allow an external system to set an ExtendedProperties object to use. |
void |
setProperty(String key,
Object value)
Allows an external system to set a property in the Velocity Runtime. |
Method Detail |
---|
void init() throws Exception
Exception
void setProperty(String key, Object value)
key
- property keyvalue
- property valuevoid setConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
configuration
- void addProperty(String key, Object value)
key
- value
- void clearProperty(String key)
key
- key of property to clearObject getProperty(String key)
key
- property to returnvoid init(Properties p) throws Exception
p
-
Exception
void init(String configurationFile) throws Exception
configurationFile
-
Exception
SimpleNode parse(Reader reader, String templateName) throws ParseException
reader
- inputstream retrieved by a resource loadertemplateName
- name of the template being parsed
ParseException
SimpleNode parse(Reader reader, String templateName, boolean dumpNamespace) throws ParseException
reader
- inputstream retrieved by a resource loadertemplateName
- name of the template being parseddumpNamespace
- flag to dump the Velocimacro namespace for this template
ParseException
Template getTemplate(String name) throws ResourceNotFoundException, ParseErrorException, Exception
Template
from the resource manager.
This method assumes that the character encoding of the
template is set by the input.encoding
property. The default is "ISO-8859-1"
name
- The file name of the desired template.
ResourceNotFoundException
- if template not found
from any available source.
ParseErrorException
- if template cannot be parsed due
to syntax (or other) error.
Exception
- if an error occurs in template initializationTemplate getTemplate(String name, String encoding) throws ResourceNotFoundException, ParseErrorException, Exception
Template
from the resource manager
name
- The name of the desired template.encoding
- Character encoding of the template
ResourceNotFoundException
- if template not found
from any available source.
ParseErrorException
- if template cannot be parsed due
to syntax (or other) error.
Exception
- if an error occurs in template initializationContentResource getContent(String name) throws ResourceNotFoundException, ParseErrorException, Exception
name
- Name of content resource to get
ResourceNotFoundException
- if template not found
from any available source.
ParseErrorException
Exception
ContentResource getContent(String name, String encoding) throws ResourceNotFoundException, ParseErrorException, Exception
name
- Name of content resource to getencoding
- Character encoding to use
ResourceNotFoundException
- if template not found
from any available source.
ParseErrorException
Exception
String getLoaderNameForResource(String resourceName)
resourceName
- Name of template or content resource
String getString(String key, String defaultValue)
key
- property keydefaultValue
- default value to return if key not
found in resource manager.
Directive getVelocimacro(String vmName, String templateName)
vmName
- Name of velocimacro requestedtemplateName
-
boolean addVelocimacro(String name, String macro, String[] argArray, String sourceTemplate, int line, int column)
name
- Name of velocimacromacro
- String form of macro bodyargArray
- Array of strings, containing the
#macro() arguments. the 0th is the name.line
- the line, where the macro startscolumn
- the column, where the macro starts
boolean isVelocimacro(String vmName, String templateName)
vmName
- Name of velocimacrotemplateName
-
boolean dumpVMNamespace(String namespace)
String getString(String key)
key
- property key
int getInt(String key)
key
- property key
int getInt(String key, int defaultValue)
key
- property keydefaultValue
- default value
boolean getBoolean(String key, boolean def)
key
- property keydef
- default value if property not found
org.apache.commons.collections.ExtendedProperties getConfiguration()
Object getApplicationAttribute(Object key)
key
- The name of the attribute to retrieve.Uberspect getUberspect()
Introspector getIntrospector()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |