SlideShare a Scribd company logo
1 of 41
Download to read offline
Mardi 17 Novembre 2009
                                            Paris, la Défense




  Où sont mes beans,
contrats et workflows ?
              WOA et REST :
 Un changement de mentalité dans l’entreprise.
Histoire d'un projet


   2007        2008       2009

  API SOAP   API REST     Site   2nd Site
Core                      WOA     WOA



                      2
Sadek
              Drobi

          Consultant
    Evangéliste en langage de
        programmation
Valtech Technology Consulting

 Editeur section Architecture
       www.InfoQ.com


                                3
Jean-Laurent
     de Morlhon
     Directeur de projets
       Editions VIDAL

    +10 ans expérience IT

       Architecture JEE

       Open Source :

              &


4
Editions VIDAL
Maison d’édition d’informations de référence sur les
                 produits de santé.

         Produits papiers & électroniques

             120 personnes en France.




                         5
Histoire d'un projet


   2007        2008       2009

  API SOAP   API REST     Site   2nd Site
Core                      WOA     WOA



                      6
Qu’est ce que REST ?



         7
REST
             Identification de ressources


http://api.vidal.fr/product/12738

http://api.vidal.fr/product/12738/monograph

http://api.vidal.fr/products?q=asp

http://api.vidal.fr/products/12738;12673/interactions


                           8
REST
Manipulation de ressource grâce aux représentations

  GET /product/12356            GET /product/12356
  Host: api.vidal.fr            Host: api.vidal.fr
  Accept: text/xml              Accept: text/html



 <product> ... </product>       <ul><li>Product...</ul>



                                GET /product/12356
  GET /product/12356            Host: api.vidal.fr
  Host: api.vidal.fr            Accept: image/png
  Accept: text/json


  {"product": { ... }}            AAHE838723AAHZJH...
                            9
REST

<html>
.../...
        <img src="http://api.vidal.fr/product/12356" />
.../...
</html>




                          10
REST
                Hypermedia comme moteur d'état
.../...
</entry>
<entry>
  <title>ASPEGIC NOURRISSONS 100mg pdre p sol buv</title>
  <link rel="alternate" href="http://api.vidal.fr/product/1528" />
  <link rel="related" href="http://api.vidal.fr/product/1528/indications" />
  <link rel="related" href="http://api.vidal.fr/product/1528/packages" />
  <category term="AVAILABLE" scheme="MarketStatus" />
                   .../...
</entry>
<entry>
.../...




                                                          Workflows ?

                                     11
REST
             Message auto-descriptif
>   GET /product/1147 HTTP/1.1
>   User-Agent: curl/7.19.4
>   Host: api.vidal.fr
>   Accept: application/xml

<   HTTP/1.1 200 OK
<   Date: Tue, 20 Oct 2009 12:41:27 GMT
<   Server: Apache
<   Transfer-Encoding: chunked
<   Content-Type: application/xml

<product>
  <id>1147</id>
  <cis>61137191</cis>
  <name>ANTIGRIPPINE A L&apos;ASPIRINE ETAT GRIPPAL cp</name>
  <type>VIDAL</type>
  <drugInSport>false</drugInSport>
  <midwife>false</midwife>
  <marketStatus>AVAILABLE</marketStatus>
  <exceptional>false</exceptional>
.../...


                                 12
Démo




 13
Etude framework REST




         14
Etude framework REST
           Navigabilité du code      Intégration avec Spring
          Projet très dynamique          Documentation

Apache         Fait le café...       Documentation hell !
 CXF         Support JAX-RS          Difficile avec AEGIS

             Impl. de référence     Intégration difficile dans
Jersey   S'intègre bien avec Spring    Google AppEngine



                           15
Navigabilité du code

public class RestAPIApplication extends Application {

    @Override
    public synchronized Restlet createRoot() {

        Router router = new Router(getContext());
        router.attach("/product/{productId}", ProductResource.class);
        router.attach("/pack/{packId}", PackResource.class);
        router.attach("/interaction/{interactionId}", InteractionResource.class);

        return router;
    }
}




                                      16
