Subject: Product-quality approach; contacts location
I’m not entirely clear whether you’re writing a component for a commercial product or coding something for a specific environment. The reason that’s important is that there are some trade-offs that might be acceptable in a controlled environment that won’t wash for a boxed product. Let’s assume you do want to write code for a boxed product.
The next thing to look at is where these contacts documents you’re interested in might reside (and how you might be able to tell if they’ve been modified).
Traditionally Notes has stored contacts in the client’s local names.nsf, to which server code will not have access. More recently, several server-side contacts stores have emerged.
In Domino 6.5, the concept of Notes roaming was introduced, and one side effect of this is that a replica of each user’s names.nsf is stored on a Domino server. The downside is that the majority of companies have not chosen to implement Notes roaming.
Around the same time, the Domino Web Access mail template added a capability for users to sync contacts between the local names.nsf and the server-based mail database. There are two drawbacks here: users needs to be set up with the DWA template, and need to manually sync their contacts. Even so, this would be a more generally acceptable approach than requiring roaming.
Finally, in Notes and Domino 8, syncing contacts to the mail file has just about become part of the replication process. However, it still needs to be enabled for users, although this can be achieved via policies (some bugs here).
Now that we know where the contacts might be, we want to look at our options for detecting when they’ve changed. In roughly decreasing order of acceptability to enterprise environments the options appear to be:
-
Find a hook from the contact update process that can be used to trigger your code running in a separate database or via a Java program installed on the server. The key thing here is to avoid modifications to the mail and address book templates. Sounds good, but this hook may not exist.
-
An agent in a separate database or a stand-alone Java program installed on the server that scans mail files (or roaming address books) for the kind of changes you want to track.
-
Event-based code in the mail database template that hooks into an event triggered by a contact update and writes a UNID to a central database. Process new notifications in the central database either with an agent or a standalone Java program. This is like the first option, but accepts the need to modify the mail template.
-
PostSave event-based code in the personal address book template that sends some notification to a central database. This approach has two big flaws: it requires code running in every user’s names.nsf, and that code has to find a way of conveying the update data from the client to your central app.
-
A scanning agent that runs on schedule in each mail database. This one isn’t likely to fly. There won’t be many server administrators who would sanction a scheduled agent running every 10 mins in each of 1000 mail files.
Perhaps, we can get an idea of how best to approach this by looking at how others have handled it. Blackberry Enterprise Server 4.0+ can sync users’ contacts from the Domino server so long as they either use the DWA contact sync feature or are set up for roaming. As far as I remember, this is handled by the BlackBerry Messaging Agent, which is a C++ or Java executable running on the server. I imagine this executable does the work of scanning the mail and address book databases for changes on a frequent schedule (~10 mins); it doesn’t appear to be event-driven.
Hope that gives you some ideas about how to approach this!
Rupert Clayton
Chicago