Yeah the control in XStream is limited of course, but that XML looks nice enough. You can also easily generate a schema for reference purposes as needed.<br><br>Of course, as mark said, we can bake this into a non XML grammar eventually, but for now, I think that looks fine ! (as long as its documented with lots of examples !).
<br><br>Michael.<br><br><div><span class="gmail_quote">On 1/29/07, <b class="gmail_sendername">Mark Proctor</b> <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
As long as you don't care about controlling the output too much, XStream<br>is simple and nice.<br><br>XML is good and quick way to prototype what you are doing, hopefully we<br>can eventually also build this into the antlr grammar.
<br><br>Mark<br>Geoffrey De Smet wrote:<br>> Michael told me on irc that XStream might also be a good idea.<br>><br>> Since I 'd like the configuration as a separate domain object model,<br>> I tryed it that way and it looks ok:
<br>><br>><br>> <LocalSearchSolver><br>> <randomSeed>5</randomSeed><br>> <finish class="StepCountFinish"><br>> <maximumStepCount>50</maximumStepCount>
<br>> </finish><br>> </LocalSearchSolver><br>><br>> What do you think of such kind of local search solver configuration?<br>><br>><br>><br>> Here are the classes that do it, they follow the builder pattern:
<br>><br>> @XStreamAlias("LocalSearchSolver")<br>> public class LocalSearchSolverConfig {<br>><br>> private long randomSeed = 0;<br>><br>> @XStreamAlias("finish")<br>> private FinishConfig finishConfig;
<br>><br>> public LocalSearchSolver build() ...<br>><br>> }<br>><br>> @XStreamAlias("StepCountFinish")<br>> public class StepCountFinishConfig implements FinishConfig {<br>><br>> private int maximumStepCount = 100;
<br>><br>> public Finish build() ...<br>><br>> }<br>><br>><br>> which looks a lot easier than fiddling around with sax or DOM?<br>> Xsd might be a problem - but maybe some day XStream can use the
<br>> javadocs to generate an xsd? If not, it shouldn't be to hard to<br>> replace the config package with a sax or dom based configuration - or<br>> just manually write an xsd.<br>><br>> With kind regards,
<br>> Geoffrey De Smet<br>><br>><br>> Mark Proctor wrote:<br>>> Look at our xml reader.Its xerces based and pluggeable and should<br>>> easily be able to adapt to anything.<br>>><br>>> Mark
<br>>> Geoffrey De Smet wrote:<br>>>> For the solver I 'd like to externalize the configuration into an<br>>>> xml(?) file.<br>>>> something like<br>>>><br>>>> <localsearch decisionMode="OPTIMAL">
<br>>>> <finish steps="500"/><br>>>> <ruleBase location="/org/foo/bar/drools.drl"/><br>>>> </localsearch><br>>>><br>>>> This is a bit inspired by how ehcache is configured, clean and easy,
<br>>>> without any class implementation details: the way users like it.<br>>>><br>>>><br>>>> I 've been thinking on doing this with XStream, but that's not<br>>>> versatile enough to make user friendly configuration files. Although
<br>>>> Xstream works out great to serialize solutions to and from xml files.<br>>>><br>>>> Next I was thinking about is JDom or Xom, but that's yet another<br>>>> dependency. What would you guys recommend?
<br>>>><br>>>><br>>><br>>> _______________________________________________<br>>> rules-dev mailing list<br>>> <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<br>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>>><br>><br>> _______________________________________________<br>> rules-dev mailing list
<br>> <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>> <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>><br><br>
_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev
</a><br></blockquote></div><br>