SlideShare a Scribd company logo
1 of 32
Let's think to the application  domain , then  model  it in simple Java Classes, write the  business logic  and Roma  will make all the rest “ ” www.RomaFramework.org Luca Garulli Roma Meta Framework Project Leader CTO AssetData [email_address]
Problem: what should I use? J2EE Microsoft .NET 2.0 Ruby On Rails Struts WebWorks Spring MVC Apache Cocoon Apache Velocity Apache Tapestry RIFE Trails JSF NextApp Echo2 Swing Yet another… SWT JDO JDBC Hibernate iBatis Castor OS Workflow Enhydra Shark BPEL engine Apache OJB EJB3/JPA
[object Object],[object Object],[object Object],[object Object],Java tools & frameworks scenario
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Maybe you need a <Meta> Framework
Architecture atom I: behaviour aspects Domain, Model  and Business Logic Persistence (repository)‏ Session Monitoring Workflow Authentication I18N (Internationalization)‏ View Reporting Aspects  describe a  behaviour  and they are implemented as  Java interfaces Scheduler Scheduler
Architecture atom II: modules Domain, Model  and Business Logic Persistence (repository)‏ Session Monitoring Workflow Authentication I18N View ??? Others Java Resource Bundle Echo2 JMX Tevere JSP JDO 2.0 JPOX 1.2 Roma architecture is totally modular.  Modules  can implement  Behavior Aspects Users Module, Custom Mock Echo2 Scheduler Open Symphony Quartz Reporting Jasper Reports
Roma: let's create a new web project >roma create web tutorial-basic org.romaframework.tutorial.basic C:orkevsomaframework >roma add view-echo2 >roma add persistence-jpox >roma add web-jetty tutorial-basic/ .settings // Eclipse directory settings database // HSQLDB embedded database for develop. lib // Compile-time libs log // Log directory script // Script directory src/ // Sources directory WebContent/ dynamic // Dynamic contents static // Static contents WEB-INF/ classes/ // Java compiled classes lib/ // Run-time libs applicationContext.xml // Main Spring IoC config file .classpath // Eclipse classpath file .project // Eclipse project file build.xml // Ant build file roma-project.xml // Roma project information Generate empty project scaffolding
Roma: look to the source directory tutorial-basic/src/ commons-logging.properties // Apache Commons logging cfg (use Log4J)‏ jetty.xml // Jetty Web Server cfg jpox-log4j.properties // JPOX's log cfg log4j.xml // Log4J logging configuration org/romaframework/tutorial/basic domain // Where to place all domain entities i18n // I18N aspect: language mapping repository // DDD Repository pattern view // View Aspect domain // Where to place all presentation   related domain classes  screen // Where to place screen cfgs [CRUD] // Any CRUD is generated as package    here containing all CRUD classes   for the entity image // All images used by Echo2 style // Echo2 stylesheets (as XML files)‏ CustomApplicationConfiguration.java // Handle user session
Roma: start to write you Domain @Persistence(mode=”tx”)‏ public void  save (){ ObjectContext.getInstance()‏ .getContexComponent(PersistenceAspect.class)‏ .updateObject( this ); } public class  Employee  { private String  name ; private String  surname ; private Date  birth ; // GETTER + SETTERS } Write the  model behavior  +  business logic Run! Start to write domain classes under the package: org/romaframework/tutorial/basic/domain Roma will be able to discover them
View: Mapping type = render < bean  id = &quot; RenderingResolver &quot;  singleton = &quot;true&quot; class = &quot;org.romaframework.aspect.view.echo2...ConfigurableRenderingResolver&quot; > < property  name = &quot;configuration&quot; > < map > < entry  key = &quot;action&quot;  value = &quot;link&quot;  /> < entry  key = &quot;object&quot;  value = &quot;object&quot;  /> < entry  key = &quot;java.lang.String&quot;  value = &quot; text &quot;  /> < entry  key = &quot;java.lang.Integer&quot;  value = &quot; text &quot;  /> < entry  key = &quot;java.lang.Float&quot;  value = &quot; text &quot;  /> < entry  key = &quot;java.lang.Double&quot;  value = &quot; text &quot;  /> < entry  key = &quot;java.lang.Boolean&quot;  value = &quot; check &quot;  /> < entry  key = &quot;java.util.Date&quot;  value = &quot; date &quot;  /> < entry  key = &quot;java.util.Collection&quot;  value = &quot; list &quot;  /> < entry  key = &quot;java.util.Set&quot;  value = &quot; list &quot;  /> < entry  key = &quot;java.util.Map&quot;  value = &quot; table &quot;  /> </ map > </ property > </ bean > Inside you  WebContent/WEB-INF  directory you can find the  applicationContext-view-echo2.xml  file containing the behavior of rendering. The  RenderingResolver  component contains the mapping between types and  rendering mode .
View: Render and Layout modes Rendering mode  is the way a field or an action is rendered. By default the View Aspect delegates to the  RenderingResolver  component to resolve it. You can override the default behavior by assigning the rendering you want by using the  annotation  (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 mode  is the way a component will be placed in to the form. By default every single field is placed inside its  own area  if 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; }
View: Draw your form using areas I To have a form layout really portable across technologies and frameworks we can't use HTML to define the layout neither the Swing or the SWT way. We need a new generic way to tell to Roma the aspect our form should be have. Areas  aim to divide your form in multiple parts. Each one must describe the way it place the component: the “ area rendering mode ”. By default is the  placeholder , namely an area type that replace itself with the component rendered (and only one). You can use all the modes between the supported ones: placeholder , cell, column, grid, row, popup, tab Areas only describe the layout form. To handle the presentation aspect much deeper you need to work with the View Aspect implementation in the behind. If you're using  Echo2  module you had to work with the Xml stylesheet files contained under the package  <your-app-package>.view.style . Roma team choosen to not generalize features like component width, heights, colors, etc. since they are so many and so much technology-related that it's much simpler to work directly with the View Aspect implementation way it offers. Note: Remember that your application will be portable across technologies and frameworks. It can run as  Web Application  or as  Swing Desktop  application. But GUI details will be lost and need to be translated in the technology you want to use!
View: Draw your form using areas II ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
< area  name = &quot;main&quot;  type = &quot;column&quot; > < area  name = &quot;fields&quot;  type = &quot;grid&quot;  size = &quot;4&quot;  /> < area  name = &quot;note&quot;  /> < area  name = &quot;actions&quot;  type = &quot;row&quot;  /> View: automatic rendering III Ok Cancel Print default  area uses a GRID to place the POJO fields. You can choice how much columns to use. Order is given by Annotation or XML Annotation actions  is the default area for actions. It's defined as a  row You can specify  custom areas  where to place fields and actions. There is no limit to the number of areas you can create Name City Zion's citizen Notes Web Surname Luca Garulli Luca zioncity </ area >
@ViewClass(orderFields=&quot;name surname city web&quot;, orderActions=&quot;ok cancel print&quot;)‏ public class Customer{ private String name; private String surname; private String city; private String web; private String notes; public void ok(){} public void cancel(){} public void print(){} } View: POJO mapping I Roma controller binds the POJO directly to the form generated. The  relationship is 1-1 : if you change the content of a field in the browser, it will be updated in you Java object and viceversa. When you push any button, the action associated will be executed. Fast to write, easy to debug, simple to handle!
public class Employee{ private String  name; private Company  company; private List<Contact> contacts; } public class Company{ private String  name; } public class Contact{ private ContactType  type; private String  type; } public class ContactType{ private String name; } View: POJO mapping II Roma render all complex types as link to another form containing the complex instance associated to the field. You can also display the joined object as embedded instead of link. Collections  are rendered as List by default, but you can render its as select, radio buttons, table, rowset, colset, etc. Download, import and run the project  Tutorial Basic  from your Eclipse (romaframeworkrunkevutorialsutorial-basic)‏
ContactInstance.java: public class ContactInstance{ @ViewField(render = ViewConstants.RENDER_SELECT, selectionField = &quot;entity.type&quot;)‏ private List<ContactType> types; } ContactInstance.xml: <?xml version=&quot;1.0&quot;?> <class> <fields> <field name=&quot;types&quot;> <aspects> <view render=&quot;select&quot; selectionField=”entity.type”/> </aspects> </field> </fields> </class> Detail your Domain meta-model You can use  Java5+ annotations  or  Xml Annotations  to detail your meta-data model. Remember that on conflict Xml Annotations win. Java Annotations pro: All in one file, faster to write Xml Annotations pro: Use of separate files so the Java sources remain clean
Change the meta-model at run-time ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Behavior aspect orchestration Persistence (repository)‏ I18N (Internationalization)‏ View DB Login Authentication Session Login Flow login()‏ display Start user session display
MVC Controller Roma controller acts between Forms and POJOs. Every time the user change some field values Roma binds changes to the POJO. This usually happens before an actions is called. You can avoid to make automatic binding by setting the “ bind ” annotation to false (use Java/Xml annotation): @ViewAction( bind =AnnotationConstants.FALSE)‏ public void reload(){ ... } If you change some field values of your POJO you had to tell it to Roma in order to refresh the updated values on the form when the Controller receives the control again. Use this: public void reload(){ name = “”; ObjectContext.getInstance(). fieldChanged (this, ”name”); }
Validation using annotations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Validation: write your own When you need more power and control to validate your POJO you can use the  custom validation . Just implement the CustomValidation interface. Example: public class EmployeeInstance implements CustomValidation{ @ViewField(required=AnnotationConstants.TRUE, min=3, max=32)‏ private String name; public void  validate (){ if( description.contains(“sex”) )‏ throw new ValidationException(this, “sex”, “Banned word”); } @ViewAction(validation=AnnotationConstants.TRUE)‏ public void save(){ ... } } Before to call the  save()  method Roma controller will execute the validation for name field and then the custom  validate()  method. If anything is ok the  save()  method will be invoked, otherwise a ValidationException will be thrown.
MVC Controller: 100% POJO based Controller Invoking “ OK ” Action POJO Binds changes form fields to the POJO Calls  ok () method against the POJO @FlowAction(next=HomePage.class)‏ public void  ok (){ sendMessageToRemoteService(); } @ViewField( required =true,  min =2)‏ private String name; public void  validate (){ if( name == null ||  name.trim().length() == 0){ throw new ValidationException( this, “name”, “ Please insert the name!”); } } Validates POJO's rules +  validate () method if any HomePage.java Follows the  flow  declared using Java5 Annotation
Accessing to Aspects and Components Roma allows to access to each registered component and aspect by  ObjectContext  singleton class. Get by class type. Convention wants  each aspect's implementation is registered in the IoC system with the name of the interface : ObjectContext.getInstance(). getComponent (ViewAspect.class).show(employee)‏ Get the component by the registered name: ObjectContext.getInstance(). getComponent (“MyComponent”)‏ Get the component in context. Useful for PersistenceAspect to work with the same transaction. ObjectContext.getInstance(). getContextComponent (PersistenceAspect.class).updateObject(employee)‏
Extension by Composition pattern I ComposedEntityInstance <Employee> EmployeeFilter Employee EmployeeFilter Classic Inheritance Extension by Composition ,[object Object],[object Object],[object Object],[object Object]
Extension by Composition pattern II ComposedEntityInstance <Employee> EmployeeFilter ,[object Object],[object Object],Employee EmployeeRepository DB Employee Employee updating retrieving
Dirty approach: dirty you hands when required EmployeeRepository EmployeeRepository JDO Roma wants cover the  most common use cases . It's utopian to imagine covering all user requirements since they are so many and frameworks can be so much differents between their. So if you need to access directly to the tool and framework in the behind you had to know that you can do it. Just remember that piece of code will be not portable across implementation when, and if, you'll decide to migrate to another one. Aseptic class. It doesn't contain any references to tool and framework used. = 100% portable :-)‏ Extension of theportable class. It's a  best practice  to name it with the technology it depends as suffix. So you'll had to search all JDO classes when you need to migrate to another one Persistence Aspect. = Not portable :-(
CRUD generation following DDD CRUDMain EmployeeMain ComposedEntityInstance <Employee> CRUDInstance CRUDSelect EmployeeInstance EmployeeListable EmployeeFilter Repository EmployeeRepository Delegates all database access * 1 1 1
Vertical domain libraries Accounting system Bank Telecommunication Assurance Human Resources Accounting system Billing system ? DDD + POJO + MetaFramework allow to create  vertical domain Libraries  as a set of class packages. These Libraries are aseptics from technologies so you can publish them to be reused, improved and extended again
Available modules now - reporting-jr - users - monitoring-mx4j - view-echo2 - designer - project-web - web-jetty - workflow-pojo - etl-xpath - project-simple - portal-solo - project-webready - workflow-tevere-gui - persistence-jpox - scheduler-quartz - admin - workflow-tevere-engine - monitoring-jmx - messaging Community is developing: - persistence-jpa - view-html-css - view-swing - wiki
Conclusions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],www.romaframework.org

