|Florent Georges||Oct 31, 2009 3:47 pm|
|Subject:||Calabash: configuration API|
|From:||Florent Georges (fgeo...@fgeorges.org)|
|Date:||Oct 31, 2009 3:47:30 pm|
As I said in a previous email, I am adding EXPath Packaging support to Calabash. This is of course still experimental, as the specification itself is still in development (but I hope to release a first draft very soon.)
For now, I have added support for RNG, RNC, Schematron, XQuery, XSD and XSLT (XSD is only supported for Xerces for now, not for Saxon SA.) XSLT and XQuery support reuses my prototype of the packaging system for Saxon, so it supports plain standard stylesheets and queries, as well as extension functions written in Java.
Of course, that required several changes to Calabash itself. I tried to make less changes as possible in the Calabash code, and tried not to make any of those changes directly related to EXPath. Actually I tried to add kind of a simple, low-level, ad-hoc configuration API to Calabash, everything related to EXPath being part of a separate project, plugged in using this simple API.
In a few words, the XProcRuntime object has a factory object (XProcConfigurer) which gives per-product configurer objects: JaxpConfigurer, JingConfigurer, SaxonConfigurer and CalabashConfigurer. This factory can be set from the outside. A default implementation of those classes has be added to the Calabash code too. See the UML sketch at:
Besides those new interfaces and classes, a few classes in Calabash have been changed. XProcRuntime of course, to keep such a factory object, but also some step implementations. For instance, the library/XSLT class has been changed to configure the Saxon's Configuration object with the configurers set on the runtime object.
p:data and p:document also can be configured to look in the EXPath repository, if they have an extension attribute @pkg:kind (which can be rng, rnc, xsd, xslt, etc.) For instance, for a p:xslt step, you can either pass the stylesheet as:
<p:input port="stylesheet"> <p:inline> <xsl:stylesheet version="2.0"> <xsl:include href="http://.../style.xsl"/> </xsl:stylesheet> </p:inline> </p:input>
or as (which integrate better with XProc IMHO):
<p:input port="stylesheet"> <p:document href="http://.../style.xsl" pkg:kind="xslt"/> </p:input>
In http://www.fgeorges.org/purl/20091031/, you will find the list of modified and added files, that is the output of "svn status" (calabash-changes.status), the whole diff of the changes, that is the output of "svn diff" (calabash-changes.diff), all the modified files (calabash-modified.zip) and all the new files, that is the configurer interfaces and their default implems (calabash-new.zip). The JAR files are the implementation of the EXPath Packaging System based on those changes.
Norm, are you interested in integrating those changes into Calabash? Or anything similar allowing user (or library) code to configure individual components used by Calabash to implement individual step? Of course the same idea could be extended to configure, say, the Apache HTTP Client object used to implement p:http-request, for instance.
Sorry for this long email, and of course do not hesitate if you have any question.
-- Florent Georges http://www.fgeorges.org/