Certain packages of our project--in this case, the
"image" package--are used both by the PDFTranscoder (a
separate application, if you will) and the FOP

The FOUserAgent is ultra-easy (?) to access from the
FOP Application, but not-so-easy (and, also,
not-so-relevant) for the PDFTranscoder.  (We also have
an SVGUserAgent, but I haven't researched it.)

Most of the methods in "image" are requesting a
FOUserAgent parameter, but are *only* using its logger
once it gets it:  ua.getLogger().warn("..."); etc,
etc.  For several of those methods, I changed the
input parameter from "FOUserAgent" to "Logger". 
(Which is probably correct, if all a certain method
needs is a logger, that's all it should get.)  Code
accessing those methods no longer send, say,
"myFOUserAgent", but "myFOUserAgent.getLogger()".

Thomas DeWeese of Batik, in doing PDF Transcoder work
for us (or maybe something else graphics-related--I
really don't understand most of that stuff ;)  had
trouble accessing the FOUserAgent from his code.  I
changed the signatures as above for the methods in
question and created a logger instance for him to use
in his calling method, fixing the problem.

Should a method need FOUserAgent--and I couldn't find
any in Image *directly* using it (a call to the SVG
package did, however, but I don't know if that SVG
package also just wanted its logger, I stopped
researching to that degree)--well, then, we can't
change its signature.

My inclination is to make FOUserAgent a FOP-only
critter and save the PDFTranscoder from it where
possible.  I.e., in the example below of needing an
image baseDir, sending the
foUserAgent.getImageBaseDir() as a parameter instead,
so Thomas can just send "myImageBaseDir" to the same
method for his transcoder work, without needing to
bother with an FOUserAgent. 


--- Chris Bowditch <[EMAIL PROTECTED]> wrote:
> Glen Mazza wrote:
> > I tried to do a complete switch from FOUserAgent
> to
> > logger in the images package, was not able to
> (there
> > are still other cases the FOUserAgent is actually
> > being used.)
> Glen - I havent looked at this in detail, but my
> understanding of the 
> FOUserAgent was the place holder for any user
> configuration, e.g. 
> baseFontDir, baseImageDir, etc. So by changing all
> FOuserAgent arguments 
> to loggers, are you excluding the possibility of
> code in the images 
> package from accessing any user configuration, e.g.
> baseImageDir?
> Chris

Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Reply via email to