A (XPages) developers guide to Cloudant - MeetIT

384 views

Published on

In introduction of Cloudant for (XPages) developer, with code examples

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
384
On SlideShare
0
From Embeds
0
Number of Embeds
233
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

A (XPages) developers guide to Cloudant - MeetIT

  1. 1. A (XPages) developers guide to Cloudant Frank van der Linden @flinden68
  2. 2. About me • Freelance Full stack Java developer, with XPages experience • Curious of new technology • Owner of elstar IT • Former IBM Champion (2013, 2014)
  3. 3. Roadmap • Why Cloudant • Introduction to Cloudant • Inside Cloudant • Connect to Cloudant • Cloudant @ XPages
  4. 4. Why Cloudant
  5. 5. Why Cloudant • For HR Assistant we wanted to use a different datastore
  6. 6. Introduction to Cloudant
  7. 7. What is Cloudant • It is the cloud version of CouchDb • CouchDb is created by Damien Katz • Cloudant is bought by IBM • It is document based • Is like MongoDb or NSF a NoSQL datastore
  8. 8. What is Cloudant • Data stored as JSON • View and Search ‘formula’ with javascript • Replication • Tasks • Build in API • No annoying limitations
  9. 9. Cloudant as service • Cloudant can be added as service in BlueMix
  10. 10. Cloudant standalone • Via website cloudant.com
  11. 11. Inside Cloudant
  12. 12. Inside Cloudant
  13. 13. Inside Cloudant • View mapping • Search index
  14. 14. Connect to Cloudant
  15. 15. Connect to Cloudant • Direct via REST • https://someusername:secret@account.cloudant.com • Via a OSGi Plugin, uses the HTTPConnection • https://bitbucket.org/flinden68/cloudant-connector
  16. 16. Connect to Cloudant • Credentials • Account, necessary for the OSGi plugin
  17. 17. Connect to Cloudant • It is JSON everywhere • _rev and _id, reserved parameters • doc{}, is the actual data from application
  18. 18. Cloudant connector • Storing in and retrieving from Cloudant • Can be accessed from Java backend. • Will take out the security issues. • Do the heavy lifting. Don't reinvent the wheel. • https://bitbucket.org/flinden68/cloudant-connector
  19. 19. Cloudant @ XPages
  20. 20. Cloudant @ XPages
  21. 21. Cloudant @ XPages
  22. 22. Cloudant @ XPages • Repeat in XPages • Columns - values from Job class
  23. 23. Cloudant @ XPages • JobController - getJobs
  24. 24. Cloudant @ XPages • Job Java Class
  25. 25. Cloudant @ XPages • CloudantDAO
  26. 26. Cloudant @ XPages • CloudantService - connect • Find the data in Cloudant
  27. 27. Cloudant @ XPages • Job JSON in Cloudant
  28. 28. Attachment @ Cloudant • Stored as base64 encoded String • Can be as standalone • Or as part of Document (we choose this way) • Store id as attachmentId, so it can be retrieved when needed
  29. 29. Attachment @ Cloudant • AttachmentDAO
  30. 30. Attachment @ Cloudant • AttachmentController • Convert upload to Attachment object
  31. 31. Attachment @ Cloudant • ControllerBase • All controllers can use these methods
  32. 32. Attachment @ Cloudant • Servlet is called in application for download • base64 data for the image tag
  33. 33. RichText @ Cloudant • Stored as MultiMimePart
  34. 34. RichText @ Cloudant • Which is nice converted to JSON ;-)
  35. 35. Search @ Cloudant • Cloudant job ftSearch index
  36. 36. Search @ Cloudant • Search example, filter the view
  37. 37. Search @ Cloudant • Do the search in the Controller, call DAO
  38. 38. Search @ Cloudant • Search method calls the CloudantService
  39. 39. Search @ Cloudant • CloudantService calls connector to get the data
  40. 40. Resources • OSGi Cloudant connector • https://bitbucket.org/flinden68/cloudant-connector • Cloudant documentation • https://docs.cloudant.com/ • HR Assistant • hrassistant.eu-gb.mybluemix.net • github.com/flinden68/HR-Assistant
  41. 41. Thank you

×