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.
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);
Below I get all my notifications from a cloudant database on BlueMix
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.
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.