Swindells, Thomas | 1 Oct 14:03 2009

Multiple worksheet decision tables

Is it possible to get Drools to load all the rules table within an excel spreadsheet if they are spread across
multiple worksheets?
>From the documentation I have read it appears drools will only load the rules from the first/a specified worksheet.
The only way I have found to do it is to load the worksheet multiple times and explicitly state each of the
worksheet names in turn.  Is this the only way?  
If so is there any easy way to get the names of all the worksheets in the file? The application won't know the
worksheet names ahead of time.

Many thanks,

Thomas

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in
error, please immediately notify the postmaster <at> nds.com and delete it from your system as well as any
copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security
purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company
registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Vikrant Yagnick | 1 Oct 16:08 2009

Re: Multiple worksheet decision tables

Hi,

I had  written some code for this a while ago. But, basically Drools uses jxl for compiling decision tables.
You can also use JXL. It has an API that gives you all the worksheet names, which you can then pass to the
compiler one by one to compile all your decision tables.

>From memory it went something like this (Import jxl***.jar)

Worksheet w=new WorkSheer(new File("filepath.xls"));

w.getSheets();

This should get you a list of sheets.

Cheers,
Vikrant
________________________________________
From: rules-users-bounces <at> lists.jboss.org [rules-users-bounces <at> lists.jboss.org] On Behalf Of
Swindells, Thomas [TSwindells <at> nds.com]
Sent: Thursday, October 01, 2009 5:33 PM
To: rules-users <at> lists.jboss.org
Subject: [rules-users] Multiple worksheet decision tables

Is it possible to get Drools to load all the rules table within an excel spreadsheet if they are spread across
multiple worksheets?
>From the documentation I have read it appears drools will only load the rules from the first/a specified worksheet.
The only way I have found to do it is to load the worksheet multiple times and explicitly state each of the
worksheet names in turn.  Is this the only way?
If so is there any easy way to get the names of all the worksheets in the file? The application won't know the
worksheet names ahead of time.
(Continue reading)

Pegram, Macon | 1 Oct 17:30 2009

Re: (no subject)

What you need to do is implement your own SystemEventListener implementation to override the default one.  Before you do anything meaningful with Drools, you’ll want to override the default by calling:

   SystemEventListenerFactory.setSystemEventListener(<YOUR SystemEventListenerImpl>);

 

Here’s a basic no-op listener:

            new SystemEventListener () {

 

                  public void debug(String arg0) { }

                  public void debug(String arg0, Object arg1) {}

                  public void exception(Throwable arg0) {}

                  public void exception(String arg0, Throwable arg1) {}

                  public void info(String arg0) {}

                  public void info(String arg0, Object arg1) {}

                  public void warning(String arg0) {}

                  public void warning(String arg0, Object arg1) {}

                 

            };

 

In reality what you probably want to do is hook in your application’s logger here so it will respect the same log levels the rest of your application runs under.

 

Macon

 

 

From: rules-users-bounces <at> lists.jboss.org [mailto:rules-users-bounces <at> lists.jboss.org] On Behalf Of Steve Ronderos
Sent: Wednesday, September 30, 2009 12:53 PM
To: rules-users <at> lists.jboss.org
Subject: [rules-users] (no subject)

 


Hello Drools Users,

I've been looking into why Drools 5 is logging debug and info messages to System.out in my app and trying to figure out how to make it stop.  It looks like the SystemEventListener that the SystemEventListenerFactory returns is a DelegatingSystemEventListener that delegates to a PrintStreamSystemEventListener.  This, by default, uses System.out as the print stream target.  I looked into the Factory and it looks like I can provide a different SystemEventListener or SystemEventListenerProvider, but it also mentions that it did not find anything in the properties, so it fails over to the default SystemEventListenerProvider.  Is there a way to configure a custom SystemEventListener or SystemEventListenerProvider so that you don't have to call SystemEventListenerFactory.setSystemEventListenerProvider() at startup?

Thanks,

Steve Ronderos

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Kris Verlaenen | 1 Oct 17:32 2009
Picon

Re: Process variables in split/action nodes

You should use a code constraint, that allows you to access the variable
directly (if you define them as variables of your process at least,
click the background of your process and edit the "variables" property).
 For example, if you have a variable "count", you can have a code
