[rules-users] Mavenizing a new drools project
Hi, I've created the HelloWorld drools sample project and i want to turn it into a maven project. i know i can create and empty maven project and copy all sources from the drools project to it, but how do i handle the dependant jars (drools runtime?) is there a guide of how to mavenize your drools projects? -- Eyal Edri ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mavenizing a new drools project
I always prefer to create the maven projects from the scratch. You only need to add the following deps (groupid and artifactid) org.drools drools-api org.drools drools-core org.drools drools-compiler You probably need to add the jboss repository as well in order to get this deps Repository.jboss.org/maven2 - Ing. Mauricio Salatino - On May 9, 2010, at 5:01, eyal edri eyal.e...@gmail.com wrote: Hi, I've created the HelloWorld drools sample project and i want to turn it into a maven project. i know i can create and empty maven project and copy all sources from the drools project to it, but how do i handle the dependant jars (drools runtime?) is there a guide of how to mavenize your drools projects? -- Eyal Edri ___ 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
[rules-users] how to create a list obj for a rule using 'memberOf'
Hi, sorry for the newbi question, i'm just starting to find my way in Drools. i want to write a rule that filters URLs with a certain suffix (e.g. jpg, gif, css, etc...). i read about global vars and other variables and i'm not sure what to do. i need to create a List with all the suffixes i want to filter, should i create it inside FileType? can you help? Eyal. --- here's why i had so far: the .drl file: *package com.test.drools* * * *import com.test.drools.Facts.FileType;* * * * * *rule Filter File Types* * * * **when* *$fileTypes : ??? * * **FileType( type memberOf $fileTypes )* * **then* * **System.out.println(ALLOW);* *end* here's FileType: package com.commtouch.drools; import java.net.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Facts { // return a file type of a url public static class FileType { private String type = html; public FileType (URL url) { // get the path from the url //TODO: use parser to do it? String path = url.getPath(); if (path != null) { // define regex to extract file from path Pattern fileRegex = Pattern.compile(([^/]+)$); Matcher fileMatcher = fileRegex.matcher(path); // get regex capure $1 (filename) String file = null; while (fileMatcher.find()) file = fileMatcher.group(1); String suffix = null; if (file != null) { //try to extract suffix from file Pattern suffixRegex = Pattern.compile(\\.([^\\.]+)$); Matcher suffixMatcher = suffixRegex.matcher(file); while (suffixMatcher.find()) suffix = suffixMatcher.group(1); //verify that the suffix is a valid suffix if (suffix != null (suffix.length() 1 suffix.length() 6)) setType(suffix); } } } public void setType(String type) { this.type = type; } public String getType() { return type; } } } -- Eyal Edri ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Mavenizing a new drools project
Take a look at the drools phone example http://blog.athico.com/2010/05/drools-bejug-2010-slides-and.html With kind regards, Geoffrey De Smet Salaboy schreef: I always prefer to create the maven projects from the scratch. You only need to add the following deps (groupid and artifactid) org.drools drools-api org.drools drools-core org.drools drools-compiler You probably need to add the jboss repository as well in order to get this deps Repository.jboss.org/maven2 - Ing. Mauricio Salatino - On May 9, 2010, at 5:01, eyal edri eyal.e...@gmail.com wrote: Hi, I've created the HelloWorld drools sample project and i want to turn it into a maven project. i know i can create and empty maven project and copy all sources from the drools project to it, but how do i handle the dependant jars (drools runtime?) is there a guide of how to mavenize your drools projects? -- Eyal Edri ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Classloader Leak?
I did this, and it did not do anything differently (still loading almost 1500 classes again for each new KnowledgeBase): KnowledgeBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,this.getClass().getClassLoader()); knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig); Anyone? Bueller? -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Leak-tp784678p787521.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
[rules-users] skip workflow's task from NodeInstance
I'm trying to do a web page that lists the active workflows (processInstances) and it's respective tasks that are waiting to be processed to continue the flow. Also, I'd like to create a button to those tasks to skip them, and go to the next task. The first part I've already done with ((RuleFlowProcessInstance)ProcessInstance).getNodeInstances() (and so on), but now I want to know if it's possible to skip the node with just a NodeInstance objetct. Can you help me? thx. just in case, I'm using the words node, activity and task to represent the same thing. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/skip-workflow-s-task-from-NodeInstance-tp787552p787552.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] skip workflow's task from NodeInstance
I can help you, can you clarify the Use Case that you are trying to model? Because how you model the business process really depends on the business use case. Based on that we can give you suggestions about the type of node to use in each situation. When you clarify that you will end up answering all your questions. For example, if you have a human task inside your process your UI should list only the human task that are already created. For my perspective there is no need to list all the active processes in your UI, unless you want to do have some kind of Drools Flow administration console, that is not business related. Greetings On Sun, May 9, 2010 at 2:55 PM, dgimenes dran...@gmail.com wrote: I'm trying to do a web page that lists the active workflows (processInstances) and it's respective tasks that are waiting to be processed to continue the flow. Also, I'd like to create a button to those tasks to skip them, and go to the next task. The first part I've already done with ((RuleFlowProcessInstance)ProcessInstance).getNodeInstances() (and so on), but now I want to know if it's possible to skip the node with just a NodeInstance objetct. Can you help me? thx. just in case, I'm using the words node, activity and task to represent the same thing. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/skip-workflow-s-task-from-NodeInstance-tp787552p787552.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 -- - http://salaboy.wordpress.com - http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] how to create a list obj for a rule using 'memberOf'
Maybe you can define a global List so you would not need to add it as a Fact: *package com.test.drools* * * *import com.test.drools.Facts.FileType;* * * *global java.util.List allowedExtensions;* * * *rule Filter File Types* * * * **when*** * **FileType( type memberOf allowedExtensions )* * **then* * **System.out.println(ALLOW);* *end* You will need to set the global list before inserting any Fact: ksession.setGlobal(allowedExtensions,somePrePopulatedList); Best, 2010/5/9 eyal edri eyal.e...@gmail.com Hi, sorry for the newbi question, i'm just starting to find my way in Drools. i want to write a rule that filters URLs with a certain suffix (e.g. jpg, gif, css, etc...). i read about global vars and other variables and i'm not sure what to do. i need to create a List with all the suffixes i want to filter, should i create it inside FileType? can you help? Eyal. --- here's why i had so far: the .drl file: *package com.test.drools* * * *import com.test.drools.Facts.FileType;* * * * * *rule Filter File Types* * * * **when* *$fileTypes : ??? * * **FileType( type memberOf $fileTypes )* * **then* * **System.out.println(ALLOW);* *end* here's FileType: package com.commtouch.drools; import java.net.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Facts { // return a file type of a url public static class FileType { private String type = html; public FileType (URL url) { // get the path from the url //TODO: use parser to do it? String path = url.getPath(); if (path != null) { // define regex to extract file from path Pattern fileRegex = Pattern.compile(([^/]+)$); Matcher fileMatcher = fileRegex.matcher(path); // get regex capure $1 (filename) String file = null; while (fileMatcher.find()) file = fileMatcher.group(1); String suffix = null; if (file != null) { //try to extract suffix from file Pattern suffixRegex = Pattern.compile(\\.([^\\.]+)$); Matcher suffixMatcher = suffixRegex.matcher(file); while (suffixMatcher.find()) suffix = suffixMatcher.group(1); //verify that the suffix is a valid suffix if (suffix != null (suffix.length() 1 suffix.length() 6)) setType(suffix); } } } public void setType(String type) { this.type = type; } public String getType() { return type; } } } -- Eyal Edri ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Esteban Aliverti ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Classloader Leak?
Drools is a dynamic system, the different classloaders is to try and allow partial reloading of classes, without having to reload everything. If we had a single classloader, we would have to reload everything, for every change. Mark On 07/05/2010 22:49, Moe Alkhafaji wrote: Interesting. Is there a reason for that? That doesn't sound too efficient. How can I get around it so that everything in the drools API uses the same default application classloader? Is there a setting or configuration somewhere that would tell drools to just use the default classloader? That would speed up the application, and require less perm gen memory. Thanks. Sent from my iPhone On May 7, 2010, at 4:30 PM, Mark Proctormproc...@codehaus.org wrote: Each kbase has it's own root classloader, and then an additional child classloader per package in the kbase. Mark On 07/05/2010 22:08, malkhafaji wrote: Hello, I noticed (using JConsole) that my application keeps loading more and more classes. I have over 105K classes loaded! I did a lot of debugging and isolation until I found the line that brings the number of classes loaded from 20K to 105K. It is this line: this.knowledgeBase.addKnowledgePackages(packages); packages is an array list of 8 DRLs that are compiled successfully. I am calling the line above exactly 99 times. However, I do have 99 instances of this.knowledgeBase. So, I have a total of 99 instances of knowledgeBase, and each instance is called once (line above) with 8 successfully compiled DRLs. I am starting to think that each instance of a KnowledgeBase somehow uses its own Classloader? Do I need to manually get the current application Classloader and pass it on to each instance of KnowledgeBase to ensure that no classes are loaded more than once? Is this a leak in the Classloader that comes inside the KnowledgeBase.addKnowledgePackage method? I did post somewhere else about delays on the line above, and no wonder it sometimes takes a couple of seconds to execute that line (the largest rules file I have is 150 KB with no more than 100 rules) if it creates a new Classloader and loads the same loaded classes AGAIN. Any insights on this? P.S. I did a search on the forum and couldn't find anything related to this. If you have better searching skills and found a post in that regards, please kindly point me to it. This is a very important issue as we are going to a live production environment in 3 weeks and I am not too happy with the performance, specifically around the line above. Thank you, and have a great weekend. ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Classloader Leak?
Thanks for the reply. I still don't understand how you would resolve this issue of ever increasing number of classes in memory. Do you expect only one KnowledgeBase to be created per application? Also, so there is no way around this? Or, am I just screwed for using multiple KnowledgeBases? Thank. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Leak-tp784678p788171.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