xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Rubin <mru...@thunderhead.com>
Subject Event broadcasting and listening question
Date Wed, 11 May 2011 13:47:49 GMT
´╗┐Hello there. I have been busy implementing 128 bit PDF encryption for FOP. I have already
got it working successfully but one issue remains that I have a question about.

In the org.apache.fop.pdf.PDFEncriptionJCE.init() method there is one place where I want to
broadcast an event message. I looked athttp://xmlgraphics.apache.org/fop/trunk/events.html
 to learn about events. However it just shows "EventBroadcaster broadcaster = [get it from
somewhere];" and doesn't show how I should be getting the broadcaster. After looking in the
code in the AFP package for existing examples I put together the following which seems to
work on testing:

FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent agent = fopFactory.newFOUserAgent();
EventBroadcaster eventBroadcaster = agent.getEventBroadcaster();
PDFEventProducer eventProducer = PDFEventProducer.Provider.get(eventBroadcaster);
eventProducer.warnRevision3PermissionsIgnored(this);

This creates a new FopFactory, from which I create a new FOUserAgent, from which I can get
the event broadcaster to supply to my event producer. (I had to create a PDFEventProducer
which extends EventProducer. Plus PDFEventProducer.xml which contains the message mapping.)

In this case the EventBroadcaster will be created new every time so I am not sure existing
listeners will pick up. So is there a recommended way that I can get an existing event broadcaster
to use? Or is the above way the correct way to do it after all?

Version of FOP is v1.0. Platform is Ubuntu Linux, running from within the Eclipse IDE.

Thanks!

-Mike





Michael Rubin
Developer

T: +44 20 8238 7400
F: +44 20 8238 7401

mrubin@Thunderhead.com

The contents of this e-mail are intended for the named addressee only. It contains information
that may be confidential. Unless you are the named addressee or an authorized designee, you
may not copy or use it, or disclose it to anyone else. If you received it in error please
notify us 
immediately and then destroy it. 





Mime
View raw message