Allen,
There is a technical
explanation behind that and we never had the time to find a way to overcome this
limitation. What you can do, although not ideal, is to send the global as a
parameter:
funcion void foo( Logger log, String cond )
{
...
}
rule XYZ
when
then
foo(
log, someString );
end
If you or anyone would like to
help improving this, let us know and we can discuss ways into doing it.
[]s
Edson
2008/10/9 Bagwell, Allen F
<afbagwe@sandia.gov>
There's probably an easy explanation for this. I was
wondering about why functions inside of rule files can't access
globals?
For example, I have a log4j logger that I pass into my rule
files via a global. The logger should never be a part of working memory.
It's just there to capture valuable feedback.
But I can't do this:
global Logger log;
function void foo(String cond)
{
if (cond == "error")
log.error("I saw an
error");
}
Because the compiler says that in the function it can't
resolve 'log'.
-A
Allen F.
Bagwell
phone:
505/284-4517
fax: 505/
844-7886
There is no monument dedicated
to the memory of a committee. -- Lester J. Pourciau
_______________________________________________
rules-users
mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core
Development
JBoss, a division of Red Hat @
www.jboss.com