Date post: | 16-Apr-2017 |
Category: |
Technology |
Upload: | frank-van-der-linden |
View: | 586 times |
Download: | 2 times |
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:[email protected]
• 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