You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Simon Pepping <sp...@leverkruid.nl> on 2006/02/22 21:55:36 UTC

Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

On Wed, Feb 22, 2006 at 08:50:57PM -0000, spepping@apache.org wrote:
> Author: spepping
> Date: Wed Feb 22 12:50:56 2006
> New Revision: 379883
> 
> URL: http://svn.apache.org/viewcvs?rev=379883&view=rev
> Log:
> Adapted this example to the new API.
> 
> Modified:
>     xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java
 
I did this to get a feel for the API. Does this reflect the intention?

Would it not be nicer to have a constructor that takes the output
stream as an argument?

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Mon, Mar 06, 2006 at 09:08:42AM +0100, Jeremias Maerki wrote:
> 
> > Added the methods. As you see from my example, I prefer early testing
> > of the consistency of the Fop object.
> 
> OK. However, I don't like your catching the IllegalStateException in the
> example code. An IllegalStateException is a descendant of
> RuntimeException and normally indicates a programmer error. It's not
> something that is usually caught. The example code should be instructive
> to the normal Java developer and should not distract with that try/catch
> around the getDefaultHandler() method IMO.

Neither do I, but I do want to catch the exception, either here or in
the listen method, where it is caught together with all exceptions. If
I do not catch it, the listening will stop, which I do not want.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 05.03.2006 21:55:44 Simon Pepping wrote:
> On Thu, Feb 23, 2006 at 10:03:29PM +0100, Simon Pepping wrote:
> > On Wed, Feb 22, 2006 at 10:22:39PM +0100, Jeremias Maerki wrote:
> > > 
> > > On 22.02.2006 21:55:36 Simon Pepping wrote:
> > > > Would it not be nicer to have a constructor that takes the output
> > > > stream as an argument?
> > > 
> > > If this is preferred, no objections. However, not all output formats take
> > > an OutputStream which means an increase of factory methods.
> > 
> > For those formats that do require an OutputStream the created object
> > is inconsistent, and one is only notified at runtime. The presence of
> > another factory method at least suggests that it under some
> > circumstances it may be necessary to create the object with an
> > OutputStream.
> 
> Added the methods. As you see from my example, I prefer early testing
> of the consistency of the Fop object.

OK. However, I don't like your catching the IllegalStateException in the
example code. An IllegalStateException is a descendant of
RuntimeException and normally indicates a programmer error. It's not
something that is usually caught. The example code should be instructive
to the normal Java developer and should not distract with that try/catch
around the getDefaultHandler() method IMO.

Jeremias Maerki


Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Thu, Feb 23, 2006 at 10:03:29PM +0100, Simon Pepping wrote:
> On Wed, Feb 22, 2006 at 10:22:39PM +0100, Jeremias Maerki wrote:
> > 
> > On 22.02.2006 21:55:36 Simon Pepping wrote:
> > > Would it not be nicer to have a constructor that takes the output
> > > stream as an argument?
> > 
> > If this is preferred, no objections. However, not all output formats take
> > an OutputStream which means an increase of factory methods.
> 
> For those formats that do require an OutputStream the created object
> is inconsistent, and one is only notified at runtime. The presence of
> another factory method at least suggests that it under some
> circumstances it may be necessary to create the object with an
> OutputStream.

Added the methods. As you see from my example, I prefer early testing
of the consistency of the Fop object.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Wed, Feb 22, 2006 at 10:22:39PM +0100, Jeremias Maerki wrote:
> 
> On 22.02.2006 21:55:36 Simon Pepping wrote:
> > Would it not be nicer to have a constructor that takes the output
> > stream as an argument?
> 
> If this is preferred, no objections. However, not all output formats take
> an OutputStream which means an increase of factory methods.

For those formats that do require an OutputStream the created object
is inconsistent, and one is only notified at runtime. The presence of
another factory method at least suggests that it under some
circumstances it may be necessary to create the object with an
OutputStream.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r379883 - /xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 22.02.2006 21:55:36 Simon Pepping wrote:
> On Wed, Feb 22, 2006 at 08:50:57PM -0000, spepping@apache.org wrote:
> > Author: spepping
> > Date: Wed Feb 22 12:50:56 2006
> > New Revision: 379883
> > 
> > URL: http://svn.apache.org/viewcvs?rev=379883&view=rev
> > Log:
> > Adapted this example to the new API.
> > 
> > Modified:
> >     xmlgraphics/fop/branches/Temp_API_Finalization/examples/embedding/java/embedding/ExampleFO2PDF.java
>  
> I did this to get a feel for the API. Does this reflect the intention?

Yes

> Would it not be nicer to have a constructor that takes the output
> stream as an argument?

If this is preferred, no objections. However, not all output formats take
an OutputStream which means an increase of factory methods.


Jeremias Maerki