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.

More on Sametime blackboxes

I was at a customer site today and among other things I was asked to take a look on a Sametime business card issue they were having with a custom blackbox. The issue was that the picture was not showing up in Sametime. They did already have a PMR open with Lotus Support but they had been unable to solve the issue.

The customer is using the “custom” blackbox implementation (com.ibm.sametime.userinfo.userinfobb.UserInfoNotesCustomBB) provided by IBM Lotus as part of Sametime 7.5.1 where you can specify a database path, a view and some field names in the UserInfoConfig.xml and the rest is taken care of for you. While this is well and good it still didn’t work. The problem was trivial to solve but it was difficult to explain why it simply didn’t work.

The issue was that the attributes used to specify the database path and view name are case sensitive!! The customer had simply followed the XML convention of using lowercase attribute names which turned out to be wrong. When you use this implementation the database attribute *has* to be called “DbName” and the view attribute *has* to be called “View”. If you get the casing wrong it wont work!

New PMR coming up – change the implementation of the class to make the attribute names case insensitive. Or read the article in THE VIEW 2008 Technical Supplement to see how to easily write your own blackbox… 🙂

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).

What’s up with the “me too” articles on developerWorks?

After reading the last installment in an article series on Notes 8 development on developerWorks I have to wonder how many articles they (developerWorks) need to publish on creating simple plug-ins, building features and publishing them using an update site. This is already extensively covered as part of the Eclipse development articles both on developerWorks and on eclipse.org/articles.

In my mind a good example of bringing something new to the table is the article on leveraging the current context in Notes 8 (Leveraging user context in the IBM Lotus Notes V8 sidebar and toolbar). That’s new. That’s something I wanna do. It still uses the first third configuring and setting up stuff but still it’s new.

Why not try some more concrete examples that actually cover some of the things that IBM bring to the table in Notes 8 / Sametime 7.5 / Expeditor or some of the areas that is going to cause problems? Suggestions could be:

  • Using the components of Expeditor e.g. the message broker and the web services engine
  • Building Notes UI’s using SWT components
  • Making your SWT components look the ones supplied by IBM
  • Communicating with the Notes application from your features/plug-ins

The above suggestions aren’t great but I’m dying to read articles on Notes 8/Sametime 7.5 that doesn’t spend the better half explaining the same ol’ concepts as have been explained so many times before…