[rules-users] bytecode representation of rules

Edson Tirelli ed.tirelli at gmail.com
Sat Jan 28 11:16:19 EST 2012


   Take a look at the org.drools.rule.JavaDialectRuntimeData class in
drools-core. It contains a Map field called "store". All bytecode generated
is stored in there, but there is no built-in way of dumping it. So either
your tool allows you to inspect it in memory, or you change the class to
dump it somewhere. Take a look at the writeExternal() method to understand
how we dump it during kbase serialization.

   Edson

2012/1/28 Mainul Raju <mainul.raju at yahoo.com>

>
> Thanks a lot. At least we are on the same track :).
>
> I already dumped it into a directory and It gives me all generated .java
> files. At this point, trying to figure out some ways around for static
> analysis on rules by using SOOT. No luck yet :( .
>
> Thanks again for your informative response.
>
> ----------
> Mainul
>
>   ------------------------------
> *From:* Edson Tirelli <ed.tirelli at gmail.com>
> *To:* Rules Users List <rules-users at lists.jboss.org>
> *Sent:* Friday, 27 January 2012, 17:35
> *Subject:* Re: [rules-users] bytecode representation of rules
>
>
>    Tough question to answer as not everything in a DRL file becomes
> bytecode, and not all in the same place. For instance, rule consequences
> and other semantic code blocks, when using the java dialect, will become a
> class that is code generated and compiled in memory. You can see that code
> by setting the dump dir option in the KnowledgeBuilderConfiguration object
> (or -Ddrools.dump.dir=<path> on the command line).
>
>    Constraints on the other hand will become a mix of JIT bytecode and/or
> MVEL expressions and/or object accessors, depending on several factors.
> Since they are shared among multiple rules, they don't belong to a single
> rule in particular, but become part of the Rete network, that is basically
> an in-memory data structure.
>
>    Not exactly sure if this helps you...
>
>    Edson
>
> 2012/1/26 Mainul Raju <mainul.raju at yahoo.com>
>
>
>
> Hello All:
>
> I have been trying to get the byte code representation of rules (.drl
> files). I would appreciate it if anyone could kindly provide me any way to
> do that.
>
> I have created a rule based application with 100 rules in 5 different .drl
> files. My intention is to analyze the application with some byte code
> analyzer (i.e. soot). For the purpose of hat static analysis, I need the
> byte-code representation of rules which I can't get from drools.
>
> Thanks in advance.
> //
> Mainul
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> 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
>
>


-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120128/4ea9e269/attachment.html 


More information about the rules-users mailing list