cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@digitalinsight.com>
Subject RE: Performing actions
Date Tue, 30 Dec 2003 00:07:06 GMT
I can tell you how we are doing it, although I can't make the source
available.  

I wrote a BusinessDelegate component. Each business delegate is defined in
cocoon.xconf as:

<business-delegates>
        <business-delegate name="getData">
            <className>busdelegate.Service</className>
            <getMethod>getData</getMethod>
            <constructorParameters>
                <parameter name="properties" type="java.util.Properties"
                           role="JNDIInitialContext"/>
            </constructorParameters>
            <parameters>
            <parameter name="sessionDto" type="SessionInfo"
inputModule="DTOModule"/>
            </parameters>
        </business-delegate>
        <business-delegate name="SetData">
            <className>busdelegate.Service</className>
            <getMethod>setData</getMethod>
            <constructorParameters>
                <parameter name="properties" type="java.util.Properties"
                           role="JNDIInitialContext"/>
            </constructorParameters>
            <parameters>
                <parameter name="sessionDto" type="SessionInfo"
inputModule="DTOModule"/>
                <parameter name="dto" type="DataDto"
inputModule="DTOModule"/>
            </parameters>
        </business-delegate>
<business-delegates>

I then have a BusinessDelegateAction that takes the business delegate name
as the src parameter.  The action invokes the business delegate by calling
the appropriate BusinessDelegate instance. It save the returned Data
Transfer Object in the request.  I then have a generator that converts the
Data Transfer Object to XML using Betwixt.  As long as the Data Transfer
Objects are constructed "nicely", Betwixt creates great XML.

The advantage of this is that I have the following Cocoon classes:
BusinessDelegateAction
BusinessDelegate
BeanGenerator
DTOModule (generates input DataTransferObjects from request parameters using
BeanUtils).
PropertiesComponent (creates a properties object that contains the EJB
properties needed to do the JNDI lookup).

None of these have any knowledge of the business delegates. The business
delegates themselves are completely independent of Cocoon. Each
BusinessDelegate is configured to call a specific business delegate as
required.

Ralph

> -----Original Message-----
> From: Olivier RICHAUD [mailto:olivier@richaud.net]
> Sent: Monday, December 29, 2003 3:50 PM
> To: users@cocoon.apache.org
> Subject: Performing actions
> 
> 
> Hi all,
> 
> We are using Cocoon as our presentation layer. The backend is 
> made of EJB
> which interact with 2 databases. The glue, when needed, 
> between EJB and
> Cocoon XSP pages is based on servlets. For example, when a form is
> submitted, the update jobs is done by servlets and depending 
> on the outcome,
> forwarded to the appropriate XSP page. 
> 
> Using servlets is not well appropriated as the flow is, like 
> a bit like
> Struts, concentrated in the sitemap. Is there a way to do a 
> better job in a
> Cocoon way? Using actions, for example? Would it result in 
> transforming all
> our servlets into actions? And what would be the advantage of 
> doing this?
> 
> Thanks and happy new year.
> 
> 
> Olivier.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message