The following two samples demonstrate how to add Notes early startup and late shutdown custom processing. It is expected that the custom code runs quickly as it will have an overall effect on the client startup and shutdown performance. When the startup and shutdown hooks are triggered, the NSF services are not running and the end-user is not authenticated. Example uses for adding custom processing include but are not limited to configuring notes, performing a migration step, such as cleanup of outdated settings, and simple roaming for custom settings.
The Notes lifecycle on Windows begins with notes.exe and nlnotes.exe; the lifecycle ends with the termination of the Java runtime. The following samples include code for both the front-end and back-end of the lifecycle. This code will interest those that are interested in knowing how to hook-in to the Notes lifecycle at a low level. For those that are not interested in the low-level hooks, but that are nonetheless interested in adding custom startup and shutdown processing, the sample also includes a way to run custom script.
The startup code sample demonstrates how to hook-in early to the notes startup process at the point where the Notes operating system layer is initialized, no databases are open, and the end-user has not yet authenticated. It is at this point where updating Notes data directory files can occur. Early startup relies on the Notes Extension Manager triggering custom code. The hook-in code is executed synchronously. Best practices indicate that your hook code runs as quickly as possible and pass execution back Notes to continue startup initialization. The sample is written in C and uses the Notes extension manager. It is guaranteed to run only once during startup.
A second example is included that demonstrates how to hook into the shutdown sequence at the point where the nlnotes process has exited and the Java process is about to exit. This sample is written as an Eclipse plug-in and relies on Eclipse early startup registration for registering a JVM shutdown hook that is triggered during the very last part of the shutdown sequence.
For development and testing, the shutdown plug-in can be installed into Notes through the file/application/install menu. When deploying your tested plug-in it is recommended to add it into the Notes kit. See 'Customizing the Notes install manifest for supplied Eclipse features' in the Domino 8.5 Administrator's Guide for more detail.
To run the samples, copy the startup.dll and startup.js to the notes directory and add the ExtMgr_AddIns=startp.dll setting to the notes.ini file. Next, start Notes and install the shutdown plugin from Notes using the file/applications/install menu and the following steps: (1) Search for new features to install; (2) add zip/jar location; (3) choose the shutdown_site.jar; (4) choose the shutdown feature; (5) follow additional prompts; (6) restart notes. When Notes is run, a start dialog message box will appear before any database is opened, and on shutdown a message box will appear after all dbs are closed.
In this sample, the default location for the startup.js script is in the Notes home directory. It is also possible to configure the startup and shutdown processing to use scripts in custom locations as shown in the settings below.
build.bat - build startup sample
initenv.bat - initialize build environment
readme.txt - this file
shutdown_project.jar - source for the shutdown plugin
shutdown_site.jar - update site for the shutdown plugin
startup.c - source to startup sample
startup.def - def file for startup sample
startup.dll - dll to test startup sample
startup.js - js to test startup sample
startup.mak - make file for startup sample
Richard Wilson is the author, Niklas Heidloff only committer.