Jostraca Reference

Configuration Settings

Ant Attributes
Command Line Options
Configuration Settings
Glossary
Template Directives
Template Sections
Template Services
Standard Files and Folders
www.jostraca.org
info@jostraca.org

Index (most frequently used first) [ alphabetical index ]
General Settings   
main.JostracaVersion   Version of Jostraca expected by the template
main.TemplateScript   Name of the scripting language used by the template
main.OutputFolder   Location of generated files
main.WorkFolder   Location of the CodeWriter program
main.FileNameRoot   Root name of each generated file
main.FileNamePrefix   Prefix to the root name of generated files
main.FileNameSuffix   Suffix to the root name of generated files
main.BackupFolder   Location of backup files
main.BackupPrefix   Prefix to name of backup files
main.BackupSuffix   Suffix to the name of backup files
main.CodeWriter   Name of the CodeWriter program
main.CodeWriterPrefix   Prefix to the name of the CodeWriter program
main.CodeWriterSuffix   Suffix to the name of the CodeWriter program
main.MetaFolder   Location of the template metadata
main.OutputLang   Language used in generated files
Process Settings   
main.ProcessStages   Ordered set of classes for processing templates
Control Settings   
main.ExternalCompiler   External program that compiles the CodeWriter program
main.ExternalCompilerOptions   Arguments to the external command line compiler
main.ExternalController   External command line program that executes the CodeWriter program
main.ExternalControllerOptions   Arguments to the external command line controller
main.SaveCodeWriter   Option to save the CodeWriter program
main.CompileCodeWriter   Option to compile the CodeWriter program
main.ExecuteCodeWriter   Option to execute the CodeWriter program
main.MakeBackup   Option to make backups of generated files
main.EnableMeta   Option to create template metadata
main.CodeWriterFormat   WriterFormat for the CodeWriter program
Language Settings   
lang.TextQuote   Source code used to quote text strings
lang.InsertPrefix   Source code prefixed to inserted text
lang.InsertSuffix   Source code suffixed to inserted text
lang.CommentLinePrefix   Source code to start a comment line
lang.CommentLineSuffix   Source code to end a comment line
lang.CommentBlockPrefix   Source code prefix to comment a block of code
lang.CommentBlockSuffix   Source code suffix to comment a block of code
Parse Settings   
parse.OpenOuterChar   Outer character of opening template script escape sequence
parse.OpenInnerChar   Inner character of opening template script escape sequence
parse.CloseInnerChar   Inner character of closing template script escape sequence
parse.CloseOuterChar   Outer character of closing template script escape sequence







General Settings
SettingTypeDescription
main.JostracaVersion
[ top ]
Version number
This setting indicates the version of Jostraca expected by the template. This setting is required in the conf directive of each template. Jostraca uses the version number specified here to enable backwards compatibility between templates.

The minimal conf directive in any template is thus:
  <% @conf
  main.JostracaVersion = 0.4
  %>
main.TemplateScript
[ top ]
String
Jostraca templates can be scripted in many languages. This setting specifies the scripting language used in the template. By default, the template scripting language is java. To check if a scripting language is supported, see if a configuration file exists for the language in the conf folder of the Jostraca distribution.

Example:
  <% @conf
  main.JostracaVersion = 0.4
  main.TemplateScript  = perl
  %>
main.OutputFolder
[ top ]
Absolute or relative folder path
Generated files are saved to this folder. You can also specify this setting on the command line using the -o option, and inside the template by using the template service method _setOutputFolder.

See: main.WorkFolder
main.WorkFolder
[ top ]
Absolute or relative folder path
Files generated by Jostraca are saved to disk by the CodeWriter program. The CodeWriter program is itself created by Jostraca as part of the generation process. The CodeWriter program is saved to a work folder. If this setting is not specified, the work folder and the output folder are one and the same.

Setting the work folder separately allows you to place the CodeWriter program in a different location to the generated files. You can use this setting to avoid polluting your source tree with CodeWriter programs. You can specify this setting on the command line using the -w option.

