Em Wed, 19 Nov 2008 17:37:48 -0300, Chris Lewis <[EMAIL PROTECTED]> escreveu:

Hi Thiago,

Hi, Chris!

Out of architectural curiosity, what do you use a UserController for in
your example?

I'm a strong supporter of n-tier architectures, so the view layer (in this case, Tapestry) does no business rules nor does data storage operations, just deals with the user actions*. Therefore, I have an UserController (an interface) and UserControllerImpl, the class that implements any business rules or processes (except persistence) related to my User entity.

To see one example of this, all the interfaces and classes cited in this message are part of Ars Machina Project's Generic Authentication package (http://www.arsmachina.com.br/project/genericauthentication). You can browse its source here: http://ars-machina.svn.sourceforge.net/viewvc/ars-machina/generic-authentication/trunk.

For the persistence layer, I have DAOs and the Generic DAO and Generic DAO-Hibernate packages (http://www.arsmachina.com.br/project/genericdao).

UserController is a Controller (Generic Controller package, http://www.arsmachina.com.br/project/genericcontroller), subinterface. One of its methods is List<T> findAll(int firstResult, int maxResults, SortCriterion... sortConstraints). If you thought of GridDataSource, you're right. :)

Tapestry CRUD (http://www.arsmachina.com.br/project/tapestrycrud), another Ars Machina Project package, defines a BaseListPage<T, K> abstract class (T = entity class, K = entity class primary key field type). BaseListPage finds out what entity its is listing, then gets its associated Controller instance. It is used to generating an object listing using the Grid component. This is why I would like to provide a default Controller instance if none is given: I wouldn't need to create a trivial Controller implementation for that. ;)

Have I satisfied your curiosity? :) If not, I can try to explain it in a better way. ;)

* That's why I don't use Tapestry-Hibernate: in my humble opinion, it puts transaction control (a processing thing, it should be in the business rules layer) in the wrong layer (view).

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to