[discuss] a new (prototypal) approach to Joran configuration

Hi Ceki/all! due to my recent involvement in Modello[1], I started experimenting how the Modello approach could benefit existing projects that require to parse XML (but also JSON and YAML) configurations, and took Logback as a good example where doing some experiments... What made me curious to made that experiment, is the fact that current Joran approach is based to SAX APIs + reflection - elements are introspected at runtime and components will be injected - while the Modello approach is based on streaming APIs and introspection analysis is performed at compile-time, generating the "parse-tree" and the (un)marshallers. So, I pushed an initial/prototypal logback-joran2 module in my personal fork[2], which APIs are not integrated with the rest of the project yet. Configuration elements are defined in the Modello descriptor[3] which enable the generation of Java APIs (included inner Builders/static utility methods), the XML Reader/Writer (based on StAX APIs) and the XSD that users could integrate in their preferred XML IDE in order to enable the validation and auto-complete editing. With that approach, users can create their configurations programmatically, for free. Final format is a little different to the current one, have a look to a sample[4] generated via these APIs, but I am working to keep the original format as much as I can. Have a look also at how simple would be reading and writing configurations. WDYT? I already applied the Logback license header, in case you are interested on exploring the Modello approach a little more and want me to push request. Have a nice day, all the best, -Simo [1] http://modello.codehaus.org/index.html [2] https://github.com/simonetripodi/logback [3] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/main... [4] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test... [5] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test... http://people.apache.org/~simonetripodi/ http://www.99soft.org/

