JasenPlugin plugin = null;
ProbabilityCalculator pluginCalc = null;
PluginContainer container = null;
Properties props = null;
JasenPluginConfiguration pluginConfig = null;
while(i.hasNext()) {
pluginConfig = (JasenPluginConfiguration)i.next();
plugin = (JasenPlugin)Class.forName(pluginConfig.getType(), true, loader).newInstance();
logger.debug("Initialising plugin: " + plugin.getClass().getName());
// initialise the plugin
if(pluginConfig.getProperties() != null) {
props = new Properties();
props.load(this.getClass().getClassLoader().getResourceAsStream(pluginConfig.getProperties()));
}
else {
props = null;
}
plugin.init(props);
if(pluginConfig.getCalculator() != null) {
pluginCalc = (ProbabilityCalculator)Class.forName(pluginConfig.getCalculator(), true, loader).newInstance();
}
// Add the plugin to a container
container = new PluginContainer();
container.setName(pluginConfig.getName());
container.setDisplayName(pluginConfig.getDisplayName());
container.setDescription(pluginConfig.getDescription());
container.setCalculator(pluginCalc);
container.setPlugin(plugin);
// Add the container to the list
plugins.add(container);