Re: [rules-users] [planner] Problem setting configuration file

2011-10-17 Thread Guilherme Kunigami
Hi,

2011/10/14 Geoffrey De Smet ge0ffrey.s...@gmail.com

 **

 I was wondering now if I can achieve the same with the drools rule file.

 That's a bit harder, but not that hard.
 Look in the Drools Planner manual for setRuleBase() (as an alternative to
 using scoreDrl's in your SolverConfig.xml)
 and look in the Drools Expert manual on how to create a RuleBase.


Great, that worked too!

Just for future reference, I used the following tutorial to create a rule
base:
http://hydrogen.informatik.tu-cottbus.de/wiki/index.php/How_to_create_and_execute_a_Drools_rulebase

And
http://docs.jboss.org/drools/release/5.2.0.Final/drools-planner-docs/html/ch04.html#d0e1566
to
set the rule base.

Thank you for the help!



 Op 13-10-11 15:37, Guilherme Kunigami schreef:

 Geoffrey,

  Thank you, that worked!

  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).


 2011/10/11 Geoffrey De Smet ge0ffrey.s...@gmail.com

  Hi Guilharme,

 There's an overloaded method called configure(InputStream in) and
 configure(Reader reader)  too, use either of those instead:

 try {
   InputStream in = new FileInputStream(
 /path/to/xml/file/SolverConf.xml);
   configurer.configure(in);
 } finally {
   IOUtils.closeSilently(in);
 }

 Op 11-10-11 15:01, Guilherme Kunigami schreef:

  Hi,

  I'm trying to load a configuration file (namely SolverConf.xml) into
 XmlSolver with the code below:

  XmlSolverConfigurer configurer = new XmlSolverConfigurer();
 configurer.configure(SOLVER_CONFIG);
 Solver solver = configurer.buildSolver();

  If I bundle SolverConf.xml file with the application .jar file, then
 using SOLVER_CONFIG as /path/to/xml/file/SolverConf.xml works fine.

  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.

  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:
 http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file
 )

  (Supposing my .jar is in /some/path and the SolverConf.xml will be on
 /some/path/conf for example)

  Thanks,



 ___
 rules-users mailing 
 listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users


 --
 With kind regards,
 Geoffrey De Smet


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 ___
 rules-users mailing 
 listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users


 --
 With kind regards,
 Geoffrey De Smet


 ___
 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


Re: [rules-users] [planner] Problem setting configuration file

2011-10-14 Thread Geoffrey De Smet

I was wondering now if I can achieve the same with the drools rule file.

That's a bit harder, but not that hard.
Look in the Drools Planner manual for setRuleBase() (as an alternative 
to using scoreDrl's in your SolverConfig.xml)

and look in the Drools Expert manual on how to create a RuleBase.

Op 13-10-11 15:37, Guilherme Kunigami schreef:

Geoffrey,

Thank you, that worked!

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).



2011/10/11 Geoffrey De Smet ge0ffrey.s...@gmail.com 
mailto:ge0ffrey.s...@gmail.com


Hi Guilharme,

There's an overloaded method called configure(InputStream in) and
configure(Reader reader)  too, use either of those instead:

try {
  InputStream in = new
FileInputStream(/path/to/xml/file/SolverConf.xml);
  configurer.configure(in);
} finally {
  IOUtils.closeSilently(in);
}

Op 11-10-11 15:01, Guilherme Kunigami schreef:

Hi,

I'm trying to load a configuration file (namely SolverConf.xml)
into XmlSolver with the code below:

XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure(SOLVER_CONFIG);
Solver solver = configurer.buildSolver();

If I bundle SolverConf.xml file with the application .jar file,
then using SOLVER_CONFIGas /path/to/xml/file/SolverConf.xmlworks
fine.

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.

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:

http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file)

(Supposing my .jar is in /some/path and the SolverConf.xml will
be on /some/path/conf for example)

Thanks,



___
rules-users mailing list
rules-users@lists.jboss.org  mailto:rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


-- 
With kind regards,

Geoffrey De Smet


___
rules-users mailing list
rules-users@lists.jboss.org mailto: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


--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [planner] Problem setting configuration file

2011-10-13 Thread Guilherme Kunigami
Geoffrey,

Thank you, that worked!

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).


2011/10/11 Geoffrey De Smet ge0ffrey.s...@gmail.com

 **
 Hi Guilharme,

 There's an overloaded method called configure(InputStream in) and
 configure(Reader reader)  too, use either of those instead:

 try {
   InputStream in = new FileInputStream(
 /path/to/xml/file/SolverConf.xml);
   configurer.configure(in);
 } finally {
   IOUtils.closeSilently(in);
 }

 Op 11-10-11 15:01, Guilherme Kunigami schreef:

 Hi,

  I'm trying to load a configuration file (namely SolverConf.xml) into
 XmlSolver with the code below:

  XmlSolverConfigurer configurer = new XmlSolverConfigurer();
 configurer.configure(SOLVER_CONFIG);
 Solver solver = configurer.buildSolver();

  If I bundle SolverConf.xml file with the application .jar file, then
 using SOLVER_CONFIG as /path/to/xml/file/SolverConf.xml works fine.

  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.

  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:
 http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file
 )

  (Supposing my .jar is in /some/path and the SolverConf.xml will be on
 /some/path/conf for example)

  Thanks,



 ___
 rules-users mailing 
 listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users


 --
 With kind regards,
 Geoffrey De Smet


 ___
 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] [planner] Problem setting configuration file

2011-10-11 Thread Guilherme Kunigami
Hi,

I'm trying to load a configuration file (namely SolverConf.xml) into
XmlSolver with the code below:

XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure(SOLVER_CONFIG);
Solver solver = configurer.buildSolver();

If I bundle SolverConf.xml file with the application .jar file, then using
SOLVER_CONFIG as /path/to/xml/file/SolverConf.xml works fine.

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.

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:
http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file
)

(Supposing my .jar is in /some/path and the SolverConf.xml will be on
/some/path/conf for example)

Thanks,
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [planner] Problem setting configuration file

2011-10-11 Thread Geoffrey De Smet

Hi Guilharme,

There's an overloaded method called configure(InputStream in) and 
configure(Reader reader)  too, use either of those instead:


try {
  InputStream in = new FileInputStream(/path/to/xml/file/SolverConf.xml);
  configurer.configure(in);
} finally {
  IOUtils.closeSilently(in);
}

Op 11-10-11 15:01, Guilherme Kunigami schreef:

Hi,

I'm trying to load a configuration file (namely SolverConf.xml) into 
XmlSolver with the code below:


XmlSolverConfigurer configurer = new XmlSolverConfigurer();
configurer.configure(SOLVER_CONFIG);
Solver solver = configurer.buildSolver();

If I bundle SolverConf.xml file with the application .jar file, then 
using SOLVER_CONFIGas /path/to/xml/file/SolverConf.xmlworks fine.


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.


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: 
http://stackoverflow.com/questions/7718807/can-getresourceasstream-find-files-outside-the-jar-file)


(Supposing my .jar is in /some/path and the SolverConf.xml will be on 
/some/path/conf for example)


Thanks,



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


--
With kind regards,
Geoffrey De Smet

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users