NVelocity.App
Class Velocity

Constructor Summary
Velocity()
        Initializes a new instance of the Velocity class.

Property Summary
Commons.Collections.ExtendedProperties ExtendedProperties
         Set an entire configuration at once. This is useful in cases where the parent application uses the ExtendedProperties class and the velocity configuration is a subset of the parent application's configuration.

Method Summary
void AddProperty(string key, object value_Renamed)
         Add a Velocity Runtime property.
void ClearProperty(string key)
         Clear a NVelocity Runtime property.
void Debug(object message)
         Log a debug message.
void Error(object message)
         Log an error message.
bool Evaluate(NVelocity.Context.IContext context, System.IO.TextWriter out_Renamed, string logTag, string instring)
         renders the input string using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.
bool Evaluate(NVelocity.Context.IContext context, System.IO.TextWriter writer, string logTag, System.IO.Stream instream)
         Renders the input stream using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.
bool Evaluate(NVelocity.Context.IContext context, System.IO.TextWriter writer, string logTag, System.IO.TextReader reader)
         Renders the input reader using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.
object GetProperty(string key)
         Get a Velocity Runtime property.
NVelocity.Template GetTemplate(string name)
         Returns a
Template
from the Velocity resource management system.
NVelocity.Template GetTemplate(string name, string encoding)
         Returns a
Template
from the Velocity resource management system.
void Info(object message)
         Log an info message.
void Init()
         initialize the NVelocity runtime engine, using the default properties of the NVelocity distribution
void Init(string propsFilename)
         initialize the Velocity runtime engine, using default properties plus the properties in the properties file passed in as the arg
void Init(Commons.Collections.ExtendedProperties p)
         initialize the Velocity runtime engine, using default properties plus the properties in the passed in java.util.Properties object
bool InvokeVelocimacro(string vmName, string logTag, string[] params_Renamed, NVelocity.Context.IContext context, System.IO.TextWriter writer)
bool MergeTemplate(string templateName, NVelocity.Context.IContext context, System.IO.TextWriter writer)
         merges a template and puts the rendered stream into the writer
bool MergeTemplate(string templateName, string encoding, NVelocity.Context.IContext context, System.IO.TextWriter writer)
         merges a template and puts the rendered stream into the writer
void SetApplicationAttribute(object key, object value_Renamed)
         Set the an ApplicationAttribue, which is an Object set by the application which is accessable from any component of the system that gets a RuntimeServices. This allows communication between the application environment and custom pluggable components of the Velocity engine, such as loaders and loggers. Note that there is no enfocement or rules for the key used - it is up to the application developer. However, to help make the intermixing of components possible, using the target Class name (e.g. com.foo.bar ) as the key might help avoid collision.
void SetProperty(string key, object value_Renamed)
         Set a Velocity Runtime property.
bool TemplateExists(string templateName)
void Warn(object message)
         Log a warning message.

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Constructor Detail

Velocity

public Velocity()

Initializes a new instance of the Velocity class.

Property Detail

ExtendedProperties

public Commons.Collections.ExtendedProperties ExtendedProperties

Set an entire configuration at once. This is useful in cases where the parent application uses the ExtendedProperties class and the velocity configuration is a subset of the parent application's configuration.

Parameters:
ExtendedProperties - configuration
Method Detail

AddProperty

public void AddProperty(string key,
                        object value_Renamed)

Add a Velocity Runtime property.

Parameters:
String - key
Object - value

ClearProperty

public void ClearProperty(string key)

Clear a NVelocity Runtime property.

Parameters:
key - of property to clear

Debug

public void Debug(object message)

Log a debug message.

Parameters:
Object - message to log

Error

public void Error(object message)

Log an error message.

Parameters:
Object - message to log

Evaluate

public bool Evaluate(NVelocity.Context.IContext context,
                     System.IO.TextWriter out_Renamed,
                     string logTag,
                     string instring)

renders the input string using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.

Parameters:
context - context to use in rendering input string
out - Writer in which to render the output
logTag - string to be used as the template name for log messages in case of error
instring - input string containing the VTL to be rendered
Returns:
true if successful, false otherwise. If false, see Velocity runtime log

Evaluate

