KEMBAR78
A (XPages) developers guide to Cloudant | PPTX
8th Sutol Conference, November 2016
A (XPages) developers
guide to Cloudant
Frank van der Linden
8th Sutol Conference, November 2016
8th Sutol Conference, November 2016
About me
• Freelance Java and web developer, with
XPages experience
• …..and JEE technologies
• Owner of Elstar IT
• Frequent (trail)runner
8th Sutol Conference, November 2016
Roadmap
• Introduction to Cloudant
• Inside Cloudant
• Connect to Cloudant
• Cloudant @ XPages
8th Sutol Conference, November 2016
Why Cloudant
• For HR Assistant wanted to try a new
datastore
8th Sutol Conference, November 2016
Introduction to
Cloudant
8th Sutol Conference, November 2016
What is Cloudant
• It is the cloud version of CouchDb
• It is document based
• CouchDb is created by Damien Katz
• Cloudant is bought by IBM
• Is like MongoDb or NSF a NoSQL
datastore
8th Sutol Conference, November 2016
What is Cloudant
• Data stored as JSON
• View and Search ‘formula’ with
javascript
• Replication
• Tasks
• Build in API
• No annoying limitations
8th Sutol Conference, November 2016
Cloudant as service
• Cloudant can be added as service in
BlueMix
8th Sutol Conference, November 2016
Cloudant standalone
• Via website, https://cloudant.com
cloudant.com
8th Sutol Conference, November 2016
Inside Cloudant
8th Sutol Conference, November 2016
Inside Cloudant
8th Sutol Conference, November 2016
Inside Cloudant
• View mapping
• Search index
8th Sutol Conference, November 2016
Connect to Cloudant
8th Sutol Conference, November 2016
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
8th Sutol Conference, November 2016
Connect to Cloudant
• Credentials
• Account, necessary for the OSGi plugin
8th Sutol Conference, November 2016
Connect to Cloudant
• It is JSON everywhere
• _rev and _id are reserved
parameters
• doc{}, is the actual data
from application
8th Sutol Conference, November 2016
Cloudant connector
• Storing in and retrieving from Cloudant
• Accessed from Java backend.
• Will take out the security issues.
• Do the heavy lifting.
• Don't reinvent the wheel.
8th Sutol Conference, November 2016
Cloudant @ XPages
8th Sutol Conference, November 2016
Cloudant @ XPages
8th Sutol Conference, November 2016
Cloudant @ XPages
8th Sutol Conference, November 2016
Cloudant @ XPages
• Repeat in XPages
• columns - values from Job class
8th Sutol Conference, November 2016
Cloudant @ XPages
• JobController -
getJobs
8th Sutol Conference, November 2016
Cloudant @ XPages
• Job Java Class
8th Sutol Conference, November 2016
Cloudant @ XPages
• CloudantDAO
8th Sutol Conference, November 2016
Cloudant @ XPages
• CloudantService - connect
• Find the data in Cloudant
8th Sutol Conference, November 2016
Cloudant @ XPages
• Job JSON in Cloudant
8th Sutol Conference, November 2016
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
8th Sutol Conference, November 2016
Attachment @ Cloudant
• AttachmentDAO
8th Sutol Conference, November 2016
Attachment @ Cloudant
• AttachmentController
• Convert upload to
Attachment object
8th Sutol Conference, November 2016
Attachment @ Cloudant
• ControllerBase
• All controllers can
use these methods
8th Sutol Conference, November 2016
Attachment @ Cloudant
• Servlet is called in application for
download
• base64 data for the image tag
8th Sutol Conference, November 2016
RichText @ Cloudant
• Stored as MultiMimePart
8th Sutol Conference, November 2016
RichText @ Cloudant
• Which is nice converted to
JSON ;-)
8th Sutol Conference, November 2016
Search @ Cloudant
• Search example, filter the view
8th Sutol Conference, November 2016
Search @ Cloudant
• Do the search in the Controller, call
DAO
8th Sutol Conference, November 2016
Search @ Cloudant
• Search method calls the
CloudantService
8th Sutol Conference, November 2016
Search @ Cloudant
• CloudantService calls connector to get
the data
8th Sutol Conference, November 2016
Search @ Cloudant
• CloudantService calls connector to get
the data
8th Sutol Conference, November 2016
Search @ Cloudant
• Cloudant job ftSearch index
8th Sutol Conference, November 2016
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
8th Sutol Conference, November 2016
8th Sutol Conference, November 2016
Thank you
8th Sutol Conference, November 2016

