cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <>
Subject Using a generic sitemap + flow (was: Makes flow script the sitemap ugly?)
Date Tue, 11 Nov 2003 22:11:28 GMT

I read the lastest comments about flow and I want to share with the rest
of you my own experiences.

We are developing database oriented webapp. We are using, well I will
repeat it again :-), Flow+Woody+OJB, JXGenerator and Druid.

And I think Flow help us in the SoC. I will try to explain it:

1-Main sitemap: Just declare all the components that the application need.
Here we have all the <map:components> + some pipelines that manage:

a) transition to business objects (subsitemaps)
b) All the common resources: images (*.gif, *.png), *.css, *.js (client).
c) Handle errors.

In the main sitemap you will not find any flow script at all.

2-"Business Object": They contains all the forms needed to manage the
particular object inside the webapp. Each Businnes Objects have the same
structure. Also they have the same sitemap. That way we don't need to
create a new sitemap every time we start one Business Object. You can also
have other forms (for example "list" not showed in the below sample). Here
is the structure of each business object:

+--- forms
|   +--- create
|   |   +--- bind.xml
|   |   +--- definition.xml
|   |   +--- flow.js
|   |   +--- template.xml
|   +--- search
|   +--- remove
|   +--- update

Every business object has his own BOH (Business Object Handler) written in
Java. The BOH is used inside the flow. The BOH contains all the functions
needed to manipulate beans used in the forms of the Business Object. The
BOH must contains the CRUD operations related to the object.

All BOHs are almost similars thanks to OJB-JDO.

The underlying part of the O/R mapping is done using Druid (hey?! here is
again Druid!).

Here is some flow script:

function createform(form) {

    var factory = cocoon.getComponent(Packages.o.a.c....JdoPMF.ROLE);
    var bean = new Packages.test.forms.area.Bean();
    var handler = new Packages.test.forms.area.Handler();;
    handler.insert(bean, factory);
    success("Areas", "Area procesada con éxito",
"¿Desea procesar una nueva área?","create");


function searchform(form) {
       {"criteria" : form.getWidget("criteria").getValue()});

function listform(form) {
    var factory = cocoon.getComponent(Packages.o.a.c.....JdoPMF.ROLE);
    var bean = new Packages.test.forms.area.List();
    var handler = new Packages.test.forms.Handler();
    var criteria = new String (cocoon.request.criteria);

    handler.getList(bean, criteria, factory);

    var nuevoBean = new Packages.test.forms.area.List();;
    handler.setList(bean, criteria, factory);
    success("Administración de Areas", "Actualización de Áreas",
       "Todos los cambios se procesaron existosamente. ¿Desea volver a
procesar la lista de áreas?", "search");

The sitemap looks:

<map:flow language="javascript">
  <map:script src="forms/create/flow.js"/>
  <map:script src="forms/search/flow.js"/>
  <map:script src="forms/list/flow.js"/>

  <!-- Woody forms display -->
  <map:pipeline internal-only="true">
    <map:match pattern="*-form-display">
      <map:generate src="forms/{1}/template.xml"/>
      <map:transform type="woody"/>
      <map:transform type="i18n"/>
      <map:transform src="context://stylesheets/agssa.xslt"/>
      <map:transform src="context://resources/woody/woody-styling.xsl"/>
      <map:transform type="encodeURL"/>
    <!-- jx forms -->
    <map:match pattern="ver-form">
      <map:generate type="jx" src="forms/ver.xml"/>

  <!-- Manejo de las continuaciones -->
    <map:match pattern="*.continue">
      <map:call continuation="{1}"/>

   <!-- Crea el flow -->
   <map:match pattern="*">
     <map:call function="woody">
       <map:parameter name="function" value="{1}form"/>
       <map:parameter name="form-definition"
       <map:parameter name="bindingURI" value="forms/{1}/bind.xml"/>
       <map:parameter name="attribute-name" value="{1}form"/>

We are still developing this idea. The "Business Objects" modules and the
best generic structure for them in any webapp.

If we found it, then we will try to develop a tool for building database
oriented webapp using Cocoon. We tought the start must be the form
definition. Based on the form definition the tool will generate the
database script, the woody forms, the java classes, the O/R mapping etc.
It would be very nice, is it? Here again, I see druid as an important part
of the overall tool helping us in the database arena.

We are now developing 2 webapp at the same time and we are trying to
follow some technics that will help us in the automatization of the code.
Under this approach we don't see to the sitemap as the most dynamic part
of the application. Or maybe?

As I told you I am lazy enough to write the same code over and over just
changing some names. :-D

Comments are welcome.

Best Regards,

Antonio Gallardo.

View raw message