On 20.06.2013 09:44, Simone Tripodi wrote:
Hi Ceki/all!
due to my recent involvement in Modello[1], I started experimenting how the Modello approach could benefit existing projects that require to parse XML (but also JSON and YAML) configurations, and took Logback as a good example where doing some experiments...
What made me curious to made that experiment, is the fact that current Joran approach is based to SAX APIs + reflection - elements are introspected at runtime and components will be injected - while the Modello approach is based on streaming APIs and introspection analysis is performed at compile-time, generating the "parse-tree" and the (un)marshallers.
Is there introspection support in Modello?
So, I pushed an initial/prototypal logback-joran2 module in my personal fork[2], which APIs are not integrated with the rest of the project yet.
Configuration elements are defined in the Modello descriptor[3] which enable the generation of Java APIs (included inner Builders/static utility methods), the XML Reader/Writer (based on StAX APIs) and the XSD that users could integrate in their preferred XML IDE in order to enable the validation and auto-complete editing. With that approach, users can create their configurations programmatically, for free.
That's just awesome!
Final format is a little different to the current one, have a look to a sample[4] generated via these APIs, but I am working to keep the original format as much as I can.
Are there any hooks in Modello to support setting component properties, e.g. appender properties? (It's a quasi-repeat of earlier question about introspection in Modello.)
Have a look also at how simple would be reading and writing configurations.
WDYT?
I think that Modello has some very interesting features which are lacking in Joran. Had I known about Modello earlier, I would probably have not written Joran in the first place.
I already applied the Logback license header, in case you are interested on exploring the Modello approach a little more and want me to push request.
Have a nice day, all the best, -Simo
[1] http://modello.codehaus.org/index.html [2] https://github.com/simonetripodi/logback [3] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/main... [4] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test... [5] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/test...
http://people.apache.org/~simonetripodi/ http://www.99soft.org/
-- Ceki 65% of statistics are made up on the spot

Hi Ceki! On Thu, Jun 20, 2013 at 11:13 PM, ceki <ceki@qos.ch> wrote:
On 20.06.2013 09:44, Simone Tripodi wrote:
Hi Ceki/all!
due to my recent involvement in Modello[1], I started experimenting how the Modello approach could benefit existing projects that require to parse XML (but also JSON and YAML) configurations, and took Logback as a good example where doing some experiments...
What made me curious to made that experiment, is the fact that current Joran approach is based to SAX APIs + reflection - elements are introspected at runtime and components will be injected - while the Modello approach is based on streaming APIs and introspection analysis is performed at compile-time, generating the "parse-tree" and the (un)marshallers.
Is there introspection support in Modello?
Nope, unfortunately :( it generates readers/writers that just invoke plain old setters/getters/adders for generated models, but that is why maybe is efficient.
So, I pushed an initial/prototypal logback-joran2 module in my personal fork[2], which APIs are not integrated with the rest of the project yet.
Configuration elements are defined in the Modello descriptor[3] which enable the generation of Java APIs (included inner Builders/static utility methods), the XML Reader/Writer (based on StAX APIs) and the XSD that users could integrate in their preferred XML IDE in order to enable the validation and auto-complete editing. With that approach, users can create their configurations programmatically, for free.
That's just awesome!
Final format is a little different to the current one, have a look to a sample[4] generated via these APIs, but I am working to keep the original format as much as I can.
Are there any hooks in Modello to support setting component properties, e.g. appender properties? (It's a quasi-repeat of earlier question about introspection in Modello.)
Have a look also at how simple would be reading and writing configurations.
WDYT?
I think that Modello has some very interesting features which are lacking in Joran. Had I known about Modello earlier, I would probably have not written Joran in the first place.
may I can kindly ask you to point me to the current XML schema for Joran configuration? Once complete, I think you could evaluate an experimental Joran2 module - which can co-live nicely with existing Joran... All the best, -Simo http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi

On 21.06.2013 10:20, Simone Tripodi wrote:
Hi Ceki!
On Thu, Jun 20, 2013 at 11:13 PM, ceki <ceki@qos.ch> wrote:
On 20.06.2013 09:44, Simone Tripodi wrote:
Hi Ceki/all!
due to my recent involvement in Modello[1], I started experimenting how the Modello approach could benefit existing projects that require to parse XML (but also JSON and YAML) configurations, and took Logback as a good example where doing some experiments...
What made me curious to made that experiment, is the fact that current Joran approach is based to SAX APIs + reflection - elements are introspected at runtime and components will be injected - while the Modello approach is based on streaming APIs and introspection analysis is performed at compile-time, generating the "parse-tree" and the (un)marshallers.
Is there introspection support in Modello?
Nope, unfortunately :( it generates readers/writers that just invoke plain old setters/getters/adders for generated models, but that is why maybe is efficient.
How does Modello know what setters and getters to generate? Do you have to manually specify each setter and getter to generate? There must be some automation because AFAIK Maven uses Modello for reading pom.xml, and Maven can inject parameters specificied in the pom into Mojos... [snip]
may I can kindly ask you to point me to the current XML schema for Joran configuration? Once complete, I think you could evaluate an experimental Joran2 module - which can co-live nicely with existing Joran...
Currently there is no XSD for Joran. Creating one is on my to do list. Moreover, the fact that Modello can create the XSD from the Model is one of the reasons I am interested in Modello. For logback-classic, the "spec" is "defined" by the rules defined in [1] and [2]. Whenever Joran sees an XML element for which there is no defined rule, it attempts to apply the implicit injection rule. The implicit injection rule tries to inject value of the the current XML element into the latest instantiated logback component. I've got a train to catch. More later. [1] http://tinyurl.com/JoranConfiguratorBase [2] http://tinyurl.com/JoranConfigurator
All the best, -Simo
http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi _______________________________________________ logback-dev mailing list logback-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-dev
-- Ceki 65% of statistics are made up on the spot

Hi Ceki,
How does Modello know what setters and getters to generate? Do you have to manually specify each setter and getter to generate? There must be some automation because AFAIK Maven uses Modello for reading pom.xml, and Maven can inject parameters specificied in the pom into Mojos...
Indeed - I maybe have not been clear about it: given the model definition[1], Modello automatically generates the POJOs, the Reader(s), the Writer(s) and the XSD, have a look at the modello-plugin configuration in the pom[2]. If you indeed inspect the joran2 sources module, you don't see any Java source - except the testcase. HTH, all the best! -Simo [1] https://github.com/simonetripodi/logback/blob/master/logback-joran2/src/main... [2] https://github.com/simonetripodi/logback/blob/master/logback-joran2/pom.xml#... http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi

Hi again Ceki, with last push[1] I accomplished to obtain the current configuration format. HTH! Best, -Simo [1] https://github.com/simonetripodi/logback/commit/f817756ee1a1a51a5e3001f7642b... http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi On Fri, Jun 21, 2013 at 10:20 AM, Simone Tripodi <simonetripodi@apache.org> wrote:
Hi Ceki!
On Thu, Jun 20, 2013 at 11:13 PM, ceki <ceki@qos.ch> wrote:
On 20.06.2013 09:44, Simone Tripodi wrote:
Hi Ceki/all!
due to my recent involvement in Modello[1], I started experimenting how the Modello approach could benefit existing projects that require to parse XML (but also JSON and YAML) configurations, and took Logback as a good example where doing some experiments...
What made me curious to made that experiment, is the fact that current Joran approach is based to SAX APIs + reflection - elements are introspected at runtime and components will be injected - while the Modello approach is based on streaming APIs and introspection analysis is performed at compile-time, generating the "parse-tree" and the (un)marshallers.
Is there introspection support in Modello?
Nope, unfortunately :( it generates readers/writers that just invoke plain old setters/getters/adders for generated models, but that is why maybe is efficient.
So, I pushed an initial/prototypal logback-joran2 module in my personal fork[2], which APIs are not integrated with the rest of the project yet.
Configuration elements are defined in the Modello descriptor[3] which enable the generation of Java APIs (included inner Builders/static utility methods), the XML Reader/Writer (based on StAX APIs) and the XSD that users could integrate in their preferred XML IDE in order to enable the validation and auto-complete editing. With that approach, users can create their configurations programmatically, for free.
That's just awesome!
Final format is a little different to the current one, have a look to a sample[4] generated via these APIs, but I am working to keep the original format as much as I can.
Are there any hooks in Modello to support setting component properties, e.g. appender properties? (It's a quasi-repeat of earlier question about introspection in Modello.)
Have a look also at how simple would be reading and writing configurations.
WDYT?
I think that Modello has some very interesting features which are lacking in Joran. Had I known about Modello earlier, I would probably have not written Joran in the first place.
may I can kindly ask you to point me to the current XML schema for Joran configuration? Once complete, I think you could evaluate an experimental Joran2 module - which can co-live nicely with existing Joran...
All the best, -Simo
http://people.apache.org/~simonetripodi/ http://twitter.com/simonetripodi
participants (3)
-
ceki
-
Simone Tripodi
-
Simone Tripodi