[rules-users] drools 4.0 compilation
Mark Proctor
mproctor at codehaus.org
Thu Aug 9 07:25:25 EDT 2007
Why do you want to do that? just stick with the default conflict
resolver. If you really want to do this over ride the setting on the
RuleBaseConfiguration.
I discussed setting this property in the email yesterday with the
subject "Re: [rules-users] Decision Tables: Probelm with sequence=true".
Mark
fuadhamidov wrote:
> ok, now final state of my code is as bellow.
> now my question is this: how do i define compositeConflictResolver to
> RuleBase?
>
>
> private static void runrule(CmsFlightServiceUsg usg) throws Exception {
> ConflictResolver[] conflictResolvers = new ConflictResolver[] {
> SalienceConflictResolver.getInstance(),
> ComplexityConflictResolver.getInstance(),
> FifoConflictResolver.getInstance() };
> CompositeConflictResolver compositeConflictResolver = new
> CompositeConflictResolver(
> conflictResolvers);
> Package pkg = (Package) readSerializedObject();
>
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> ruleBase.addPackage(pkg);
> WorkingMemory workingMemory = ruleBase.newStatefulSession();
> workingMemory.insert(usg);
> workingMemory.fireAllRules();
> }
>
> private static void compile() throws Exception {
> String rulecontent = readRuleFromFile();
> PackageBuilder builder = new PackageBuilder();
> builder.addPackageFromXml(new BufferedReader(new StringReader(
> rulecontent)));
> Package pkg = builder.getPackage();
> writeSerializedObject(pkg);
> }
>
> private static void writeSerializedObject(Object object) throws IOException
> {
> FileOutputStream fileOutputStream = new FileOutputStream("sample.txt");
> ObjectOutputStream objectOutputStream = new ObjectOutputStream(
> fileOutputStream);
> objectOutputStream.writeObject(object);
> objectOutputStream.close();
> }
>
> private static Object readSerializedObject() throws IOException,
> ClassNotFoundException {
> FileInputStream fileInputStream = new FileInputStream("sample.txt");
> ObjectInputStream objectInputStream = new ObjectInputStream(
> fileInputStream);
> Object object = objectInputStream.readObject();
> return object;
> }
>
>
> Mark Proctor wrote:
>
>> While drools 2.x was limited to XML, 4.0 preference is for the DRL,
>> which is a none xml format. It doesn't produce a jar at the moment just
>> a binary Packaage instance, which you can serialise.
>>
>> Mark
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070809/32c0b620/attachment.html
More information about the rules-users
mailing list