[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. 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 postmas...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 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-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas [tswinde...@nds.com] Sent: Thursday, October 01, 2009 5:33 PM To: rules-users@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. 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 postmas...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users MASTEK LTD. Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server. ~~ ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 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.here...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] (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-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Steve Ronderos Sent: Wednesday, September 30, 2009 12:53 PM To: rules-users@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 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 akary...@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@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] (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-boun...@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-boun...@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-boun...@lists.jboss.org [mailto:rules-users- boun...@lists.jboss.org] On Behalf Of Steve Ronderos Sent: Wednesday, September 30, 2009 12:53 PM To: rules-users@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 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 akary...@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@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] 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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 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