Sametime business card data cache

The Sametime client has a cache of the information it has fetched from the business card (aka blackbox) system on a per user basis. This is both the textual data and the image data. In case your Sametime client displays stale data you can do one of two things:

  1. Right-click the contact and select “Refresh Person Info”. This will make Sametime refetch the data from the Sametime server.
  2. Clear the cache from disk.

In some cases option 1 wont work although it’s far far the easiest. I have seen this when changing the person image format (e.g. from jpg til gif). In this case you may need to clear the cache from disk.

So where is this cache? Well if you open the “workspace.metadata.pluginscom.ibm.collaboration.realtime.people.implPersonCache” directory beneath your Notes data directory you’ll see a directory per Sametime community you’re connected to. In each of these directories you’ll find

  • an .index file containing a list of the known users
  • an XML file per user with person info
  • a picture, if any, of the user

If you want to purge the cache for a community you can close the Notes client, clear the contents of the .index file (you may be able to delete the file altogether but I haven’t tried) and delete the xml and image files. When you restart Notes and hover over a Sametime contact the client will refetch the business card data.

Easy.

Sametime blackboxes and CommonField tag – keep your eyes open!

I have written quite a couple of posts about Sametime blackboxes over time on how to write your own and how to configure multiple blackboxes to fetch business card data from multiple sources. I wrote some articles in THE VIEW on the matter and I wrote the backbox used on the Bleedyellow site to fetch business card from Lotus Connections.

One of the critical pieces in the Sametime blackbox puzzle is the <CommonField CommonFieldName=”fieldname”/> tag from the userinfoconfig.xml (the file used to configure the blackbox system). This tag is used to indicate to the blackbox subsystem which field from the primary blackbox should be used to identify the user being queried in subsequent blackboxes. Unfortunately I have seen over the last couple of implementations I have done that this tag cannot be relied upon anymore.

In the last two implementations I have done I’m seeing that the UID from the context being sent to the secondary (and tertiary) blackbox is the distinguished name (i.e. the LDAP DN or Notes DN) rather than the e-mail address is specified in userinfoconfig.xml. These implementations are primarily based on Domino 8.0.2 and Sametime 8.0.1. In these implementations I have had to write code to “re-lookup” the e-mail address in LDAP based on the DN.

I’m trying to get IBM to react to this fact but no luck so far. I’ll keep you posted…

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.

Custom Sametime blackbox for bleedyellow.com

Over the last few days I have been working with Chris Whisonant from LOTUS911 / bleedyellow.com to write a custom Sametime blackbox for bleedyellow.com. In case you don’t know, a blackbox in “Sametime speak”, is what you write if you would like to get business card info from systems other than Domino Directory or LDAP.

This blackbox uses the DB2 JDBC drivers to plug into the Lotus Connections Profiles database at bleedyellow.com to get business card data from there. This means that if you update your bleedyellow.com profile with a photo your co-bleeders will now be able to see it when they hover their mouse over your name in Sametime.

Besides the photo we also surfase the blog-link and the timezone instead of company name and department as you can see in the screenshot below.

During my work with this blackbox and previous work I have done with the UserInfo API for two upcoming articles in THE VIEW on the same subject I have learned a lot of stuff, both good and bad, about the API. The API gives you a lot of flexibility but there are also major shortcomings so expect some blogging on this in the future. For now simply rejoice! 🙂

Now I invite you to update your Lotus Connections profile and share any comments you have on the hovering with me or Chris.

P.S.: I know there is a Lotus Connections plug-in for Sametime that provides hover-functionality from the Solution Catalog but I really wanted a server-based solution.

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