cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Guttmann <>
Subject Re: OT: Transforming EJB data to XML for Cocoon
Date Thu, 22 Nov 2001 13:36:41 GMT

as with EJBs in general, you always have some freedom in the way you implement
your solution, i.e. whether you use session beans only, session and bean-managed
entity beans, session and container-managed entity beans, session beans and
castor, value objects, etc. In other words, there's no single correct solution.

If there's anything that applies in all the cases, it's the use of a session
bean as an entry point, i.e. a facade. In your particular case, you could for
example use a business delegate that would call the session bean to source some
data you want to display. That business delegate (we called them transformers in
our team here) would implement the XMLFragment interface. In the code of the
transformers toSAX() method you could e.g.

1) invoke a method of your session bean, which returns some value objects (e.g.
a a List)
2) insert the start tag of some outer xml element into your SAX stream
3) iterate through your List of value objects, and invoke each value object's
toSAX() method.
4) insert the end tag of some outer xml element into your SAX stream.

Each of the value objects will - on invocation - insert its state to the SAX
stream as a series of SAX events executed through the ContentHandler passed as
an argument.

Hope this helps.

Jozsa Kristof wrote:

> Dear Werner,
>   I do use entity beans to store my data. Now, if I get it right, you
> suggest writing a Cocoon Transformer, which calls my entity beans' toSAX()
> methods by hand, while implementing the XMLFragment or XMLizable interface
> in the entity beans? (I'm using Cocoon 2.0rc2).
>   So far I wrote some session beans to handle a couple of entity beans - I'm
> using joined tables and difficult queries on many tables, so I
> shouldn't/cannot use the enitity beans directly from Cocoon. Can I implement
> the XMLizable interface in my session bean then?
> Is that the right way of outputting xml data from entity beans and from
> complex searches for Cocoon?
> Best regards,
> Christopher Jozsa
> --
> .Digital.Yearning.for.Networked.Assassination.and.Xenocide

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message