constraint (MVEL or Java dialect) like:

  return count > 10;

Also, inside your actions, you also have direct access to your process
variables, so your action could be written like this:

  kcontext.setVariable("count", count++);

Kris

Quoting Renato Herebia <renato.herebia <at> dextra-sw.com>:

> Hi!
> 
> How can I access process variables inside split nodes, in fact, in
> split
> contraints?
> 
> I accessed a process variable named "count" in an action node like
> that:
> 
> Integer c = (Integer) kcontext.getVariable("count");
> kcontext.setVariable("count", ++c);
> 
> But, in a split constraint doesn't work. So, my doubts are:
> - How is the way in split constraints?
> - Is there a simpler way to access process variables in action node?
> 
> Thanks!
> 
> -- 
> Renato Herebia
> 

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Kris Verlaenen | 1 Oct 17:42 2009
Picon

Re: Drools Flow: waiting for process to complete without polling

I'm not sure that having a thread wait like this until all processes
have completed is a good idea in general, as in theory processes could
run for a long time (hours/days/weeks/...).  Unless of course you are
only using synchronous processes, but in that case the engine will only
return once the process has been completed anyway (if you call it
synchronously).

But the approach you suggest is valid, you can register an event
listener to react whenever a process instance is completed, or similarly
you could use the history log to retrieve this kind of information
(making it decoupled from the actual execution).

Kris

Quoting Alexandros Karypidis <akarypid <at> yahoo.gr>:

> Hello,
> 
> I'm not very experienced in the Drools Flow API so I'm looking into
> the 
> best way to code a simple thing: wait for all processes in a session
> to 
> complete without polling.
> 
> The only way I could thing of from the javadoc reference I read, is
> to 
> synchronize and do a wait()/notify() using a ProcessEventListener. It
> 
> seems a lot of work for a use-case that is too basic. I set up a 
> listener like this:
> 
>     pel = new ProcessEventListener() {
>        // ...
>             public void afterProcessCompleted(ProcessCompletedEvent
> pce) {
>                 synchronized (this) {
>                     notifyAll();
>                 }
>             }
>     }
>     ksession.addEventListener(pel);
> 
> ...then wait for processes (one in this simplified case) to complete
> 
> like this:
> 
>     synchronized (pel) {
>         new Thread(new Runnable() {
>             public void run() {
>                 ksession.fireUntilHalt();
>             }
>         }).start();
>         ksession.startProcess("some.process");
>         pel.wait(); // the notifyAll() resumes this
>     }
> 
> Is there a better way to do this?
> 
> _______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Steve Ronderos | 1 Oct 20:14 2009

Re: (no subject)


Thanks Macon,

That is the information I was looking for.  I was looking at the code and it looked like there were some comments hinting at making the SystemEventListener configurable.  Is this a future feature? or am I reading too much into the comments?

Thanks,

Steve Ronderos

rules-users-bounces <at> lists.jboss.org wrote on 10/01/2009 10:30:58 AM:

> [image removed]
>
> Re: [rules-users] (no subject)
>
> Pegram, Macon
>
> to:
>
> Rules Users List
>
> 10/01/2009 10:34 AM
>
> Sent by:
>
> rules-users-bounces <at> lists.jboss.org
>
> Please respond to Rules Users List
>
> What you need to do is implement your own SystemEventListener
> implementation to override the default one.  Before you do anything
> meaningful with Drools, you’ll want to override the default by calling:
>    SystemEventListenerFactory.setSystemEventListener(<YOUR
> SystemEventListenerImpl>);
>  
> Here’s a basic no-op listener:
>             new SystemEventListener () {
>  
>                   public void debug(String arg0) { }
>                   public void debug(String arg0, Object arg1) {}
>                   public void exception(Throwable arg0) {}
>                   public void exception(String arg0, Throwable arg1) {}
>                   public void info(String arg0) {}
>                   public void info(String arg0, Object arg1) {}
>                   public void warning(String arg0) {}
>                   public void warning(String arg0, Object arg1) {}
>                  
>             };
>  
> In reality what you probably want to do is hook in your
> application’s logger here so it will respect the same log levels the
> rest of your application runs under.
>  
> Macon
>  
>  
>
> From: rules-users-bounces <at> lists.jboss.org [mailto:rules-users-
> bounces <at> lists.jboss.org] On Behalf Of Steve Ronderos
> Sent: Wednesday, September 30, 2009 12:53 PM
> To: rules-users <at> lists.jboss.org
> Subject: [rules-users] (no subject)
>  
>
> Hello Drools Users,
>
> I've been looking into why Drools 5 is logging debug and info
> messages to System.out in my app and trying to figure out how to
> make it stop.  It looks like the SystemEventListener that the
> SystemEventListenerFactory returns is a
> DelegatingSystemEventListener that delegates to a
> PrintStreamSystemEventListener.  This, by default, uses System.out
> as the print stream target.  I looked into the Factory and it looks
> like I can provide a different SystemEventListener or
> SystemEventListenerProvider, but it also mentions that it did not
> find anything in the properties, so it fails over to the default
> SystemEventListenerProvider.  Is there a way to configure a custom
> SystemEventListener or SystemEventListenerProvider so that you don't
> have to call
> SystemEventListenerFactory.setSystemEventListenerProvider() at startup?
>
> Thanks,
>
> Steve Ronderos_______________________________________________
> rules-users mailing list
> rules-users <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Alexandros Karypidis | 1 Oct 20:18 2009
Picon

