in ti/phase2/jars/core/src/java/org/apache/ti/script/ExpressionEvaluatorFactory.java [83:168]
private static final ExpressionEngineFactory initialize(Map factoryMap) {
assert factoryMap != null;
NetUIConfig config = ConfigUtil.getConfig();
ExpressionLanguagesConfig elConfig = config.getExpressionLanguages();
assert elConfig != null;
ExpressionLanguageConfig[] els = elConfig.getExpressionLanguages();
assert els != null;
if (els != null) {
for (int i = 0; i < els.length; i++) {
String name = els[i].getName();
String className = els[i].getFactoryClass();
ExpressionEngineFactory factory = null;
try {
Class type = Class.forName(className);
factory = (ExpressionEngineFactory) type.newInstance();
} catch (ClassNotFoundException cnf) {
if (_logger.isWarnEnabled()) {
_logger.warn("Could not create an ExpressionEngineFactory for type \"" + className +
"\" because the implementation class could not be found.");
}
continue;
} catch (Exception ex) {
assert ex instanceof IllegalAccessException || ex instanceof InstantiationException;
if (_logger.isWarnEnabled()) {
_logger.warn("Could not create an ExpressionEngineFactory for type \"" + className +
"\" because an error occurred creating the factory. Cause: " + ex, ex);
}
continue;
}
if (factoryMap.containsKey(name)) {
if (_logger.isWarnEnabled()) {
_logger.warn("Overwriting a previously defined ExpressionEngineFactory named \"" + name +
"\" with a new ExpressionEngineFactory of type \"" + className + "\"");
} else {
_logger.info("Adding an ExpressionEngineFactory named \"" + name + "\" with implementation \"" +
className + "\"");
}
}
factoryMap.put(name, factory);
}
}
ExpressionEngineFactory defaultEngineFactory = null;
String defaultLanguage = elConfig.getDefaultLanguage();
if (defaultLanguage != null) {
defaultEngineFactory = (ExpressionEngineFactory) factoryMap.get(defaultLanguage);
if (defaultEngineFactory != null) {
if (_logger.isInfoEnabled()) {
_logger.info("Using a default expression evaluator of type \"" +
factoryMap.get(defaultLanguage).getClass().getName() + "\"");
}
} else {
String msg = "The default ExpressionEvaluator named \"" + defaultLanguage +
"\" was specified, but the ExpressionEngineFactory could not be found.";
if (_logger.isWarnEnabled()) {
_logger.warn(msg);
}
throw new RuntimeException(msg);
}
} else {
String msg = "There is no default expression engine specified.";
if (_logger.isErrorEnabled()) {
_logger.error(msg);
}
throw new RuntimeException(msg);
}
return defaultEngineFactory;
}