|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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(java.lang.String key,
java.lang.Object value)
Add a property to the configuration. |
boolean |
addVelocimacro(java.lang.String name,
java.lang.String macro,
java.lang.String[] argArray,
java.lang.String sourceTemplate)
Adds a new Velocimacro. |
void |
clearProperty(java.lang.String key)
Clear the values pertaining to a particular property. |
void |
debug(java.lang.Object message)
Log a debug message. |
boolean |
dumpVMNamespace(java.lang.String namespace)
tells the vmFactory to dump the specified namespace. |
void |
error(java.lang.Object message)
Log an error message. |
java.lang.Object |
getApplicationAttribute(java.lang.Object key)
|
boolean |
getBoolean(java.lang.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(java.lang.String name)
Returns a static content resource from the resource manager. |
ContentResource |
getContent(java.lang.String name,
java.lang.String encoding)
Returns a static content resource from the resource manager. |
int |
getInt(java.lang.String key)
Int property accessor method to hide the configuration implementation. |
int |
getInt(java.lang.String key,
int defaultValue)
Int property accessor method to hide the configuration implementation. |
Introspector |
getIntrospector()
|
java.lang.String |
getLoaderNameForResource(java.lang.String resourceName)
Determines is a template exists, and returns name of the loader that provides it. |
java.lang.Object |
getProperty(java.lang.String key)
Allows an external caller to get a property. |
java.lang.String |
getString(java.lang.String key)
String property accessor method to hide the configuration implementation |
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
String property accessor method with default to hide the configuration implementation. |
Template |
getTemplate(java.lang.String name)
Returns a Template from the resource manager. |
Template |
getTemplate(java.lang.String name,
java.lang.String encoding)
Returns a Template from the resource manager |
Directive |
getVelocimacro(java.lang.String vmName,
java.lang.String templateName)
Returns the appropriate VelocimacroProxy object if strVMname is a valid current Velocimacro. |
void |
info(java.lang.Object message)
Log an info message. |
void |
init()
|
void |
init(java.util.Properties p)
Initialize the Velocity Runtime with a Properties object. |
void |
init(java.lang.String configurationFile)
Initialize the Velocity Runtime with the name of ExtendedProperties object. |
boolean |
isVelocimacro(java.lang.String vmName,
java.lang.String templateName)
Checks to see if a VM exists |
SimpleNode |
parse(java.io.Reader reader,
java.lang.String templateName)
Parse the input and return the root of AST node structure. |
SimpleNode |
parse(java.io.Reader reader,
java.lang.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(java.lang.String key,
java.lang.Object value)
Allows an external system to set a property in the Velocity Runtime. |
void |
warn(java.lang.Object message)
Log a warning message. |
Method Detail |
public void init() throws java.lang.Exception
public void setProperty(java.lang.String key, java.lang.Object value)
String
- property keyString
- property valuepublic void setConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
ExtendedProperties
- configurationpublic void addProperty(java.lang.String key, java.lang.Object value)
String
- keyString
- valuepublic void clearProperty(java.lang.String key)
String
- key of property to clearpublic java.lang.Object getProperty(java.lang.String key)
key
- property to returnpublic void init(java.util.Properties p) throws java.lang.Exception
Properties
- public void init(java.lang.String configurationFile) throws java.lang.Exception
Properties
- public SimpleNode parse(java.io.Reader reader, java.lang.String templateName) throws ParseException
InputStream
- inputstream retrieved by a resource loaderString
- name of the template being parsedpublic SimpleNode parse(java.io.Reader reader, java.lang.String templateName, boolean dumpNamespace) throws ParseException
InputStream
- inputstream retrieved by a resource loaderString
- name of the template being parseddumpNamespace
- flag to dump the Velocimacro namespace for this templatepublic Template getTemplate(java.lang.String name) throws ResourceNotFoundException, ParseErrorException, java.lang.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.java.lang.Exception
- if an error occurs in template initializationpublic Template getTemplate(java.lang.String name, java.lang.String encoding) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
Template
from the resource managername
- The name of the desired template.encoding
- Character encoding of the templateResourceNotFoundException
- if template not found
from any available source.ParseErrorException
- if template cannot be parsed due
to syntax (or other) error.java.lang.Exception
- if an error occurs in template initializationpublic ContentResource getContent(java.lang.String name) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
name
- Name of content resource to getResourceNotFoundException
- if template not found
from any available source.public ContentResource getContent(java.lang.String name, java.lang.String encoding) throws ResourceNotFoundException, ParseErrorException, java.lang.Exception
name
- Name of content resource to getencoding
- Character encoding to useResourceNotFoundException
- if template not found
from any available source.public java.lang.String getLoaderNameForResource(java.lang.String resourceName)
resourceName
- Name of template or content resourcepublic void warn(java.lang.Object message)
Object
- message to logpublic void info(java.lang.Object message)
Object
- message to logpublic void error(java.lang.Object message)
Object
- message to logpublic void debug(java.lang.Object message)
Object
- message to logpublic java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
String
- key property keyString
- defaultValue default value to return if key not
found in resource manager.public Directive getVelocimacro(java.lang.String vmName, java.lang.String templateName)
String
- vmName Name of velocimacro requestedpublic boolean addVelocimacro(java.lang.String name, java.lang.String macro, java.lang.String[] argArray, java.lang.String sourceTemplate)
String
- name Name of velocimacroString
- macro String form of macro bodyString
- argArray Array of strings, containing the
#macro() arguments. the 0th is the name.public boolean isVelocimacro(java.lang.String vmName, java.lang.String templateName)
name
- Name of velocimacropublic boolean dumpVMNamespace(java.lang.String namespace)
public java.lang.String getString(java.lang.String key)
key
- property keypublic int getInt(java.lang.String key)
String
- key property keypublic int getInt(java.lang.String key, int defaultValue)
key
- property keyint
- default valuepublic boolean getBoolean(java.lang.String key, boolean def)
String
- key property keyboolean
- default default value if property not foundpublic org.apache.commons.collections.ExtendedProperties getConfiguration()
public Introspector getIntrospector()
public java.lang.Object getApplicationAttribute(java.lang.Object key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |