www.RomaFramework.orgLet's think to“the application domain,then model it in simple Java Classes,write the business logic andRoma will make all the rest”Luca GarulliCTO AssetDataluca.garulli@assetdata.itProblem: what should I use?MicrosoftRuby On Rails.NET 2.0 J2EENextApp EnhydraJSF Trails JDBC CastorEcho2 SharkStruts Spring Apache Apache OSJDOWebWorks MVC Tapestry OJB WorkflowApache Apache BPELSWT Hibernate EJB3/JPACocoon Velocity engineYetSwing RIFE iBatisanother…2Java tools & frameworks scenario• It’s not easy to choose the right framework, since there are a lot of them• Each framework is proprietary, so migration is too much difficult, or impossible• Often the learning curve to know a new framework it’s quite steep and require a lot of time to learn it before to understand if it's the right one for youIt may happens to notice that during the development the •framework chosen doesn’t supposrot me features we need or that the best choice wans other one…Changing it’s too costly3Maybe you need a Framework• Using a meta framework means to use a set of behaviour interfaces instead of framework APIs directly.• The aim is to cover the 80-90% of most common functionalities (the most used). The other 10-20% uncovered can be used using the framework implementation directly. Just remember this will be not portable at zero cost• All application code can migrate to another supported framework without change the code• All ...
It’s not easy tochoosethe right framework, since there are a lot of them Each framework isproprietary, somigrationis too much difficult, or impossible Often thelearning curveto know a new framework it’s quite steep and require a lot of time to learn it before to understand if it's the right one for you It may happens to notice that during the development the framework chosen doesn’t supportsome featureswe need or that the best choice wasanother one…Changing it’s too costly
3
Maybe you need a Meta> Framework <
• •
• • •
Using a meta framework means to usea set of behaviour interfacesinstead of framework APIs directly. The aim is to cover the80-90% of most common functionalities(the most used). The other 10-20% uncovered can be used using the framework implementation directly. Just remember this will be not portable at zero cost All application code can migrate to another supported frameworkwithout change the code All application model, domain and business logic are POJOs The meta framework knows: –Domain, the business model and logic –Aspects (or Concerns), as behavior interfaces –Modules, Plug-ins, often as Aspect implementation
4
Architecture atom I: behaviour aspects
Persistence (repository)
I18N (Internationalization)
Authentication
Workflow
View
Domain, Modeland Business Logic
Monitoring
Scheduler
Reporting
Scheduler
Session
Aspectsdescribe a behaviourand they are implemented as Java interfaces
5
Archtie
Roma architecture is totally modular. Modulescan implement Behavior Aspects
tcureatomII:Echom2odJSuPle
JDO 2.0 JPOX 1.2ec(Its8n1ereisPweNy)itor repos
s
Java Resource Bundle
UseCrsusMtoomdule,Authentication ScheduleryQonrtzuaSenphympO MockDomain, Modeland Business Logic
// Apache Commons logging cfg (use Log4J) // Jetty Web Server cfg // JPOX's log cfg // Log4J logging configuration
// Where to place all domain entities // I18N aspect: language mapping // DDD Repository pattern // View Aspect // Where to place all presentation related domain classes // Where to place screen cfgs // Any CRUD is generated as package here containing all CRUD classes for the entity // All images used by Echo2 // Echo2 stylesheets (as XML files)
CustomApplicationConfiguration.java // Handle user session
8
Roma: start to write you Domain
public classEmployee{ private Stringname; private Stringsurname; private Datebirth;
// GETTER + SETTERS }
Write themodel behavior+ business logic
@Persistence(mode=”tx”) public voidsave(){
ObjectContext.getInstance() .getContexComponent(PersistenceAspect.class) .updateObject( this ); }
Start to write domain classes under the package:
org/romaframework/tutorial/basic/domain
Roma will be able to discover them
Run!
9
View: Mapping type = render
Inside youWebContenEW/tNI-BFdirectory you can find thelmx.2oext-Cont-echviewappitnoilacfile containing the behavior of rendering. TheRenderingResolvercomponent contains the mapping between types andrendering mode.
Rendering modeis the way a field or an action is rendered. By default the View Aspect delegates to theRenderingResolvercomponent to resolve it. You can override the default behavior by assigning the rendering you want by using theannotation(Java/Xml). The supported rendering types are:
Layout modeis the way a component will be placed in to the form. By default every single field is placed inside itsown areaif defined (just create one and assign the same name of the field), otherwise will go in the “fields” area. Every single action will follow the same behavior but if not found the own area, Roma will place it in the“actions” area. You can override this by using annotation and specifying a type between these: