Florian adler minute project

30
MinuteProject reverse-engineering short stories Florian Adler Riga 7/6/12

Transcript of Florian adler minute project

Page 1: Florian adler   minute project

MinuteProjectreverse-engineering

short stories

Florian AdlerRiga 7/6/12

Page 2: Florian adler   minute project

About meFrench, living in BelgiumJava dev, founder of minuteprojectWorking @EC

Former navy officer dropped in IT minefield at Y2K

Page 3: Florian adler   minute project

Agenda• MinuteProject Overview

Demo1 – simple JPA2 backend• Customisation

Demo2 – model evolution JPA2• Integration technics

Demo3 – REST app CXF/spring/jpa2• Statement Driven Development

Demo4 – REST app with SDD• Goodies

Demo5 – OpenXava app• Extend Minuteproject/ contribute?http://minuteproject.blogspot.be/2012/05/minuteproject-reverse-engineering-short.html

Page 4: Florian adler   minute project

OverviewMinuteProject is a:• Code generator• OpenSource Apache v2 licence• 4000+ downloads• Reverse-engineering tool

– RDBMS– WSDL

Page 5: Florian adler   minute project

Target Techno Ecosystem

JPA2 JPA (2/1) Hibernate iBatis

Spring configurationDAO – ORM integration

DAO layerEJB – CDI – DAO

Layer

OpenXava FitNesse

Under investigation

First Release

Mature

Under development

Vaadin

JSF Primefaces

RESTJersey

WS

RooRails

Benerator

Grails

Play

Tutorial

JSF Primefaces

REST CXF

RESTSpringMVC

JOOQ

AutomatedBusiness

Logic

MinuteProjectGenerator

Load modelEnrich

Generate

Page 6: Florian adler   minute project

Techno Demos

JPA2 JPA2 Hibernate iBatis

Spring configurationDAO – ORM integration

DAO layerEJB – CDI – DAOLayer

OpenXava FitNesse

Vaadin

JSF Primefaces

RESTJersey

WS

RooRails

Benerator

Grails

Play

Tutorial

JSF Primefaces

REST CXF

RESTSpringMVC

JOOQ

AutomatedBusiness

Logic

Load modelEnrich

Generate

MinuteProjectGenerator

DEMOS

Page 7: Florian adler   minute project

Why MinuteProject?• Why code generation?• Do not reinvent the wheel

– i.e. let the others do the framework/specs• Crystallize your knowledge• Go fast and customise• Reverse-Engineering is not a one shot process

Page 8: Florian adler   minute project

When to use it?• Legacy model upgrades to new tech

• Work from scratch: – Development tool – Iterative methodology

• Your own model as your technology tutorial

Page 9: Florian adler   minute project

Operating Mechanism

MP engine

MP

gen

erat

ed A

rtif

acts

Target Technologies A

TargetTechnologies B

Target Technology A/BTemplates

MP main configEnriches model

Loads

Loads metadata

Applies templates

Generates

Database model

Uses DB modelstructure

Page 10: Florian adler   minute project

Demo 1 – JPA2

http://minuteproject.blogspot.be/2012/05/rigajug-demo-1-jpa2.html

Page 11: Florian adler   minute project

Demo 1 - explanations

• Start from scratch• Generate from the console & command line• Review artifacts • Write a unit test

Page 12: Florian adler   minute project

Customisation• Art of enrichment• Art of reverse-analysis• Configure model/target

Configuration optionsIndividual (fine grain)Global (declarative conventions)

http://minuteproject.wikispaces.com/Convention

Page 13: Florian adler   minute project

Demo 2 – JPA2

http://minuteproject.blogspot.be/2012/05/rigajug-demo-2-jpa2.html

Page 14: Florian adler   minute project

Demo 2 - explanations

• Start from scratch• Generate from the console & command line• Review artifacts• Write a unit test• Secure modified code

Page 15: Florian adler   minute project

Integration Technics2 standards• integration by extension• integration by overridingMP adds a new one• integration by alteration/mutation• 3 types of alteration

– artifact level (exclude for next generation)– added section– updatable section

Page 16: Florian adler   minute project

Demo 3 - REST

Architecture blocks

http://minuteproject.blogspot.be/2012/05/rigajug-demo-rest-cxf.html

JPA2

DAO

CXF SPRING

Page 17: Florian adler   minute project

Demo 3 - explanations• Start from scratch• Artifacts review:

– CXF track– Spring config– Backend DAO– JPA2– Maven projects

• Deploy and test on Tomcat• Test URL

Page 18: Florian adler   minute project

SDD – Statement Driven Dev. • Sometimes statements are just enough• Model is secondary• You just need:

– Statement ex: query– I/O

Page 19: Florian adler   minute project

SDD exampleStart from an SQL query to deduce function and output

select k.key_name, t.translation, t.date_finalization, l.code, l.description, tl.first_name, tl.last_name, tl.email from translation t, language l, user tl, translation_key kwheret.language_id = l.idlanguageand tl.idUser = t.translator_idand k.id = t.key_idorder by key_name

Page 20: Florian adler   minute project

SDD exampleProvide some input

select k.key_name, t.translation, t.date_finalization, l.code, l.description, tl.first_name, tl.last_name, tl.email from translation t, language l, user tl, translation_key kwheret.language_id = l.idlanguageand tl.idUser = t.translator_idand k.id = t.key_idand k.key_name like ?and l.code like ?order by key_namelimit ?

Page 21: Florian adler   minute project

SDD - exampleFeed statement into Minuteproject

<query name="get translation info"> <query-body> <value><![CDATA[select k.key_name, t.translation, t.date_finalization, l.code, l.description, tl.first_name, tl.last_name, tl.email from translation t, language l, user tl, translation_key k where t.language_id = l.idlanguage and tl.idUser = t.translator_id and k.id = t.key_id and k.key_name like ? and l.code like ? order by key_name limit ?]]> </value></query-body>

Page 22: Florian adler   minute project

SDD - exampleFeed input into Minuteproject

<query-params>

<query-param name="key" is-mandatory="false" type="STRING" sample="'test'"/>

<query-param name="code" is-mandatory="false" type="STRING" sample="'FR'"/>

<query-param name="max" is-mandatory="false" type="INT" sample="10"/>

</query-params>

Page 23: Florian adler   minute project

Demo 4

SDD is WYSIWYGwhat you STATE is what you get

http://minuteproject.blogspot.be/2012/05/rigajug-demo-rest-sdd.html

Page 24: Florian adler   minute project

GoodiesWhy not have a JEE web app instantlyOpenXava app generation• Is a RAD Open Source JEE framework based on

JPA2• Has front-end rendering annotation on entities• Is AJAX

Page 25: Florian adler   minute project

Demo 5 – OpenXava App

MinuteProject generates:• OpenXava project artifacts• Build and deploy script

http://minuteproject.blogspot.be/2012/05/rigajug-demo-instant-openxava-app.html

Page 26: Florian adler   minute project

Extend MinuteProjectArtifacts can be generated at multiple levels:• Field• Entities (table,view)• Package • Model• Application

Page 27: Florian adler   minute project

Extend MinuteProject• Add a track• Add template metadata• Add template (velocity)• Add library• Add plugin• Artifact cross-reference

Page 28: Florian adler   minute project

Success stories• Belgium Finance Ministry• European Commission

• In Latvia

Page 29: Florian adler   minute project

F A Q

Page 30: Florian adler   minute project

Contact• Twitter @minuteproject• Googlegroup minuteproject• Mail [email protected]