Re: Drools Flow: waiting for process to complete without polling

Hello Kris,

Thank you for your reply.

I am currenty doing "test-driven" development outside an application 
server to learn the API. I launch processes from within a unit test 
method; hence my need to wait in this manner so that I can perform a 
final assertion on process state (after the process is complete).

You are totally correct to point out that in real life, I will be 
executing long-running processes from within JBoss in my application 
across multiple executions of the application. So what is the typical 
approach for doing that? Do you typically install Drools as a service in 
a SAR, or do you launch it with a servlet startup listener when the WAR 
starts? Also, how do you make sure a clean undeploy/shutdown occurs 
where process execution is gracefully suspended and process states are 
saved? Can you give me some pointers?

Thank you.

Kris Verlaenen wrote:
> I'm not sure that having a thread wait like this until all processes
> have completed is a good idea in general, as in theory processes could
> run for a long time (hours/days/weeks/...).  Unless of course you are
> only using synchronous processes, but in that case the engine will only
> return once the process has been completed anyway (if you call it
> synchronously).
>
> But the approach you suggest is valid, you can register an event
> listener to react whenever a process instance is completed, or similarly
> you could use the history log to retrieve this kind of information
> (making it decoupled from the actual execution).
>
> Kris
>
> Quoting Alexandros Karypidis <akarypid <at> yahoo.gr>:
>
>   
>> Hello,
>>
>> I'm not very experienced in the Drools Flow API so I'm looking into
>> the 
>> best way to code a simple thing: wait for all processes in a session
>> to 
>> complete without polling.
>>
>> The only way I could thing of from the javadoc reference I read, is
>> to 
>> synchronize and do a wait()/notify() using a ProcessEventListener. It
>>
>> seems a lot of work for a use-case that is too basic. I set up a 
>> listener like this:
>>
>>     pel = new ProcessEventListener() {
>>        // ...
>>             public void afterProcessCompleted(ProcessCompletedEvent
>> pce) {
>>                 synchronized (this) {
>>                     notifyAll();
>>                 }
>>             }
>>     }
>>     ksession.addEventListener(pel);
>>
>> ...then wait for processes (one in this simplified case) to complete
>>
>> like this:
>>
>>     synchronized (pel) {
>>         new Thread(new Runnable() {
>>             public void run() {
>>                 ksession.fireUntilHalt();
>>             }
>>         }).start();
>>         ksession.startProcess("some.process");
>>         pel.wait(); // the notifyAll() resumes this
>>     }
>>
>> Is there a better way to do this?
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users <at> lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>>     

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

kamal konduru | 1 Oct 22:12 2009
Picon

Class loader security exception


Hi Everyone,

I have a problem deploying drools5 project.  In our deployment process due
to security reasons JVMS are not allowed to create clasloader. However
Drools is trying to create a CompositeClassLoader which interns calls a
System Class Loader's constructor, that is not allowed by JVM.

The rules are not complicated, however we have around 200 rules in around 4
to 5 drls and would like to deploy them in JVM. 

Please suggest if there is any way to bypass this security issue.

