Calabash: flexible configuration API

  Hi Norman, everyone,

  During the last week, I've been investigating the opportunities
to configure the individual components used by Calabash, as Saxon
and Jing for instance.  My goal is to see how I can add support
for the EXPath Packaging System to Calabash, but I think those
ideas would be valuable to anyone who wants to plug configuration
code in a predefined way.

  For what I've seen, Calabash tries to configure the components
it uses with the basic defaults as well as with the options it
needs for itself.  For very common options, it tries to provide
the user with a uniform way to set them.  For instance the URI
resolver.  But this approach shows its limits, for instance with
the URI resolver for XQuery modules.

  What I suggest here provides a way to plug some user code and
to give to it direct access to the components (to do whatever it
wants to do with,) instead of trying to define a set of options
that could be set on several components (I guess that's possible,
but would require time and more feedback and experience with
real-world pipelines.)

  The idea is quite simple.  See the class diagram at
http://www.fgeorges.org/tmp/calabash/configurers.png.  It defines
a simple interface for each component.  For instance, the
interface SaxonConfigurer provides 2 methods, resp. to configure
Saxon when it is used to run an XSLT step, and to configure Saxon
when it is used to run an XQuery step.  As well as something
similar for Jing (to validate with RNG or RNC.)

  A factory gives access to all of those configurer, and
XProcRuntime has a reference to such a factory, set either via
the command line or via the Calabash Java API.

  Of course, that approach exposes "implementation details"
(those interfaces would change if Calabash drop Jing to use MSV
for instance.)  But I think this is the point: how to give to the
user the full power of accessing individual components, in a
controlled way, while keeping a clean design.

  You will find a diff (against 0.9.15, aka SVN 456) as well as
the new classes to put within the package com.xmlcalabash.util at
http://www.fgeorges.org/tmp/calabash/.  This is just a quick
implem of the proposed change for only Saxon and Jing (and only
for the steps 'xslt', 'xquery', and 'validate-with-relax-ng')
just to make things clearer.  There is no way to change the
factory excepted the method XProcRuntime.setConfigurer().

  What do you think?

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/

Received on Monday, 19 October 2009 15:20:44 UTC