[rules-users] Is InternalRuleBase safe to use?
Mark Proctor
mproctor at codehaus.org
Sat Nov 17 12:34:32 EST 2007
If it safe to use in that it works now, but its an internal api so could
change at any time - so we don't recommend you using it. The correct
place to set the ConsequenceExceptionHandler is via the
RuleBaseConfiguration, which allows you to overide it there.
Mark
Jared Davis wrote:
> Hi,
>
> re:Drools 4.0.3
>
> I want/need to use ConsequenceExceptionHandler for exception handling.
> I'd like to be able to get the ConsequenceExceptionHandler from a
> StatefulSession.
>
> The only way I see to get the handler relies on InternalRuleBase.
> The JavaDoc at http://downloads.jboss.com/drools/docs/_
> 4.0.3.15993.GA/apidocs/org/drools/common/InternalRuleBase.html
> does not have any annotation that it is internal use only. However the naming
> convention sure makes me this this is a bad idea.
>
> Any alternatives to the following code to retrieve the
> ConsequenceExceptionHandler?
>
>
> InternalRuleBase thisSmellsLikeABadIdea= (InternalRuleBase) wm.getRuleBase();
> DroolsExceptionHandler deh = (DroolsExceptionHandler)
> thisSmellsLikeABadIdea.getConfiguration().getConsequenceExceptionHandler();
> List<Exception> exceptions = deh.getExceptions();
>
> (Where DroolsExceptionHandler is
>
> package droolsconfig;
>
> import java.util.ArrayList;
> import java.util.List;
> import org.drools.WorkingMemory;
> import org.drools.spi.Activation;
> import org.drools.spi.ConsequenceExceptionHandler;
>
>
> public class DroolsExceptionHandler implements ConsequenceExceptionHandler {
> List<Exception> exceptions = new ArrayList<Exception>();
>
> public DroolsExceptionHandler() {
> }
>
> public void handleException(Activation activation, WorkingMemory
> workingMemory, Exception exception) {
> exceptions.add(exception);
> }
> public List<Exception> getExceptions() {
> return exceptions;
> }
>
> }
>
> )
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
More information about the rules-users
mailing list