More Related Content

What's hot

Sprouting into the world of Elm
Sprouting into the world of ElmSprouting into the world of Elm
Sprouting into the world of ElmMike Onslow
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsBG Java EE Course
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programmingKuntal Bhowmick
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
JSF 2 and beyond: Keeping progress coming
JSF 2 and beyond: Keeping progress comingJSF 2 and beyond: Keeping progress coming
JSF 2 and beyond: Keeping progress comingAndy Schwartz
 
Java applet basics
Java applet basicsJava applet basics
Java applet basicsSunil Pandey
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedBG Java EE Course
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat ToolKanika2885
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and DeploymentBG Java EE Course
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programmingKuntal Bhowmick
 

What's hot (20)

Sprouting into the world of Elm
Sprouting into the world of ElmSprouting into the world of Elm
Sprouting into the world of Elm
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
Java applet
Java appletJava applet
Java applet
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Unified Expression Language
Unified Expression LanguageUnified Expression Language
Unified Expression Language
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
JSF 2 and beyond: Keeping progress coming
JSF 2 and beyond: Keeping progress comingJSF 2 and beyond: Keeping progress coming
JSF 2 and beyond: Keeping progress coming
 
Annotations
AnnotationsAnnotations
Annotations
 
Rich faces
Rich facesRich faces
Rich faces
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Java applet basics
Java applet basicsJava applet basics
Java applet basics
 
27 applet programming
27  applet programming27  applet programming
27 applet programming
 
Java Server Faces (JSF) - advanced
Java Server Faces (JSF) - advancedJava Server Faces (JSF) - advanced
Java Server Faces (JSF) - advanced
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
 
code analysis for c++
code analysis for c++code analysis for c++
code analysis for c++
 
Jsp
JspJsp
Jsp
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
C# XML documentation
C# XML documentationC# XML documentation
C# XML documentation
 

Similar to RomaFramework Tutorial Basics

Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsRicardo Varela
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)Jenna Pederson
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet Sagar Nakul
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshellLennart Schoors
 
Component Framework Primer for JSF Users
Component Framework Primer for JSF UsersComponent Framework Primer for JSF Users
Component Framework Primer for JSF UsersAndy Schwartz
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptRohan Chandane
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperFabrit Global
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2tahirraza
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformAlfresco Software
 
JSON Logger Baltimore Meetup
JSON Logger Baltimore MeetupJSON Logger Baltimore Meetup
JSON Logger Baltimore MeetupManjuKumara GH
 
Introduction To Eclipse RCP
Introduction To Eclipse RCPIntroduction To Eclipse RCP
Introduction To Eclipse RCPwhbath
 

Similar to RomaFramework Tutorial Basics (20)