API REST
@Component
@Path("/company")
@Produces( {MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public class CompanyResource {

   private final CompanyBo companyBo;

   @Autowired
   public CompanyResource(final CompanyBo companyBo) {
      this.companyBo = companyBo;
   }

   @GET
   @Path("/{id}")
   @Produces( {MediaType.APPLICATION_JSON})
   public Company getCompany(@PathParam("id") final Integer companyId) {
      if (companyId == null) {
         throw new WebApplicationException(Status.BAD_REQUEST);
      }
      return companyBo.searchById(companyId);
   }

.../...                            17
SOAP vs REST
       SOAP                             REST
                             • Embrasse le web
Artificiel pour le web        • Système de cache inhérent



                             • Utilisation des standards
                             • Contrats possibles avec
Basé sur des contrats          WADL




                        18
Cache

GET        POST




PUT        DELETE




      19
Cache
   Client       Cache                                             Client



Client       Cache                          Serve             Client                 Cache         Server



 Client       Cache

                                                                                        Proxy
                                                               Client

                           Client
                                                               Client       Cache
    Client


                                                          Client                    Cache       Cache       Server
 Client                             Cache       Server


                                                         Client          Cache


                        Proxy Inverse
  Client


                                                                Client
                                                                                    Real Life...

                                                         20
Histoire d'un projet


   2007        2008        2009

  API SOAP   API REST      Site   2nd Site
Core                       WOA     WOA



                      21
Qu’est ce que WOA ?



         22
WOA ?


WOA = MASHUP ( REST + JS + POX ) ^ KISS




                   23
Tout est une ressource
 Bibliothèque
                                          Page Web
  de widget
                                         ( Mashup )

  widget        JS + HTML
                              Widget
                                             specific html
                            "configuré"

   Service                               widget       widget
( Fournisseur               widget
de données )
                                         widget
   REST         XML/JSON


                                24
WOA
                       "TLD style"


<vidal:tableau
  data="http://api.vidal.fr/services/product?{id}"
  widget="http://api.vidal.fr/widgets/gridWithPagination"
  css="http://monsite.fr/mycss.css"
/>



                           25
<script type="text/javascript">
//<![CDATA[(function(loc) { if (loc.pathname == '/') { return; } var uri_re = /^(?:(?:[^:/?#]+):)?(?://(?:[^/?#]*))?([^?#]*)(?:
?([^#]*))?(?:#(.*))?/; var target_domain = ''; loc.href.replace(uri_re, function(all, path, query, frag) { var dst, src; dst =
src = path + (query ? '?' + query : ''); if (frag) { if (frag.charAt(0) == '/') { dst = frag.replace(/^/+/, '/') .replace(/_fb_qsub=
([^&]+)&?/, function(all, domain){ if (domain.substring(domain.length - 13) == '.topLeft') { target_domain =
'http://'+domain; } return ''; }); } else if (/&|=/.test(frag)) { var q = {}; var m = frag.match(/([^#]*)(#.*)?/); var arr =
(query||'').split('&').concat((m[1]||'').split('&')); for (var i=0, length=arr.length; i<length; i++) { var t = arr[i].split('='); if
(t.length && t[0] != '') { q[t[0]] = t[1]; } } var s = []; for (var i in q) { s.push(i+ (q[i]?'='+q[i]:'')); } dst = path+'?'+s.join('&')+(m
[2]||''); } } dst = "" + dst; if (dst != src) { window.location.replace(target_domain + dst); } }); })(window.location); !function()
{ var doc = document, htm = doc.documentElement, phc = 'DOMControl_placeholder', nearest = function(elm, tag)
{ while (elm && elm.nodeName != tag) { elm = elm.parentNode; } return elm; }, fob = function (e) { var e = e ||
window.event, elm = e.target || e.srcElement, ph = elm.getAttribute('placeholder'); if (ph) { if ('focus' == e.type || 'focusin'
== e.type) { if (elm.value == ph) { elm.value = ''; CSS.removeClass(elm, phc); } } else { if (elm.value == '')
{ CSS.addClass(elm, phc); elm.value = ph; } } } }; $ = window.$ || function(id) { var e = doc.getElementById(id); return
(e && e.getAttribute('id') == id) ? e : null; }; CSS = window.CSS || { addClass : function(e, c) { e.className += ' ' + c; },
removeClass : function(e, c) { e.className = e.className .replace(new RegExp('(^|s)' + c + '(?=s|$)', 'g'), ' '); } };
Bootloader = window.Bootloader || { _preloaded : [], _callbacks : {}, loadComponents : function(component, callback)
{ if (callback) { var cb = Bootloader._callbacks; cb[component] = cb[component] || []; cb[component].push(callback); }
var script = doc.createElement('script'); script.type = 'text/javascript'; script.src = '/rsrcx.php?boot&enable=' +
component; doc.getElementsByTagName('head')[0].appendChild(script); }, done : function(names)
{ Bootloader._preloaded.push(names); } }; htm.onclick = function(e) { e = e || window.event; var elem = nearest(e.target
|| e.srcElement, 'A') || htm, href = elem.getAttribute('ajaxify') || elem.href;//]]>
</script>



        Javascript ? Trop complexe ?
        Pour échapper à la complexité de javascript, le plus simple est
        de ne pas en écrire...
                                                                                                                                   26
Désarmer Javascript 
Utilisez des bibliothèques et
des outils de plus haut
niveau 


         jQuery
   Functional JavaScript




                                27
Programmation Fonctionnelle
Functional Javascript:

	

 	

   map(invoke('toUpperCase'),   ['two', 'words']);
	

 	

    ! ["TWO", "WORDS"]



! !       select( '>2' ,    [1,2,3,4]);
! !        ! [3, 4]



                                                       28
JQuery (1/2)
jQuery.getFeed( {
! url : ‘/news’,
! success : function(feed) {
!     displayNews(container, feed);
! }
});




                                      29
JQuery (2/2)


$("#pack-title a").toggleClass("collapsed");




                                               30
Widgets: Modularité en JS
var srchBx = new SearchBox("searchDiv","Rechercher");

var products = newProduct("productSummary",
  ! !      !    !     "productListGridContainer",
! ! !      !    !     "/products/count?q={arg}",
! ! !      !    !     "Médicaments");

srchBx.onSearch.add(products.showResultsForTerm);




                                                    31
Cool! Mais nécessite
beaucoup de discipline.


                          32
Ou on écrit tout en Java :
        GWT



                             33
JS "à la main" vs GWT
       JS "à la main"                       GWT

                                Code de binding template <->
Code de Mashup en Javascript
                                 GWT à écrire en Javascript

                                Widgets accessibles uniquement
Widgets accessibles à tous...
                                        au monde java.

   Code essentiellement
                                  Code essentiellement java
        Javascript


                                                              34
Tests
 Tests d'interface graphique
Tests unitaires au niveau ressources
                   Programmer au bon niveau d'abstraction
                      Tests fonctionnels au niveau mashup
                                                              

 Tests fonctionnels avec selenium
 Outillage non java

                                        Syndrome des IDE... 

                                                         35
Démo




 36
Histoire d'un projet


   2007        2008        2009

  API SOAP   API REST      Site   2nd Site
Core                       WOA     WOA



                      37
Futur

• Utilisation de widgets en dehors de sites web
  VIDAL

• Monétiser les widgets en complément des API
  auprès d'éditeurs.




                      38
Démo




 39
?
40
Références
• http://www.infoq.com/woa
• Caching
  • http://bit.ly/Bz4EZ
  • http://www.mnot.net/cache_docs
• Orchestration
  • http://www.infoq.com/articles/webber-rest-workflow
• Interviews
  • http://bit.ly/qpQhy
• Blogs
  • http://jim.webber.name/
  • http://hinchcliffe.org/default.aspx

                            41

More Related Content

What's hot

Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)
Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)
Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)hibnico
 
Concevoir, développer et sécuriser des micro-services avec Spring Boot
Concevoir, développer et sécuriser des micro-services avec Spring BootConcevoir, développer et sécuriser des micro-services avec Spring Boot
Concevoir, développer et sécuriser des micro-services avec Spring BootDNG Consulting
 
Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Eric SIBER
 
Etes vous-prets-pour-le-succes-2011
Etes vous-prets-pour-le-succes-2011Etes vous-prets-pour-le-succes-2011
Etes vous-prets-pour-le-succes-2011Steven VAN POECK
 
Et pourquoi pas JEE ?
Et pourquoi pas JEE ?Et pourquoi pas JEE ?
Et pourquoi pas JEE ?PALO IT
 
ToulouseJUG - REX Flex, Spring & Agilité
ToulouseJUG - REX Flex, Spring & AgilitéToulouseJUG - REX Flex, Spring & Agilité
ToulouseJUG - REX Flex, Spring & AgilitéNicolas Deverge
 
Service WEB de type REST avec Java
Service WEB de type REST avec JavaService WEB de type REST avec Java
Service WEB de type REST avec JavaFrancois ANDRE
 
les servlets-java EE
les  servlets-java EEles  servlets-java EE
les servlets-java EEYassine Badri
 
Presentation JEE et son écossystéme
Presentation JEE et son écossystémePresentation JEE et son écossystéme
Presentation JEE et son écossystémeAlgeria JUG
 
Introduction à Angular JS
Introduction à Angular JSIntroduction à Angular JS
Introduction à Angular JSAntoine Rey
 
Introduction à Zend Framework 2
Introduction à Zend Framework 2Introduction à Zend Framework 2
Introduction à Zend Framework 2Mickael Perraud
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les basesAntoine Rey
 

What's hot (17)

Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)
Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)
Maven/Ivy vs OSGi (Toulouse Jug 26-05-2011)
 
Concevoir, développer et sécuriser des micro-services avec Spring Boot
Concevoir, développer et sécuriser des micro-services avec Spring BootConcevoir, développer et sécuriser des micro-services avec Spring Boot
Concevoir, développer et sécuriser des micro-services avec Spring Boot
 
Servlets et JSP
Servlets et JSPServlets et JSP
Servlets et JSP
 
Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)Spring Meetup Paris - Back to the basics of Spring (Boot)
Spring Meetup Paris - Back to the basics of Spring (Boot)
 
Jsp
JspJsp
Jsp
 
Etes vous-prets-pour-le-succes-2011
Etes vous-prets-pour-le-succes-2011Etes vous-prets-pour-le-succes-2011
Etes vous-prets-pour-le-succes-2011
 
Et pourquoi pas JEE ?
Et pourquoi pas JEE ?Et pourquoi pas JEE ?
Et pourquoi pas JEE ?
 
ToulouseJUG - REX Flex, Spring & Agilité
ToulouseJUG - REX Flex, Spring & AgilitéToulouseJUG - REX Flex, Spring & Agilité
ToulouseJUG - REX Flex, Spring & Agilité
 
Spring 3.0
Spring 3.0Spring 3.0
Spring 3.0
 
Service WEB de type REST avec Java
Service WEB de type REST avec JavaService WEB de type REST avec Java
Service WEB de type REST avec Java
 
les servlets-java EE
les  servlets-java EEles  servlets-java EE
les servlets-java EE
 
Presentation JEE et son écossystéme
Presentation JEE et son écossystémePresentation JEE et son écossystéme
Presentation JEE et son écossystéme
 
Introduction à Angular JS
Introduction à Angular JSIntroduction à Angular JS
Introduction à Angular JS
 
Introduction à Zend Framework 2
Introduction à Zend Framework 2Introduction à Zend Framework 2
Introduction à Zend Framework 2
 
