Custom entity resolver support for RuleSetReader
------------------------------------------------
Key: DROOLS-466
URL: http://jira.codehaus.org/browse/DROOLS-466
Project: drools
Type: Improvement
Components: io
Versions: 2.1
Reporter: Charles Zhao
Attachments: RuleSetReader.java
We are using Drools to build a validation framework and need to support
reusable rule files that can be imported into ruleset files. We've searched
around and seems the only way is to use xml entities (it would be very nice if
drools has built-in import support though). Here is an example of how we use
xml entity to import the rule file:
<?xml version="1.0" ?>
<!DOCTYPE rule-set [
<!ENTITY sub-rules SYSTEM "rules/sub-rules.java.drl" >
]>
<rule-set name="RuleSet"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd">
<!-- RULE FRAGMENT INCLUDES HERE -->
&sub-rules;
</rule-set>
The problem is that we have to be able to import rule files from classpath as
well. The solution came to my mind was to provide our own entity resolver that
deals with rule files. But currently drools' RuleSetReader provides
resolveEntity implementation that only resolves xml schemas and doesn't allow
us to hook in another entity resolver.
So I would propose to change RuleSetReader to support custom entity resolver.
Attached is the modified version of RuleSetReader I used to fix the problem
locally, and hope you guys will add the support to drools.
Thanks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira