roma introduction and concepts

19
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] http://zion-city.blogspot.com http://twitter.com/lgarulli

Upload: luca-garulli

Post on 10-May-2015

1.983 views

Category:

Technology


0 download

DESCRIPTION

Fast introduction to the most innovative framework to build web applications

TRANSCRIPT

Page 1: Roma introduction and concepts

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

Page 2: Roma introduction and concepts

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

Page 3: Roma introduction and concepts

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”

Page 4: Roma introduction and concepts

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

Page 5: Roma introduction and concepts

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

Page 6: Roma introduction and concepts

6

AspectsAuthentication

•Flow•Enterprise

•Hook•I18n (internationalization)

•Logging•Monitoring•Persistence

•Registry•Reporting

•Scheduler•Security•Semantic

•Serialization•Service•Session

•Validation•View

•Workflow

Page 7: Roma introduction and concepts

7

POJO is the answer for all

•POJO••

•(Plain Old Java Object)

Page 8: Roma introduction and concepts

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?

Page 9: Roma introduction and concepts

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!

Page 10: Roma introduction and concepts

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?

Page 11: Roma introduction and concepts

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

Page 12: Roma introduction and concepts

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(){...}•}

Page 13: Roma introduction and concepts

13

Auto rendering: POJO → Form

Page 14: Roma introduction and concepts

14

Binding POJO ↔ Form

Page 15: Roma introduction and concepts

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(){• ...• }•}

Page 16: Roma introduction and concepts

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.

Page 17: Roma introduction and concepts

17

Extension by composition II

Page 18: Roma introduction and concepts

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!

Page 19: Roma introduction and concepts

19

Demo pleeeease!