Support JEE Servlet Jsp MVC M.Youssfi
Support JEE Servlet Jsp MVC M.YoussfiSupport JEE Servlet Jsp MVC M.Youssfi
Support JEE Servlet Jsp MVC M.Youssfi
 
Support cours j2_ee
Support cours j2_eeSupport cours j2_ee
Support cours j2_ee
 
Workshop Spring - Session 1 - L'offre Spring et les bases
Workshop Spring  - Session 1 - L'offre Spring et les basesWorkshop Spring  - Session 1 - L'offre Spring et les bases
Workshop Spring - Session 1 - L'offre Spring et les bases
 

Similar to Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de mentalité dans l'entreprise.

Introduction aux RIA (Rich Internet Applications)
Introduction aux RIA (Rich Internet Applications)Introduction aux RIA (Rich Internet Applications)
Introduction aux RIA (Rich Internet Applications)Tugdual Grall
 
WebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsWebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsVincent Perrin
 
Normes avancées du Web - GTI780 & MTI780 - ETS - A08
Normes avancées du Web  - GTI780 & MTI780 - ETS - A08Normes avancées du Web  - GTI780 & MTI780 - ETS - A08
Normes avancées du Web - GTI780 & MTI780 - ETS - A08Claude Coulombe
 
Java dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de JonasJava dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de JonasMicrosoft
 
La mobilité dans Drupal
La mobilité dans DrupalLa mobilité dans Drupal
La mobilité dans DrupalAdyax
 
HTML5... La révolution maintenant!
HTML5... La révolution maintenant!HTML5... La révolution maintenant!
HTML5... La révolution maintenant!CARA_Lyon
 