See: main.OutputFolder

Example:
jostraca -o generated-files-folder \
  -w code-writer-folder
main.FileNameRoot
[ top ]
Partial file name
The names of generated files are formed by concatenating the values of the settings main.FileNamePrefix, main.FileNameRoot and main.FileNameSuffix.

These settings are specified using the template service methods _setFileNamePrefix, _setFileNameRoot and _setFileNameSuffix.
main.FileNamePrefix
[ top ]
Partial file name
See: main.FileNameRoot
main.FileNameSuffix
[ top ]
Partial file name
See: main.FileNameRoot
main.BackupFolder
[ top ]
Absolute or relative folder path
Previously generated files are backed up to this folder before being overwritten. The backup file names are prefixed with a date-time stamp followed by the value of main.BackupPrefix and suffixed with the value of main.BackupSuffix. This setting can also be specified on the command line using the -b option.

See: main.BackupPrefix, main.BackupSuffix, main.MakeBackup
main.BackupPrefix
[ top ]
Partial file name
See: main.BackupFolder
main.BackupSuffix
[ top ]
Partial file name
See: main.BackupFolder
main.CodeWriter
[ top ]
Partial file name
This setting specifies the name of the CodeWriter program. The CodeWriter is the compiled version of the template and is executed by Jostraca to actually create the generated output files.

The name of the CodeWriter is formed by concatenating the values of the settings main.CodeWriterPrefix, main.CodeWriter and main.CodeWriterSuffix. However, if main.CodeWriter is not defined (the default), then the name of the CodeWriter is formed by adding the suffix Writer to the name of the template. The name of the template is converted to a standard form so that it forms a valid Java variable name (non-alphanumeric characters are removed).

See: main.CodeWriterPrefix, main.CodeWriterSuffix
main.CodeWriterPrefix
[ top ]
Partial file name
See: main.CodeWriter
main.CodeWriterSuffix
[ top ]
Partial file name
See: main.CodeWriter
main.MetaFolder
[ top ]
Absolute or relative folder path
A record is kept of the properties and files used to generate each template. This metadata is saved to a special properties file in a specified metadata folder. If this setting is not specified, the metadata folder and the work folder are the same.

Setting the metadata folder separately allows you to place the metadata properties file in a different location to the generated files and the CodeWriter. You can use this setting to avoid polluting your work folder with additional property files. You can specify this setting on the command line using the -m option.

See: main.WorkFolder

Example:
jostraca -m metadata-folder \
  -w code-writer-folder
main.OutputLang
[ top ]
name of language
This option can be used to provide extra information to IDE tools (such as CodeGenClipse) about the target language of the generated files.

Process Settings
SettingTypeDescription
main.ProcessStages
[ top ]
partial class names
This is an internal setting that specifies the processing stages that will be applied to template. These processing stages can be different for different template scripting languages. Each language specific configuration file in the conf folder specifies the processing stages for that language.

The process stages are dynamically defined and implementation specific so they will not be dicussed here. However, each stage requires a special property that defines the implemenation class for that stage. For example, if a Preparer stage is present, then a main.process.Preparer property must be defined.

Control Settings
SettingTypeDescription
main.ExternalCompiler
[ top ]
Command line program
Jostraca compiles the template source code into a CodeWriter program. This CodeWriter program must then itself be compiled, before it can be executed by Jostraca. This compilation is performed by an external program. This external program is the compiler for the template scripting language used in the template. For example, javac is used when the template scripting language is java. The setting main.ExternalCompiler specifies this external compiler program.

Note that in order to use this option, you must specify an external compiler stage with the main.process.Compiler dynamic setting. For example, for Java, use:
  main.process.Compiler = org.jostraca.process.ExternalJavaCompiler
  


See: main.ExternalCompilerOptions, main.CodeWriterCompiler
main.ExternalCompilerOptions
[ top ]
Command line arguments.
This setting specifies the command line options to the external compiler program specified by the setting main.ExternalCompiler.

