You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robert Sösemann <ro...@gmx.de> on 2002/12/18 12:22:05 UTC

XSP/ESQL - separation of concerns?

Hello,

in my current project I am using xsp and esql logicsheet for db retrivieval
and tag generation only.
Although I know that this is good for developing (no extra compilation) I am
not very happy with it.

What I don't like is:
-------------------
- many SQL statement (complex tag structure) mixed cionfusingly with the
actual document elements
- the low readability of the code, also hard to debug...
- no "cocoon-like" separtion of concerns (mix SQL-logic with tags)
- the feeling that it is not the most performant way of doing this

What I would like better (but don't excately know how):
-------------------------------------------------------
- put all SQL that is needed for generating on specific page into another
"thing" (beans?) that has no tags
- make my xsp shorter, more readable
- have the good balance of performance, easy debugging, extensibility and
the typical "cocoon separation of concerns"

Here is a short but typical code snippet:
---------------------------------------
    <ROOT>
        <esql:connection>
            <esql:pool>mysql_pool</esql:pool>

            <esql:execute-query>
                <esql:query>
                *COMPLEX QUERY, SOMETIMES 5 <esql:query> PER XSP *
                </esql:query>

                <esql:results>
                    <esql:row-results>
                        <ARTICLE>
                            <xsp:attribute name="ID"><esql:get-int
column="5"/></xsp:attribute>
                            <xsp:attribute name="MAIN"><esql:get-string
column="7"/></xsp:attribute>
                            <xsp:attribute name="SUB"><esql:get-string
column="8"/></xsp:attribute>
                            <xsp:attribute name="PDFPRINT"><esql:get-int
column="9"/></xsp:attribute>

                            <!-- Attribute evtl. NULL bei Direktanzeige -->
                            <xsp:logic>
                                if(!<esql:is-null column="3"/>) {
                                    <HEADER><esql:get-string
column="1"/></HEADER>
                                }

                            </xsp:logic>

                            <esql:get-xml column="2"/>

                            <DATE><esql:get-string column="11"/></DATE>
                            <AUTHOR><esql:get-string column="12"/></AUTHOR>
                        </ARTICLE>
                    </esql:row-results>
                </esql:results>
                <esql:no-results></esql:no-results>
                <esql:error-results></esql:error-results>
            </esql:execute-query>
        </esql:connection>
    </ROOT>

</xsp:page>


Should I better use own generators or beans? What are your experiences?

Robert



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSP/ESQL - separation of concerns?

Posted by Jörg Heinicke <Jo...@gmx.de>.
But it's obvious that you must map the data retrieved by the SQL-queries
into tags. Is it really useful to have an intermediate step like the mentioned
Torque? Aren't the tags only another data representation?

Joerg

> Hello,
> 
> in my current project I am using xsp and esql logicsheet for db
> retrivieval
> and tag generation only.
> Although I know that this is good for developing (no extra compilation) I
> am
> not very happy with it.
> 
> What I don't like is:
> -------------------
> - many SQL statement (complex tag structure) mixed cionfusingly with the
> actual document elements
> - the low readability of the code, also hard to debug...
> - no "cocoon-like" separtion of concerns (mix SQL-logic with tags)
> - the feeling that it is not the most performant way of doing this
> 
> What I would like better (but don't excately know how):
> -------------------------------------------------------
> - put all SQL that is needed for generating on specific page into another
> "thing" (beans?) that has no tags
> - make my xsp shorter, more readable
> - have the good balance of performance, easy debugging, extensibility and
> the typical "cocoon separation of concerns"
> 
> Here is a short but typical code snippet:
> ---------------------------------------
>     <ROOT>
>         <esql:connection>
>             <esql:pool>mysql_pool</esql:pool>
> 
>             <esql:execute-query>
>                 <esql:query>
>                 *COMPLEX QUERY, SOMETIMES 5 <esql:query> PER XSP *
>                 </esql:query>
> 
>                 <esql:results>
>                     <esql:row-results>
>                         <ARTICLE>
>                             <xsp:attribute name="ID"><esql:get-int
> column="5"/></xsp:attribute>
>                             <xsp:attribute name="MAIN"><esql:get-string
> column="7"/></xsp:attribute>
>                             <xsp:attribute name="SUB"><esql:get-string
> column="8"/></xsp:attribute>
>                             <xsp:attribute name="PDFPRINT"><esql:get-int
> column="9"/></xsp:attribute>
> 
>                             <!-- Attribute evtl. NULL bei Direktanzeige
> -->
>                             <xsp:logic>
>                                 if(!<esql:is-null column="3"/>) {
>                                     <HEADER><esql:get-string
> column="1"/></HEADER>
>                                 }
> 
>                             </xsp:logic>
> 
>                             <esql:get-xml column="2"/>
> 
>                             <DATE><esql:get-string column="11"/></DATE>
>                             <AUTHOR><esql:get-string
> column="12"/></AUTHOR>
>                         </ARTICLE>
>                     </esql:row-results>
>                 </esql:results>
>                 <esql:no-results></esql:no-results>
>                 <esql:error-results></esql:error-results>
>             </esql:execute-query>
>         </esql:connection>
>     </ROOT>
> 
> </xsp:page>
> 
> 
> Should I better use own generators or beans? What are your experiences?
> 
> Robert

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: XSP/ESQL - separation of concerns?

Posted by Ray Martin <ra...@aci-hq.com>.
Sir,

Have you looked at Torque, which is an Apache Software Foundation project.
Torque maps objects to relational databases.  Torque provides all the
set/gets to access table fields.

In Cocoon, you would write an action that would call the appropriate Torque
classes to perform the database access.

This keeps logic separated from the presentation - an absolute must.

Ray

> -----Original Message-----
> From: Robert Sösemann [mailto:robert.soesemann@gmx.de]
> Sent: Wednesday, December 18, 2002 6:22 AM
> To: cocoon-users@xml.apache.org
> Subject: XSP/ESQL - separation of concerns?
>
>
> Hello,
>
> in my current project I am using xsp and esql logicsheet for db
> retrivieval
> and tag generation only.
> Although I know that this is good for developing (no extra
> compilation) I am
> not very happy with it.
>
> What I don't like is:
> -------------------
> - many SQL statement (complex tag structure) mixed cionfusingly with the
> actual document elements
> - the low readability of the code, also hard to debug...
> - no "cocoon-like" separtion of concerns (mix SQL-logic with tags)
> - the feeling that it is not the most performant way of doing this
>
> What I would like better (but don't excately know how):
> -------------------------------------------------------
> - put all SQL that is needed for generating on specific page into another
> "thing" (beans?) that has no tags
> - make my xsp shorter, more readable
> - have the good balance of performance, easy debugging, extensibility and
> the typical "cocoon separation of concerns"
>
> Here is a short but typical code snippet:
> ---------------------------------------
>     <ROOT>
>         <esql:connection>
>             <esql:pool>mysql_pool</esql:pool>
>
>             <esql:execute-query>
>                 <esql:query>
>                 *COMPLEX QUERY, SOMETIMES 5 <esql:query> PER XSP *
>                 </esql:query>
>
>                 <esql:results>
>                     <esql:row-results>
>                         <ARTICLE>
>                             <xsp:attribute name="ID"><esql:get-int
> column="5"/></xsp:attribute>
>                             <xsp:attribute name="MAIN"><esql:get-string
> column="7"/></xsp:attribute>
>                             <xsp:attribute name="SUB"><esql:get-string
> column="8"/></xsp:attribute>
>                             <xsp:attribute name="PDFPRINT"><esql:get-int
> column="9"/></xsp:attribute>
>
>                             <!-- Attribute evtl. NULL bei
> Direktanzeige -->
>                             <xsp:logic>
>                                 if(!<esql:is-null column="3"/>) {
>                                     <HEADER><esql:get-string
> column="1"/></HEADER>
>                                 }
>
>                             </xsp:logic>
>
>                             <esql:get-xml column="2"/>
>
>                             <DATE><esql:get-string column="11"/></DATE>
>                             <AUTHOR><esql:get-string
> column="12"/></AUTHOR>
>                         </ARTICLE>
>                     </esql:row-results>
>                 </esql:results>
>                 <esql:no-results></esql:no-results>
>                 <esql:error-results></esql:error-results>
>             </esql:execute-query>
>         </esql:connection>
>     </ROOT>
>
> </xsp:page>
>
>
> Should I better use own generators or beans? What are your experiences?
>
> Robert
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: XSP/ESQL - separation of concerns?

Posted by Luca Morandini <lu...@tin.it>.
Jeremy,

no idea... I use Stored Procedures, hence, performance is not an issue for me :)

Try searching this mailing list, the subject was mentioned some time ago.

Best regards,

--------------------------------------------- 
               Luca Morandini 
               GIS Consultant 
              lmorandini@ieee.org 
http://utenti.tripod.it/lmorandini/index.html 
---------------------------------------------
 

> -----Original Message-----
> From: Jeremy Quinn [mailto:jeremy@media.demon.co.uk]
> Sent: Thursday, December 19, 2002 11:50 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: XSP/ESQL - separation of concerns?
> 
> 
> 
> On Wednesday, Dec 18, 2002, at 11:37 Europe/London, Luca Morandini 
> wrote:
> 
> > The caveats are:
> > - SQLTranformer in slower than ESQL
> >
> 
> Eeargh!
> 
> How much slower?!?
> 
> regards Jeremy
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSP/ESQL - separation of concerns?

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Wednesday, Dec 18, 2002, at 11:37 Europe/London, Luca Morandini 
wrote:

> The caveats are:
> - SQLTranformer in slower than ESQL
>

Eeargh!

How much slower?!?

regards Jeremy


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: XSP/ESQL - separation of concerns?

Posted by Luca Morandini <lu...@tin.it>.
Robert,

you could try using SQLTransformer to handle just your SQL queries and then apply a stylesheet to transform them, if need be, in
another XML dictionary before the final rendegin in HTML, WML, PDF, etc.

The advantages are:
- a streamlining of the source code
- the ability to easily replace XML produced by a query with a static XML file (and viceversa)

The caveats are:
- SQLTranformer in slower than ESQL
- use 2.0.4, since there is a nasty bug in 2.0.3 making hard, at times, the use of XSLT after an SQLTransformer step

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Robert Sösemann [mailto:robert.soesemann@gmx.de]
> Sent: Wednesday, December 18, 2002 12:22 PM
> To: cocoon-users@xml.apache.org
> Subject: XSP/ESQL - separation of concerns?
>
>
> Hello,
>
> in my current project I am using xsp and esql logicsheet for db retrivieval
> and tag generation only.
> Although I know that this is good for developing (no extra compilation) I am
> not very happy with it.
>
> What I don't like is:
> -------------------
> - many SQL statement (complex tag structure) mixed cionfusingly with the
> actual document elements
> - the low readability of the code, also hard to debug...
> - no "cocoon-like" separtion of concerns (mix SQL-logic with tags)
> - the feeling that it is not the most performant way of doing this
>
> What I would like better (but don't excately know how):
> -------------------------------------------------------
> - put all SQL that is needed for generating on specific page into another
> "thing" (beans?) that has no tags
> - make my xsp shorter, more readable
> - have the good balance of performance, easy debugging, extensibility and
> the typical "cocoon separation of concerns"
>
> Here is a short but typical code snippet:
> ---------------------------------------
>     <ROOT>
>         <esql:connection>
>             <esql:pool>mysql_pool</esql:pool>
>
>             <esql:execute-query>
>                 <esql:query>
>                 *COMPLEX QUERY, SOMETIMES 5 <esql:query> PER XSP *
>                 </esql:query>
>
>                 <esql:results>
>                     <esql:row-results>
>                         <ARTICLE>
>                             <xsp:attribute name="ID"><esql:get-int
> column="5"/></xsp:attribute>
>                             <xsp:attribute name="MAIN"><esql:get-string
> column="7"/></xsp:attribute>
>                             <xsp:attribute name="SUB"><esql:get-string
> column="8"/></xsp:attribute>
>                             <xsp:attribute name="PDFPRINT"><esql:get-int
> column="9"/></xsp:attribute>
>
>                             <!-- Attribute evtl. NULL bei Direktanzeige -->
>                             <xsp:logic>
>                                 if(!<esql:is-null column="3"/>) {
>                                     <HEADER><esql:get-string
> column="1"/></HEADER>
>                                 }
>
>                             </xsp:logic>
>
>                             <esql:get-xml column="2"/>
>
>                             <DATE><esql:get-string column="11"/></DATE>
>                             <AUTHOR><esql:get-string column="12"/></AUTHOR>
>                         </ARTICLE>
>                     </esql:row-results>
>                 </esql:results>
>                 <esql:no-results></esql:no-results>
>                 <esql:error-results></esql:error-results>
>             </esql:execute-query>
>         </esql:connection>
>     </ROOT>
>
> </xsp:page>
>
>
> Should I better use own generators or beans? What are your experiences?
>
> Robert
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>