cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Ramos" <mailing-li...@parsec.es>
Subject Custom transformer as a singleton
Date Thu, 26 Aug 2004 18:48:36 GMT
Hi there,

I am a newbie with Avalon and Cocoon, and have some doubts... if this is not the place where
I should ask the following questions, feel free to redirect me somewhere else, I will be grateful.

I want to use cocoon as the presentation layer for a new web project.

I will build a sitemap that will do the following:

 1.- with a RequestGenerator, get html form data as xml
 2.- with an XSL transformer, make a nice XML representation of the request.
 3.- with a custom transformer, transform the XML request into an XML response
 4.- with an XSL transformer, represent the XML response with HTML
 5.- serialize to HTML.

 In step 3, I will be using XML binding technology (XMLBeans) to get a java object that represents
the XML document received, and also to generate the response. So, for the request and response
objects of my application I will be generating their xml schema, and the xml binding compiler
will generate the java classes for me.

 Inside my transformer I will get a java object from the input XML DOM, and depending on the
type of this object I will be forwarding a request to a controller that will generate a response
as a java object that will be represented as a DOM and returned as the product of the transformation.

 The class that decides which controller gets used for each request type is somehow an implementation
of the front controller pattern. Basically it has a processRequest method that receives a
request object and returns a response object. Not too original, eh?

 My transformer 'transform' method is just a wrapper around the processRequest method of the
front controller.

 Now, my concern is: ¿ Can I make my transformer a singleton ? ¿ How do I ensure this ?
Having my transfromer created and dereferenced for each request would create me some problems,
as it would also do having a pool of these transformers acting concurrently.

What I want is to have my singleton transformer using many threads to process concurrent requests
without problems, the same idea as in the doGet and doPost methods of a servlet.

Anyone can throw some light into these issues? Or provide some pointers?

Most important... am I crazy doing something like this? Maybe there is already some great
application framework aou there working with a similar design.

Thanks for any replies,

Javier
Mime
View raw message