Sametime blackbox – update needed for Lotus Connections 2.0

I wrote a number of articles in THE VIEW some time back on writing custom Sametime blackboxes (see the March/April and May/June 2008 issues). If you implemented the Sametime blackbox that read data from Lotus Connections (like it’s done on bleedyellow.com) and you have upgraded (or are planning to upgrade) to Lotus Connections 2.0 this post is for you.

The database schema for Lotus Connections 2.0 has changed slightly in comparison with Lotus Connections 1.0.x so if you’re using a custom Sametime blackbox to read data from Lotus Connections it needs to be changed. The only thing that needs to change is the SQL since the key column in the EMPINST.PHOTO table has been renamed from PROF_UID to PROF_KEY (hightlighted in the SQL below).

SELECT EMPL.PROF_UID UID, PROF_DISPLAY_NAME DSP_NAME, PROF_MAIL_LOWER EMAIL, PROF_MOBILE MOBILE, PROF_PAGER PAGER, PROF_TITLE TITLE, PROF_TIMEZONE TIMEZONE, PROF_TELEPHONE_NUMBER PHONE, PROF_BLOG_URL BLOG_URL, EMPL.PROF_DEPARTMENT_NUMBER DEPT_NO, DEPT.PROF_DEPARTMENT_TITLE DEPT_NAME, EMPL.PROF_ORGANIZATION_IDENTIFIER ORG_IDENT, ORG.PROF_ORGANIZATION_TITLE ORG_NAME, EMPL.PROF_ISO_COUNTRY_CODE CTRY_ISOCODE, CTRY.PROF_COUNTRY_DESC CTRY_NAME, P.PROF_IMAGE PHOTO_BYTES, P.PROF_FILE_TYPE PHOTO_MIMETYPE FROM EMPINST.EMPLOYEE EMPL LEFT OUTER JOIN EMPINST.PHOTO P ON EMPL.PROF_KEY=P.PROF_KEY LEFT OUTER JOIN EMPINST.DEPARTMENT DEPT ON EMPL.PROF_DEPARTMENT_NUMBER=DEPT.PROF_DEPARTMENT_CODE LEFT OUTER JOIN EMPINST.COUNTRY CTRY ON EMPL.PROF_ISO_COUNTRY_CODE=CTRY.PROF_ISO_COUNTRY_CODE LEFT OUTER JOIN EMPINST.ORGANIZATION ORG ON EMPL.PROF_ORGANIZATION_IDENTIFIER=ORG.PROF_ORGANIZATION_CODE WHERE EMPL.PROF_MAIL_LOWER=?

Part 2 of the blackbox article published

The second and final article in my series on Sametime blackboxes (Configuring the Sametime business card system, Part 2: Reach more data with custom blackboxes) has been published at the THE VIEW website and will be out in the May/June issue.

Where as the first article primarily focused on configuration and setup of the blackbox system the second article describes how to develop your own custom blackbox implementations. One of the blackboxes I describe is the one I developed for the bleedyellow.com Sametime server. This implementation retrieves business card data from Lotus Connections.

THE VIEW 2008 Technical Supplement available for download


THE VIEW 2008 Technical Solutions Supplement is now available for download from THE VIEW at no charge. Although you will likely pick up a hardcopy at some conference this year it never hurts to have the PDF as well. The supplement features a short piece by yours truly called “Use a blackbox to bolster your Sametime Connect buddy list with business card data”.

Download THE VIEW 2008 Solutions Supplement

Article draft of to THE VIEW

Just shot of an e-mail with a draft of my next article for THE VIEW. The working title is “Into the blackbox – a tour of the Sametime Business Card system” and will discuss and describe the business card system, a.k.a. UserInfo, of Sametime and how to configure, mix and match blackboxes and how to write your own blackbox implementations. The article is a little less development focused than I’m used to but I still managed to sneak in some Java code… 😉

No word yet on when it’s gonna be out but I’m guessing the March/April 2008 issue.

Sametime blackboxes (update)

Just a short update on my Sametime blackboxes post from earlier today.

As noted by Julian Robichaux and Urs Meli in comments I had a typo in the previously posted code as I had managed to insert the wrong looping code twice… 😦 The correct, correct looping should be:

public static void main(String[] args) {
   LinkedList l = new LinkedList();
   for (int i=0; i<10; i++) {
      l.addLast(new Simple(i));
   }
   while (l.size() > 0) {
      System.out.println("" + ((Simple)l.removeFirst()).getI());
   }
}

