[jboss-jira] [JBoss JIRA] Issue Comment Edited: (JBRULES-2700) Allow setting a global variable (for example a service) which can be used by the score rules
Geoffrey De Smet (JIRA)
jira-events at lists.jboss.org
Fri Jul 29 07:46:24 EDT 2011
[ https://issues.jboss.org/browse/JBRULES-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12551639#comment-12551639 ]
Geoffrey De Smet edited comment on JBRULES-2700 at 7/29/11 7:44 AM:
--------------------------------------------------------------------
For another issue, it should be possible to set the RuleBase instead of supplying the DRL references.
Would that solve this issue? Maybe not because a service needs to be set on the WM, not the RuleBase which creates the WM.
Update: It would not solve this issue because setting it on the rulebase doesn't work, because global variables need to be set on the WorkingMemory instances, not the RuleBase.
However, every now and then planner needs to create a new WM (especially once we go multi-threaded/vm), currently only in debug mode I believe, so setting it on an individual WM isn't a good solution.
Defining a map of globals to put on any WM that is created, might work.
was (Author: ge0ffrey):
For another issue, it should be possible to set the RuleBase instead of supplying the DRL references.
Would that solve this issue? Maybe not because a service needs to be set on the WM, not the RuleBase which creates the WM.
However, every now and then planner needs to create a new WM (especially once we go multi-threaded/vm), currently only in debug mode I believe, so setting it on an individual WM isn't a good solution.
Defining a map of globals to put on any WM that is created, might work.
> Allow setting a global variable (for example a service) which can be used by the score rules
> --------------------------------------------------------------------------------------------
>
> Key: JBRULES-2700
> URL: https://issues.jboss.org/browse/JBRULES-2700
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: drools-planner
> Reporter: Wouter Horré
> Assignee: Geoffrey De Smet
>
> Currently, it is not possible to set a global variable in the working memory used by the solver. If a scoring rule needs an external helper for calculating scores (e.g. a dependency injected with OSGi DS), a workaround using a static variable in some class accessible by the scoring rules is needed.
> The easiest implementation is probably a new method in the Solver interface:
> public WorkingMemory getWorkingMemory();
> which provides access to the working memory used by the solver.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list