Re: [rules-users] Memory leak when deploying to Maven repository?
Hello, our scenario is like this: From our customer, we get an Excel file which contains something rule-like which we convert into actual Drools rule strings. Those, we want to deploy in our local Maven repository (the one being used by Drools/KIE/Maven) as an actual artifact. This allows us later, to create new rules with KIE-WB, which are then deployed into the same repository, but with a higher artifact version. The actual application can then initially, when it doesn't have a connection to KIE-WB, use the rules created from the Excel sheet. In a second step, it can later get a more current rule artifact from the KIE-WB repository. This is why we create an actual artifact out of the Excel sheet. That process takes a while, so we do it in the startup listener. As far as I understand it and as far as I could see it on the filesystem, when I build a KieModule programmatically, it is not persisted anywhere and it is lost on restart of the system. That is why I wanted to explicitly persist it with the Aether facilities, as depicted in my previous post. If I do not do that and if I then check at startup if the artifact version does exist, I get back a false and it is created again - which takes quite some time. This is the reason why I want to store my created artifact in the local, persistent repository. Am I getting something wrong? Is the artifact already stored somewhere? I hope my intentions are a bit clearer now ... Thanks in advance! Dominik -Ursprüngliche Nachricht- Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Mario Fusco Gesendet: Dienstag, 10. Juni 2014 17:06 An: rules-users@lists.jboss.org Betreff: Re: [rules-users] Memory leak when deploying to Maven repository? Hi Dominik, I'm honestly not understanding why you're creating a kieModule and most important why you're deploying it on maven in a ServletContextListener, but I am guessing you're doing this only to demonstrate the problem. Also be aware that for doing so you're using some drools internal API and these API aren't guaranteed to be stable. However every time you build a kieModule or you load it from a maven repo, it is stored in the KieRepository. If you need to remove it from there you can do this explicitly by using the KieRepository.removeKieModule(ReleaseId) method. I hope this helps, Mario -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Memory-leak-when-deploying-to-Maven-repository-tp4029950p4029955.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dr.-Ing. Jürgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Memory leak when deploying to Maven repository?
Hello everybody, I use Drools to create rules from an external source and create an artifact from those rule strings, putting it into a local repository. A minimalistic working example can be found at https://github.com/dadadom/MavenMemoryLeakMinimalExample The code, taken from that example, is basically like this: ReleaseId releaseId = new ReleaseIdImpl(some:releaseid:1.0.0-SNAPSHOT); String rules = rule \testrule\ ... ; KieServices kServices = KieServices.Factory.get(); KieFileSystem kfs = kServices.newKieFileSystem(); kfs.write(src/main/resources/someBase/testrule, rules); kfs.generateAndWritePomXML(releaseId); String kmoduleXmlString = kmodule ... /kmodule; kfs.writeKModuleXML(kmoduleXmlString.getBytes()); KieModule kieModule = kServices.newKieBuilder(kfs).getKieModule(); try { File pomFile = new File(System.getProperty(java.io.tmpdir), pom.xml); try (FileOutputStream fos = new FileOutputStream(pomFile)) { fos.write(KieBuilderImpl.generatePomXml(releaseId).getBytes()); fos.flush(); } catch (IOException e) { e.printStackTrace(); } final MavenRepository mavenRepository = MavenRepository.getMavenRepository(); mavenRepository.deployArtifact(releaseId, (InternalKieModule) kieModule, pomFile); When I call this method in a ServletContextListener in a Tomcat Server (version 7 or 8) and undeploy the application afterwards, I get a memory leak. Tomcat tells me that the application has a memory leak: The following web applications were stopped (reloaded, undeployed), but their classes from previous runs are still loaded in memory, thus causing a memory leak (use a profiler to confirm): /mvntest Looking at the memory dump with e.g. JProfiler, I can trace the dangling instances back to an object static INSTANCE of class org.drools.compiler.kie.builder.impl.KieRepositoryImpl So it seems like there is something which I am either missing or which is a bug. I cannot find any .close() or .release() method or something alike on any of the involved objects ... If anyone could give me a hint how to solve this problem, I'd be happy not to litter my memory no more :) Regards and thanks Dominik ... mit freundlichen Gr??en / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkm?ller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de .. Vorsitzender des Aufsichtsrats: Dr.-Ing. J?rgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Efficiency questions about DSL
Hello, any progress or new on this issue? I am currently facing the situation that I'd like to create a basic DSL for different projects, placing it in a separate artifact which only gets included. It would be great if the KIE Workbench (and, obviously, the underlying engine) supported that. Thank you Dominik Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Michael Anstis Gesendet: Freitag, 21. März 2014 15:19 An: Rules Users List Betreff: Re: [rules-users] Efficiency questions about DSL It's a deliberate decision in the workbench; as it follows what is supported by the core engine. I've asked the core engine developers to comment on whether the underlying Drools engine supports (does support, should support or will support) cross-JAR DSLs. With kind regards, Mike On 21 March 2014 08:52, mfalaize maxime.fala...@gmail.commailto:maxime.fala...@gmail.com wrote: Is it a deliberate choice to not include DSL files in the same package ? If we are limited to the same folder (or same package), what do you think about supporting inheritance in DSL files ? With this feature we could provide to the community generic translation DSL files for many languages. Sorry for the new questions ! :D I'd like to help to develop but I don't want to make useless contributions... 2014-03-20 20:19 GMT+01:00 manstis [via Drools] [hidden email]http://user/SendEmail.jtp?type=nodenode=4028867i=0: So many questions I can comment on the workbench related aspects. The workbench only includes DSL files for authoring DSLR (or RDSLR) files that are in the same folder as the rule. I use the term folder as we don't support same package (which would imply if the same package existed in different JARs we'd include all DSL files - we do not). The expander keyword is, AFAIK, deprecated. DSL/DSLR expansion depends upon the files being in the same folder. @Mario, @Mark, @Edson. Can you comment on whether KIE does handle DSL expansion across different JARs? Sent on the move On 18 Mar 2014 09:20, mfalaize [hidden email]http://user/SendEmail.jtp?type=nodenode=4028841i=0 wrote: Hi, I was wondering how to use efficiently DSL with my rules and I have several questions about it : - First, I have the impression that we can use DSL files only in the same package of the DSLR file. When I tried to load DSL files by the kmodule.xml (specifying the different packages in the packages attribute of kbase) it does not work. Do I have to load each DSL files programmatically or is there a way to load it automatically by the kmodule.xml (and if it is the case, how can we handle the parsing order of these files ?) ? - An underlying question is is this a good practice to divide DSL files ? I would like to translate all my rules in french and to put the generic translations in a unique DSL file to reuse it in all of my different DSLR files. - I noted that we can use more than one DSL file for one DSLR file (it works at the runtime) but when it is the case the DRL viewer of the DSL rule editor does not work and I don't have autocompletion. I tried to put several expander instructions but it fails. Is there a way to make it work ? I think DSL stuff is underestimate at this moment by the community and for my last question I would like to know what is the future plans about this feature ? Maybe I could help to develop it. Regards -- View this message in context: http://drools.46999.n3.nabble.com/Efficiency-questions-about-DSL-tp4028774.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list [hidden email]http://user/SendEmail.jtp?type=nodenode=4028841i=1 https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list [hidden email]http://user/SendEmail.jtp?type=nodenode=4028841i=2 https://lists.jboss.org/mailman/listinfo/rules-users If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/Efficiency-questions-about-DSL-tp4028774p4028841.html To unsubscribe from Efficiency questions about DSL, click here. NAMLhttp://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- Maxime FALAIZE View this message in context: Re: [rules-users] Efficiency questions about DSLhttp://drools.46999.n3.nabble.com/Efficiency-questions-about-DSL-tp4028774p4028867.html Sent from the Drools: User forum mailing list archivehttp://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html at Nabble.com.
[rules-users] Startup KIE Workbench without network connection
Hello, I try to setup KIE Workbench (6.1.0.BetaX) on Tomcat 7 on a Windows 2012 Server without connection to the internet. When starting up, the KIE-WB does not start up. I get the following errors in localhost.log (cut for better readability): Mai 15, 2014 5:08:18 PM org.apache.catalina.core.StandardContext listenerStart Schwerwiegend: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions: [...] Caused by: java.lang.RuntimeException: https://github.com/guvnorngtestuser1/guvnorng-playground.git: cannot open git-upload-pack [...] Caused by: java.net.ConnectException: Connection time out: github.com This happens because the initial demo repository is downloaded - I do not want and need those repositories! I could work around this by copying the TOMCAT_HOME/bin/.niogit directory to that server and have it start up then. BUT: IMHO it is an inconvenience, maybe even a bug, that an internet connection is needed to set up the Drools KIE Workbench. How are we supposed to tell our infrastructure team that we need an open connection to some website with code to setup an editing system for internal knowledge ... Should I file a bug for that? Is there a way to deactivate the downloading of the initial demo repository? Could it somehow be delivered with the KIE-WB package? Thanks Dominik ... mit freundlichen Gr??en / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkm?ller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de .. Vorsitzender des Aufsichtsrats: Dr.-Ing. J?rgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Startup KIE Workbench without network connection
Hello, many thanks for that information! I somehow never got that far down in the properties-page to notice. Nevertheless I think that the startup should not fail completely, if the sample repositories cannot be downloaded. Shouldn’t a warning suffice? Thank you! Dominik Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Ioannis Christodoulou Gesendet: Donnerstag, 15. Mai 2014 17:40 An: Rules Users List Betreff: Re: [rules-users] Startup KIE Workbench without network connection Hello, you probably need to set: -Dorg.kie.demo=false and -Dorg.kie.example=false in your startup variables. For example, using jboss, I have in standalone.conf file (used during jboss startup) JAVA_OPTS=$JAVA_OPTS -Dorg.kie.demo=false -Dorg.kie.example=false This will disable the demo and the example sources from the workbench. Ευχαριστώ πολύ, Ιωάννης Χριστοδούλου On Thu, May 15, 2014 at 6:27 PM, Sandjaja, Dominik dominik.sandj...@it-motive.demailto:dominik.sandj...@it-motive.de wrote: Hello, I try to setup KIE Workbench (6.1.0.BetaX) on Tomcat 7 on a Windows 2012 Server without connection to the internet. When starting up, the KIE-WB does not start up. I get the following errors in localhost.log (cut for better readability): Mai 15, 2014 5:08:18 PM org.apache.catalina.core.StandardContext listenerStart Schwerwiegend: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions: […] Caused by: java.lang.RuntimeException: https://github.com/guvnorngtestuser1/guvnorng-playground.git: cannot open git-upload-pack […] Caused by: java.net.ConnectException: Connection time out: github.comhttp://github.com This happens because the initial demo repository is downloaded – I do not want and need those repositories! I could work around this by copying the TOMCAT_HOME/bin/.niogit directory to that server and have it start up then. BUT: IMHO it is an inconvenience, maybe even a bug, that an internet connection is needed to set up the Drools KIE Workbench. How are we supposed to tell our infrastructure team that we need an open connection to “some website with code” to setup an editing system for internal knowledge … Should I file a bug for that? Is there a way to deactivate the downloading of the initial demo repository? Could it somehow be delivered with the KIE-WB package? Thanks Dominik … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183tel:%2B49%20%280%29%20203%2060878%20183 Fax: +49 (0) 203 60878 222tel:%2B49%20%280%29%20203%2060878%20222 e-mail: dominik.sandj...@it-motive.demailto:dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 6 47269 Duisburg i...@it-motive.demailto:i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dr.-Ing. Jürgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dr.-Ing. Jürgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Broken KIE-WB binary for Tomcat 7
Hello, I just tried to install the KIE-Workbench on Tomcat 7 out of the downloaded file kie-drools-wb-distribution-6.0.1.Final.zip with authentication. It turns out that obviously the web.xml inside the WAR in binaries/kie-drools-wb-distribution-wars-6.0.1.Final-tomcat7.0.war is wrong. It is missing some elements which have to do with authentication so that the whole installation process, described in the README.txt does not work. In 6.1.0.Beta1, that problem is fixed. On the other hand, the kie-tomcat-integration-6.1.0.Beta1.jar seems to be broken, at least I can't start my tomcat with that one in the lib folder. This problem can be circumvented by using kie-tomcat-integration-6.0.1.Final.jar instead, that one works. In total: Only the .war from 6.1.0.Beta1 together with kie-tomcat-integration from 6.0.1.Final is a working combination on a Tomcat 7.0.26. That seems a bit sad, given that this combination should not be the most uncommon one (running KIE-WB on Tomcat). You guys are making it really hard to switch to Drools 6 ... Regards Dominik … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dr.-Ing. Jürgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Avoid parsiong project pom.xml when running Drools
Hello, I am using Drools 6.1.0.Beta1 in a project with the following (shortened) pom.xml: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; modelVersion4.0.0/modelVersion groupIdde.test.configuration/groupId artifactIdsomeTest/artifactId version0.7.0-SNAPSHOT/version packagingjar/packaging namedroolsTest/name parent groupIdde.test/groupId artifactIdmaven-parent/artifactId version0.3/version /parent dependencies !-- The Drools rule engine -- dependency groupIdorg.drools/groupId artifactIddrools-core/artifactId version6.1.0.Beta1/version /dependency dependency groupIdorg.drools/groupId artifactIddrools-compiler/artifactId version6.1.0.Beta1/version /dependency !-- getting maven artefacts -- dependency groupIdorg.kie/groupId artifactIdkie-ci/artifactId version6.1.0.Beta1/version /dependency /dependencies /project For the internal maven, used within KIE/Drools, I have a separate settings.xml, which is configured with the property -Dkie.maven.settings.custom=X:\\droolsmaven\\settings.xml The contents of this file are: settings xmlns=http://maven.apache.org/SETTINGS/1.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd; localRepositoryx:/droolsmaven/repository/localRepository profiles profile idmavenDroolsProfile/id activation activeByDefaulttrue/activeByDefault /activation repositories repository idsomeRepo/id urlhttp://1.2.3.4/url releases enabledfalse/enabled /releases snapshots enabledfalse/enabled /snapshots /repository repository idcentral/id urlhttp://repo1.maven.org/maven2/url releases enabledfalse/enabled /releases snapshots enabledfalse/enabled /snapshots /repository /repositories /profile /profiles /settings In that local repository, the respective artifact used later is deployed, which is working, confirmed with a non-maven-project. Now, when trying running the following code within the maven project which is defined by the above mentioned pom, I get the errors mentioned after this code block: public class MainKieTest { public static void main(String[] args) { KieServices ks = KieServices.Factory.get(); KieRepository repository = ks.getRepository(); ReleaseId releaseId = ks.newReleaseId(de.test.package, artifact, 1.0.1); KieContainer kieContainer = ks.newKieContainer(releaseId); KieScanner kieScanner = ks.newKieScanner(kieContainer); kieScanner.scanNow(); } } The error is: DEBUG [main] (KieRepositoryImpl.java:92) - KieModule Lookup. ReleaseId de.test.package:artifact:1.0.1 was not in cache, checking classpath DEBUG [main] (KieRepositoryImpl.java:98) - KieModule Lookup. ReleaseId de.test.package:artifact:1.0.1 was not in cache, checking maven repository WARN [main] (MavenSettings.java:47) - Environment variable M2_HOME is not set DEBUG [main] (Logs.java:390) - Add publisher: com.google.inject.internal.InjectorImpl@5221dfe5 -[explicit bindings]--- 0. ProviderInstanceBinding{key=Key[type=com.google.inject.Injector, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=ProviderInjector} [...] lines cut for brevity 198. ConstructorBinding{key=Key[type=org.apache.maven.lifecycle.DefaultSchedules,
Re: [rules-users] Avoid parsiong project pom.xml when running Drools
Hello, the pom.xml of de.test.package:artifact:1.0.1: ?xml version=1.0 encoding=UTF-8? project xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdde.test.package/groupId artifactIdartifact/artifactId version1.0.1/version nameartifact/name /project The problem I think is, that the embedded Aether/Maven tries to parse the pom of the project it is running within (de.test.configuration:droolsTest:0.7-SNAPSHOT). And I have no idea why it is doing that. The maven-parent:pom is used by our projects, it is not declared in any pom.xml which is used for Drools-artifacts. Thank you Dominik -Ursprüngliche Nachricht- Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Mario Fusco Gesendet: Donnerstag, 13. März 2014 18:08 An: rules-users@lists.jboss.org Betreff: Re: [rules-users] Avoid parsiong project pom.xml when running Drools Hi Dominik, what you're reporting is not 100% clear to me. Could you also show me the pom.xml file of de.test.package:artifact:1.0.1? This is indeed the actual KieProject and then the pom file that our embedded maven/aether is trying to parse. Apparently also that pom declares de.test:maven-parent:pom:0.3 as parent. Is that correct? If so why it cannot find that parent with your configuration? Thanks for your clarifications, Mario -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-Avoid-parsiong-project-pom-xml-when-running-Drools-tp4028690p4028696.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 6 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dr.-Ing. Jürgen Sturm Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Find out order of insert in RHS
Hello Wolfgang, thank you for the hint. I introduced a new Class Counter with just an int property and a method getAndIncrease. This class is referenced in a base rule which all the other rules extend. On the RHS of all rule inserts I set a field to the value of c.getAndIncrease() which gives me the correct order. The hint with the static counter was the right one! Regards Dominik -Ursprüngliche Nachricht- Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun Gesendet: Donnerstag, 7. Februar 2013 18:59 An: Rules Users List Betreff: Re: [rules-users] Find out order of insert in RHS If object creation is done in the same order as the insertion: surely a simple static counter in the class would give you the required monotonous value. Otherwise, a listener could be set, which will see the actual order of insertion, and it can set the order-of-insertion property. -W On 07/02/2013, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: Hi everybody, short: is there a way to have an automatic counter for the RHS of a rule when inserting several objects in one rule? Long: I use drools with a DSL to insert items for a frontend dropdown box. The generated rule is e.g. like the following one: rule testRule_H dialect mvel when SomePartOfMyModel( someField == H ) then DropDownItem fact1 = new DropDownItem(); fact1.setLabel( My Label 1 ); fact1.setValue( B ); insert (fact1); DropDownItem fact1 = new DropDownItem(); fact1.setLabel( My Label 2 ); fact1.setValue( A ); insert (fact1); This works nicely and I get all the items. The problem I have is with the sorting. Users use Guvnor to edit the available items for the dropdown box, so they add and remove items from the RHS. Since I retrieve those objects from the knowledge base in my java code like this: CollectionFactHandle handles = statefulKnowledgeSession.getFactHandles(new ClassObjectFilter(DropDownItem.class)); for (FactHandle handle : handles) { DropDownItem selectItem = (DropDownItem) statefulKnowledgeSession.getObject(handle); ... I think I cannot be sure about the order the objects are retrieved (it's a collection, no guaranteed sorting!). So, I sort the DropDownItems alphabetically by their value. My question now is, as stated above: How can I implement a counter which I can use in the facts being inserted to keep my inserted facts (DropDownItems) in the same order as they are inserted? Thanks in advance Dominik … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ 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 … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Find out order of insert in RHS
Hi everybody, short: is there a way to have an automatic counter for the RHS of a rule when inserting several objects in one rule? Long: I use drools with a DSL to insert items for a frontend dropdown box. The generated rule is e.g. like the following one: rule testRule_H dialect mvel when SomePartOfMyModel( someField == H ) then DropDownItem fact1 = new DropDownItem(); fact1.setLabel( My Label 1 ); fact1.setValue( B ); insert (fact1); DropDownItem fact1 = new DropDownItem(); fact1.setLabel( My Label 2 ); fact1.setValue( A ); insert (fact1); This works nicely and I get all the items. The problem I have is with the sorting. Users use Guvnor to edit the available items for the dropdown box, so they add and remove items from the RHS. Since I retrieve those objects from the knowledge base in my java code like this: CollectionFactHandle handles = statefulKnowledgeSession.getFactHandles(new ClassObjectFilter(DropDownItem.class)); for (FactHandle handle : handles) { DropDownItem selectItem = (DropDownItem) statefulKnowledgeSession.getObject(handle); ... I think I cannot be sure about the order the objects are retrieved (it's a collection, no guaranteed sorting!). So, I sort the DropDownItems alphabetically by their value. My question now is, as stated above: How can I implement a counter which I can use in the facts being inserted to keep my inserted facts (DropDownItems) in the same order as they are inserted? Thanks in advance Dominik … mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de http://www.it-motive.de …… Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor model with 'Comparable' not working
Hi everybody, I use Guvnor 5.4 and have a model which consists of classes and subclasses. @Entity public class TestClass { @Id private long id; @Embedded private TestEmbeddable embedded; } @Embeddable public class TestEmbeddable implements ComparableTestEmbeddable { @Column private String testProperty; @Override public int compareTo(TestEmbeddable o) {...} } Now, in Guvnor I use the guided Editor and create a new WHEN condition: There is a TestClass with: embedded ... Usually, when I click on embedded, I can select Apply a constraint to a sub-field of 'embedded': Show sub fields ... This line does NOT show if that subclass (here: TestEmbeddable) implements Comparable. It does however work if I don't use Comparable or if I select TestEmbeddable directly (which I can't as I don't inject those into my working environment). Is this a known bug? I couldn't find anything about this. TIA Dominik ... mit freundlichen Gr??en / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Fax: +49 (0) 203 60878 222 e-mail: dominik.sandj...@it-motive.de it-motive AG Zum Walkm?ller 10-12 47269 Duisburg i...@it-motive.de http://www.it-motive.de .. Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor: Dependent Enumeration loosing value
Hi everybody, I use the advanced, dependent enumeration concepts of the Guvnor DSL as explained here (second part): http://docs.jboss.org/drools/release/5.4.0.Final/drools-guvnor-docs/html /ch04.html#d0e1887 In principle, this works fine: I get my values in the dropdown fields just fine, e.g. when using the following DSL sentence: [when]In the module {module:ENUM:Enums.BooleanModules} the checkbox for the field {field:ENUM:Enums.BooleanField} is checked={module} ( {field}Visible {field} ) When everything works, the {field} is filled, depending on the selected value in {module}. BUT: If I create such a rule, close it, open it again, the following DRL is generated (given that {module} has the value MODULE: MODULE ( Visible ) As you can see, the value for {field} is missing at all! If I change something somewhere else in the rule and save it, the rule is invalid and everything breaks! I have no idea where to look as there are no errors when saving or loading the rules. Should I file a bug for this or am I missing something? Thanks Dominik ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Programatically filled Enum not getting loaded
Hi, I just tried to recreate the problem but when I create everything from scratch in a new package, it seems to work?! So I can't reliably reproduce the situation which on the other hand means, that there seems to be a problem in the state of the package. Bad, but seems like I have to start from the bottom again to get that working ... Von: rules-users-boun...@lists.jboss.org im Auftrag von Michael Anstis Gesendet: Mi 13.06.2012 18:37 An: Rules Users List Betreff: Re: [rules-users] Programatically filled Enum not getting loaded Sounds like a bug to me. Please raise a JIRA at https://issues.jboss.org/browse/GUVNOR, including a self-contained repository export and your description below. With kind regards, Mike On 13 June 2012 16:47, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: I use Guvnor 5.4.0 with the following Assets: Enum: 'Enums.Modules' : (new de.itm.util.DroolsEnumHelper()).loadModules() DSL: [when]Testmodule {module:ENUM:Enums.Modules} is just for testing={module} : Cylinder() DroolsEnumHelper-Class: public ListString loadModules() { ListString values = new ArrayListString(); for (Module module : Module.values()) { values.add(module.getModuleName() + = + module.getDisplayName()); } return values; } When running the Source-Validate in the Enum-Editor, I see the method getting called (being connected to the JBoss for Debugging). But if I use the DSL rule in the guided editor, I can select the rule but the dropdown field stays grayed out. The loadModules() method isn't even called, no getting stuck in my breakpoint! Anyone an idea why and how this happens? Am I doing something totally wrong? Thanks Dominik ... mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Mobil+49 (0) 162 2624490 Fax: +49 (0) 203 60878 22 e-mail: dominik.sandj...@it-motive.de mailto:dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de mailto:i...@it-motive.de http://www.it-motive.de http://www.it-motive.de/ .. Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users winmail.dat___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Programatically filled Enum not getting loaded
Alright ... After some more investigation and a lot of trial-and-error, I think I found the problem: If the class which contains the method filling the enum (in my case the DroolsEnumHelper class) is also contained in the POJO model, the dropDown seems to stop working. Further investigation needs to be carried out to confirm this, but for the moment I am happy J Greetings Dominik Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Sandjaja, Dominik Gesendet: Donnerstag, 14. Juni 2012 11:33 An: Rules Users List Betreff: AW: [rules-users] Programatically filled Enum not getting loaded Hi, I just tried to recreate the problem but when I create everything from scratch in a new package, it seems to work?! So I can't reliably reproduce the situation which on the other hand means, that there seems to be a problem in the state of the package. Bad, but seems like I have to start from the bottom again to get that working ... Von: rules-users-boun...@lists.jboss.org im Auftrag von Michael Anstis Gesendet: Mi 13.06.2012 18:37 An: Rules Users List Betreff: Re: [rules-users] Programatically filled Enum not getting loaded Sounds like a bug to me. Please raise a JIRA at https://issues.jboss.org/browse/GUVNOR, including a self-contained repository export and your description below. With kind regards, Mike On 13 June 2012 16:47, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: I use Guvnor 5.4.0 with the following Assets: Enum: 'Enums.Modules' : (new de.itm.util.DroolsEnumHelper()).loadModules() DSL: [when]Testmodule {module:ENUM:Enums.Modules} is just for testing={module} : Cylinder() DroolsEnumHelper-Class: public ListString loadModules() { ListString values = new ArrayListString(); for (Module module : Module.values()) { values.add(module.getModuleName() + = + module.getDisplayName()); } return values; } When running the Source-Validate in the Enum-Editor, I see the method getting called (being connected to the JBoss for Debugging). But if I use the DSL rule in the guided editor, I can select the rule but the dropdown field stays grayed out. The loadModules() method isn't even called, no getting stuck in my breakpoint! Anyone an idea why and how this happens? Am I doing something totally wrong? Thanks Dominik ... mit freundlichen Grüßen / kind regards Dominik Sandjaja Fon: +49 (0) 203 60878 183 Mobil+49 (0) 162 2624490 Fax: +49 (0) 203 60878 22 e-mail: dominik.sandj...@it-motive.de mailto:dominik.sandj...@it-motive.de it-motive AG Zum Walkmüller 10-12 47269 Duisburg i...@it-motive.de mailto:i...@it-motive.de http://www.it-motive.de http://www.it-motive.de/ .. Vorsitzender des Aufsichtsrats: Dipl.-Ing. Klaus Straub Vorstand: Horst-Dieter Deelmann (Vors.), Matthias Heming, Christoph Tim Klose HRB 9207, Amtsgericht Duisburg ___ 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] Using 'from {x}.field' in DSL
I have the following Drools DSL sentence: [when]The field {field} in the module {module} contains value {value}=$a : {module} ( {field} != null) String( this.equalsIgnoreCase({value}) ) from $a.{field} where the `field` is a `Set` of Strings. Now, if I have two of these sentences in one rule, it obviously won't work as the variable `$a` occurs twice. So I wanted to improve the rule to make the variable, well, variable: [when]The field {field} in the module {module} contains value {value} as {a}={a} : {module} ( {field} != null) String( this.equalsIgnoreCase({value}) ) from {a}.{field} This doesn't work, I can't use the part `{a}.`, that breaks. So, my questions are: Is there either a way to rewrite the rules or a way to allow the `{variable}.` notation to work? Alternatively, is there a `contains` operator which works case insensitive? Thanks in advance Dominik ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Using 'from {x}.field' in DSL
There is no expanded DRL. If I take that line into the DSL, I can't even validate the DSL and if I have the line in it, I can't select any DSL statements for rules in Guvnor. BTW, I am using Drools and Guvnor 5.4.0. Von: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun Gesendet: Dienstag, 12. Juni 2012 17:31 An: Rules Users List Betreff: Re: [rules-users] Using 'from {x}.field' in DSL Have you checked the expanded DRL? What does this line look like? -W On 12 June 2012 17:06, Sandjaja, Dominik dominik.sandj...@it-motive.de wrote: I have the following Drools DSL sentence: [when]The field {field} in the module {module} contains value {value}=$a : {module} ( {field} != null) String( this.equalsIgnoreCase({value}) ) from $a.{field} where the `field` is a `Set` of Strings. Now, if I have two of these sentences in one rule, it obviously won't work as the variable `$a` occurs twice. So I wanted to improve the rule to make the variable, well, variable: [when]The field {field} in the module {module} contains value {value} as {a}={a} : {module} ( {field} != null) String( this.equalsIgnoreCase({value}) ) from {a}.{field} This doesn't work, I can't use the part `{a}.`, that breaks. So, my questions are: Is there either a way to rewrite the rules or a way to allow the `{variable}.` notation to work? Alternatively, is there a `contains` operator which works case insensitive? Thanks in advance Dominik ___ 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