This application was submitted as part of the 2016 ICS Developer Competition. The OpenNTF Enterprise credentials were deactivated after the contest (which were used to demonstrate instance support), but the code remains as a useful representation of integrating with disparate services and Watson, as well as an example Darwino application.
The Social Analyzer is a J2EE+mobile application that allows for the collection of “social” data
in a community: tweets, Slack channel content, RSS feeds, and a Domino discussion database. Each
of these feeds can be configured and will be checked every 30 minutes; new content is downloaded
and added to the embedded Darwino database, which is then used for the browsing UI as well as by
several additional tasks.
The first task is a Watson Tone Analyzer task. It will periodically process new content in the
database and run it through Watson's Tone Analyzer, storing the results back in the DB. This data
is used in charts on the individual user pages and could be queried in the back-end SQL database
The second is a DashDB connector, which takes the tone-analyzed content and pushes it out to a
DashDB instance, where it can be queried by other Bluemix tools. One such example is using
an iPython Notebook, which uses code modified from an IBM blog example:
Darwino notebook: https://cdsx.ng.bluemix.net/data/notebooks/d22d1ded-c766-4801-b831-4c173204feca/view?access_token=434aea209034b34c2bc8df1d9999536d49415bb4bc78c779c5a7e7c06d0ce58a
The Social Analyzer is based on Darwino, and I've set up an Enterprise license for OpenNTF
in order to properly use the instance-enabled features (used for its nature as a Connections
Cloud widget). The credentials are:
(credentials removed after contest)
This will primarily be useful for Maven access, and I've included a file named “settings.xml”
in the config folder. This file should go inside a folder named “.m2” in your user home directory
for Maven to find it.
The Darwino Studio for Eclipse and the Domino adapter can be acquired by going to https://darwino.com,
logging in with the above credentials, and going to https://www.darwino.com/downloads/ - choose
the Enterprise Edition.
The app itself is a set of Maven projects, consisting of a root project, a “shared” project of
the business logic, a “webui” project of the web assets, and then target-platform projects for
J2EE, Android, iOS, and SWT. The J2EE is the main way to use the application for its purposes.
The application can be deployed to Bluemix or to a local J2EE server (Tomcat, for example). In
either case, it will need some configuration in a properties file as well as an accompanying
SQL database server (Postgres is recommended). If the application is imported into Eclipse,
the J2EE project can be run on a set up server normally.
On Bluemix, the database can be set up by attaching an instance of “PostgreSQL by Compose-ii” to
Locally, the best route is to set up a stock PostgresSQL server from https://www.postgresql.org/download/
(the most recent non-release-candidate version works well) and then configuring it using a
local “darwino-beans.xml” file. There is an example of this file in the “config” directory;
it should be modified to use an appropriate server name in the JDBC URL and then placed in the root
of a Tomcat installation folder.
In either case, it will be important to configure the application with service credentials,
which is done in the “darwino.properties” file. For local installations, this file can be placed
alongside the “darwino-beans.xml” file in the root of a Tomcat installation. For Bluemix,
these settings can be added to the “darwino.properties” or “darwino.bluemix.properties” files
in the “social-analyzer-j2ee” application, in “webapp/WEB-INF”. For the supporting Bluemix services,
they will require authentication credentials and locations from the instantiated services from
the Bluemix dashboard. For the Domino Discussion connection, it will require a running Domino
server with a Discussion Database adapter set up.
Use as a Connections Cloud widget
The application is intended to be embedded in a Connections Cloud (apps.collabservnext.com)
environment by hosting it on an HTTPS-capable web server (such as Tomcat with an SSL certificate)
and creating a widget application. There is a JSON file in social-analyzer/social-analyzer-j2ee
that contains the content necessary to publish, pointing to a Bluemix demo instance we have
set up. If you install the Darwino Studio, it will allow you to configure Connections Cloud
credentials in preferences and then publish this file via its right-click menu.
This will require setup within the Connections Cloud to register the Social Analyzer as
an approved OAuth application, which can be done via https://apps.collabservnext.com/manage/account/isv/input
(which is in the Administration panel, then “Internal Apps”). The credentials generated there
should be specified in the “darwino.properties” file.
To add a Twitter feed, it will require the four tokens from Twitter's API setup. That can be done by
logging in and adding an app here: https://apps.twitter.com . That will list the tokens to use, which
can then be pasted into the Twitter feed setup inside the application. The remaining field, the query,
is a semicolon-delimited list of search queries, such as “#xpages; #openntf”.
Similar to Twitter, Slack integration is done by generating a token for your user+community pairing. In this
case, they should just be the development test tokens, which can be set up via
https://api.slack.com/docs/oauth-test-tokens . The remaining field is a semicolon-delimited list of
channel names, such as “beginners; general”.
RSS is simpler than the others: just provide a URL for an RSS or Atom feed (the feed URL directly - it doesn't
do RSS-client-style auto-detection based on root URLs). If it's available and the app can read it
(Java can be finicky about SSL certificates sometimes), it will read in the content.
Services: Domino Discussion database
The Domino Discussion Database service piggybacks on top of Darwino's Domino replication capability.
If this is set up and the app replicates in content from a discussion database, then enabling the service
in the configuration will cause it to process the replicated-in data.
The replication can be configured by setting up a Domino server for Darwino replication and then adding
an adapter named “socialanalyzer” using the provided “socialanalyzer.groovy” file for the DSL code. The
main potential adjustment to make would be to set the “nsfName” parameter to the file path of a discussion
database on the server. In the example, it's pointing to a copy of the IBM NotesWeb ND8 forum - any of those
public forums would work, as would any DB based on the standard discussion database template.
To set up the Domino server, install the included Update Site onto a 9.0 or above server and then create a new
database named “darwinosync.nsf” using the included NTF. Restart HTTP, sign the new database, and open it
via the web to configure the database adapter. These files and further instructions are in the Darwino download
ZIP in the “connectors/domino” folder.