Re: [rules-users] Is InternalRuleBase safe to use?

2007-11-17 Thread Mark Proctor
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 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 exceptions = new ArrayList();
   
public DroolsExceptionHandler() {

}

public void handleException(Activation activation, WorkingMemory
workingMemory, Exception exception) {
exceptions.add(exception);
}
public List getExceptions() {
return exceptions;
}

}


)


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Is InternalRuleBase safe to use?

2007-11-14 Thread Jared Davis
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 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 exceptions = new ArrayList();
   
public DroolsExceptionHandler() {
}

public void handleException(Activation activation, WorkingMemory
workingMemory, Exception exception) {
exceptions.add(exception);
}
public List getExceptions() {
return exceptions;
}

}

)


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users