You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2004/06/15 21:24:18 UTC

The Bean's The Thing! [was:Re: CForms and Database - 5 Degrees of Separation?]

Following on from Ugo's suggestions that XDoclet mapping is
the way to go in order to have all the data, for relating a
bean's information to its corresponding match in the database,
located in one place, it struck me that much of what appears 
in the various Cocoon files can also be considered as
"mapping" data, and therefor located in the bean.

In fact, after further reading, I see the form2_bind_bean.xml 
file makes the suggestion that:
 "It would be an interesting exercise to generate this file 
 from javadoc-tags in the bean using an xdoclet-like approach."
 
If this is possible for the binding, it should also be possible
to do it for the form definition itself.  I doubt it would be
useful for the form layout, as this is more visually oriented.

The main disadvantage of encoding all these types of data in 
the bean is the lack of validation that can readily be performed
when storing them in an XML file.  So the trade-off being made
is centralisation of maintenance - with 4 different resources
all being updated/regenerated from a single source - versus the
difficulty of easily validating those changes...

If this approach is potentially useful one, does anyone have any
ideas on how to actually implement it: would it require new
functionality to be added in to XDoclet, or would it require 
some Cocoon-based tool that would have to be created from 
scratch?  Either way, I assume that some code would have to be 
written...

Comments, suggestions?

Derek

>>> ugo@apache.org 2004/06/14 10:58:43 PM >>>
Il giorno 14/giu/04, alle 20:36, Derek Hohls ha scritto:

> Some good points.  Bear in mind, however that your
> revised 1,2,3 are probably only feasible if your DB amin
> and web developer are one and the same.  I am not sure
> my db admin would take kindly to me updating her data-
> bases with my tool!

In which case, have Hibernate generate the necessary DDL scripts for 
updating the schema and let your DBA review and apply them. You can do

that.

> As for using XDoclet; I 've seen references to this but,
> frankly, was hoping to avoid having to learn "yet another
> technology" to address what should be a simple problem.
> (Java, forms, Hibernate... the list goes on!)  -I will
> bear this in mind for future.

The point is: with XDoclet, you don't have to compile your mapping 
files by hand, so it's one less thing to learn (well, you have to learn

the syntax of the tags instead of the mapping DTD, but it's actually 
simpler) and the XDoclet-tags-to-mapping-files trick is taken care of 
with a simple Ant task. Having the accessor methods and mapping info in

the same place makes it easier to keep them in sync.

	Ugo

-- 
Ugo Cei - http://beblogging.com/ 


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


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


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


Re: The Bean's The Thing! [was:Re: CForms and Database - 5 Degrees of Separation?]

Posted by Ugo Cei <ug...@apache.org>.
Il giorno 15/giu/04, alle 21:24, Derek Hohls ha scritto:

> If this approach is potentially useful one, does anyone have any
> ideas on how to actually implement it: would it require new
> functionality to be added in to XDoclet, or would it require
> some Cocoon-based tool that would have to be created from
> scratch?  Either way, I assume that some code would have to be
> written...

If you opt to store the metadata in javadoc comments, I think XDoclet 
is the way to go. You'd have to write an XDoclet template for CForm 
definitions/bindings, not necessarily some Java code, but I'm not very 
familiar with XDoclet.

	Ugo

-- 
Ugo Cei - http://beblogging.com/


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