I'm a bit confused as to how this relates to your previous post. Where are
you getting the exception?
Something like this would work:
File dsl = new File("Path of your rule");
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newFileResource(dsl), ResourceType.DRL);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
FactType airlineType = kbase.getFactType("droolshelloworld",
"Airline");
Object ob = airlineType.newInstance();
airlineType.set(ob, "name", "//Airline");
session.insert(ob);
session.fireAllRules();
And your rule looks like this:
declare Airline
name:String
end
rule"Test"
when
message:Airline(name=="//Airline")
then
System.out.println("Hello Richa.....");
end
As I said in my previous post. You really need to read some tutorials on
this.
--
View this message in context:
http://drools.46999.n3.nabble.com/Pass-Parameter-to-drools-file-dynamical...
Sent from the Drools: User forum mailing list archive at
Nabble.com.