HTML5... La révolution maintenant!
HTML5... La révolution maintenant!HTML5... La révolution maintenant!
HTML5... La révolution maintenant!CARA_Lyon
 
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs Web
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs WebUne visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs Web
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs WebFrédéric Harper
 
Codedarmor 2012 - 06/03 - HTML5, CSS3 et Javascript
Codedarmor 2012 - 06/03 - HTML5, CSS3 et JavascriptCodedarmor 2012 - 06/03 - HTML5, CSS3 et Javascript
Codedarmor 2012 - 06/03 - HTML5, CSS3 et Javascriptcodedarmor
 
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...CERTyou Formation
 
De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)Restlet
 
Flex, une techno RIA incontournable pour les futures app web ?
Flex, une techno RIA incontournable pour les futures app web ?Flex, une techno RIA incontournable pour les futures app web ?
Flex, une techno RIA incontournable pour les futures app web ?GreenIvory
 
Développer sereinement avec Node.js
Développer sereinement avec Node.jsDévelopper sereinement avec Node.js
Développer sereinement avec Node.jsJulien Giovaresco
 
Introduction à Angularjs
Introduction à AngularjsIntroduction à Angularjs
Introduction à AngularjsRossi Oddet
 
I don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry piI don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry piadelegue
 
De A à Z : Choisir une architecture pour sa solution applicative
De A à Z : Choisir une architecture pour sa solution applicativeDe A à Z : Choisir une architecture pour sa solution applicative
De A à Z : Choisir une architecture pour sa solution applicativeMicrosoft
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependancesArchitecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependancesENSET, Université Hassan II Casablanca
 

Similar to Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de mentalité dans l'entreprise. (20)

Introduction aux RIA (Rich Internet Applications)
Introduction aux RIA (Rich Internet Applications)Introduction aux RIA (Rich Internet Applications)
Introduction aux RIA (Rich Internet Applications)
 
WebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet ApplicationsWebSphere Portal & Rich Internet Applications
WebSphere Portal & Rich Internet Applications
 
Normes avancées du Web - GTI780 & MTI780 - ETS - A08
Normes avancées du Web  - GTI780 & MTI780 - ETS - A08Normes avancées du Web  - GTI780 & MTI780 - ETS - A08
Normes avancées du Web - GTI780 & MTI780 - ETS - A08
 
Java dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de JonasJava dans Windows Azure: l'exemple de Jonas
Java dans Windows Azure: l'exemple de Jonas
 
La mobilité dans Drupal
La mobilité dans DrupalLa mobilité dans Drupal
La mobilité dans Drupal
 
HTML5... La révolution maintenant!
HTML5... La révolution maintenant!HTML5... La révolution maintenant!
HTML5... La révolution maintenant!
 
HTML5... La révolution maintenant!
HTML5... La révolution maintenant!HTML5... La révolution maintenant!
HTML5... La révolution maintenant!
 
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs Web
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs WebUne visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs Web
Une visite guidée d’Internet Explorer 9 et HTML5 pour les développeurs Web
 
Codedarmor 2012 - 06/03 - HTML5, CSS3 et Javascript
Codedarmor 2012 - 06/03 - HTML5, CSS3 et JavascriptCodedarmor 2012 - 06/03 - HTML5, CSS3 et Javascript
Codedarmor 2012 - 06/03 - HTML5, CSS3 et Javascript
 
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...
Wpl53 g formation-developper-des-applications-pour-ibm-websphere-portal-8-0-a...
 
Nouveaux apis
Nouveaux apisNouveaux apis
Nouveaux apis
 
De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)De l'Open Source à l'Open API (in French)
De l'Open Source à l'Open API (in French)
 
Flex, une techno RIA incontournable pour les futures app web ?
Flex, une techno RIA incontournable pour les futures app web ?Flex, une techno RIA incontournable pour les futures app web ?
Flex, une techno RIA incontournable pour les futures app web ?
 
Développer sereinement avec Node.js
Développer sereinement avec Node.jsDévelopper sereinement avec Node.js
Développer sereinement avec Node.js
 
Introduction à Angularjs
Introduction à AngularjsIntroduction à Angularjs
Introduction à Angularjs
 
I don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry piI don't always write reactive application but when I do, it run on raspberry pi
I don't always write reactive application but when I do, it run on raspberry pi
 
