private void initializeDirectives()
{
initializeDirectiveManager();
/*
* Initialize the runtime directive table.
* This will be used for creating parsers.
*/
// runtimeDirectives = new Hashtable();
ExtendedProperties directiveProperties = new ExtendedProperties();
/*
* Grab the properties file with the list of directives
* that we should initialize.
*/
try
{
directiveProperties.Load(
Assembly.GetExecutingAssembly().GetManifestResourceStream(RuntimeConstants.DEFAULT_RUNTIME_DIRECTIVES));
}
catch(System.Exception ex)
{
throw new System.Exception("Error loading directive.properties! " + "Something is very wrong if these properties " +
"aren't being located. Either your Velocity " +
"distribution is incomplete or your Velocity " + "jar file is corrupted!\n" + ex.Message);
}
/*
* Grab all the values of the properties. These
* are all class names for example:
*
* NVelocity.Runtime.Directive.Foreach
*/
IEnumerator directiveClasses = directiveProperties.Values.GetEnumerator();
while(directiveClasses.MoveNext())
{
String directiveClass = (String) directiveClasses.Current;
// loadDirective(directiveClass);
directiveManager.Register(directiveClass);
}
/*
* now the user's directives
*/
String[] userdirective = configuration.GetStringArray("userdirective");
for(int i = 0; i < userdirective.Length; i++)
{
// loadDirective(userdirective[i]);
directiveManager.Register(userdirective[i]);
}
}