Re: Loading of extension element mappings.

2004-09-23 Thread Jeremias Maerki
Ok, let's go for FOUserAgent.addElementMapping(ElementMapping) then.
No problem.

On 24.09.2004 00:21:58 Glen Mazza wrote:
> --- Jeremias Maerki <[EMAIL PROTECTED]> wrote:
> > > So I propose to change the API signature from
> > >  FOUserAgent.addElementMapping(String)
> > > to
> > >  FOUserAgent.addElementMapping(ElementMapping)
> > 
> > Keep both, please.
> > 
> 
> Unless there is a legitimate reason, I would strongly
> prefer choosing one or the other.  These will be
> stored in a collection object, to be read by the
> FOTreeBuilder--right now, I see no reason for
> maintaining a string version as well, and then have
> subsequent code to merge the two from the two APIs.
> 
> FOUserAgent.addElementMapping(ElementMapping) is a
> perfectly clean, acceptable API.  (I originally went
> with the string version for future
> compatibility--ElementMapping can change to be
> something else instead but the API wouldn't have to
> change.  But we can use the one you recommend instead
> for the reasons you have given.)


Jeremias Maerki



Re: Loading of extension element mappings.

2004-09-23 Thread Glen Mazza
--- Jeremias Maerki <[EMAIL PROTECTED]> wrote:
> > So I propose to change the API signature from
> >  FOUserAgent.addElementMapping(String)
> > to
> >  FOUserAgent.addElementMapping(ElementMapping)
> 
> Keep both, please.
> 

Unless there is a legitimate reason, I would strongly
prefer choosing one or the other.  These will be
stored in a collection object, to be read by the
FOTreeBuilder--right now, I see no reason for
maintaining a string version as well, and then have
subsequent code to merge the two from the two APIs.

FOUserAgent.addElementMapping(ElementMapping) is a
perfectly clean, acceptable API.  (I originally went
with the string version for future
compatibility--ElementMapping can change to be
something else instead but the API wouldn't have to
change.  But we can use the one you recommend instead
for the reasons you have given.)

Thanks,
Glen



Re: Loading of extension element mappings.

2004-09-23 Thread Jeremias Maerki

On 23.09.2004 23:34:20 Finn Bock wrote:
> I think the API for adding additional element mappings to the 
> FOUserAgent is bound to cause problems when fop is deployed in a multi 
> classloader environment.
>
> Using tomcat as an example, an extension mapping deployed in a webapp 
> can not be found if a well meaning administrator has placed fop.jar in 
> tomcats common/lib directory. This is because 
> FOTreeBuilder.addElementMapping(String) uses Class.forName() to load the 
> element mapping class.
> 
> I see several possible solutions:
> 
> 1) Let FOTreeBuilder.addElementMapping() also check the
> Thread.getContextClassLoader() for the extension element mapping.
> This will work in environments that actually sets the context
> classloader. Tomcat does but other environments doesn't.
> 
> 2) Pass in an explicit classloader to use when loading extension
> mappings.
> 
> 3) Let the client pass the actual element mapping object, instead of
> just passing in the name of the element mapping class.
> 
> I'm strongly in favor of 3) because it Just Work (tm), and when a 
> ClassNotFoundException do occur, the programmer immediately knows why 
> and how to fix it.

I agree. Actually, you can already do that in 0.20.5. Must have vanished
during refactoring.

> So I propose to change the API signature from
>  FOUserAgent.addElementMapping(String)
> to
>  FOUserAgent.addElementMapping(ElementMapping)

Keep both, please.


Jeremias Maerki



Loading of extension element mappings.

2004-09-23 Thread Finn Bock
Hi Team,
I think the API for adding additional element mappings to the 
FOUserAgent is bound to cause problems when fop is deployed in a multi 
classloader environment.

Using tomcat as an example, an extension mapping deployed in a webapp 
can not be found if a well meaning administrator has placed fop.jar in 
tomcats common/lib directory. This is because 
FOTreeBuilder.addElementMapping(String) uses Class.forName() to load the 
element mapping class.

I see several possible solutions:
1) Let FOTreeBuilder.addElementMapping() also check the
   Thread.getContextClassLoader() for the extension element mapping.
   This will work in environments that actually sets the context
   classloader. Tomcat does but other environments doesn't.
2) Pass in an explicit classloader to use when loading extension
   mappings.
3) Let the client pass the actual element mapping object, instead of
   just passing in the name of the element mapping class.
I'm strongly in favor of 3) because it Just Work (tm), and when a 
ClassNotFoundException do occur, the programmer immediately knows why 
and how to fix it.

So I propose to change the API signature from
FOUserAgent.addElementMapping(String)
to
FOUserAgent.addElementMapping(ElementMapping)
regards,
finn