Hi all guys - and happy new year! As a new ASF committer and Cocoon3 PMC member, I propose the creation of a new Apache Lab, called "@Digester"
@Digester The Apache commons-digester[1] is a great, light and fast XML parser; it works with the SAX APIs and provides a serie of facilities to map XML to POJOs. It's configurable in the following ways: * instancing and registering digester's rules into the digester; * using the shorthand registration methods * XML digester rules. Even if these methods are excellent, they are limited - if Java objects are due to be changed quickly, all previous methods need to be extended/modified. Inspired by the basic idea behind the JPA, JAXB's specifications, the digester-annotations package would add some facilities to configure the commons-digester using the Java5 language metadata annotations support, it means creating the digester ruleset introspecting the target POJOs, using a provided set of annotations. Using the annotated Java object it's possible to create, in runtime the digester parser, avoiding manual updates. I mean, for example, given the following XML snippet <web-app> [...] <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>application</param-name> <param-value>org.apache.struts.example.ApplicationResources</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> </servlet> [...] </web-app> @ObjectCreate("web-app/servlet") public final class ServletBean { @BeanPropertySetter("web-app/servlet/servlet-name") private String servletName; @BeanPropertySetter("web-app/servlet/servlet-class") private String servletClass; private final Map<String, String> initParams = new HashMap<String, String>(); public String getServletName() { return this.servletName; } public void setServletName(String servletName) { this.servletName = servletName; } public String getServletClass() { return this.servletClass; } public void setServletClass(String servletClass) { this.servletClass = servletClass; } @CallMethod("web-app/servlet/init-param") public void addInitParam(@CallParam("web-app/servlet/init-param/param-name") String name, @CallParam("web-app/servlet/init-param/param-value") String value) { this.initParams.put(name, value); } [...] } and a special DigesterLoader is able to create Digester rules simply by analizing the ServletBean class: Digester digester = DigesterLoader.createDigester(ServletBean.class); Of course, this approach has limitations too - i.e. it doesn't work with 3rd part developed objects - but the combined use of the different approaches should reduce the manually produced code. Current status of code: I've already done almoust the 80% of code on google-code[2] licensed under ASF2 license and also submitted a deprecable patch[3] on commons-digester Jira: I would like to set up the lab, removing the project on google-code, deprecate the patch and complete the work in the lab, then re-propose to commons-digester community the new feature. What do you think about it? I really hope you'll find this new way of parsing XML interesting like I do :P Thanks in advance, best regards!!! Simone Tripodi [1] http://commons.apache.org/digester/ [2] http://code.google.com/p/digester-annotations/source/browse/ [3] https://issues.apache.org/jira/browse/DIGESTER-135 -- http://www.google.com/profiles/simone.tripodi
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:labs="http://labs.apache.org/doap-ext/1.0#" xmlns:projects="http://projects.apache.org/ns/asfext#"> <Project rdf:about="http://labs.apache.org/labs#at-digester"> <name>@Digester</name> <shortname>at-digester</shortname> <shortdesc xml:lang="en">Digester metadata annotations extension</shortdesc> <description xml:lang="en">the Digester-annotations package shall add some facilities to configure the commons-digester using the Java language metadata annotations.</description> <homepage rdf:resource="http://labs.apache.org/at-digester/" /> <license rdf:resource="http://usefulinc.com/doap/licenses/asl20" /> <created>2010-1-4</created> <labs:status>active</labs:status> <maintainer> <foaf:Person rdf:about="http://people.apache.org/~simonetripodi/#me"> <foaf:name>Simone Tripodi</foaf:name> <foaf:homepage rdf:resource="http://people.apache.org/~simonetripodi/" /> <foaf:mbox_sha1sum>a72e039d0a1f7e9d6299fb24dd1e43a9defb0dde</foaf:mbox_sha1sum> </foaf:Person> </maintainer> <repository> <SVNRepository> <location rdf:resource="http://svn.apache.org/repos/asf/labs/at-digester/" /> <browse rdf:resource="http://svn.apache.org/viewvc/labs/at-digester/" /> </SVNRepository> </repository> <programming-language>Java</programming-language> </Project> </rdf:RDF>
--------------------------------------------------------------------- To unsubscribe, e-mail: labs-unsubscr...@labs.apache.org For additional commands, e-mail: labs-h...@labs.apache.org