See: main.ExternalCompiler
main.ExternalController
[ top ]
Command line program.
The CodeWriter program must be executed to generate the output files from the template. With most scripting languages this is performed by a command line program, such as perl or python that executes the CodeWriter script. The setting main.ExternalController specifies this external controller program.

See: main.ExternalControllerOptions, main.CodeWriterController

Note that in order to use this option, you must specify an external controller stage with the main.process.Controller dynamic setting. For example, for Java, use:
  main.process.Controller = org.jostraca.process.ExternalJavaController
  
Also note that for most scripting languages like Perl and Python and external controller is used by default so that changing this setting is not necessary.
main.ExternalControllerOptions
[ top ]
Command line arguments.
This setting specifies the command line options to the external controller program specified by the setting main.ExternalController.

See: main.ExternalController
main.SaveCodeWriter
[ top ]
Yes or No
The CodeWriter program source code must be saved to disk before it can be compiled and executed by Jostraca. When this setting is set to yes (the default) the CodeWriter program source code is written to disk, when set to no, it is not.

For maximum flexibility this setting is independent of the main.CompileCodeWriter and main.ExecuteCodeWriter settings.

See: main.CompileCodeWriter, main.ExecuteCodeWriter
main.CompileCodeWriter
[ top ]
Yes or No.
This setting controls the compilation of the CodeWriter program. When this setting is set to yes (the default) the CodeWriter program is compiled, when set to no, it is not.

The actual compilation is controlled by the settings main.CodeWriterCompiler and main.CodeWriterCompilerOptions.

This setting can also be specified on the command lines using the -c option for yes, and the -C option for no.

For maximum flexibility this setting is independent of the main.SaveCodeWriter and main.ExecuteCodeWriter settings.

See: main.SaveCodeWriter, main.ExecuteCodeWriter
main.ExecuteCodeWriter
[ top ]
Yes or No.
This setting controls the execution of the CodeWriter program. If the CodeWriter is not executed, no output files are generated. When this setting is set to yes (the default) the CodeWriter program is executed, when set to no, it is not.

The actual execution is controlled by the settings main.CodeWriterController and main.CodeWriterControllerOptions.

This setting can also be specified on the command lines using the -g option for yes, and the -G option for no.

For maximum flexibility this setting is independent of the main.SaveCodeWriter and main.CompileCodeWriter settings.

See: main.SaveCodeWriter, main.CompileCodeWriter
main.MakeBackup
[ top ]
Yes or No.
Backups of generated files are made when this setting is set to yes (the default). Backups are not made when this setting is set to no

The command line option -B can also be used to turn backups off.

See: main.BackupFolder
main.EnableMeta
[ top ]
Yes or No.
Metadata describing the template generation process is stored when this setting is set to yes (the default). Metadata is not stored when this setting is set to no

The command line option -M can also be used to turn metadata off.

See: main.MetaFolder
main.CodeWriterFormat
[ top ]
Absolute or relative file path
The WriterFormat is used as the framework for the CodeWriter program. Jostraca stores a set of basic WriterFormats in the format subfolder of the jostraca folder.

Language Settings
SettingTypeDescription
lang.TextQuote
[ top ]
Source code
Literal text strings in the CodeWriter program source code must be properly quoted using an appropriate character from the template scripting language, which in most cases is the double quote character: ". This character is specified in the setting lang.TextQuote.

See: lang.InsertPrefix, lang.InsertSuffix, lang.TemplateTextTransforms
lang.InsertPrefix
[ top ]
Source code
Template text is inserted into generated files by calling an _insert template service method in the CodeWriter program. Such method calls appear as
 _insert( "text" ); 
in the Java version of the CodeWriter program. Other languages are similar. The text string is prefixed with the value of lang.InsertPrefix, suffixed with the value of lang.InsertSuffix and quoted with the value of lang.TextQuote.

