[rules-users] How to read DRL files not in resource classpath?
Charles
hiicharles at gmail.com
Wed Jun 13 22:13:39 EDT 2012
Thanks Geoffrey.
That really solved my problem.
Below is how I used scoreDirectorFactoryConfigy.setRuleBase( ruleBase ).
Note:
<scoreDrl>/rules.drl</scoreDrl> must be removed from solverConfig.xml or
else will have problem.
// Imports
import org.drools.compiler.RuleBaseLoader;
import org.drools.RuleBase;
// Implementation
String DRLPath = "./rules.drl";
FileReader fileReader = new FileReader( new File( *DRLPath* ) );
RuleBaseLoader ruleBaseLoader = RuleBaseLoader.getInstance();
RuleBase ruleBase = ruleBaseLoader.loadFromReader( fileReader );
scoreDirectorFactoryConfig.setRuleBase(ruleBase);
fileReader.close();
Solver solver = solverFactory.buildSolver();
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-read-DRL-files-not-in-resource-classpath-tp4017885p4017934.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list