private void initializeResourceManager()
{
// Which resource manager?
IResourceManager rmInstance = (IResourceManager)
applicationAttributes[RuntimeConstants.RESOURCE_MANAGER_CLASS];
String rm = GetString(RuntimeConstants.RESOURCE_MANAGER_CLASS);
if (rmInstance == null && rm != null && rm.Length > 0)
{
// if something was specified, then make one.
// if that isn't a ResourceManager, consider
// this a huge error and throw
Object o;
try
{
Type rmType = Type.GetType(rm);
o = Activator.CreateInstance(rmType);
}
catch(System.Exception)
{
String err = "The specified class for Resourcemanager (" + rm + ") does not exist.";
Error(err);
throw new System.Exception(err);
}
if (!(o is IResourceManager))
{
String err = "The specified class for ResourceManager (" + rm +
") does not implement ResourceManager. NVelocity not initialized correctly.";
Error(err);
throw new System.Exception(err);
}
resourceManager = (IResourceManager) o;
resourceManager.Initialize(this);
}
else if (rmInstance != null)
{
resourceManager = rmInstance;
resourceManager.Initialize(this);
}
else
{
// someone screwed up. Lets not fool around...
String err =
"It appears that no class was specified as the ResourceManager. Please ensure that all configuration information is correct.";
Error(err);
throw new System.Exception(err);
}
}