<br> Nicholas,<br><br> It seems that dialect configuration is not exposed yet through the drools-api. We need to do that. <br> <br> Would you please open a JIRA so that this is not lost?<br><br> Meanwhile, the work around is to fallback to the previous API:<br>
<br> JavaDialectConfiguration conf = (JavaDialectConfiguration) ((PackageBuilderConfiguration)knowledgeBuilderConfiguration).getDialectConfiguration( "java" );<br> conf.setCompiler( JavaDialectConfiguration.JANINO );<br>
<br> Finally, please remember that JANINO does not support java 1.6. >From his project page it supports java 1.4 with a few features from 1.5.<br><br> []s<br> Edson<br><br> <br><br><div class="gmail_quote">2009/7/2 Nicholas Hemley <span dir="ltr"><<a href="mailto:nic.hemley@sidonis.com">nic.hemley@sidonis.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-GB">
<div>
<p>Hello,</p>
<p> </p>
<p>I have a little test case as follows:</p>
<p> </p>
<p style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">import</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;">
org.drools.builder.KnowledgeBuilderConfiguration;</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">import</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;">
org.drools.builder.KnowledgeBuilderFactory;</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">import</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;">
org.junit.Assert;</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">import</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> org.junit.Test;</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p style=""><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">public</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">class</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;">
TestDrools5Config {</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New";"> </span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(100, 100, 100);">@Test</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">public</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><b><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(127, 0, 85);">void</span></b><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> testConfig() {</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> KnowledgeBuilderConfiguration
knowledgeBuilderConfiguration = KnowledgeBuilderFactory.<i>newKnowledgeBuilderConfiguration</i>();</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> knowledgeBuilderConfiguration.setProperty(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"drools.dialect.java.compiler"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">, </span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"JANINO"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> knowledgeBuilderConfiguration.setProperty(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"drools.dialect.java.lngLevel"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">, </span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"1.6"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> String
droolsDialectJavaCompiler = knowledgeBuilderConfiguration.getProperty(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"drools.dialect.java.compiler"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> System.</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);">out</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;">.println(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"droolsDialectJavaCompiler="</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> +
droolsDialectJavaCompiler);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> Assert.<i>assertNotNull</i>(droolsDialectJavaCompiler);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> String <u>droolsDialectJavaLngLevel</u>
= knowledgeBuilderConfiguration.getProperty(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"drools.dialect.java.lngLevel"</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;">);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> System.</span><i><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 192);">out</span></i><span style="font-size: 10pt; font-family: "Courier New"; color: black;">.println(</span><span style="font-size: 10pt; font-family: "Courier New"; color: rgb(42, 0, 255);">"drools.dialect.java.lngLevel="</span><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> + droolsDialectJavaLngLevel);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> Assert.<i>assertNotNull</i>(droolsDialectJavaLngLevel);</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p style=""><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> }</span><span style="font-size: 10pt; font-family: "Courier New";"></span></p>
<p><span style="font-size: 10pt; font-family: "Courier New"; color: black;">}</span></p>
<p><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span></p>
<p><span style="font-size: 10pt; font-family: "Courier New"; color: black;">It fails.</span></p>
<p><span style="font-size: 10pt; font-family: "Courier New"; color: black;"> </span></p>
<p><span style="font-size: 10pt; font-family: "Courier New"; color: black;">I have seen the post for using JANINO with Drools:</span></p>
<p><a href="http://lists.jboss.org/pipermail/rules-users/2009-February/008089.html" target="_blank">http://lists.jboss.org/pipermail/rules-users/2009-February/008089.html</a></p>
<p> </p>
<p>Yet this does not explain my test case failing – any ideas.</p>
<p> </p>
<p>It appears as if it is not possible to set JANINO
programmatically, only via properties.conf, etc. which I don’t want to
do(!)</p>
<p> </p>
<p><span style="font-size: 10.5pt; font-family: Consolas;">Cheerio,</span></p>
<p><span style="font-size: 10.5pt; font-family: Consolas;">Nic
Hemley</span></p>
</div>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>