The Fop API is fine -- as long as it remains stable to the minimal level I'm using it.

I'm just doing:
  final Class  fopClass = Class.forName( "org.apache.fop.apps.Fop" );
  final Object  fop = fopClass.getConstructor( String.class ).newInstance( "application/pdf" );  // new Fop( "application/pdf" )
  fopClass.getMethod( "setOutputStream", OutputStream.class ).invoke( fop, a_outputStream );  // fop.setOutputStream( a_outputStream )
  final DefaultHandler  defaultHandler = (DefaultHandler) fopClass.getMethod( "getDefaultHandler" ).invoke( fop );  // fop.getDefaultHandler()
That's it (catch block omitted, of course).

It's always good to keep the simple stuff simple, but in this case having to load just one class and call only 1 constructor and 2 methods makes this approach quite reasonable whereas I'd hate to have a whole lot more of such code to do the same thing.  [Note the 0.20.5 code is just slightly longer so 0.91 is a good step in this respect.]
--
Jess Holle

Jeremias Maerki wrote:
Noted, but the fact that the API is not stable has been documented in [1].
We've been pushing finalizing the API before us for a long time. The old
0.20.5 API sadly doesn't fit all the requirements that we have today.

Another idea for your situation is a wrapper API that shields you from
the actualy API of the FO implementation you use. I've written such a
wrapper API [2] although the published version is now a little behind
and would need to be updated. Furthermore, I got negative feedback from
Sun about my choice of name. But if there is sufficient demand and a
little help I can always revive it. I'm actively using it in my private
projects.

[1] http://xmlgraphics.apache.org/fop/0.91/upgrading.html
[2] http://www.jeremias-maerki.ch/dev/jaxg/index.html

On 07.02.2006 10:46:48 Jess Holle wrote:
  
Having just added reflection code to make my code work with 0.20.5 and 
0.91 beta, I'd like to see the existing Fop() constructor continue to 
work as per 0.91 beta.

Overall having to use reflection to maintain use of the current stable 
while being ready for the future is at once understandable and 
obnoxious.  The simpler the new API is for simple cases (I'm *not* 
re-using anything from one execution to the next due to the infrequency 
of the calls, etc) and the sooner it stabilizes for these, the better.  
I had kind of assumed that "beta" meant "API is stable for simple cases" :-)

--
Jess Holle

Jeremias Maerki wrote:
    
As part of my upcoming optimization work I want to finalize the FOP API.
I've written down a proposal in the Wiki:
http://wiki.apache.org/xmlgraphics-fop/ApiDesign

If possible, I'd like to have that finished by the end of the week.
Please post your feedback ASAP.

Jeremias Maerki

  
      



Jeremias Maerki

  

Reply via email to