{
throw new WorkflowParserException(algName.trim() + ".classpath setting not found.", e);
}
logger.debug("Algorithm class: " + classPath);
Algorithm alg = createAlgorithmInstance(classPath);
Util.assertNotNull(alg);
String propLocation = m_properties.getProperty(algName.trim() + ".properties");
if(propLocation != null)
{
Properties algProperties = new Properties();
try
{
algProperties.load(new FileInputStream(propLocation));
alg.setConfig(algProperties);
}
catch(Exception e)
{
logger.error("Cannot set algorithm properties.", e);
}
}
/*
* If it is a evaluation algorithm, then get .classpath and .evaluate settings.
* Instantiate the inner algorithm and wrap it with the eval alg.
*/
if(alg instanceof EvaluationAlgorithm)
{
String innerAlgName = m_properties.getProperty(algName.trim() + ".evaluate");
try
{
Util.assertNotNull(innerAlgName);
}
catch(Exception e)
{
throw new WorkflowParserException(algName.trim() + ".evalute setting not found. An evaluation " +
"algorithm must wrap a reputation system testbed algorithm.", e);
}
logger.debug("Inner algorithm name: " + innerAlgName);
String innerAlgClasspath = m_properties.getProperty(innerAlgName.trim() + ".classpath");
try
{
Util.assertNotNull(innerAlgClasspath);
}
catch(Exception e)
{
throw new WorkflowParserException(".classpath setting not found for an algorithm. ", e);
}
logger.debug("Inner algorithm classpath: " + innerAlgClasspath);
Algorithm innerAlg = createAlgorithmInstance(innerAlgClasspath);
Util.assertNotNull(innerAlg);
((EvaluationAlgorithm) alg).wrap(innerAlg);
}