Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Java script everywhere

599 views

Published on

"JavaScript Everywhere: Backend to Web and to Mobile Apps" Slide site on WSO2Con

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Java script everywhere

  1. 1. JavaScript Everywhere: Backend to Web and to Mobile Apps Ruchira Wageesha & Madhuka Udantha WSO2 Inc.
  2. 2. Path • Why JavaScript • We will mainly discuss about JaggeryJS • Jaggery APIs • Start with a high level discussion • Then Hands On
  3. 3. Reaching Out the Last Mile • Users no longer accept average user experience • Users Interfaces (UIs) covers the last mile • Often decides the success and how much it will integrate with the user’s lives.
  4. 4. Evolution of Web Applications
  5. 5. Evolution of Web Applications
  6. 6. Web Apps •Mobiles •Internet /networks •Desktops/PC •Portal Devices •Tabs/Tablets
  7. 7. Types of Web Application • Client side (Static HTML) • Client driven, blocking (old Forms based submit ) • Client driven, non blocking (AJAX) • Client and server driven, non-blocking (web sockets)
  8. 8. User Interface
  9. 9. Revolution of UI in Web Apps • Javascript has become the defacto technology • Variuos Javascript libaries • Supported by all browsers • Thanks goe to •Web 2.0 •HTML5 • No longer simplistic applications • Widely used
  10. 10. Javascript end to end?
  11. 11. Javascript end to end? (Contd.) ● No complexities in data binding (UI to Business logic thanks to JSON) ● No serialization / de-serialization ● Rich space with many common javascript libraries ● Rapid application development ● Resourcful ● No compiling, making & building
  12. 12. What my options • NodeJS - o Based on Google V8 JS engine o Event driven, non-blocking processing • Jaggery o Provided traditional development experience like in PHP/JSP o De-facto framework for all WSO2 user facing applications
  13. 13. https://github.com/wso2/jaggery
  14. 14. Introduction to Jaggery • Like JSP/ PHP, but user writes code completely in javascript (Data access / Business Logic / UI) • Runs as a Web app (e.g. tomcat) • Runs on top of Java • Provides very close integration with WSO2 Products (e.g. Users, Web service calls, access to the registry, access OSGI services etc. )
  15. 15. First Look {jaggery.js} Nothing complex If (you are familiar with WSO2) { server runtimes, it’s the same thing } Else { extract the zip, run sh /bin/server.sh/.bat } http://dist.wso2.org/snapshots/maven2/org/jaggeryjs/jaggery/0.9.0-SNAPSHOT/jaggery-0.9.0-20140321.143805-240.zip
  16. 16. Hello Jaggery!! • Most straight forward Sample • Open up a text editor • Create {JAGGERY_HOME}/apps/carshop/hello.jag • Browser to :http://localhost:9763/carshop/hello.jag
  17. 17. Out Put Syntax
  18. 18. Data Storage • Create a DB connection (DB config) • Perform CRUD operations • Results sent as json
  19. 19. Using Databases and Registry • <jaggery-home>carbonrepositorycomponentslib • Drivers for DB • MetadataStore collection Resource
  20. 20. Process APIs • Server details
  21. 21. RESTful Service URIMatcher "urlMappings": [{ "url": "/sample/uri-mapping", "path": "/index.jag“ }]
  22. 22. RESTful Service (application.serve())
  23. 23. RESTful Service - router https://github.com/splinter/jaggery-pipe
  24. 24. Demo • Use-case?
  25. 25. Demo
  26. 26. Demo REST service call
  27. 27. Calling out a SOAP Service
  28. 28. Demo SOAP service invoke
  29. 29. HTML5 and WebSockets
  30. 30. Demo Web Socket
  31. 31. Including 3rd party js libraries • {{ mustache }} • Handlebars.js • base64 js
  32. 32. Java and Jaggery • Writing HostObject for Jaggery • Java Class accessing http://madhukaudantha.blogspot.com/2014/02/writing-hostobject-for-jaggery.html
  33. 33. Configuration
  34. 34. Configuration (Cont.)
  35. 35. Visualization
  36. 36. WSO2 and Jaggery
  37. 37. WSO2 and Jaggery
  38. 38. Develop RESTful Service & Routering • URL Mapping Using inbuilt jaggery.conf • Front End Controller Concept Application.serve() var pipe=require('pipe'); var router=require('router'); pipe.plug(router);
  39. 39. Presentation https://github.com/wso2/caramel
  40. 40. If not test? https://github.com/Madhuka/jaggery-test-framewrok
  41. 41. Some utilities • Carbon module • File API • Email API • Feed API • oauth • uuid https://github.com/wso2/jaggery-extensions
  42. 42. Summary • Why js • Jaggery.js • Jaggery API • Router • Jaggery-test • Finally….
  43. 43. References • jaggeryjs.org • wso2.com • https://github.com/wso2/caramel • https://github.com/splinter/jaggery-pipe • https://github.com/Madhuka/jaggery-test-framewrok • http://ruchirawageesha.blogspot.com/ • http://madhukaudantha.blogspot.com/
  44. 44. QA
  45. 45. Thank you

×