roma introduction and concepts
DESCRIPTION
Fast introduction to the most innovative framework to build web applicationsTRANSCRIPT
JL-1
Roma <Meta>Framework
Introduction and main concepts
CTO at AssetData, Technical Manager at Romulus consortium, Author of
Roma Framework and OrientDB Open Source projects
Luca Garulli
[email protected]://zion-city.blogspot.com
http://twitter.com/lgarulli
2
Development Scenario I
Choose the right framework between hundreds
Learning curve often is steep and requires a lot of time to
learn before to understand if it's the right one for us
Each framework is proprietary, so migration is too much difficult, or sometimes impossible
3
Development Scenario IIWhat happens if you
discover that the tool or the framework you choose
doesn’t support some features we need or that
the best choice was another one?
Changing it’s too costly, sometime “impossible”
4
Do you need a <meta> framework?
Set of behavior interfaces instead of framework APIs directly.
The aim is to cover the 80-90% of the most common use cases. For the uncovered 10-
20% you can use the framework implementation directly
Migration to another supported framework without change the code
5
Domain centric view
Others
Persistence (repository)
ViewInternatio nalization
(I18N)
SessionAuthentication
Monitoring
Workflow
Aspects define the interfaces
(behaviour) of the meta-framework
Domain model and
business logic
Modules can implement
aspects of the meta-framework
CRUD
Login
User & Profile
Jetty
Echo2
Java Resource
Bundle
Custom, LDAP
JMX
Portlet
Janiculum
JPA
JDO
Tevere
Http
6
AspectsAuthentication
•Flow•Enterprise
•Hook•I18n (internationalization)
•Logging•Monitoring•Persistence
•Registry•Reporting
•Scheduler•Security•Semantic
•Serialization•Service•Session
•Validation•View
•Workflow
7
POJO is the answer for all
•POJO••
•(Plain Old Java Object)
8
Everything is a POJO•The application model is composed by
POJOs•
•The domain entities synchronized with the database are POJOs
The Business Logic is written in POJOs•
•The Web Services are POJOs•
•Guess the Web pages?
9
Enriched Meta Model I•Roma auto discovers all the model
of your•application and generate:
••Forms,
•Database tables•OR-mapping configuration,
•Web services,•and much more!
10
Enriched Meta Model II•But Java as language is not enough to
express a complete model. What means this?•
•private List<Contact> contacts;•
•Is it a relationship? 1-N or N-M? If yes it's embedded or not?
••How can I render it in my Web Page?
•A List, a Table or a Select field?
11
Enriched Meta Model III•We need a way to enrich the meta-model using
Java5+ Annotations or Xml Annotations•ContactInstance.java:••public class ContactInstance{• @ViewField(render = ViewConstants.RENDER_TABLE)• private List<Contact> contacts;•}
•ContactInstance.xml:••<?xml version="1.0"?>•<class>• <fields>• <field name="contacts">• <aspects>• <view render="table"/>• </aspects>• </field>• </fields>•</class>
Xml Annotations pro: Use of separate files so the Java sources remain clean
Java5+ Annotations pro:All in one file,faster to write
12
Auto rendering: POJO insteadof GUI components
•public class User {• private String name;• private String surname;• private City city;• private String web;•• @ViewField(render=”textarea”)• private String notes;• • public void ok(){...}• public void cancel(){...}• public void print(){...}•}
13
Auto rendering: POJO → Form
14
Binding POJO ↔ Form
15
Composite Forms•To build complex forms you need to composite
POJOs all together•ContactInstance.java:••public class ContactForm {• @ViewField(render = “objectembedded”, label=”Personal Information”)• private Contact me;•• @ViewField(render = “tab”)• private Contact[] colleagues = new Contact[]{ • new Contact(“Joy”,“Miner”),• new Contact(“Tim”, “King”) };•• @ViewField(style = “{width: 400px;}”)• private String description;•• public void sendEmail(){• ...• }•}
16
Extension by composition I
ComposedEntityInstance<Employee>
EmployeeFilter
Employee
EmployeeFilter
Classic Inheritance Extension by Composition
All Employee fields and actions are merged with Employee ones. You can override fields, actions and events just redefine it in the EmployeeFilter class. The object contained is in the field called “entity”.
Doesn't work very well with some frameworks such as JDO and Hibernate: you need to use the class declared in the ORMapping tool and not its extension.
17
Extension by composition II
18
Getting started!
Connect to http://www.romaframework.org
Download latest version
Download the Handbook
Start with the first tutorial
Ask to the forum or the online support
Enjoy!
19
Demo pleeeease!