--- Finn Bock <[EMAIL PROTECTED]> wrote:
> I don't want to change any FOP code! And if I have
> to change any FOP
> sources to add an extension, then FOP doesn't
> support extension with the
> meaning of extension as I understand it.
>From what I understand a program may not change its
own source code while it is running so we may not have
complete freedom for everything.
> An extension mechanism where I can put an unmodified
> fop.jar and
> myextension.jar on the CLASSPATH and have it work is
> a defining issue to
OK, this looks like a nice feature to have, and the
modifications made to FOP in this regard can be
helpful to others who have similar work to do.
Here's what I see:
1.) myextension.jar will need a FOElementMapping 
subclass that will reroute fo:Block from Block.java to
FinnBlock.java. Have FinnBlock.java override the
vCN() for the new validation rules.
(FinnBlock.java can also override addLayoutManager()
if it uses a different one--let's discuss this one if
it is an adequate substitute for your need for the LM
makers we were discussing earlier.)
Ideally, myextension.FinnFOElementMapping can subclass
FOElementMapping so you will only need to define
makers for the elements you are changing.
2.) FOUserAgent.addElementMapping()  is the
interface to add an element mapping to runtime FOP.
Embedded users wanting to link in your library in
their code will need to call
3.) FOTreeBuilder currently loads the "default"
mappers first, then checks for any user-added ones
. We will need to change this logic to have FOP
first load any user-defined (or run-time discovered)
element mappings first, then load each of the default
ones *if* its namespace hasn't already been loaded.
So for the user adding FinnFOElementMapping with the
XSL namespace URI, this will result in
FOElementMapping *not* being loaded, because it has
the same namespace URI.
4.) (If applicable) Finally, for command-line users,
subclass apps.Fop java, changing both constructors to
load your element mapping:
and provide a finnfop.bat/.sh that will call this.
1.) Same as #1 above.
2.) Provide a subclass of FOTreeBuilder in my
extension.java that overrides the method
setupDefaultMapping() to load FinnFOElementMapping
instead of FOElementMapping.
3.) Same as #4 above.