Hi,<br><br><div class="gmail_quote">2011/10/14 Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  
    
  
  <div text="#000000" bgcolor="#ffffff"><div class="im">
    <blockquote type="cite">I was wondering now if I can achieve the
      same with the drools rule file.</blockquote></div>
    That&#39;s a bit harder, but not that hard.<br>
    Look in the Drools Planner manual for &quot;setRuleBase()&quot; (as an
    alternative to using &lt;scoreDrl&gt;&#39;s in your SolverConfig.xml)<br>
    and look in the Drools Expert manual on how to create a RuleBase.<br></div></blockquote><div><br></div><div>Great, that worked too!</div><div><br></div><div>Just for future reference, I used the following tutorial to create a rule base:</div>
<div><a href="http://hydrogen.informatik.tu-cottbus.de/wiki/index.php/How_to_create_and_execute_a_Drools_rulebase">http://hydrogen.informatik.tu-cottbus.de/wiki/index.php/How_to_create_and_execute_a_Drools_rulebase</a></div>
<div><br></div><div>And <a href="http://docs.jboss.org/drools/release/5.2.0.Final/drools-planner-docs/html/ch04.html#d0e1566">http://docs.jboss.org/drools/release/5.2.0.Final/drools-planner-docs/html/ch04.html#d0e1566</a> to set the rule base.</div>
<div><br></div><div>Thank you for the help!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div text="#000000" bgcolor="#ffffff">
    <br>
    Op <a href="tel:13-10-11%2015" value="+13101115" target="_blank">13-10-11 15</a>:37, Guilherme Kunigami schreef:
    <div><div></div><div class="h5"><blockquote type="cite">Geoffrey,
      <div><br>
      </div>
      <div>Thank you, that worked! </div>
      <div><br>
      </div>
      <div>I was wondering now if I can achieve the same with the drools
        rule file. The method below wouldn&#39;t work because it&#39;s not me
        who load the file (I think it&#39;s at
        AbstractSolverConfig.buildRuleBase, which seems to use
        getResourceAsStream too).</div>
      <div><br>
      </div>
      <div><br>
        <div class="gmail_quote">2011/10/11 Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com" target="_blank">ge0ffrey.spam@gmail.com</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
            <div text="#000000" bgcolor="#ffffff"> Hi Guilharme,<br>
              <br>
              There&#39;s an overloaded method called configure(InputStream
              in) and configure(Reader reader)  too, use either of those
              instead:<br>
              <br>
              try {<br>
                InputStream in = new FileInputStream(&quot;<font face="&#39;courier new&#39;, monospace">/path/to/xml/file/SolverConf.xml&quot;);</font><br>
                configurer.configure(in);<br>
              } finally {<br>
                IOUtils.closeSilently(in);<br>
              }<br>
              <br>
              Op 11-10-11 15:01, Guilherme Kunigami schreef:
              <blockquote type="cite">
                <div>
                  <div>
                    <div>Hi,</div>
                    <div><br>
                    </div>
                    <div><font face="arial, helvetica, sans-serif">I&#39;m
                        trying to load a configuration file (namely
                        SolverConf.xml) into XmlSolver with the code
                        below:</font></div>
                    <div> <span style="font-family:&#39;courier new&#39;,monospace"><br>
                      </span></div>
                    <div>
                      <div><font face="&#39;courier new&#39;, monospace">XmlSolverConfigurer
                          configurer = new XmlSolverConfigurer();</font></div>
                      <div><font face="&#39;courier new&#39;, monospace">configurer.configure(SOLVER_CONFIG);</font></div>
                      <div><font face="&#39;courier new&#39;, monospace">Solver
                          solver = configurer.buildSolver();</font></div>
                    </div>
                    <div><font face="&#39;courier new&#39;, monospace"><br>
                      </font></div>
                    <div><font face="arial, helvetica, sans-serif">If I
                        bundle SolverConf.xml file with the application
                        .jar file, then using </font><font face="&#39;courier new&#39;, monospace">SOLVER_CONFIG</font><font face="arial, helvetica, sans-serif"> as </font><font face="&#39;courier new&#39;, monospace">/path/to/xml/file/SolverConf.xml</font><font face="arial, helvetica, sans-serif"> works fine.</font></div>

                    <div><span style="font-family:&#39;courier new&#39;,monospace"><br>
                      </span></div>
                    <div><font face="arial, helvetica, sans-serif">But I
                        want to use SolverConf.xml outside the .jar, so
                        I can easiliy edit it, but I don&#39;t know what
                        path should I pass to it.</font></div>
                    <div><font face="arial, helvetica, sans-serif"><br>
                      </font></div>
                    <div><font face="arial, helvetica, sans-serif">I
                        know it&#39;s a Java related question, but I was
                        wondering if anyone had a similar problem when
                        configuring drools planner. (I&#39;ve asked on
                        stackoverflow, but none of the answers worked
                        for me: <a href="http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file" target="_blank">http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file</a>)</font></div>

                    <div><font face="arial, helvetica, sans-serif"><br>
                      </font></div>
                    <div><font face="arial, helvetica, sans-serif">(Supposing
                        my .jar is in /some/path and the SolverConf.xml
                        will be on /some/path/conf for example)</font></div>
                    <div><font face="arial, helvetica, sans-serif"><br>
                      </font></div>
                    <div><font face="arial, helvetica, sans-serif">Thanks,</font></div>
                    <div><font face="&#39;courier new&#39;, monospace"><br>
                      </font></div>
                    <div><font face="&#39;courier new&#39;, monospace"><br>
                      </font></div>
                  </div>
                </div>
                <pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
              </blockquote>
              <font color="#888888"> <br>
                <pre cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
              </font></div>
            <br>
            _______________________________________________<br>
            rules-users mailing list<br>
            <a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
      </div>
      <pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
  </div></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>