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> &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt; 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&#39;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>&gt; Michael told me on irc that XStream might also be a good idea.<br>&gt;<br>&gt; Since I &#39;d like the configuration as a separate domain object model,<br>&gt; I tryed it that way and it looks ok:
<br>&gt;<br>&gt;<br>&gt; &lt;LocalSearchSolver&gt;<br>&gt;&nbsp;&nbsp; &lt;randomSeed&gt;5&lt;/randomSeed&gt;<br>&gt;&nbsp;&nbsp; &lt;finish class=&quot;StepCountFinish&quot;&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;maximumStepCount&gt;50&lt;/maximumStepCount&gt;
<br>&gt;&nbsp;&nbsp; &lt;/finish&gt;<br>&gt; &lt;/LocalSearchSolver&gt;<br>&gt;<br>&gt; What do you think of such kind of local search solver configuration?<br>&gt;<br>&gt;<br>&gt;<br>&gt; Here are the classes that do it, they follow the builder pattern:
<br>&gt;<br>&gt; @XStreamAlias(&quot;LocalSearchSolver&quot;)<br>&gt; public class LocalSearchSolverConfig {<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; private long randomSeed = 0;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; @XStreamAlias(&quot;finish&quot;)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; private FinishConfig finishConfig;
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; public LocalSearchSolver build() ...<br>&gt;<br>&gt; }<br>&gt;<br>&gt; @XStreamAlias(&quot;StepCountFinish&quot;)<br>&gt; public class StepCountFinishConfig implements FinishConfig {<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; private int maximumStepCount = 100;
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; public Finish build() ...<br>&gt;<br>&gt; }<br>&gt;<br>&gt;<br>&gt; which looks a lot easier than fiddling around with sax or DOM?<br>&gt; Xsd might be a problem - but maybe some day XStream can use the
<br>&gt; javadocs to generate an xsd? If not, it shouldn&#39;t be to hard to<br>&gt; replace the config package with a sax or dom based configuration - or<br>&gt; just manually write an xsd.<br>&gt;<br>&gt; With kind regards,
<br>&gt; Geoffrey De Smet<br>&gt;<br>&gt;<br>&gt; Mark Proctor wrote:<br>&gt;&gt; Look at our xml reader.Its xerces based and pluggeable and should<br>&gt;&gt; easily be able to adapt to anything.<br>&gt;&gt;<br>&gt;&gt; Mark
<br>&gt;&gt; Geoffrey De Smet wrote:<br>&gt;&gt;&gt; For the solver I &#39;d like to externalize the configuration into an<br>&gt;&gt;&gt; xml(?)&nbsp;&nbsp;file.<br>&gt;&gt;&gt; something like<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; &lt;localsearch decisionMode=&quot;OPTIMAL&quot;&gt;
<br>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;finish steps=&quot;500&quot;/&gt;<br>&gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ruleBase location=&quot;/org/foo/bar/drools.drl&quot;/&gt;<br>&gt;&gt;&gt; &lt;/localsearch&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; This is a bit inspired by how ehcache is configured, clean and easy,
<br>&gt;&gt;&gt; without any class implementation details: the way users like it.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; I &#39;ve been thinking on doing this with XStream, but that&#39;s not<br>&gt;&gt;&gt; versatile enough to make user friendly configuration files. Although
<br>&gt;&gt;&gt; Xstream works out great to serialize solutions to and from xml files.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Next I was thinking about is JDom or Xom, but that&#39;s yet another<br>&gt;&gt;&gt; dependency. What would you guys recommend?
<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-dev mailing list<br>&gt;&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<br>&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>&gt;&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; rules-dev mailing list
<br>&gt; <a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>&gt;<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>