IInputAdaptor fileInputAdaptor = new FileInputAdaptor();
IInputAdaptor httpInputAdaptor = new HttpInputAdaptor();
FileOutputAdaptor fileOutAdaptor = new FileOutputAdaptor();
FileJobExporter fileJobExporter = new FileJobExporter();
fileJobExporter.setMaxCreateReportWorker(2);
fileJobExporter.init();
fileOutAdaptor.setJobExporter(fileJobExporter);
JobResultMerger jobResultMerger = new JobResultMerger();
jobResultMerger.init();
defaultAnalysisEngine.addInputAdaptor(fileInputAdaptor);
defaultAnalysisEngine.addInputAdaptor(httpInputAdaptor);
defaultAnalysisEngine.addOutputAdaptor(fileOutAdaptor);
FileJobBuilder jobBuilder = new FileJobBuilder();
jobBuilder.init();
Map<String,Job> jobs = jobBuilder.build("jobs-config-engine.properties");
long time = System.currentTimeMillis();
for(Job job : jobs.values())
{
List<JobTask> tasks = job.getJobTasks();
List<JobTaskResult> taskResults = new ArrayList<JobTaskResult>();
for(JobTask jobtask : tasks)
{
taskResults.add(defaultAnalysisEngine.doAnalysis(jobtask));
}
JobTaskResult jobTaskResult = jobResultMerger.merge(tasks.get(0), taskResults,true,true);
defaultAnalysisEngine.doExport(tasks.get(0), jobTaskResult);
}
System.out.println(System.currentTimeMillis() - time);
fileJobExporter.releaseResource();
jobResultMerger.releaseResource();
defaultAnalysisEngine.releaseResource();
}