See: lang.TextQuote, lang.InsertSuffix, lang.TemplateTextTransforms, lang.TemplateInsertTransforms
lang.InsertSuffix
[ top ]
Source code
See: lang.InsertPrefix
lang.CommentLinePrefix
[ top ]
Source code
This setting is used to create single line comments inside the CodeWriter program. The comment is prefixed with the value of lang.CommentLinePrefix and suffixed with the value of lang.CommentLineSuffix. You should use the normal symbol for the template scripting language.

See: lang.CommentLineSuffix
lang.CommentLineSuffix
[ top ]
Source code
See: lang.CommentLinePrefix
lang.CommentBlockPrefix
[ top ]
Source code
This setting is used to comment blocks of code inside the CodeWriter program. The comment block is prefixed with the value of lang.CommentBlockPrefix and suffixed with the value of lang.CommentBlockSuffix. You should use the normal symbol for the template scripting language.

See: lang.CommentBlockSuffix
lang.CommentBlockSuffix
[ top ]
Source code
See: lang.CommentBlockPrefix

Parse Settings
SettingTypeDescription
parse.OpenOuterChar
[ top ]
Single character.
Template text and script are differentiated by placing template script inside escape sequences such as <% and %>. The open outer character is the first character of the opening escape sequence, by default, <.

See: parse.OpenInnerChar
parse.OpenInnerChar
[ top ]
Single character.
The default value is %.
See: parse.OpenOuterChar
parse.CloseInnerChar
[ top ]
Single character.
The default value is %.
See: parse.OpenOuterChar.
parse.CloseOuterChar
[ top ]
Single character.
The default value is >.
See: parse.OpenOuterChar

Index (alphabetical) [ top ]
lang.CommentBlockPrefix   Source code prefix to comment a block of code
lang.CommentBlockSuffix   Source code suffix to comment a block of code
lang.CommentLinePrefix   Source code to start a comment line
lang.CommentLineSuffix   Source code to end a comment line
lang.InsertPrefix   Source code prefixed to inserted text
lang.InsertSuffix   Source code suffixed to inserted text
lang.TextQuote   Source code used to quote text strings
main.BackupFolder   Location of backup files
main.BackupPrefix   Prefix to name of backup files
main.BackupSuffix   Suffix to the name of backup files
main.CodeWriter   Name of the CodeWriter program
main.CodeWriterFormat   WriterFormat for the CodeWriter program
main.CodeWriterPrefix   Prefix to the name of the CodeWriter program
main.CodeWriterSuffix   Suffix to the name of the CodeWriter program
main.CompileCodeWriter   Option to compile the CodeWriter program
main.EnableMeta   Option to create template metadata
main.ExecuteCodeWriter   Option to execute the CodeWriter program
main.ExternalCompiler   External program that compiles the CodeWriter program
main.ExternalCompilerOptions   Arguments to the external command line compiler
main.ExternalController   External command line program that executes the CodeWriter program
main.ExternalControllerOptions   Arguments to the external command line controller
main.FileNamePrefix   Prefix to the root name of generated files
main.FileNameRoot   Root name of each generated file
main.FileNameSuffix   Suffix to the root name of generated files
main.JostracaVersion   Version of Jostraca expected by the template
main.MakeBackup   Option to make backups of generated files
main.MetaFolder   Location of the template metadata
main.OutputFolder   Location of generated files
main.OutputLang   Language used in generated files
main.ProcessStages   Ordered set of classes for processing templates
main.SaveCodeWriter   Option to save the CodeWriter program
main.TemplateScript   Name of the scripting language used by the template
main.WorkFolder   Location of the CodeWriter program
parse.CloseInnerChar   Inner character of closing template script escape sequence
parse.CloseOuterChar   Outer character of closing template script escape sequence
parse.OpenInnerChar   Inner character of opening template script escape sequence
parse.OpenOuterChar   Outer character of opening template script escape sequence































Copyright © 2000-2001 Richard Rodger.