Ibm
IbmIbm
Ibm
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile Widgets
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
 
Component Framework Primer for JSF Users
Component Framework Primer for JSF UsersComponent Framework Primer for JSF Users
Component Framework Primer for JSF Users
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Sencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScriptSencha / ExtJS : Object Oriented JavaScript
Sencha / ExtJS : Object Oriented JavaScript
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Red5 - PHUG Workshops
Red5 - PHUG WorkshopsRed5 - PHUG Workshops
Red5 - PHUG Workshops
 
Spring boot
Spring bootSpring boot
Spring boot
 
JSON Logger Baltimore Meetup
JSON Logger Baltimore MeetupJSON Logger Baltimore Meetup
JSON Logger Baltimore Meetup
 
Introduction To Eclipse RCP
Introduction To Eclipse RCPIntroduction To Eclipse RCP
Introduction To Eclipse RCP
 

More from Luca Garulli

Scale Out Your Graph Across Servers and Clouds with OrientDB
Scale Out Your Graph Across Servers and Clouds  with OrientDBScale Out Your Graph Across Servers and Clouds  with OrientDB
Scale Out Your Graph Across Servers and Clouds with OrientDBLuca Garulli
 
Polyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesPolyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesLuca Garulli
 
How Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionHow Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionLuca Garulli
 
OrientDB and Hazelcast
OrientDB and HazelcastOrientDB and Hazelcast
OrientDB and HazelcastLuca Garulli
 
