On 28/01/2014, SrjTx <clickthex(a)yahoo.com> wrote:
Thanks for the reply.
I have read that section of the docs a multiple times.
Unfortunately, I do not have a handle to the ksession to call setGlobal on.
My knowledge session is created/owned by KIE-WB/Switchyard and we are
looking for an API so that I can get a handle to something on which I can
call setGlobal.
I've had a quick look at
https://docs.jboss.org/author/display/SWITCHYARD/Knowledge+Services
and it seems to me that you need to define
<operations>
<operation ...>
<globals>
<global from="" to=""/>
</globals>
</...></...>
I suspect that "from" should be some Java expression returning the
global object and "to" the global's DRL name, perhaps from the
SwitchYard Context. But the author doesn't provide any examples and no
details.
One other approach you might take is to install a global via a
high-priority one-shot rule:
rule "startup"
salience 999999999
when
then
kcontext.getKieRuntime().setGlobal(...,"...");
end
Lastly, you can simply use a static object in some class:
import foo.bar.Globals;
...
then
Globals.foo.store( whatever );
...
-W
Ideally, I need something like
xxx.getKnowledgeBaseByName("mykb");
or maybe
xxx.getKnowledgePackageByName("mykb");
or maybe
xxx.getKnowledgeSessionByName("mykb");
which ever of those I can call setGlobal on.
FYI, our KIE stuff is container managed via maven integration with kie-wb -
we do not control the lifecycle of any KIE objects kb, package, session,
etc.
Thanks again
--
View this message in context:
http://drools.46999.n3.nabble.com/Null-pointer-exception-when-using-globa...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users