public void run(WekaEngineInstance engineInstance) {
WekaKnowledgeFlow knowledgeFlow;
WekaKnowledgeFlowEnv knowledgeFlowEnv;
WekaEngineInstanceMonitor wekaEngineInstanceMonitor;
WorkManager wm;
WekaWork wekaWork;
WekaWorkListener wekaWorkListener;
logger.debug("IN");
try {
Assert.assertNotNull(engineInstance, "Parameter [engineInstance] cannot be null");
// wrap ...
knowledgeFlowEnv = new WekaKnowledgeFlowEnv(engineInstance.getEnv());
knowledgeFlow = WekaKnowledgeFlow.load(engineInstance.getTemplate(), knowledgeFlowEnv);
wekaEngineInstanceMonitor = new WekaEngineInstanceMonitor(engineInstance.getEnv());
WekaEngine.getConfig().getEngineOutputFilesDir();
File outputFile = new File(WekaEngine.getConfig().getEngineOutputFilesDir(), "out" + System.currentTimeMillis() + ".txt");
logger.debug("Outputfile set to [" + outputFile + "]");
knowledgeFlowEnv.setOutputFile( outputFile );
//knowledgeFlowEnv.setOutputFile(new File("C:\\ProgramFiles\\apache-tomcat-6.0.18\\resources\\weka\\outputfiles\\pippo.txt"));
// ...and run
wm = new WorkManager();
wekaWork = new WekaWork(knowledgeFlow);
wekaWorkListener = new WekaWorkListener( wekaEngineInstanceMonitor );
wm.run(wekaWork, wekaWorkListener);
} catch (Throwable t) {
throw new RuntimeException("Impossible to execute command in a new thread", t);
} finally {
logger.debug("OUT");
}