Why relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeWhy relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeLuca Garulli
 
Why relationships are cool but "join" sucks
Why relationships are cool but "join" sucksWhy relationships are cool but "join" sucks
Why relationships are cool but "join" sucksLuca Garulli
 
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Luca Garulli
 
Switching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itSwitching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itLuca Garulli
 
Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Luca Garulli
 
Switching from relational to the graph model
Switching from relational to the graph modelSwitching from relational to the graph model
Switching from relational to the graph modelLuca Garulli
 
Internet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptInternet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptLuca Garulli
 
Switching from the Relational to the Graph model
Switching from the Relational to the Graph modelSwitching from the Relational to the Graph model
Switching from the Relational to the Graph modelLuca Garulli
 
OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)Luca Garulli
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBLuca Garulli
 
No sql matters_2012_keynote
No sql matters_2012_keynoteNo sql matters_2012_keynote
No sql matters_2012_keynoteLuca Garulli
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1Luca Garulli
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App developmentLuca Garulli
 
OrientDB the database for the web 1.1
OrientDB the database for the web 1.1OrientDB the database for the web 1.1
OrientDB the database for the web 1.1Luca Garulli
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and conceptsLuca Garulli
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQLLuca Garulli
 

More from Luca Garulli (20)

Scale Out Your Graph Across Servers and Clouds with OrientDB
Scale Out Your Graph Across Servers and Clouds  with OrientDBScale Out Your Graph Across Servers and Clouds  with OrientDB
Scale Out Your Graph Across Servers and Clouds with OrientDB
 
Polyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesPolyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model Databases
 
How Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolutionHow Graph Databases started the Multi Model revolution
How Graph Databases started the Multi Model revolution
 
OrientDB and Hazelcast
OrientDB and HazelcastOrientDB and Hazelcast
OrientDB and Hazelcast
 
Why relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in RomeWhy relationships are cool but join sucks - Big Data & Graphs in Rome
Why relationships are cool but join sucks - Big Data & Graphs in Rome
 
Why relationships are cool but "join" sucks
Why relationships are cool but "join" sucksWhy relationships are cool but "join" sucks
Why relationships are cool but "join" sucks
 
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
Soffri di patologie da "domini complessi con tante relazioni"? C'è una nuova ...
 
Switching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.itSwitching from Relational 2 Graph - CloudConf.it
Switching from Relational 2 Graph - CloudConf.it
 
Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3Switching from Relational to the Graph model v1.3
Switching from Relational to the Graph model v1.3
 
Switching from relational to the graph model
Switching from relational to the graph modelSwitching from relational to the graph model
Switching from relational to the graph model
 
Internet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScriptInternet Apps powered by NoSQL and JavaScript
Internet Apps powered by NoSQL and JavaScript
 
Switching from the Relational to the Graph model
Switching from the Relational to the Graph modelSwitching from the Relational to the Graph model
Switching from the Relational to the Graph model
 
OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)OrientDB document or graph? Select the right model (old presentation)
OrientDB document or graph? Select the right model (old presentation)
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDB
 
No sql matters_2012_keynote
No sql matters_2012_keynoteNo sql matters_2012_keynote
No sql matters_2012_keynote
 
OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1OrientDB distributed architecture 1.1
OrientDB distributed architecture 1.1
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
OrientDB the database for the web 1.1
OrientDB the database for the web 1.1OrientDB the database for the web 1.1
OrientDB the database for the web 1.1
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and concepts
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQLOrientDB introduction - NoSQL
OrientDB introduction - NoSQL
 

Recently uploaded

Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Americas Got Grants
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Kirill Klimov
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...ssuserf63bd7
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxsaniyaimamuddin
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfJos Voskuil
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCRashishs7044
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy Verified Accounts
 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024Adnet Communications
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Servicecallgirls2057
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyotictsugar
 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckHajeJanKamps
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Pereraictsugar
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMVoces Mineras
 

Recently uploaded (20)

No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
Corporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information TechnologyCorporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information Technology
 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
Digital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdfDigital Transformation in the PLM domain - distrib.pdf
Digital Transformation in the PLM domain - distrib.pdf
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
 
