1
votes

I am use xls file as resource for Drools engine. If I understand correctly, when starts, internal Drools engine converts .xls file to .drl file first, next compile and run in normal manner. The question is how can I catch intermediate .drl file on the way xls -> drl. I need it for troubleshooting. Are there others ways for debug .xls drools capability ?

1

1 Answers

3
votes

This is some code I've lying around that is running under 5.x. You may have to change the import for 6.x.

import org.drools.decisiontable.SpreadsheetCompiler;

private void testSpreadsheet( String dtpath ){
File dtf = new File( dtPath );
InputStream is;
try {
  is = new FileInputStream( dtf );
  SpreadsheetCompiler ssComp = new SpreadsheetCompiler();
  String s = ssComp.compile( is, InputType.XLS );
  System.out.println( "=== Begin generated DRL ===" );
  System.out.println( s );
  System.out.println( "=== End generated DRL ===" );
} catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
}

}