cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ġURDINA Michal <Michal.Durd...@assetsoft.sk>
Subject Design of unmarshaling sitemap component
Date Thu, 29 Jul 2004 07:20:23 GMT
Hi,
I would like to discuss the design problem of the sitemap component. My plan is to develop
special let's call it transformer for transforming sources for pages written or generated
by analysts (model) to dynamic pages generating required results (implementation). The form
of model is custom XML according to given XMLSchema and the implementation pages should be
in form of jxtemplates (or xsp).

The transformation should go like this:

pipeline:
            additional data
                   |
modelXML -> populated modelXML -> computed model -> jxtemplate source

The intent of the pipeline is to generate executable source from model that will generate
required dynamic page. The trick is that the computed modelXML is not trivial and should be
implemented as Java OM. What I need to involve is conversion from XML to Java Object, make
the computation in Java and go back with the results to XML in form of jxtemplate source.

I have two alternatives of implementation. Both are involving castor for converting XML to
Java object.

A.) make the XML2Java conversion in transformer
pipeline:

file(modelXML) -> cinclude(aditionaldata) -> castortransformer(modelClass, template)
->

-> jxtemplatetransformer -> jxtemplate (or xsp) source
           |
      modelInstance

This starts with reading modelXML from file, including additional data (i.e. in form of another
xml document). Populated XML is then the source for Castor unmarshaling, the intermediate
result is the instance of modelClass placed on request attribute. The transformer then emits
the template given in second parameter. The modelInstance is used in template and jxtemplatetransformer
is used to generate required page source (jxtemplate again or xsp).

B.) make the XML2Java conversion in action:

pipeline1:
action(cocoon:/pipeline2, modelClass) {
	jxtemplategenerator(template) -> jxtemplate (or xsp) source 
                 |
           modelInstance
}

pipeline2:
file(modelXML) -> cinclude(aditionaldata) -> XML

This is simmilar to A.) but with the exception that this does not break the SAX stream in
castortransformer and XML2Java conversion is done between two pipelines. On the other hand
there is useless serialization and deserialization between both pipelines.

There is question about which approach is better from the design point of view.

Additional questions include:
- in case of A.) is it better to have modelXML on the start of the pipeline and template as
the parameter or to have template at the start of the pipeline and modelXML as the parameter?

- are there any other viable and simple alternatives?

Thank you for your comments.
Michal

Mime
View raw message