A (XPages) developers guide to Cloudant

  • 1.
    8th Sutol Conference,November 2016 A (XPages) developers guide to Cloudant Frank van der Linden
  • 2.
    8th Sutol Conference,November 2016
  • 3.
    8th Sutol Conference,November 2016 About me • Freelance Java and web developer, with XPages experience • …..and JEE technologies • Owner of Elstar IT • Frequent (trail)runner
  • 4.
    8th Sutol Conference,November 2016 Roadmap • Introduction to Cloudant • Inside Cloudant • Connect to Cloudant • Cloudant @ XPages
  • 5.
    8th Sutol Conference,November 2016 Why Cloudant • For HR Assistant wanted to try a new datastore
  • 6.
    8th Sutol Conference,November 2016 Introduction to Cloudant
  • 7.
    8th Sutol Conference,November 2016 What is Cloudant • It is the cloud version of CouchDb • It is document based • CouchDb is created by Damien Katz • Cloudant is bought by IBM • Is like MongoDb or NSF a NoSQL datastore
  • 8.
    8th Sutol Conference,November 2016 What is Cloudant • Data stored as JSON • View and Search ‘formula’ with javascript • Replication • Tasks • Build in API • No annoying limitations
  • 9.
    8th Sutol Conference,November 2016 Cloudant as service • Cloudant can be added as service in BlueMix
  • 10.
    8th Sutol Conference,November 2016 Cloudant standalone • Via website, https://cloudant.com cloudant.com
  • 11.
    8th Sutol Conference,November 2016 Inside Cloudant
  • 12.
    8th Sutol Conference,November 2016 Inside Cloudant
  • 13.
    8th Sutol Conference,November 2016 Inside Cloudant • View mapping • Search index
  • 14.
    8th Sutol Conference,November 2016 Connect to Cloudant
  • 15.
    8th Sutol Conference,November 2016 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.
    8th Sutol Conference,November 2016 Connect to Cloudant • Credentials • Account, necessary for the OSGi plugin
  • 17.
    8th Sutol Conference,November 2016 Connect to Cloudant • It is JSON everywhere • _rev and _id are reserved parameters • doc{}, is the actual data from application
  • 18.
    8th Sutol Conference,November 2016 Cloudant connector • Storing in and retrieving from Cloudant • Accessed from Java backend. • Will take out the security issues. • Do the heavy lifting. • Don't reinvent the wheel.
  • 19.
    8th Sutol Conference,November 2016 Cloudant @ XPages
  • 20.
    8th Sutol Conference,November 2016 Cloudant @ XPages
  • 21.
    8th Sutol Conference,November 2016 Cloudant @ XPages
  • 22.
    8th Sutol Conference,November 2016 Cloudant @ XPages • Repeat in XPages • columns - values from Job class
  • 23.
    8th Sutol Conference,November 2016 Cloudant @ XPages • JobController - getJobs
  • 24.
    8th Sutol Conference,November 2016 Cloudant @ XPages • Job Java Class
  • 25.
    8th Sutol Conference,November 2016 Cloudant @ XPages • CloudantDAO
  • 26.
    8th Sutol Conference,November 2016 Cloudant @ XPages • CloudantService - connect • Find the data in Cloudant
  • 27.
    8th Sutol Conference,November 2016 Cloudant @ XPages • Job JSON in Cloudant
  • 28.
    8th Sutol Conference,November 2016 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.
    8th Sutol Conference,November 2016 Attachment @ Cloudant • AttachmentDAO
  • 30.
    8th Sutol Conference,November 2016 Attachment @ Cloudant • AttachmentController • Convert upload to Attachment object
  • 31.
    8th Sutol Conference,November 2016 Attachment @ Cloudant • ControllerBase • All controllers can use these methods
  • 32.
    8th Sutol Conference,November 2016 Attachment @ Cloudant • Servlet is called in application for download • base64 data for the image tag
  • 33.
    8th Sutol Conference,November 2016 RichText @ Cloudant • Stored as MultiMimePart
  • 34.
    8th Sutol Conference,November 2016 RichText @ Cloudant • Which is nice converted to JSON ;-)
  • 35.
    8th Sutol Conference,November 2016 Search @ Cloudant • Search example, filter the view
  • 36.
    8th Sutol Conference,November 2016 Search @ Cloudant • Do the search in the Controller, call DAO
  • 37.
    8th Sutol Conference,November 2016 Search @ Cloudant • Search method calls the CloudantService
  • 38.
    8th Sutol Conference,November 2016 Search @ Cloudant • CloudantService calls connector to get the data
  • 39.
    8th Sutol Conference,November 2016 Search @ Cloudant • CloudantService calls connector to get the data
  • 40.
    8th Sutol Conference,November 2016 Search @ Cloudant • Cloudant job ftSearch index
  • 41.
    8th Sutol Conference,November 2016 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
  • 42.
    8th Sutol Conference,November 2016
  • 43.
    8th Sutol Conference,November 2016 Thank you
  • 44.
    8th Sutol Conference,November 2016