<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <blockquote type="cite">I was wondering now if I can achieve the
      same with the drools rule file.</blockquote>
    That's a bit harder, but not that hard.<br>
    Look in the Drools Planner manual for "setRuleBase()" (as an
    alternative to using &lt;scoreDrl&gt;'s in your SolverConfig.xml)<br>
    and look in the Drools Expert manual on how to create a RuleBase.<br>
    <br>
    Op 13-10-11 15:37, Guilherme Kunigami schreef:
    <blockquote
cite="mid:CAK0MeX4UECfa61+ig763CyuwJav3XGHWEYbFWtNoKPN6wvt9OQ@mail.gmail.com"
      type="cite">Geoffrey,
      <div><br>
      </div>
      <div>Thank you, that worked!&nbsp;</div>
      <div><br>
      </div>
      <div>I was wondering now if I can achieve the same with the drools
        rule file. The method below wouldn't work because it's not me
        who load the file (I think it'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 moz-do-not-send="true"
              href="mailto:ge0ffrey.spam@gmail.com">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's an overloaded method called configure(InputStream
              in) and configure(Reader reader)&nbsp; too, use either of those
              instead:<br>
              <br>
              try {<br>
              &nbsp; InputStream in = new FileInputStream("<font
                face="'courier new', monospace">/path/to/xml/file/SolverConf.xml");</font><br>
              &nbsp; configurer.configure(in);<br>
              } finally {<br>
              &nbsp; IOUtils.closeSilently(in);<br>
              }<br>
              <br>
              Op 11-10-11 15:01, Guilherme Kunigami schreef:
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div>Hi,</div>
                    <div><br>
                    </div>
                    <div><font face="arial, helvetica, sans-serif">I'm
                        trying to load a configuration file (namely
                        SolverConf.xml) into XmlSolver with the code
                        below:</font></div>
                    <div> <span style="font-family: 'courier
                        new',monospace;"><br>
                      </span></div>
                    <div>
                      <div><font face="'courier new', monospace">XmlSolverConfigurer
                          configurer = new XmlSolverConfigurer();</font></div>
                      <div><font face="'courier new', monospace">configurer.configure(SOLVER_CONFIG);</font></div>
                      <div><font face="'courier new', monospace">Solver
                          solver = configurer.buildSolver();</font></div>
                    </div>
                    <div><font face="'courier new', monospace"><br>
                      </font></div>
                    <div><font face="arial, helvetica, sans-serif">If I
                        bundle&nbsp;SolverConf.xml file with the application
                        .jar file, then using </font><font
                        face="'courier new', monospace">SOLVER_CONFIG</font><font
                        face="arial, helvetica, sans-serif"> as </font><font
                        face="'courier new', monospace">/path/to/xml/file/SolverConf.xml</font><font
                        face="arial, helvetica, sans-serif"> works fine.</font></div>
                    <div><span style="font-family: 'courier
                        new',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'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's a Java related question, but I was
                        wondering if anyone had a similar problem when
                        configuring drools planner. (I've asked on
                        stackoverflow, but none of the answers worked
                        for me:&nbsp;<a moz-do-not-send="true"
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="'courier new', monospace"><br>
                      </font></div>
                    <div><font face="'courier new', monospace"><br>
                      </font></div>
                  </div>
                </div>
                <pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true"
              href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              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 wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
  </body>
</html>