RomaFramework Tutorial and Basics
32 pages
English

RomaFramework Tutorial and Basics

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
32 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

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 ...

Informations

Publié par
Nombre de lectures 49
Langue English

Extrait

www.RomaFramework.org
Let's think to
the applicationdomain, thenmodelit in simple Java Classes, write thebusiness logicand Romawill make all the rest
Luca Garulli CTO AssetData luca.garulli@assetdata.it
BPEL engine
Enhydra Shark
OS Workflow
Microsoft .NET 2.0
Yet another…
SWT
Apache Tapestry
2
Ruby On Rails
J2EE
Struts WebWorks
Apache Velocity
JSF
Spring MVC
RIFE
NextApp Echo2
Apache Cocoon
Swing
EJB3/JPA
JDO
iBatis
Hibernate
JDBC
Trails
Apache OJB
Castor
Plbor :metahw should I use?
Java tools & frameworks scenario
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
tcurea to mII:Ec hom2odJSuPle
JDO 2.0 JPOX 1.2ec(Its8n1ereisPweNy)itor repos
s
Java Resource Bundle
UseCrsu sMtoomdule,Authentication ScheduleryQonrtzua SenphympO MockDomain, Modeland Business Logic
Tevere
JMX
Monitoring
Session
Echo2
ReportingJasper Reports
??? Others
6
Roma: let's create a new web project
>roma create web tutorial-basic org.romaframework.tutorial.basic C:\work\dev\os\romaframework >roma add view-echo2 >roma add persistence-jpox >roma add web-jetty
tutorial-basic/ .settings database lib log script  src/  WebContent/ dynamic static WEB-INF/ classes/ lib/ applicationContext.xml  .classpath .project  build.xml  roma-project.xml
Generate empty project scaffolding
// Eclipse directory settings // HSQLDB embedded database for develop. // Compile-time libs // Log directory // Script directory // Sources directory // Dynamic contents // Static contents // Java compiled classes // Run-time libs // Main Spring IoC config file // Eclipse classpath file // Eclipse project file // Ant build file // Roma project information
7
Roma: look to the source directory
tutorial-basic/src/
commons-logging.properties jetty.xml jpox-log4j.properties log4j.xml
org/romaframework/tutorial/basic
domain i18n repository view domain screen [CRUD]
image style
// 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.
<beanid="RenderingResolver"singleton="true" class="org.romaframework.aspect.view.echo2...ConfigurableRenderingResolver">  <propertyname="configuration"> <map>           <entrykey="action"value="link"/>  <entrykey="object"value="object"/>
=  <entrykey"java.lang.String"value="text"/>  <entrykey="java.lang.Integer"value="text"/>  <entrykey="java.lang.Float"value="text"/>  <entrykey="java.lang.Double"value="text"/>  <entrykey="java.lang.Boolean"value="check"/>  <entrykey="java.util.Date"value="date"/>  <entrykey="java.util.Collection"value="list"/>  <entrykey="java.util.Set"value="list"/>  <entrykey="java.util.Map"value="table"/>  </map>  </property> </bean>
10
View: Render and Layout modes
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:
default, accordion, button, check, colset, date, datetime, html, image, imagebutton, label, link, list, menu, objectlink, objectembedded, password, popup, progress, radio, richtext, rowset, select, tab, table, tableedit, text, textarea, time, tree, upload
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:
default, accordion, block, form, screen, expand, menu, popup
Example using Java5 annotations:
public class Task{  @ViewField(render=”richtext”, layout=”form://bottom”)  private String description; }
11
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents