Want to join me in building a better Notes Java API?

One of the things that are the hardest for Notes Java developers transitioning to developing plug-ins for Notes 8 is handling threading. All access to the Notes backend classes must occur on the Notes thread using NotesJob or a thread statically initialized using NotesThread.sinitThread. This is cumbersome and prone to runtime exceptions making the development process slow and agonizing. Also most interaction is started from the UI thread making the need for handling the Notes thread all too common.

A far better approach, IMHO, would be to not require the programmer to handle the threading all together as there are solutions for this readily available. The solution isn’t hard to do.

In an effort to prove this point I sat down for an hour or so at Lotusphere (I know I’m behind in blogging this) and cooked up a wrapper API that wraps the Notes API and provides access to the Notes backend classes without the need to worry about threading. The Notes API is made up of interfaces which makes it even easier.

The whole concept with the wrapper is that the user can write code like this in an event handler

public void widgetSelected(SelectionEvent event) {
  try {
    // get value
    Session session = NotesPlatform.getInstance().getSession();
    Database db = session.getDatabase(null, "names.nsf");
    View v = db.getView("($People)");
    ViewEntryCollection vec = v.getAllEntries();

    // set value in label
    lblCount.setText("Found " + vec.getCount() + " contacts...");

    // return from event
    return;

  } catch (Exception e) {
    StringWriter sw = new StringWriter();
    e.printStackTrace(new PrintWriter(sw));
    txtException.setText(sw.toString());
  }
}

instead of doing stuff like this which includes two extra jobs and having to make sure that no Notes API access is done from the UI thread:

public void widgetSelected(SelectionEvent event) {
  // kick of Notes job to get data
  new NotesJob("Some job") {
    public IStatus runInNotesThread(ProgressMonitor m)
                               throws NotesException {
      // get value
      Session session = NotesPlatform.getInstance().getSession();
      Database db = session.getDatabase(null, "names.nsf");
      View v = db.getView("($People)");
      ViewEntryCollection vec = v.getAllEntries();

      // get count into final variable
      final int count = vec.getCount();

      // kick of new UI job to update UI
      new UIJob("Update UI") {
        public IStatus runInUIThread(IProgressMonitor monitor) {
          // set value in label
          lblCount.setText("Found " + count + " contacts...");
          return Status.OK_STATUS;
         }
      }.schedule();

      // return
      return Status.OK_STATUS;
    }
  }.schedule();

  // return
  return;
}

Besides being shorter code-wise the former code is also much easier to read and understand. The performance of the former is somewhat slower than the latter (“native” API) due to context switching but the fact that I could do this is 60 minutes proves that something can and should be done to make plug-in development easier. Imagine what could be done in more time. Tweaking for performance should be possible and easy enough. Also using this wrapper API could be a choice the developer makes – ease of use over performance… It could be a call I as a developer was willing to make.

This could actually be a good idea for a project on OpenNTF. If anyone is interested to join up on the project let me know – I’ll be interested in joining forces with someone.

Tomorrow I’ll blog about how this is done and just how easy it is.

TwitNotes – v. 1.0.7 is out

Just uploaded TwitNotes v. 1.0.7 to the update site. It’s just a small bug fix release that fixes some minor things:

  • Easier searching by responding to pressing the Enter key on the Search tab
  • Make sure all profile images are scaled to 48x48px to handle too large images (looking at you @marybethraven)
  • Attempt to fix wordwrap issue on Ubuntu – still working on that

Thanks to Brian Leonard from IBM for providing a widget descriptor to make installation a lot easier. Simply drag the link to your MyWidgets sidebar plug-in to install.

Developing plug-ins for Notes 8.0.x, Notes 8.5, Sametime 8.0.x and Sametime 7.5.x

I received an e-mail from Dirk Jebing on my blog post on deploying TwitNotes in Sametime and how I was having deployment problems due to an exception being thrown. This is a long time ago but Dirk now found the solution which actually turned out to be a close cousin to my Cross compiling sidebar plugins for Notes 8.0.x and Notes 8.5 post.


Hi Mikkel,

at least for my plugin I could solve this! The two steps I did (perhaps it may help you):
1) I realized that I build my plugin with sametime 8.01 SDK. So I changed that (that did not help at all)
2) In the sametime logs my eye fell on an UnsupportedClassVersionError. So I changed the compiler compliance level (which stood on 5.0) to 1.4, as it has been with Sametime SDK 7.5.1. And now it works!

Cya, Dirk

So the lesson is to always watch for the JDK level of the client you’re developing for…

My take on the LotusLive Contacts Sync plug-in and how to install it more easily

I read Chris Tooheys post on the LotusLive contact sync plug-in for Notes 8 (LotusLive Notes Contacts Sync on Lotus Notes 8.5… and why you should care!) with great interest and was very happy to see they didn’t choose to make it a sidebar plug-in. Instead they chose a Tools-action which makes much more sense and which doesn’t take up space in the sidebar. Now it just needs a hook (extension point) into the replication API to sync when I replication with my servers – that would be very nice.

I haven’t really tested the plug-in thoroughly yet but I found it funny that I had to issue a cross certificate to a LotusLive certificate during the install (“CN=www.lotuslive.com/OU=Terms of use at www.verisign.com/rpa (c)05/OU=Lotus/O=INTERNATIONAL BUSINESS MACHINES CORPORATION/L=Phoenix/ST=Arizona/C=US/SerialNumber=DOC:19110616/XX=V1.0, Clause 5.(b)/XX=New York/XX=US”). This is the SSL certificate of the LotusLive.com site. I can actually install without cross-certifying but cannot restart the client until I create the cross-certificate. Maybe Lotus should choose a SSL certificate that is trusted by the Notes client by default.

To make it easier to install I created a LotusLive Contacts Sync widget descriptor which you can use to install the plug-in much more easily than doing the File/Application/Install dance.

To install from this either save the xml-file to your computer and drag it to the MyWidgets sidebar (or use a widget catalog) or drag the link directly to the sidebar.

How dynamic are your Notes sidebar plugins?

If you thought that the MyWidgets sidebar plug-in is doing some kind of dark magic to dynamically add sidebar plug-ins then think again. The purpose of my latest exploration into the World of Eclipse was to find out how I could do the same stuff. It wasn’t easy and took a while but it proved to be easier than I thought (once I knew how of cause). The plug-in I did is rather simple but shows how to dynamically add sidebar plug-ins and associate actions with it much like MyWidgets. If you want to see how it works check out the Flash movie. Now this has amazing possibilities…

As always – this isn’t your ol’ Notes client… 🙂

Thinking about improvements to TwitNotes – do you have any suggestions?


While I’m getting more and more absorbed into the twitterverse I’m also thinking about new ways to extend TwitNotes to make it even more useful in my day-to-day twittering. The search capability I added that hooks into Twitter search is nice but making searches persistent would be nice. By persistent I mean to have the option of having Twitter searches in separate, created-on-the-fly, sidebar plugins for easier reference. It might well be that it makes just as much sense to follow a hashtag as to follow your friends and your timeline. Also having separate access to your replies would be nice.

If you have comments and/or suggestions about improvements please drop me a comment or send me a direct message via Twitter. You can also simply reply to me.

Google Apps Update: February 24 Outage Postmortem

Following Ed Brills “VNUNet: What if Google Mail had been your corporate IT system?” post following the Google mail outage the other day I found it interesting, as a paying Google mail customer (for my private e-mail accounts), that I received an e-mail from Google during the night.


“Dear Google Apps customer,

Between approximately 9AM to 12PM GMT / 1AM to 4AM PST on Tuesday, February 24, 2009, some Google Apps mail users were unable to access their accounts. The actual outage period varied by user because the recovery process was executed in stages. No data was lost during this time. The root cause of the problem was a software bug that caused an unexpected service disruption during the course of a routine maintenance event. The root cause of this unexpected service disruption has been found and fixed.

<snip />

We will be extending a full 15-day SLA credit to all affected Google Apps Premier customers for the month of February. This credit will be applied to customer accounts automatically so there’s no action needed on the part of administrators.”

The e-mail goes on but at least they recognize that something went wrong…