public bool Evaluate(NVelocity.Context.IContext context,
                     System.IO.TextWriter writer,
                     string logTag,
                     System.IO.Stream instream)

Renders the input stream using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.

Parameters:
context - context to use in rendering input string
out - Writer in which to render the output
logTag - string to be used as the template name for log messages in case of error
instream - input stream containing the VTL to be rendered
Returns:
true if successful, false otherwise. If false, see Velocity runtime log

Evaluate

public bool Evaluate(NVelocity.Context.IContext context,
                     System.IO.TextWriter writer,
                     string logTag,
                     System.IO.TextReader reader)

Renders the input reader using the context into the output writer. To be used when a template is dynamically constructed, or want to use Velocity as a token replacer.

Parameters:
context - context to use in rendering input string
out - Writer in which to render the output
logTag - string to be used as the template name for log messages in case of error
reader - Reader containing the VTL to be rendered
Returns:
true if successful, false otherwise. If false, see Velocity runtime log

GetProperty

public object GetProperty(string key)

Get a Velocity Runtime property.

Parameters:
key - property to retrieve
Returns:
property value or null if the property not currently set

GetTemplate

public NVelocity.Template GetTemplate(string name)

Returns a

Template
from the Velocity resource management system.

Parameters:
name - The file name of the desired template.
Returns:
The template. @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if an error occurs in template initialization

GetTemplate

public NVelocity.Template GetTemplate(string name,
                                      string encoding)

Returns a

Template
from the Velocity resource management system.

Parameters:
name - The file name of the desired template.
encoding - The character encoding to use for the template.
Returns:
The template. @throws ResourceNotFoundException if template not found from any available source. @throws ParseErrorException if template cannot be parsed due to syntax (or other) error. @throws Exception if an error occurs in template initialization @since Velocity v1.1

Info

public void Info(object message)

Log an info message.

Parameters:
Object - message to log

Init

public void Init()

initialize the NVelocity runtime engine, using the default properties of the NVelocity distribution


Init

public void Init(string propsFilename)

initialize the Velocity runtime engine, using default properties plus the properties in the properties file passed in as the arg

Parameters:
propsFilename - file containing properties to use to initialize the Velocity runtime

Init

public void Init(Commons.Collections.ExtendedProperties p)

initialize the Velocity runtime engine, using default properties plus the properties in the passed in java.util.Properties object

Parameters:
p - Proprties object containing initialization properties

InvokeVelocimacro

public bool InvokeVelocimacro(string vmName,
                              string logTag,
                              string[] params_Renamed,
                              NVelocity.Context.IContext context,
                              System.IO.TextWriter writer)


MergeTemplate

public bool MergeTemplate(string templateName,
                          NVelocity.Context.IContext context,
                          System.IO.TextWriter writer)

merges a template and puts the rendered stream into the writer

Parameters:
templateName - name of template to be used in merge
context - filled context to be used in merge
writer - writer to write template into
Returns:
true if successful, false otherwise. Errors logged to velocity log.

MergeTemplate

public bool MergeTemplate(string templateName,
                          string encoding,
                          NVelocity.Context.IContext context,
                          System.IO.TextWriter writer)

merges a template and puts the rendered stream into the writer

Parameters:
templateName - name of template to be used in merge
encoding - encoding used in template
context - filled context to be used in merge
writer - writer to write template into
Returns:
true if successful, false otherwise. Errors logged to velocity log @since Velocity v1.1

SetApplicationAttribute

public void SetApplicationAttribute(object key,
                                    object value_Renamed)

Set the an ApplicationAttribue, which is an Object set by the application which is accessable from any component of the system that gets a RuntimeServices. This allows communication between the application environment and custom pluggable components of the Velocity engine, such as loaders and loggers. Note that there is no enfocement or rules for the key used - it is up to the application developer. However, to help make the intermixing of components possible, using the target Class name (e.g. com.foo.bar ) as the key might help avoid collision.

Parameters:
key - object 'name' under which the object is stored
value - object to store under this key

SetProperty

public void SetProperty(string key,
                        object value_Renamed)

Set a Velocity Runtime property.

Parameters:
String - key
Object - value

TemplateExists

public bool TemplateExists(string templateName)


Warn

public void Warn(object message)

Log a warning message.

Parameters:
Object - message to log