Sametime blackboxes

This week I have been writing an article on writing custom Sametime blackboxes for THE VIEW 2008 Technical Supplement and during my research I have stumbled across of number of interesting things. One of them is quite serious so I thought I ought to share.


You might not know this but when you hover your mouse over a contact in Sametime Connect 7.5 the data from the business card is actually retrieved using a servlet on the Sametime server. This servlet in turn uses a number of so-called blackboxes to fetch the actual information. You can write your own blackbox implementation using an API provided by IBM Lotus to fetch the business card data from another data source than the Sametime directory (whether that be Domino or LDAP).

First of all let me say that I like the idea of the blackbox API and that it makes total sense that I can extend the Sametime Connect business card system.

There is just two caveats I would like to point your attention to:

  1. The configuration file you edit is IBM Confidential
  2. The lifecycle methods are not called consistently

Configuration file

Blackbox configuration is done in a file called UserInfoConfig.xml in the Domino binary directory. On the top of this file there is a header saying that the file is IBM Confidential which to me is crazy since it’s for configuration and is publicly available.

Anyway this is just funny – the second part is worse.

Lifecycle methods

The interface you extend to write a blackbox has an init() method which is called once the blackbox pool is constructed and a terminate() method which is supposedly called upon blackbox termination. And here lies the problem – the terminate() method is only called for half the blackboxes. This is found out using a simple blackbox that writes to the Domino console once the different methods are called.

This effectively means that the whole lifecycle management cannot be used at all. The methods are there, I gather, to allow you to acquire long-lived resources in the init() method and assure their termination in the terminate() method. If the terminate() method isn’t called this can lead to resource leaks which isn’t very nice. What’s worse is that they can be very hard to diagnose.

I have found the problem in the blackbox pool code and it is a typical novice programmer mistake. Consider the following code:

import java.util.LinkedList;

public class RookieLooping {

   public static void main(String[] args) {
      LinkedList l = new LinkedList();
      for (int i=0; i<10; i++) {
         l.addLast(new Simple(i));
      }
      for (int i=0; i<l.size(); i++) {
         System.out.println("" + ((Simple)l.remove(i)).getI());
      }
   }

   public static final class Simple {
      private int i = 0;
      public Simple(int i) {
         this.i = i;
      }
      public int getI() {
         return i;
      }
   }
}

This code will result in the following output:

0
2
4
6
8

This isn’t what the programmer expected. He/she probably expected something like this:

0
1
2
3
4
5
6
7
8
9

If you look at the code you can probably see why. The for-loop used to remove elements from the LinkedList is the source of the problem. It only considers every second element of this list. A correct implementation could be (although there are numerous ways of doing it):

public static void main(String[] args) {
   LinkedList l = new LinkedList();
   for (int i=0; i<10; i++) {
      l.addLast(new Simple(i));
   }
   while (l.size() > 0) {
      System.out.println("" + ((Simple)l.removeFirst()).getI());
   }
}

I have reported this problem to IBM Lotus Support but for now, as of Sametime 7.5.1 CF1, you cannot rely on the terminate() method being called.

Just beware… (I have reported the issue to Lotus Support and is awaiting a SPR number).

New THE VIEW article is out!

I’m happy to say that my newest article is online at THE VIEW website. The article is on managing and provisioning lotus.domino.Session objects to plug-ins in Sametime Connect 7.5.1 – a subject that’s a little tricky due to the native code underneath the Notes/Domino Java API and due to the way that classloaders work in Sametime Connect/Expeditor.

For the ones who’s already on Sametime 7.5.1 please see the errata (https://lekkimworld.com/theview_sametime).

Article abstract:

Take the mystery out of providing multiple Notes sessions from Sametime Connect. Plug-in developers find that running multiple Sametime plug-ins that access Notes at the same time is tricky; the reasons are due to how the Sametime 7.5 Java application-programming interface (API) differs from the one Notes uses, and how Java class-loaders load native library code on Windows. The solution provided in this article uses a bundled group of plug-ins, invisible to connect users, for managing lotus.domino.Session objects across other plug-ins. You also learn how to achieve fast plug-in deployments with automatic Connect configuration, plus easier plug-in maintenance. The solution code is available for download at THE VIEW Web site.