out = new PrintStream (getOutputDirectory()+number+root+"_results.xml");
if(Trace()){
tracefile = new FileOutputStream(getOutputDirectory()+number+root+"_trace.xml");
}
IRSession session = rs.newSession();
DTState state = session.getState();
state.setOutput(tracefile, out);
if(Trace()){
state.setState(DTState.DEBUG | DTState.TRACE);
if(Verbose()){
state.setState(DTState.VERBOSE);
}
state.traceStart();
}
// Get the XML mapping for the rule set, and load a set of data into the EDD
loadData(session, path, dataset);
if(Verbose()){
if(harnessVersion() < 2){
datamap.print(new FileOutputStream(getOutputDirectory()+number+root+"_datamap.xml"));
}else{
autoDataMap.printDataLoadXML(new FileOutputStream(getOutputDirectory()+number+root+"_datamap.xml"));
}
entityfile = new FileOutputStream(getOutputDirectory()+number+root+"_entities_before.xml");
RArray entitystack = new RArray(0,false,false);
for(int i=0; i< session.getState().edepth()-2; i++){
entitystack.add(session.getState().entityfetch(i));
}
session.printEntityReport(new XMLPrinter(entityfile), false, false, session.getState(), "entitystack", entitystack);
}
// Once the data is loaded, execute the rules.
RulesException ex = null;
try{
executeDecisionTables(session);
}catch(RulesException e){
ex = e;
}
// Then if asked, dump the entities.
if(Verbose()){
entityfile = new FileOutputStream(getOutputDirectory()+number+root+"_entities_after.xml");
RArray entitystack = new RArray(0,false,false);
for(int i=0; i< session.getState().edepth()-2; i++){
entitystack.add(session.getState().entityfetch(i));
}
session.printEntityReport(new XMLPrinter(entityfile),false, false, session.getState(), "entitystack", entitystack);
}
if(ex!=null)throw ex;
// Print the report
try{
printReport(dfcnt, session, out);
}catch(Throwable e){
if(!Console()){ // If we are going to the console, assume the same
// error will get thrown, so don't print twice.
System.out.println(e.toString());
}
}
// If asked, print the report again to the console.
if(Console()){
try{
printReport(dfcnt, session,System.out);
}catch(Throwable e){
System.out.println(e.toString());
}
}
if(Trace()){
session.getState().traceEnd();
}
} catch ( Exception ex ) {
System.out.print("<-ERR ");
if(Console()){