[Yanel-dev] Resources and Usecases

Josias Thöny josias.thoeny at wyona.com
Thu Mar 15 15:26:39 CET 2007


Hi all,

Here's an attempt to define resources and usecases. It's quite similar 
to how it is in Lenya.
This is just meant as food for thought. Some people may come up with 
completely different ideas, and I'm interested to hear them.


Resource:
========
A resource is responsible to create/render/deliver the content for a 
certain url of the website.


Usecase:
=======
A usecase takes actions and/or delivers the content for any url with a 
request-parameter yanel.usecase=myusecase

In particular, a usecase may represent an action which may take some 
user interaction according to a certain "workflow" like e.g. :
(It would not be limited to this schema though)

show screen
   |
   +--> click ok  --> check conditions
   |                     |
   |                     +-> if ok: execute  --> handle errors
   |                     |
   |                     +-> if nok: go back to 'show screen'
   |
   +--> click cancel --> cancel

The usecase framework takes care of the following tasks which are common 
to most executable usecases:
- parameter passing (how to pass form parameters to the java code
   and vice-versa)
- error handling (check preconditions, handle parameter validation
   errors and other kind of errors)
- view processing (creating a view using a template and applying
   standard xslt or i18n transformer)
   (jelly support would be nice, it's similar to jx)
- control flow (handle pre-defined actions like submit/cancel)
- allow automated execution of a usecase (e.g. by a scheduler)


Moreover, I would like to achieve the following with a usecase framework:
- creation of new usecases is easy (e.g. no need to create individual
   ant build files for each usecase)
- a usecase only contains the code which is really necessary
   (e.g. a java handler class, a view template, and a configuration)
- no code duplication between usecases
- common look & feel for form-based usecases
- no need to register usecases for each realm individually.

josias



More information about the Yanel-development mailing list