After installing Eclipse 3.2.1, I downloaded drools Eclipse IDE 3.0.4 plugin from JBoss site and put it in the plugins folder of eclipse home dir. Then restart eclipse, then File -> New -> Project -> JBoss Rules -> New Rules Project. I give a name for the project and click Finish. This has create the project with two automatically created source folders namely src/java and src/rules. In src/java, I can see com.samples.DroolsTest.java which uses the rule Sample.drl in src/rules.
But I obtained some errors in code(the bold lines), like:
- the method newWorkingMemory() is undefined for ruleBase type
- the method fireAllRules () is undefined for workingMemory type
- the method addPackage(pkg) is undefined for ruleBase type
//load up the rulebase
RuleBase ruleBase = readRule();
WorkingMemory workingMemory =
ruleBase.newWorkingMemory();
//go !
Message message = new Message();
message.setMessage( "Hello World" );
message.setStatus( Message.HELLO );
workingMemory.assertObject( message );
workingMemory.fireAllRules();
.......................................................
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
Please tell me what is the problem.
Regards, Alan.
Sponsored Link
Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate - Click now to apply
