NVelocity.NAnt.Texen
Class Generator

A text/code generator class

Field Summary
string inputEncoding
         This is the encoding for the input file(s) (templates).
string OUTPUT_PATH
         Where the texen output will placed.
string outputEncoding
         This is the encoding for the output file(s).
string TEMPLATE_PATH
         Where the velocity templates live.
NVelocity.App.VelocityEngine ve
         Velocity engine.

Constructor Summary
Generator()
         Default constructor.
Generator(string propFile)
         Create a new generator object with properties loaded from a file. If the file does not exist or any other exception occurs during the reading operation the default properties are used. *
Generator(Commons.Collections.ExtendedProperties props)
         Create a new Generator object with a given property set. The property set will be duplicated. *

Property Summary
string InputEncoding
NVelocity.NAnt.Texen.Generator Instance
string LogPrefix
string OutputEncoding
string OutputPath
string TemplatePath
NVelocity.App.VelocityEngine VelocityEngine

Method Summary
void fillContextDefaults(NVelocity.Context.IContext context)
         Add properties that will aways be in the context by default *
void fillContextHash(NVelocity.Context.IContext context, System.Collections.Hashtable objs)
         Add all the contents of a Hashtable to the context. *
void fillContextProperties(NVelocity.Context.IContext context)
         Add objects to the context from the current properties. *
NVelocity.Context.IContext getContext(System.Collections.Hashtable objs)
         Create a new context and fill it with the elements of the objs Hashtable. Default objects and objects that comes from the properties of this Generator object is also added. *
NVelocity.Template getTemplate(string templateName, string encoding)
         Returns a template, based on encoding and path. *
System.IO.StreamWriter getWriter(string path, string encoding)
         Returns a writer, based on encoding and path. *
string parse(string controlTemplate, NVelocity.Context.IContext controlContext)
         Parse the control template and merge it with the control context. This is the starting point in texen. *
string parse(string inputTemplate, string intputEncoding, string outputFile, string outputEncoding, string objectID, object object_Renamed)
         Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. You can add objects to the context with the objs Hashtable. *
string parse(string inputTemplate, string outputFile, string objectID, object object_Renamed)
         Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. You can add objects to the context with the objs Hashtable. *
string parse(string inputTemplate, string outputFile)
         Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. *
void setDefaultProps()
         Set default properties.
void shutdown()
         Properly shut down the generator, right now this is simply flushing and closing the file writers that we have been holding on to.

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


Field Detail

inputEncoding

protected internal string inputEncoding

This is the encoding for the input file(s) (templates).


OUTPUT_PATH

public string OUTPUT_PATH

Where the texen output will placed.


outputEncoding

protected internal string outputEncoding

This is the encoding for the output file(s).


TEMPLATE_PATH

public string TEMPLATE_PATH

Where the velocity templates live.


ve

protected internal NVelocity.App.VelocityEngine ve

Velocity engine.

Constructor Detail

Generator

public Generator()

Default constructor.


Generator

public Generator(string propFile)

Create a new generator object with properties loaded from a file. If the file does not exist or any other exception occurs during the reading operation the default properties are used. *

Parameters:
String - properties used to help populate the control context.

Generator

public Generator(Commons.Collections.ExtendedProperties props)

Create a new Generator object with a given property set. The property set will be duplicated. *

Parameters:
Properties - properties object to help populate the control context.
Property Detail

InputEncoding

public string InputEncoding


Instance

public NVelocity.NAnt.Texen.Generator Instance


LogPrefix

public string LogPrefix


OutputEncoding

public string OutputEncoding


OutputPath

public string OutputPath


TemplatePath

public string TemplatePath


VelocityEngine

public NVelocity.App.VelocityEngine VelocityEngine

Method Detail

fillContextDefaults

protected internal void fillContextDefaults(NVelocity.Context.IContext context)

Add properties that will aways be in the context by default *

Parameters:
Context - control context to fill with default values.

fillContextHash

protected internal void fillContextHash(NVelocity.Context.IContext context,
                                        System.Collections.Hashtable objs)

Add all the contents of a Hashtable to the context. *

Parameters:
Context - context to fill with objects
Hashtable - source of objects

fillContextProperties

protected internal void fillContextProperties(NVelocity.Context.IContext context)

Add objects to the context from the current properties. *

Parameters:
Context - control context to fill with objects that are specified in the default.properties file

getContext

protected internal NVelocity.Context.IContext getContext(System.Collections.Hashtable objs)

Create a new context and fill it with the elements of the objs Hashtable. Default objects and objects that comes from the properties of this Generator object is also added. *

Parameters:
Hashtable - objects to place in the control context
Returns:
Context context filled with objects

getTemplate

public NVelocity.Template getTemplate(string templateName,
                                      string encoding)

Returns a template, based on encoding and path. *

Parameters:
templateName - name of the template
encoding - template encoding

getWriter

public System.IO.StreamWriter getWriter(string path,
                                        string encoding)

Returns a writer, based on encoding and path. *

Parameters:
path - path to the output file
encoding - output encoding

parse

public string parse(string controlTemplate,
                    NVelocity.Context.IContext controlContext)

Parse the control template and merge it with the control context. This is the starting point in texen. *

Parameters:
String - control template
Context - control context
Returns:
String generated output

parse

public string parse(string inputTemplate,
                    string intputEncoding,
                    string outputFile,
                    string outputEncoding,
                    string objectID,
                    object object_Renamed)

Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. You can add objects to the context with the objs Hashtable. *

Parameters:
String - input template
String - inputEncoding template encoding
String - output file
String - outputEncoding encoding of output file
String - id for object to be placed in the control context
String - object to be placed in the context
Returns:
String generated output from velocity

parse

public string parse(string inputTemplate,
                    string outputFile,
                    string objectID,
                    object object_Renamed)

Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. You can add objects to the context with the objs Hashtable. *

Parameters:
String - input template
String - output file
String - id for object to be placed in the control context
String - object to be placed in the context
Returns:
String generated output from velocity

parse

public string parse(string inputTemplate,
                    string outputFile)

Parse an input and write the output to an output file. If the output file parameter is null or an empty string the result is returned as a string object. Otherwise an empty string is returned. *

Parameters:
String - input template
String - output file

setDefaultProps

protected internal void setDefaultProps()

Set default properties.


shutdown

public void shutdown()

Properly shut down the generator, right now this is simply flushing and closing the file writers that we have been holding on to.