Resthub lyonjug

4,551
-1

Published on

RESThub 1.1 presentation

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,551
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
40
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Resthub lyonjug

  1. 1.
  2. 2. Full stackframework<br />
  3. 3. Whatis RESThub ?<br />Java Stack<br />JavascriptStack<br />
  4. 4. Don'tRepeatYourself<br />
  5. 5. Keep It Simple, Stupid<br />
  6. 6. Not reinventing the wheel !<br />Some rights reserved by vrogy<br />
  7. 7. Java Stack<br />
  8. 8. Java stack modules<br />GenericRESTWebservice<br />Tapestry 5<br />Integration<br />Plugin Architecture<br />Generic Middle classes<br />Tooling - Testing<br />Documentation<br />
  9. 9. Software design<br />Plugin based architecture<br />Spring + naming convention<br />classpath*: scanning<br />Maven multi modules<br />Runtime configurationwith SpEL<br />Multilayered software design<br />Interface - Implementation<br />DAO - Service - View<br /><ul><li>Focus on business</li></li></ul><li>Enable progressive complexity<br />
  10. 10. Java Middle stack<br />Validator<br />JSR 303 Bean validation<br />SpringDBUnitintegration<br />Hades 2<br />Generic DAO<br />Generic Services and tests<br />3.5<br />JPA2 Persistenceengine<br />Cross modules scanningfor JPA entities<br />Embedded database<br />1.3<br />
  11. 11. Generic classes<br />@Named("bookingDao") <br />public class JpaBookingDao<br />extends GenericJpaResourceDao<Booking> implements BookingDao {     <br />...}<br />@Named("bookingService") <br />public class BookingServiceImpl<br />extends GenericResourceServiceImpl<Booking, BookingDao> implements BookingService {     <br />...}<br />
  12. 12. Generic tests<br />Default Spring behaviour (Rollback=true) isdisabled !In memory H2 database configuration<br /><ul><li>AbstractResthubTest: Spring configuration aware
  13. 13. AbstractResthubTransactionalTest: your test istransactional
  14. 14. AbstractResthubTransactionAwareTest: designed to test yourservice layer
  15. 15. AbstractResthubWebTest: embeddedpreconfiguredJetty
  16. 16. AbstractDaoTest, AbstractServiceTest, AbstractControlerTest:generic CRUD unit tests</li></li></ul><li>SpringDBUnit integration<br />@Named("sampleDataSet")<br />public class SampleDataSetInitializerimplements DataSetInitializer{ @Override<br />public void createData() throws Exception {<br /> ...<br />}<br />}<br />@InjectDataSet(value ="sampleDataSet",onceForClass=false)<br />public class SampleDaoTest {<br />@Test<br />public void sampleTest() {<br /> ...<br />}<br />}<br />
  17. 17. REST webservices<br />JAX-RS REST Webservices<br />OAuth2 basedsecurity<br />Jersey 1.6<br />GenericwebservicesGeneric tests<br />JSON Serialization<br />Jackson 1.7<br />7.3<br />WADL explorer jQuery plugin<br />Run/Debug web application<br />
  18. 18. Generic REST Services<br />How to… retrieve a persisted object in database ?<br />@GET<br />@Path("/{ref}")<br />@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})<br />public Response getResource(@PathParam("ref") String ref) {<br /> T entity = this.service.findByRef(ref);<br />if(entity == null) {<br />return Response.status(Status.NOT_FOUND).build();<br /> }<br />return Response.ok(entity).build();<br />}<br />
  19. 19. OAuth2<br />
  20. 20. Serialization<br /><ul><li>XML serialization thanks to JAXB annotation
  21. 21. JSON serialization
  22. 22. Not so simple to manage (cyclic object graphs)
  23. 23. « BadgerFish » or « Mapped » strategy are not easy to use
  24. 24. We have chosen Jackson POJO serialization
  25. 25. Interesting features like parent/children bi–directional link support
  26. 26. Missing reference support</li></li></ul><li>JavascriptStack<br />
  27. 27. Use case 1 : server based MVC Framework<br />Clientside<br />Stateless<br />Browser<br />Dynamicpages<br />Session<br />MVC Framework<br />Webservices(optional)<br />MVCframework<br />Server side<br />Middle<br />Templateprocessing<br />
  28. 28. Use case 2 : client MVC with RESThub JS<br />Session<br />Browser<br />MVCframework<br />Client side<br />HTML5/JavaScript RIA<br />Templateprocessing<br />Staticfiles<br />Dynamicdata<br />RESTWebservices<br /> Static file(JS, HTML, CSS)<br />Stateless<br />Server side<br />Middle<br />
  29. 29. Why Java developpershate JS ?<br />Contextloss, and no classes<br />Scopes and closures<br />No strongtyping<br />Cross browser compatibility<br />Damnit, it’s Web developpement !<br />
  30. 30. But Web techno Rocks !<br />Concernsseparation<br />Highlydynamic<br />Productive and quick<br />Apps are trendy and sexy <br />
  31. 31. No restart needed !<br />
  32. 32. Javascriptstack for RIA Webapps<br />But why ?<br />RIA vs Server sidepresentationframework<br />So muchunused power on our desktop !<br />Competitorsalreadyprovideframework<br />Allows…<br />Use the latest web technologies consistently<br />Reduce traffic and server load<br />Reuse server-programming good practices<br />
  33. 33. Javascriptstack<br />Widgets<br />JavaScript core library<br />ui 1.8<br />1.4<br />Script loader andOptimizer<br />Class support<br />RESThub JS MVC<br />
  34. 34. Script loading<br />I wantmy imports !<br />define([<br />'lib/resthub', <br />'routes', <br />'controllers/home'<br />], function() { <br /> ... <br />});<br />
  35. 35. Routing<br />Only one <br />« real » page<br />Using the hash > no reload<br />$.route('#/home', function() { <br /> ... <br />});<br />$.route('#/home');<br />
  36. 36. Classes<br />We’reused to OOP, not prototype<br />define(['lib/class'], function(Class) {<br />returnClass.extend('MyClass', {<br />attribute: 'some value',<br />method: function() { <br /> }<br /> });<br />});<br />Static, instance, single inheritance<br />
  37. 37. Controllers & templates<br />Controller: presentationlogic<br />define(['lib/controller'], function(Controller) {<br />returnController.extend('HomeController', {<br />template : 'views/home.html',<br />init : function() { <br />this.render({user:{name:'Tyler'}});<br /> }<br /> });<br />});<br />Template: readable DOM fragment<br /><p>Hello ${user.name} !</p><br />
  38. 38. Widgets<br />Interactive enhanced GUI<br />Buildyour GUI, as in Swing/SWT<br />init: function() { <br />this.render();<br /> $('a.confirm', this.element)<br /> .click($.proxy(this, '_confirmHandler')<br /> .button({<br /> label: i18n.buttons.confirm<br /> });<br />}<br />
  39. 39. Repositories<br />Connection to REST servers<br />define(['lib/repository'], function(Repository) {<br />returnRepository.extend('UserRepository', {<br />root: 'api/users/',<br />findByName: function(name, callback) { <br />this._get(this.root + name, callback);<br /> }<br /> });<br />});<br />
  40. 40. Bonus<br />Local storage > client session<br />Event bus > betweencontrollers<br />I18n > like in Java<br />Security > OAuth2<br />JSON > effective communication<br />Console > like log4j<br />…<br />
  41. 41. Global view<br />Application server<br />Web browser<br />View<br />Controller<br />Repository<br />View<br />Controller<br />Routes<br />DAO<br />Business Services<br />REST Web Services<br />Repository<br />View<br />Controller<br />Tools<br />
  42. 42. Demo<br />
  43. 43. RESThubexamples<br />Javascript<br />Javascript & Tapestry 5<br />
  44. 44. RESThub examples<br />
  45. 45. Status & Roadmap<br />
  46. 46. Status and Roadmap<br />RESThub 1.1-RC1 has just been released !<br />RESThub 1.2roadmap :<br />SpringData integration (CouchDB, Redis)<br />OAuth 2 final version support<br />AsyncHttpClient for scalable architecture<br />PushStatesupport on routing<br />Client sidebean validation based on JSR-303 annotations<br />Websocket support<br />NodeJSbased server sidetemplateprocessing<br />
  47. 47. Questions ?<br />http://resthub.orghttp://pullrequest.org<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×