thanks
kamal Konduru
--

-- 
View this message in context: http://www.nabble.com/Class-loader-security-exception-tp25705700p25705700.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Renato Herebia | 1 Oct 23:10 2009

Re: Process variables in split/action nodes

Kris, thanks for your answer...

I've tried to access the variable in a split constraint (return count != 1;) with mvel dialect and I got this trace in runtime:

Uncaught exception on client
java.lang.RuntimeException: unable to execute ReturnValueEvaluator
    at org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:124)
    at org.drools.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:62)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
    at org.drools.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:37)
    at org.drools.workflow.instance.node.EventBasedNodeInstance.triggerCompleted(EventBasedNodeInstance.java:96)
    at org.drools.workflow.instance.node.EventBasedNodeInstance.triggerCompleted(EventBasedNodeInstance.java:77)
    at org.drools.workflow.instance.node.WorkItemNodeInstance.triggerCompleted(WorkItemNodeInstance.java:192)
    at org.drools.workflow.instance.node.HumanTaskNodeInstance.triggerCompleted(HumanTaskNodeInstance.java:74)
    at org.drools.workflow.instance.node.WorkItemNodeInstance.workItemCompleted(WorkItemNodeInstance.java:246)
    at org.drools.workflow.instance.node.WorkItemNodeInstance.signalEvent(WorkItemNodeInstance.java:222)
    at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:258)
    at org.drools.process.instance.impl.DefaultWorkItemManager.completeWorkItem(DefaultWorkItemManager.java:96)
    at org.drools.process.workitem.wsht.WSHumanTaskHandler$GetCompletedTaskResponseHandler.execute(WSHumanTaskHandler.java:282)
    at org.drools.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:67)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:752)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832)
    at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:379)
    at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:173)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:49)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:832)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:616)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:414)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:408)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:578)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:540)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:532)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:58)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:857)
    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at org.mvel2.math.MathProcessor.getInternalNumberFromType(MathProcessor.java:555)
    at org.mvel2.math.MathProcessor._doOperations(MathProcessor.java:155)
    at org.mvel2.math.MathProcessor.doOperations(MathProcessor.java:79)
    at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:102)
    at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:37)
    at org.mvel2.ast.ReturnNode.getReducedValueAccelerated(ReturnNode.java:45)
    at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
    at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:107)
    at org.mvel2.MVEL.executeExpression(MVEL.java:978)
    at org.drools.base.mvel.MVELReturnValueEvaluator.evaluate(MVELReturnValueEvaluator.java:110)
    at org.drools.workflow.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:121)
    ... 36 more

With Java dialect I got a problem when I add the rule flow to the KnowledgeBuilderFactory:

java.lang.RuntimeException: Process Compilation error : org.drools.lang.descr.ProcessDescr <at> 69695f
    com/sample/Process_com_sample_0.java (9:387) : Incompatible operand types String and int

    at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:81)
    at com.sample.ProcessTest.main(ProcessTest.java:30)


Using action node, I could get the variable process with mvel dialect in action just calling:

System.out.println("The counting is: " + count);

If I use Java dialect with the same System.out, I got this problem after add the rule flow to the KnowledgeBuilderFactory:

java.lang.RuntimeException: unable to execute Action
    at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:56)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:141)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:128)
    at org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:49)
    at org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:41)
    at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:111)
    at org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:16)
    at org.drools.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:185)
    at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:230)
    at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1639)
    at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:272)
    at com.sample.ProcessTest.main(ProcessTest.java:42)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at com.sample.Process_com_sample_0Action0Invoker.execute(Process_com_sample_0Action0Invoker.java:18)
    at org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:54)
    ... 12 more


In this scenario, my doubts are:
- It's necessary any configuration for the access in action/split nodes to process variables?
- How can I do that?


Thanks in advance.

--
Renato Herebia
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Swindells, Thomas | 2 Oct 11:07 2009

Decision Tables agenda group

I’ve been trying to get agenda groups working and after a bit of poking around have realised that agenda group support is broken.

 

Looking on jira somebody has already raised the bug and supplied a simple patch (https://jira.jboss.org/jira/browse/JBRULES-2208) when is this patch likely to be applied to trunk or do I need to maintain my own branch of the decision tables?

 

Thanks,

 

Thomas


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster <at> nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Gmane