Ter Web Service Intro
Ter Web Service IntroTer Web Service Intro
Ter Web Service Intro
 
De A à Z : Choisir une architecture pour sa solution applicative
De A à Z : Choisir une architecture pour sa solution applicativeDe A à Z : Choisir une architecture pour sa solution applicative
De A à Z : Choisir une architecture pour sa solution applicative
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Architecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependancesArchitecture jee principe de inversion de controle et injection des dependances
Architecture jee principe de inversion de controle et injection des dependances
 

More from Jean-Laurent de Morlhon

More from Jean-Laurent de Morlhon (10)

Culture du Programmeur
Culture du ProgrammeurCulture du Programmeur
Culture du Programmeur
 
Git fu
Git fuGit fu
Git fu
 
Software Craftsmanship : en Pratique - AgileTour
Software Craftsmanship : en Pratique - AgileTourSoftware Craftsmanship : en Pratique - AgileTour
Software Craftsmanship : en Pratique - AgileTour
 
Software Craftsmanship: En pratique
Software Craftsmanship: En pratiqueSoftware Craftsmanship: En pratique
Software Craftsmanship: En pratique
 
Code retreat june24th
Code retreat june24thCode retreat june24th
Code retreat june24th
 
SVN to GitHUb
SVN to GitHUbSVN to GitHUb
SVN to GitHUb
 
Comment j'ai remplacé 30% de mes développeurs en adoptant l'agilité... et aut...
Comment j'ai remplacé 30% de mes développeurs en adoptant l'agilité... et aut...Comment j'ai remplacé 30% de mes développeurs en adoptant l'agilité... et aut...
Comment j'ai remplacé 30% de mes développeurs en adoptant l'agilité... et aut...
 
Scrum, 3 Ans après...
Scrum, 3 Ans après...Scrum, 3 Ans après...
Scrum, 3 Ans après...
 
Scrum & VIdal Retour d'experience
Scrum & VIdal Retour d'experienceScrum & VIdal Retour d'experience
Scrum & VIdal Retour d'experience
 
Construire une ligne de produit logiciel "toyotisme ou fordisme" ?
Construire une ligne de produit logiciel "toyotisme ou fordisme" ?Construire une ligne de produit logiciel "toyotisme ou fordisme" ?
Construire une ligne de produit logiciel "toyotisme ou fordisme" ?
 

