elstar IT

Fullstack | Java | Tech Speaker | Tech Coach | Frank van der Linden

  • About me
  • Blog license
  • My Open source projects

Cloudant-connector for XPages

04-04-2016 4 responses flinden68 bluemix community development

ibmcloudant
At Engage I was triggered by a great session of Niklas Heidloff of all the goodies on BlueMix. He was mentioning Cloudant, which is used for Node-Red, and simularities with the Notes Database. Like documents, views and even replication.

Not that weird as you start looking closer, Cloudant is the cloud version of CouchDb. Which is invented by Damien Katz, who also was involved by the creation of the NSF.

I found on the internet a very nice easy to use open source project, Java-cloudant, who is doing the heavy lifting in the interaction with Cloudant.

The plugin

I have added in the plugin the most basic interactions with the Cloudant, like CRUD for a single document, CRUD bulk for documents and some databases interaction.

Everything starts with the creation of a CloudantConnector instance, which needs the account, username and password to setup the connection

CloudantConnector connector = new CloudantConnector(account, username, password);

The database interactions, currently in the plugin

List dbs = (List) connector.findAllDatabases();
connector.setDatabase(String dbName, boolean create);
connector.createDb(String dbName);
connector.deleteDb(String dbName);

To interact with documents,there is a need to set a specific database. Where the create parameter is a boolean. If true, the database will be created if not existing.

connector.setDatabase(String dbName, boolean create);

The CRUD interactions for a single Document and bulk documents.

connector.createBulk(List objects);
connector.updateBulk(List objects);
connector.deleteBulk(List objects);
List list = connector.findAllDocuments(Object.class);
List list = connector.findAllDocumentIds();

connector.save(final Object obj);
connector.delete(final Object obj);
connector.update(final Object obj);
Object obj = connector.find(Class cls, String id);

 

An example

Below I get all my notifications from a cloudant database on BlueMix

blue mix-cloudant-xpages

 

Where is the code

I have open sourced the code in GIT repository on Bitbucket. Inside is the plugin, but also the update site which can be imported in an Update Site Database on a Domino Server. For more information see the ReadMe in the repository.

 

Contribute

If there is a need for other methods, let me know in the repository issues section, or better contribute to the project by making a fork of the repository and afterwards make a pull request.

 

Happy coding….

Tags: BlueMix, cloudant, development, xpages

4 thoughts on “Cloudant-connector for XPages”

  1. Fredrik Norling says:
    05-04-2016 at 06:24

    Great Frank, perhaps consider releasing thru openntf.org 😉

    Reply
  2. Niklas Heidloff says:
    05-04-2016 at 06:52

    Very nice, Frank!

    To make it even simpler to consume this in XPages it would be good to have Cloudant data sources, similarly as done for relational:
    https://github.com/OpenNTF/XPagesExtensionLibrary/tree/master/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.relational/src/com/ibm/xsp/extlib/relational

    Reply
    1. Frank van der Linden says:
      05-04-2016 at 12:34

      I will have a look and try to implement it

      Reply
  3. Pingback: Update on my Cloudant connector for XPages - elstar IT

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • « Hello Jackson4XPages f.k.a Jackson JSON wrapper
  • Update on my Cloudant connector for XPages »

Contact me

My name is Frank van der Linden and I am an independent software developer based in the Netherlands. The last 2 years I was awarded as IBM Champion. Also I am on the board of OpenNTF. My specialisations are Java, Web development and Domino.


If you want to hire me, please fill in the Contact form


IBM Champion web badge
Apache Logo

All the code on this blog are under the Apache License 2.0. For more details, see Apache License 2.0

Most recent posts

  • Engage 2020: Hello are you listening, There is stream for everything
  • Spring Cloud Function on Azure run locally
  • Deploy Spring Cloud Function to IBM Cloud
  • Speaking (again) at Engage in a Zoo
  • Congratulations, you’re an IBM Champion (again)!

Latest reactions

  • Spring Cloud Function on Azure run locally - elstar IT on Deploy Spring Cloud Function to IBM Cloud
  • flinden68 on Quick XPages tip: add Fullcalendar plugin to your application
  • Rajesh samal on Quick tip: Swagger support for Spring Webflux
  • dsieyx on Quick XPages tip: add Fullcalendar plugin to your application
  • John on Named as IBM Champion 2019

Archive

  • March 2020
  • February 2020
  • January 2020
  • October 2019
  • September 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • October 2018
  • September 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014

Category

  • bluemix
  • business
  • cloudant
  • community
  • development
  • hrassistant
  • openntf
  • running
  • salesforce
  • Springboot
  • Tesla
  • trailrunning
  • Uncategorized
  • watson
  • OpenNTF
  • Collaboration Today
  • XSnippets
  • Stackoverflow
  • IBM Collaboration Solutions
  • Social Business Toolkit
  • About me
  • Dutch curriculum vitae
  • English curriculum vitae
  • Google+
  • LinkedIn profile
  • Twitter
  • Slideshare
  • Blog license
  • My open source projects