You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Paloma Gomez <pa...@gmail.com> on 2006/04/24 11:20:21 UTC

Database-related usecase and Usecase framework

Hi all,

I want to create custom usecases to manipulate a database.
I've found a Cocoon sample which I'd like to adapt for this purpose:

http://cocoon.zones.apache.org/demos/21branch/samples/blocks/forms/sql

This sample uses two *.js files to manipulate the database and I am trying
to work out a way to make them fit with the Lenya 1.4 usecase framework.
After reading the documentation on the lenya 1.4 usecase framework and
studying how the lenya cforms module and this Cocoon sample work,
I'm not sure if it is feasible approach.

There would be three different usecases: list, edit and delete. The first
usecase I'm trying to implement is List.

My problem is that I need to pass the data retrieved from the database
to a jx template, and looking at the file usecases.js I think there is no way
to do this- I might be wrong, though. As I've read in the documentation that
some special complex usecases might require a custom flowscript, I'd like
to confirm that this one falls into this category.

I would also like to know how to implement usecases outside the
usecase framework. I've seen in  $LENYA/webapp/lenya/usecase.xmap that
there
is a distinction between registered and unregistered usecases. Is
there some documentation on this?


Thanks,

Paloma

--
Paloma Gomez

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Database-related usecase and Usecase framework

Posted by Doug Chestnut <dh...@virginia.edu>.

Paloma Gomez wrote:
> Hi all,
> 
> I want to create custom usecases to manipulate a database.
> I've found a Cocoon sample which I'd like to adapt for this purpose:
> 
> http://cocoon.zones.apache.org/demos/21branch/samples/blocks/forms/sql
> 
> This sample uses two *.js files to manipulate the database and I am trying
> to work out a way to make them fit with the Lenya 1.4 usecase framework.
> After reading the documentation on the lenya 1.4 usecase framework and
> studying how the lenya cforms module and this Cocoon sample work,
> I'm not sure if it is feasible approach.
> 
> There would be three different usecases: list, edit and delete. The first
> usecase I'm trying to implement is List.
> 
> My problem is that I need to pass the data retrieved from the database
> to a jx template, and looking at the file usecases.js I think there is no way
> to do this- I might be wrong, though. As I've read in the documentation that
> some special complex usecases might require a custom flowscript, I'd like
> to confirm that this one falls into this category.
> 
> I would also like to know how to implement usecases outside the
> usecase framework. I've seen in  $LENYA/webapp/lenya/usecase.xmap that
> there
> is a distinction between registered and unregistered usecases. Is
> there some documentation on this?

No documentation that I could find (didn't look in the wiki though). 
Have a look lower in usecase.xmap and see:

       <!-- {publication-id}/{area}/{uri}-->
       <map:match pattern="*/*/**">

         <!-- mount publication-specific usecase sitemap -->
         <map:match type="usecase" pattern="*">
           <map:act src="fallback://usecase-{1}.xmap" 
type="resource-exists">
             <map:mount check-reload="true" reload-method="synchron" 
src="{fallback://usecase-{../1}.xmap}" uri-prefix="{../../1}"/>
           </map:act>
         </map:match>

         <!-- Mount separate usecase sitemap if it exists. -->
         <map:match type="usecase" pattern="*">
           <map:act src="usecases/{1}/usecase-{1}.xmap" 
type="resource-exists">
             <map:mount check-reload="true" reload-method="synchron" 
src="usecases/{../1}/usecase-{../1}.xmap" uri-prefix=""/>
           </map:act>
         </map:match>

iirc a request param/value of lenya.usecase=myusecase will first try to 
mount your usecase-myusecase.xmap file, it that doesn't exist, then it 
tries to mount usecases/myusecase/usecase-myusecase.xmap sitemap.

hth,
--Doug
> 
> 
> Thanks,
> 
> Paloma
> 
> --
> Paloma Gomez
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Database-related usecase and Usecase framework

Posted by Paloma Gomez <pa...@gmail.com>.
Thanks, this makes things clearer.

--Paloma

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Database-related usecase and Usecase framework

Posted by Andreas Hartmann <an...@apache.org>.
Paloma Gomez wrote:
> Hi all,
> 
> I want to create custom usecases to manipulate a database.
> I've found a Cocoon sample which I'd like to adapt for this purpose:
> 
> http://cocoon.zones.apache.org/demos/21branch/samples/blocks/forms/sql

I don't know how to use DB binding with the CForm support of the
usecase framework, but what you could do is access a OR-mapping
layer (JDO / hibernate) from the usecase handler class. IMO this
would be the cleanest solution at the moment, if you want to use
the usecase framework.


> This sample uses two *.js files to manipulate the database and I am trying
> to work out a way to make them fit with the Lenya 1.4 usecase framework.
> After reading the documentation on the lenya 1.4 usecase framework and
> studying how the lenya cforms module and this Cocoon sample work,
> I'm not sure if it is feasible approach.

The usecase framework is rather designed to manipulate Lenya documents,
not for custom DB access. This might change in the future, but at the
moment it might be easier to use CForms directly.


> There would be three different usecases: list, edit and delete. The first
> usecase I'm trying to implement is List.
> 
> My problem is that I need to pass the data retrieved from the database
> to a jx template, and looking at the file usecases.js I think there is no way
> to do this- I might be wrong, though. As I've read in the documentation that
> some special complex usecases might require a custom flowscript, I'd like
> to confirm that this one falls into this category.

I'm not sure - that depends on the flexibility of the CForms support of
the usecase framework. Maybe Thorsten knows more.

> I would also like to know how to implement usecases outside the
> usecase framework. I've seen in  $LENYA/webapp/lenya/usecase.xmap that
> there
> is a distinction between registered and unregistered usecases. Is
> there some documentation on this?

Registering a usecase just means to add an entry to cocoon.xconf
(preferrably using an xpatch file), denoting that a usecase should
be handled by the usecase framework. If you don't register a usecase,
you can add specific pipelines in your publication's sitemap
(just match the lenya.usecase request parameter).

HTH,
-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org