Ou sont mes beans, contrats et workflows ? WOA et REST: Un changement de mentalité dans l'entreprise.

  • 1. Mardi 17 Novembre 2009 Paris, la Défense Où sont mes beans, contrats et workflows ? WOA et REST : Un changement de mentalité dans l’entreprise.
  • 2. Histoire d'un projet 2007 2008 2009 API SOAP API REST Site 2nd Site Core WOA WOA 2
  • 3. Sadek Drobi Consultant Evangéliste en langage de programmation Valtech Technology Consulting Editeur section Architecture www.InfoQ.com 3
  • 4. Jean-Laurent de Morlhon Directeur de projets Editions VIDAL +10 ans expérience IT Architecture JEE Open Source : & 4
  • 5. Editions VIDAL Maison d’édition d’informations de référence sur les produits de santé. Produits papiers & électroniques 120 personnes en France. 5
  • 6. Histoire d'un projet 2007 2008 2009 API SOAP API REST Site 2nd Site Core WOA WOA 6
  • 7. Qu’est ce que REST ? 7
  • 8. REST Identification de ressources http://api.vidal.fr/product/12738 http://api.vidal.fr/product/12738/monograph http://api.vidal.fr/products?q=asp http://api.vidal.fr/products/12738;12673/interactions 8
  • 9. REST Manipulation de ressource grâce aux représentations GET /product/12356 GET /product/12356 Host: api.vidal.fr Host: api.vidal.fr Accept: text/xml Accept: text/html <product> ... </product> <ul><li>Product...</ul> GET /product/12356 GET /product/12356 Host: api.vidal.fr Host: api.vidal.fr Accept: image/png Accept: text/json {"product": { ... }} AAHE838723AAHZJH... 9
  • 10. REST <html> .../... <img src="http://api.vidal.fr/product/12356" /> .../... </html> 10
  • 11. REST Hypermedia comme moteur d'état .../... </entry> <entry> <title>ASPEGIC NOURRISSONS 100mg pdre p sol buv</title> <link rel="alternate" href="http://api.vidal.fr/product/1528" /> <link rel="related" href="http://api.vidal.fr/product/1528/indications" /> <link rel="related" href="http://api.vidal.fr/product/1528/packages" /> <category term="AVAILABLE" scheme="MarketStatus" /> .../... </entry> <entry> .../... Workflows ? 11
  • 12. REST Message auto-descriptif > GET /product/1147 HTTP/1.1 > User-Agent: curl/7.19.4 > Host: api.vidal.fr > Accept: application/xml < HTTP/1.1 200 OK < Date: Tue, 20 Oct 2009 12:41:27 GMT < Server: Apache < Transfer-Encoding: chunked < Content-Type: application/xml <product> <id>1147</id> <cis>61137191</cis> <name>ANTIGRIPPINE A L&apos;ASPIRINE ETAT GRIPPAL cp</name> <type>VIDAL</type> <drugInSport>false</drugInSport> <midwife>false</midwife> <marketStatus>AVAILABLE</marketStatus> <exceptional>false</exceptional> .../... 12
  • 15. Etude framework REST Navigabilité du code Intégration avec Spring Projet très dynamique Documentation Apache Fait le café... Documentation hell ! CXF Support JAX-RS Difficile avec AEGIS Impl. de référence Intégration difficile dans Jersey S'intègre bien avec Spring Google AppEngine 15
  • 16. Navigabilité du code public class RestAPIApplication extends Application { @Override public synchronized Restlet createRoot() { Router router = new Router(getContext()); router.attach("/product/{productId}", ProductResource.class); router.attach("/pack/{packId}", PackResource.class); router.attach("/interaction/{interactionId}", InteractionResource.class); return router; } } 16
  • 17. API REST @Component @Path("/company") @Produces( {MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public class CompanyResource { private final CompanyBo companyBo; @Autowired public CompanyResource(final CompanyBo companyBo) { this.companyBo = companyBo; } @GET @Path("/{id}") @Produces( {MediaType.APPLICATION_JSON}) public Company getCompany(@PathParam("id") final Integer companyId) { if (companyId == null) { throw new WebApplicationException(Status.BAD_REQUEST); } return companyBo.searchById(companyId); } .../... 17
  • 18. SOAP vs REST SOAP REST • Embrasse le web Artificiel pour le web • Système de cache inhérent • Utilisation des standards • Contrats possibles avec Basé sur des contrats WADL 18
  • 19. Cache GET POST PUT DELETE 19
  • 20. Cache Client Cache Client Client Cache Serve Client Cache Server Client Cache Proxy Client Client Client Cache Client Client Cache Cache Server Client Cache Server Client Cache Proxy Inverse Client Client Real Life... 20
  • 21. Histoire d'un projet 2007 2008 2009 API SOAP API REST Site 2nd Site Core WOA WOA 21
  • 22. Qu’est ce que WOA ? 22
  • 23. WOA ? WOA = MASHUP ( REST + JS + POX ) ^ KISS 23
  • 24. Tout est une ressource Bibliothèque Page Web de widget ( Mashup ) widget JS + HTML Widget specific html "configuré" Service widget widget ( Fournisseur widget de données ) widget REST XML/JSON 24
  • 25. WOA "TLD style" <vidal:tableau data="http://api.vidal.fr/services/product?{id}" widget="http://api.vidal.fr/widgets/gridWithPagination" css="http://monsite.fr/mycss.css" /> 25
  • 26. <script type="text/javascript"> //<![CDATA[(function(loc) { if (loc.pathname == '/') { return; } var uri_re = /^(?:(?:[^:/?#]+):)?(?://(?:[^/?#]*))?([^?#]*)(?: ?([^#]*))?(?:#(.*))?/; var target_domain = ''; loc.href.replace(uri_re, function(all, path, query, frag) { var dst, src; dst = src = path + (query ? '?' + query : ''); if (frag) { if (frag.charAt(0) == '/') { dst = frag.replace(/^/+/, '/') .replace(/_fb_qsub= ([^&]+)&?/, function(all, domain){ if (domain.substring(domain.length - 13) == '.topLeft') { target_domain = 'http://'+domain; } return ''; }); } else if (/&|=/.test(frag)) { var q = {}; var m = frag.match(/([^#]*)(#.*)?/); var arr = (query||'').split('&').concat((m[1]||'').split('&')); for (var i=0, length=arr.length; i<length; i++) { var t = arr[i].split('='); if (t.length && t[0] != '') { q[t[0]] = t[1]; } } var s = []; for (var i in q) { s.push(i+ (q[i]?'='+q[i]:'')); } dst = path+'?'+s.join('&')+(m [2]||''); } } dst = "" + dst; if (dst != src) { window.location.replace(target_domain + dst); } }); })(window.location); !function() { var doc = document, htm = doc.documentElement, phc = 'DOMControl_placeholder', nearest = function(elm, tag) { while (elm && elm.nodeName != tag) { elm = elm.parentNode; } return elm; }, fob = function (e) { var e = e || window.event, elm = e.target || e.srcElement, ph = elm.getAttribute('placeholder'); if (ph) { if ('focus' == e.type || 'focusin' == e.type) { if (elm.value == ph) { elm.value = ''; CSS.removeClass(elm, phc); } } else { if (elm.value == '') { CSS.addClass(elm, phc); elm.value = ph; } } } }; $ = window.$ || function(id) { var e = doc.getElementById(id); return (e && e.getAttribute('id') == id) ? e : null; }; CSS = window.CSS || { addClass : function(e, c) { e.className += ' ' + c; }, removeClass : function(e, c) { e.className = e.className .replace(new RegExp('(^|s)' + c + '(?=s|$)', 'g'), ' '); } }; Bootloader = window.Bootloader || { _preloaded : [], _callbacks : {}, loadComponents : function(component, callback) { if (callback) { var cb = Bootloader._callbacks; cb[component] = cb[component] || []; cb[component].push(callback); } var script = doc.createElement('script'); script.type = 'text/javascript'; script.src = '/rsrcx.php?boot&enable=' + component; doc.getElementsByTagName('head')[0].appendChild(script); }, done : function(names) { Bootloader._preloaded.push(names); } }; htm.onclick = function(e) { e = e || window.event; var elem = nearest(e.target || e.srcElement, 'A') || htm, href = elem.getAttribute('ajaxify') || elem.href;//]]> </script> Javascript ? Trop complexe ? Pour échapper à la complexité de javascript, le plus simple est de ne pas en écrire... 26
  • 27. Désarmer Javascript  Utilisez des bibliothèques et des outils de plus haut niveau  jQuery Functional JavaScript 27
  • 28. Programmation Fonctionnelle Functional Javascript: map(invoke('toUpperCase'), ['two', 'words']); ! ["TWO", "WORDS"] ! ! select( '>2' , [1,2,3,4]); ! ! ! [3, 4] 28
  • 29. JQuery (1/2) jQuery.getFeed( { ! url : ‘/news’, ! success : function(feed) { ! displayNews(container, feed); ! } }); 29
  • 31. Widgets: Modularité en JS var srchBx = new SearchBox("searchDiv","Rechercher"); var products = newProduct("productSummary", ! ! ! ! "productListGridContainer", ! ! ! ! ! "/products/count?q={arg}", ! ! ! ! ! "Médicaments"); srchBx.onSearch.add(products.showResultsForTerm); 31
  • 32. Cool! Mais nécessite beaucoup de discipline. 32
  • 33. Ou on écrit tout en Java : GWT 33
  • 34. JS "à la main" vs GWT JS "à la main" GWT Code de binding template <-> Code de Mashup en Javascript GWT à écrire en Javascript Widgets accessibles uniquement Widgets accessibles à tous... au monde java. Code essentiellement Code essentiellement java Javascript 34
  • 35. Tests Tests d'interface graphique Tests unitaires au niveau ressources Programmer au bon niveau d'abstraction Tests fonctionnels au niveau mashup   Tests fonctionnels avec selenium  Outillage non java Syndrome des IDE...  35
  • 37. Histoire d'un projet 2007 2008 2009 API SOAP API REST Site 2nd Site Core WOA WOA 37
  • 38. Futur • Utilisation de widgets en dehors de sites web VIDAL • Monétiser les widgets en complément des API auprès d'éditeurs. 38
  • 40. ? 40
  • 41. Références • http://www.infoq.com/woa • Caching • http://bit.ly/Bz4EZ • http://www.mnot.net/cache_docs • Orchestration • http://www.infoq.com/articles/webber-rest-workflow • Interviews • http://bit.ly/qpQhy • Blogs • http://jim.webber.name/ • http://hinchcliffe.org/default.aspx 41