setting globals in rule file
by Chris Richmond
Shouldn't it be possible to set a global variable value within the rule file
itself at the top. Something like?
global String deviceName = "myDevice";
I thought you could do that, but consistently get an error saying illegal
character '=' expected "("
Or something along those lines.
This is possible and that syntax should work, shouldn't it?
Thanks,
Chris
16 years, 6 months
ways to specify encoding for .drl files
by RD
Hi Drool users,
I'm a total noob in drools, so please forgive me if my questions are
answered before (By the way I did search the mailing listing but didn't get
anything suitable).
The Q I have is "Is there a way to specify the encoding for .drl files"???.
I'm using drools 5.0.1 and all my drl files are loaded from changeset.xml.
The problem I'm facing is that I have some utf-8 chars in my drl files,
which are not interpreted correctly while we compile those files.
I was wondering whether there was a way to specify the encoding in the
changeset.xml itself something like this ....
<resource source='classpath:manipulation/abc.drl' type='DRL'
encoding='UTF-8' />
Thanks!
RD
16 years, 6 months
retrieving streams/entry points from java api
by Chris Richmond
Hello,
I am trying to determine, iterate the working memory streams within my rule
by doing the following:
for(WorkingMemoryEntryPoint entry :
session.getWorkingMemoryEntryPoints()){
System.err.println("entry point stream:
" + entry.toString());
}
But I can find no method/way to finid the actual text name of the entry
point(what is written in the rule as from entry-point "xxxx").
Is there a way to do this? To list the readable names of the entry points
from your session? I would like to list those entry points in a drop down
as application profiles, so if they have one selected, one entry point of
rules will be inserted to and so on..
Thanks,
Chris
16 years, 6 months
Re: [rules-users] KnowledgeBase & Classloader - reload class or re-create
by Edson Tirelli
Nick,
I see. In any case, Drools will not allow you to do that without
recompiling the knowledge base, but, why don't you simply make your
"MyFunctions" class be a delegate to your actual functions? So, whenever you
reload your fuctions, all you need to do is rewire things inside your
MyFunctions class... isolated and clean... no need to have things rewired in
Drools side... sounds much lighter than any other approach, even if it was
possible to do the rewire in Drools, it would certainly be heavier...
Just an idea...
Edson
2009/10/14 Nicholas Hemley <nic.hemley(a)sidonis.com>
> Edson,
>
>
>
> Actually, I only use custom action classes in the RHS (see below)
>
>
>
> e.g.
>
> rule TEARDOWN_3004865719
>
> when
>
> child0:MyClass (
>
> state1 == 0,
>
> state2 == 0
>
> )
>
> then
>
> MyFunctions.performOperation( "TEARDOWN
> _3004865719",
>
> "message",
>
> child0,
>
> true );
>
> end
>
>
>
> The classes referenced in the LHS will always stay the same.
>
>
>
> So if we want to re-load the class MyFunctions (since these custom actions
> may be updated), then I currently have to re-create the
> StatefulKnowledgeSession from a new KnowledgeBase, etc. so that the
> findClass() method is called on MyClassLoader.
>
>
>
> Cheerio,
>
> Nic
>
>
>
> *Nicholas Hemley*
>
> *Senior Developer*
>
> *Sidonis | Powering a New Generation of Service Assurance*
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
16 years, 6 months
Re: [rules-users] KnowledgeBase & Classloader - reload class or re-create
by Nicholas Hemley
Edson,
Actually, I only use custom action classes in the RHS (see below)
e.g.
rule TEARDOWN_3004865719
when
child0:MyClass (
state1 == 0,
state2 == 0
)
then
MyFunctions.performOperation( "TEARDOWN
_3004865719",
"message",
child0,
true );
end
The classes referenced in the LHS will always stay the same.
So if we want to re-load the class MyFunctions (since these custom actions
may be updated), then I currently have to re-create the
StatefulKnowledgeSession from a new KnowledgeBase, etc. so that the
findClass() method is called on MyClassLoader.
Cheerio,
Nic
Nicholas Hemley
Senior Developer
Sidonis | Powering a New Generation of Service Assurance
16 years, 6 months
Re: [rules-users] KnowledgeBase & Classloader - reload class or re-create Knowledgebase?
by Edson Tirelli
Nicholas,
I assume that you are using your classes not only in the consequence, but
in the LHS of the rules as well, right? In this case, a knowledge base
recompilation will be necessary. That is because Drools must indeed keep
references to your class in order to be able to properly match incoming
facts, extract their attribute values, etc. Drools already provides
re-wiring for most of its artifacts, but providing the same to user defined
classes would be close to recompile the knowledge base again.
Now, I am curious about your use case? why do you need to re-load your
classes?
[]s
Edson
2009/10/14 Nicholas Hemley <nic.hemley(a)sidonis.com>
> Hello,
>
>
>
> I am using various classes in the consequences of my rules and I would like
> to dynamically re-load the classes.
>
>
>
> Currently, I include the following code snippet which sets the class
> loader:
>
>
>
> KnowledgeBaseConfiguration kbConf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties,
> MyClassLoader.getInstance());
>
> KnowledgeBase knowledgeBase =
> KnowledgeBaseFactory.newKnowledgeBase(kbConf);
>
>
>
> However, if I change the underlying jar and inform my classloader of this
> change, the old class is still used in the rule consequences.
>
>
>
> I therefore assume that Drools is storing a reference to the old class in
> the previously created KnowledgeBases so MyClassLoader.loadClass() is only
> invoked the first time the class is required.
>
>
>
> My question is thus: Is there any way to force a class reload on a
> KnowledgeBase or do I have to re-create the Knowledgebase?
>
>
>
> If so, would it be a case of getAllFactHandles() (or similar) and assert
> these into a newly created KnowledgeBase with a new instance of
> MyClassloader?
>
>
>
> Cheerio,
>
> Nic
>
>
>
> *Nicholas Hemley*
>
> *Senior Developer*
>
> *Sidonis | Powering a New Generation of Service Assurance*
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
16 years, 6 months
KnowledgeBase & Classloader - reload class or re-create Knowledgebase?
by Nicholas Hemley
Hello,
I am using various classes in the consequences of my rules and I would like
to dynamically re-load the classes.
Currently, I include the following code snippet which sets the class loader:
KnowledgeBaseConfiguration kbConf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties,
MyClassLoader.getInstance());
KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
However, if I change the underlying jar and inform my classloader of this
change, the old class is still used in the rule consequences.
I therefore assume that Drools is storing a reference to the old class in
the previously created KnowledgeBases so MyClassLoader.loadClass() is only
invoked the first time the class is required.
My question is thus: Is there any way to force a class reload on a
KnowledgeBase or do I have to re-create the Knowledgebase?
If so, would it be a case of getAllFactHandles() (or similar) and assert
these into a newly created KnowledgeBase with a new instance of
MyClassloader?
Cheerio,
Nic
Nicholas Hemley
Senior Developer
Sidonis | Powering a New Generation of Service Assurance
16 years, 6 months
[droolsflow] ForEach
by Anderson vasconcelos
Hi all
I have a flow that has a "for each" where for each Ticket (List of
FactObject) create a subflow that contains a HumanTask
How can i set the Ticket inside a Content of HumanTask of subflow?
I Tried to put #{ticket} inside a content of HumanTask, but the just put a
string of class (Ticket.toString()), and not a instance of Ticket.
16 years, 6 months
Re: [rules-users] unable to determine value type class *** URGENT***
by Corneil du Plessis
Srithu wrote:
>
> I have a wired behavior..
>
> I have a set of rules and i have used drools-guvnor to packaging them...
> It is working in windows machines where i have jboss which is running on
> IBM java 5 and 6..
>
> When i connect the same from jboss Which is running on 64 bit IBM java 6
> on linux is not working...
> The same is working If i used 64 bit IBM java 5 on linux.....
>
>
> I getting following exception...
>
>
>
> Please help....
>
>>> [2009-02-11 12:30:29,697] [705980] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - org.drools.RuntimeDroolsException: unable to determine
>>> ValueType for Class [class java.lang.Object]
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> org.drools.base.ValueType.determineValueType(ValueType.java:193)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> org.drools.base.ValueType.readResolve(ValueType.java:125)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)
>
>>> [2009 -02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12]
>>> [ERROR] [STDERR ] - at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at java.lang.reflect.Method.invoke(Method.java:599)
>
> [deleted stacktrace]
>
>
We are experiencing same issue on WebSphere 6.1 FP 23 on Linux and AIX.
Has anyone found a resolution?
Regards
Corneil
--
View this message in context: http://www.nabble.com/unable-to-determine-value-type-class--***-URGENT***...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 6 months