Buy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail AccountsBuy gmail accounts.pdf Buy Old Gmail Accounts
Buy gmail accounts.pdf Buy Old Gmail Accounts
 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024
 
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort ServiceCall US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
Call US-88OO1O2216 Call Girls In Mahipalpur Female Escort Service
 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyot
 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
 
Kenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith PereraKenya Coconut Production Presentation by Dr. Lalith Perera
Kenya Coconut Production Presentation by Dr. Lalith Perera
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQM
 

RomaFramework Tutorial Basics

  • 1. Let's think to the application domain , then model it in simple Java Classes, write the business logic and Roma will make all the rest “ ” www.RomaFramework.org Luca Garulli Roma Meta Framework Project Leader CTO AssetData [email_address]
  • 2. Problem: what should I use? J2EE Microsoft .NET 2.0 Ruby On Rails Struts WebWorks Spring MVC Apache Cocoon Apache Velocity Apache Tapestry RIFE Trails JSF NextApp Echo2 Swing Yet another… SWT JDO JDBC Hibernate iBatis Castor OS Workflow Enhydra Shark BPEL engine Apache OJB EJB3/JPA
  • 3.
  • 4.
  • 5. Architecture atom I: behaviour aspects Domain, Model and Business Logic Persistence (repository)‏ Session Monitoring Workflow Authentication I18N (Internationalization)‏ View Reporting Aspects describe a behaviour and they are implemented as Java interfaces Scheduler Scheduler
  • 6. Architecture atom II: modules Domain, Model and Business Logic Persistence (repository)‏ Session Monitoring Workflow Authentication I18N View ??? Others Java Resource Bundle Echo2 JMX Tevere JSP JDO 2.0 JPOX 1.2 Roma architecture is totally modular. Modules can implement Behavior Aspects Users Module, Custom Mock Echo2 Scheduler Open Symphony Quartz Reporting Jasper Reports
  • 7. Roma: let's create a new web project >roma create web tutorial-basic org.romaframework.tutorial.basic C:orkevsomaframework >roma add view-echo2 >roma add persistence-jpox >roma add web-jetty tutorial-basic/ .settings // Eclipse directory settings database // HSQLDB embedded database for develop. lib // Compile-time libs log // Log directory script // Script directory src/ // Sources directory WebContent/ dynamic // Dynamic contents static // Static contents WEB-INF/ classes/ // Java compiled classes lib/ // Run-time libs applicationContext.xml // Main Spring IoC config file .classpath // Eclipse classpath file .project // Eclipse project file build.xml // Ant build file roma-project.xml // Roma project information Generate empty project scaffolding
  • 8. Roma: look to the source directory tutorial-basic/src/ commons-logging.properties // Apache Commons logging cfg (use Log4J)‏ jetty.xml // Jetty Web Server cfg jpox-log4j.properties // JPOX's log cfg log4j.xml // Log4J logging configuration org/romaframework/tutorial/basic domain // Where to place all domain entities i18n // I18N aspect: language mapping repository // DDD Repository pattern view // View Aspect domain // Where to place all presentation related domain classes screen // Where to place screen cfgs [CRUD] // Any CRUD is generated as package here containing all CRUD classes for the entity image // All images used by Echo2 style // Echo2 stylesheets (as XML files)‏ CustomApplicationConfiguration.java // Handle user session
  • 9. Roma: start to write you Domain @Persistence(mode=”tx”)‏ public void save (){ ObjectContext.getInstance()‏ .getContexComponent(PersistenceAspect.class)‏ .updateObject( this ); } public class Employee { private String name ; private String surname ; private Date birth ; // GETTER + SETTERS } Write the model behavior + business logic Run! Start to write domain classes under the package: org/romaframework/tutorial/basic/domain Roma will be able to discover them
  • 10. View: Mapping type = render < bean id = &quot; RenderingResolver &quot; singleton = &quot;true&quot; class = &quot;org.romaframework.aspect.view.echo2...ConfigurableRenderingResolver&quot; > < property name = &quot;configuration&quot; > < map > < entry key = &quot;action&quot; value = &quot;link&quot; /> < entry key = &quot;object&quot; value = &quot;object&quot; /> < entry key = &quot;java.lang.String&quot; value = &quot; text &quot; /> < entry key = &quot;java.lang.Integer&quot; value = &quot; text &quot; /> < entry key = &quot;java.lang.Float&quot; value = &quot; text &quot; /> < entry key = &quot;java.lang.Double&quot; value = &quot; text &quot; /> < entry key = &quot;java.lang.Boolean&quot; value = &quot; check &quot; /> < entry key = &quot;java.util.Date&quot; value = &quot; date &quot; /> < entry key = &quot;java.util.Collection&quot; value = &quot; list &quot; /> < entry key = &quot;java.util.Set&quot; value = &quot; list &quot; /> < entry key = &quot;java.util.Map&quot; value = &quot; table &quot; /> </ map > </ property > </ bean > Inside you WebContent/WEB-INF directory you can find the applicationContext-view-echo2.xml file containing the behavior of rendering. The RenderingResolver component contains the mapping between types and rendering mode .
  • 11. View: Render and Layout modes Rendering mode is the way a field or an action is rendered. By default the View Aspect delegates to the RenderingResolver component to resolve it. You can override the default behavior by assigning the rendering you want by using the annotation (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 mode is the way a component will be placed in to the form. By default every single field is placed inside its own area if 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; }
  • 12. View: Draw your form using areas I To have a form layout really portable across technologies and frameworks we can't use HTML to define the layout neither the Swing or the SWT way. We need a new generic way to tell to Roma the aspect our form should be have. Areas aim to divide your form in multiple parts. Each one must describe the way it place the component: the “ area rendering mode ”. By default is the placeholder , namely an area type that replace itself with the component rendered (and only one). You can use all the modes between the supported ones: placeholder , cell, column, grid, row, popup, tab Areas only describe the layout form. To handle the presentation aspect much deeper you need to work with the View Aspect implementation in the behind. If you're using Echo2 module you had to work with the Xml stylesheet files contained under the package <your-app-package>.view.style . Roma team choosen to not generalize features like component width, heights, colors, etc. since they are so many and so much technology-related that it's much simpler to work directly with the View Aspect implementation way it offers. Note: Remember that your application will be portable across technologies and frameworks. It can run as Web Application or as Swing Desktop application. But GUI details will be lost and need to be translated in the technology you want to use!
  • 13.
  • 14. < area name = &quot;main&quot; type = &quot;column&quot; > < area name = &quot;fields&quot; type = &quot;grid&quot; size = &quot;4&quot; /> < area name = &quot;note&quot; /> < area name = &quot;actions&quot; type = &quot;row&quot; /> View: automatic rendering III Ok Cancel Print default area uses a GRID to place the POJO fields. You can choice how much columns to use. Order is given by Annotation or XML Annotation actions is the default area for actions. It's defined as a row You can specify custom areas where to place fields and actions. There is no limit to the number of areas you can create Name City Zion's citizen Notes Web Surname Luca Garulli Luca zioncity </ area >
  • 15. @ViewClass(orderFields=&quot;name surname city web&quot;, orderActions=&quot;ok cancel print&quot;)‏ public class Customer{ private String name; private String surname; private String city; private String web; private String notes; public void ok(){} public void cancel(){} public void print(){} } View: POJO mapping I Roma controller binds the POJO directly to the form generated. The relationship is 1-1 : if you change the content of a field in the browser, it will be updated in you Java object and viceversa. When you push any button, the action associated will be executed. Fast to write, easy to debug, simple to handle!
  • 16. public class Employee{ private String name; private Company company; private List<Contact> contacts; } public class Company{ private String name; } public class Contact{ private ContactType type; private String type; } public class ContactType{ private String name; } View: POJO mapping II Roma render all complex types as link to another form containing the complex instance associated to the field. You can also display the joined object as embedded instead of link. Collections are rendered as List by default, but you can render its as select, radio buttons, table, rowset, colset, etc. Download, import and run the project Tutorial Basic from your Eclipse (romaframeworkrunkevutorialsutorial-basic)‏
  • 17. ContactInstance.java: public class ContactInstance{ @ViewField(render = ViewConstants.RENDER_SELECT, selectionField = &quot;entity.type&quot;)‏ private List<ContactType> types; } ContactInstance.xml: <?xml version=&quot;1.0&quot;?> <class> <fields> <field name=&quot;types&quot;> <aspects> <view render=&quot;select&quot; selectionField=”entity.type”/> </aspects> </field> </fields> </class> Detail your Domain meta-model You can use Java5+ annotations or Xml Annotations to detail your meta-data model. Remember that on conflict Xml Annotations win. Java Annotations pro: All in one file, faster to write Xml Annotations pro: Use of separate files so the Java sources remain clean
  • 18.
  • 19. Behavior aspect orchestration Persistence (repository)‏ I18N (Internationalization)‏ View DB Login Authentication Session Login Flow login()‏ display Start user session display
  • 20. MVC Controller Roma controller acts between Forms and POJOs. Every time the user change some field values Roma binds changes to the POJO. This usually happens before an actions is called. You can avoid to make automatic binding by setting the “ bind ” annotation to false (use Java/Xml annotation): @ViewAction( bind =AnnotationConstants.FALSE)‏ public void reload(){ ... } If you change some field values of your POJO you had to tell it to Roma in order to refresh the updated values on the form when the Controller receives the control again. Use this: public void reload(){ name = “”; ObjectContext.getInstance(). fieldChanged (this, ”name”); }
  • 21.
  • 22. Validation: write your own When you need more power and control to validate your POJO you can use the custom validation . Just implement the CustomValidation interface. Example: public class EmployeeInstance implements CustomValidation{ @ViewField(required=AnnotationConstants.TRUE, min=3, max=32)‏ private String name; public void validate (){ if( description.contains(“sex”) )‏ throw new ValidationException(this, “sex”, “Banned word”); } @ViewAction(validation=AnnotationConstants.TRUE)‏ public void save(){ ... } } Before to call the save() method Roma controller will execute the validation for name field and then the custom validate() method. If anything is ok the save() method will be invoked, otherwise a ValidationException will be thrown.
  • 23. MVC Controller: 100% POJO based Controller Invoking “ OK ” Action POJO Binds changes form fields to the POJO Calls ok () method against the POJO @FlowAction(next=HomePage.class)‏ public void ok (){ sendMessageToRemoteService(); } @ViewField( required =true, min =2)‏ private String name; public void validate (){ if( name == null || name.trim().length() == 0){ throw new ValidationException( this, “name”, “ Please insert the name!”); } } Validates POJO's rules + validate () method if any HomePage.java Follows the flow declared using Java5 Annotation
  • 24. Accessing to Aspects and Components Roma allows to access to each registered component and aspect by ObjectContext singleton class. Get by class type. Convention wants each aspect's implementation is registered in the IoC system with the name of the interface : ObjectContext.getInstance(). getComponent (ViewAspect.class).show(employee)‏ Get the component by the registered name: ObjectContext.getInstance(). getComponent (“MyComponent”)‏ Get the component in context. Useful for PersistenceAspect to work with the same transaction. ObjectContext.getInstance(). getContextComponent (PersistenceAspect.class).updateObject(employee)‏
  • 25.
  • 26.
  • 27. Dirty approach: dirty you hands when required EmployeeRepository EmployeeRepository JDO Roma wants cover the most common use cases . It's utopian to imagine covering all user requirements since they are so many and frameworks can be so much differents between their. So if you need to access directly to the tool and framework in the behind you had to know that you can do it. Just remember that piece of code will be not portable across implementation when, and if, you'll decide to migrate to another one. Aseptic class. It doesn't contain any references to tool and framework used. = 100% portable :-)‏ Extension of theportable class. It's a best practice to name it with the technology it depends as suffix. So you'll had to search all JDO classes when you need to migrate to another one Persistence Aspect. = Not portable :-(
  • 28. CRUD generation following DDD CRUDMain EmployeeMain ComposedEntityInstance <Employee> CRUDInstance CRUDSelect EmployeeInstance EmployeeListable EmployeeFilter Repository EmployeeRepository Delegates all database access * 1 1 1
  • 29. Vertical domain libraries Accounting system Bank Telecommunication Assurance Human Resources Accounting system Billing system ? DDD + POJO + MetaFramework allow to create vertical domain Libraries as a set of class packages. These Libraries are aseptics from technologies so you can publish them to be reused, improved and extended again
  • 30. Available modules now - reporting-jr - users - monitoring-mx4j - view-echo2 - designer - project-web - web-jetty - workflow-pojo - etl-xpath - project-simple - portal-solo - project-webready - workflow-tevere-gui - persistence-jpox - scheduler-quartz - admin - workflow-tevere-engine - monitoring-jmx - messaging Community is developing: - persistence-jpa - view-html-css - view-swing - wiki
  • 31.
  • 32.