I want to bring your attention to a blog entry by Bob Balfe called Labs for “Eclipse, extensions, composites and XPages!” are now available! The site he points to is really cool and has some very nice hands-on exercises on how to do composite applications incl. XPage components and Eclipse components. If you’re new to Composite Applications or want to brush up this is for you.
I get a lot of questions (via e-mail and IM) on how to get started with plugin development for the Lotus Notes platform. Instead of answering them all individually I thought I would (finally) write a general purpose blog post to try and answer these questions in general terms.
First of I’m sorry to say that the current state of affairs for someone who want to get started doing plugin development for the Lotus Notes platform is grim. There is as you might have experienced very little material available for programmers new to the Eclipse world to build stuff for Lotus Notes 8+ clients. To make things worse the material that is available often cut corners or simply start out too advanced. That being said I am hearing muffled voices mention some material being developed and that IBM Lotus is focusing on this matter but it will be yet some time before it’s out. Until that time and until we can upload information directly into the brain like martial arts skills are given to Nemo in The Matrix I suggest the following.
My suggestions for someone getting started would be to start by realizing that programming for Eclipse and hence in SWT for the Lotus Notes 8 client has nothing, what so ever, to do with traditional Notes programming. It sounds obvious but once you have accepted this it gets easier. Maybe not easier technically but easier to accept that this is a completely new field you’re venturing into. If nothing else you stop looking to IBM Lotus for help and instead turn to the Eclipse side of the internet.
Before you start to whine I think this is just fine and how it should be. Really. Initially most of the stuff you need to know to get started has nothing to do with IBM Lotus but is general purpose Eclipse development information. It’s like blaming Toyota for not telling you how to repair their cars. Toyota can be expected to tell you and document what’s so special about their cars. They can’t be expected to teach you the basics – you go to a car repair classes for that.
It’s the same with Eclipse development. Learn the basics and specialize from there. You could say that we could expect information about the various ways to extend the client to readily available and better documented. I’ll give you that… 🙂
Once you’re past that and before you embark on your journey first realize this. In Eclipse and SWT we build everything our selves and we’re left to the mercy of the client and the differences that exist across the different platforms (Notes 8.0.x vs. Notes 8.5 across Mac / Linux / Windows XP / Windows Vista / Windows 7). We’re close to the metal with all the benefits, worries and problems that entail.
So if I had to come up with an action plan for learning about Eclipse / Expeditor / Notes 8+ development it would be something like the following:
- Learn Java! Become proficient in Java! It sounds obvious but it’s one of the pillars for being successful in this area. Pay special attention to the following areas as they are used heavily when developing for Eclipse:
- Event publishing/subscription using listeners
- Anonymous inner classes
- Learn about GUI development in general. Resources for developing in Java SWING are just as good as those for SWT as many, if not all, of the concepts apply to both. UI development includes:
- Layout managers
- Threading and the concept on an UI thread. What should and shouldn’t you do on the UI thread!?
- Learn about Eclipse and the Eclipse platform for building RCP (Rich Client Platform) programs.
- Buy a book about it such as “Java Developer’s Guide to Eclipse, The (2nd Edition)“. It has been a good help to me.
- Stop by http://www.eclipse.org/articles and take a look at the articles there.
- Follow this blog 🙂
As you can see it’s no small adventure you’re starting into. The learning curve may be steep but it’s also rewarding to be able to extend the client beyond belief. If only you’d started learning Java earlier…
Props goes out to the Java UI Team (Ryan Baxter, Adam Geheb, Stanton Sievers) for publishing the Java UI API Exerciser plugin showing how to use the Java UI API for the Notes client. If you’re doing Java plugins for the Notes client you definitely want to check it out. Installation is also very easy because it’s signed and as such also serves as a showcase on how plugin deployment works when it’s fully transparent.
More info can be found on the catalog entry.
From time to time I come across some functionality I think should be part of the Notes client but isn’t. If it’s really a big pain point for me and I can implement it myself I do so as a Notes plugin. I’ve implemented a number of such plugins over time but few have ever been published. Since I get requests for similar functionality from time to time I decided to create a page and publish the functionality there as I find the time and dig out the code and polish it of. I envision the list growing over time so do come back! 🙂
If you got suggestions let me know.
Further reading: Notes 8 Utilities
Part of my new LotusScript.doc release is of course finding ways to make it even easier to use and use the API that’s now supplied as part of LotusScript.doc. Central to all this is extending DDE to make LotusScript.doc accessible in a variety of ways. Today I’ll show you how to add context, i.e. right-click, menus to the DDE navigator on the left as you can see below.
Doing this is actually very easy and only comprises of an IViewActionDelegate (the code; implement org.eclipse.ui.IViewActionDelegate) and a entry in plugin.xml to indicate where to stick the action. In this case it’s an objectContribution to org.eclipse.ui.popupMenus:
<extension point="org.eclipse.ui.popupMenus"> <objectContribution adaptable="true" id="com.lekkimworld.dde.navctxmenu.objectContribution" objectClass="org.eclipse.core.resources.IFile"> <action class="com.lekkimworld.dde.navctxmenu.MyContextAction" enablesFor="2+" id="com.lekkimworld.dde.navctxmenu.action" label="DDE context stuff (select min. 2 design elements)" menubarPath="additions" style="push"> </action> </objectContribution> </extension>
The above should be pretty much self-explanatory.
The example code is available for download as an Eclipse project: com.lekkimworld.dde.navctxmenu.zip
I read on planetlotus.org that the learning plug-in is available for download from the Domino wiki. For those who want to learn more about developing Notes 8 plug-ins please note that this is actually the sample plug-in from the Extending Sametime 7.5 Building Plug-ins for Sametime Redbook.
Unfortunately the Sametime 7.5 SDK doesn’t contain any information that I can find on how to use log and debug messages in custom plugins. Furthermore all the Sametime 7.5 articles on developerWorks I have seen use System.out which is really a no, no. This post contain some information on logging that I have found out myself – partly through looking around in the Sametime 7.5 Connect client installation and partly by trial-and-error.
FYI: I’m doing a fair bit of Sametime 7.5 plugin development at the moment. For one because it’s fun and second because I’m writing an article for THE VIEW (slated for the March/April issue) on Sametime 7.5 development.
Logging is at the heart of any development project whether that be a Notes database or a Java application. You can of cause resort to using System.out / System.err for logging but that’s clearly a no, no! If you are in doubt why I suggest you start here. Once you come to the conclusion that you really should be using a logging framework there basically is two options:
- java.util.logging (available directly in the JDK since JDK 1.4)
- Apache log4j
Many libraries will furthermore use Jakarta Commons Logging to isolate themselves from the underlying logging technology. In part because they cannot tell which logging framework will be used by clients and because it affords the client the choice.
However in the case of the Sametime 7.5 Connect client the choice has been made for you since Sametime 7.5 uses java.util.logging. You can choose to use Commons Logging but then the logging levels will not fit the ones used in Sametime.
I would suggest you stay with java.util.logging.
Please note: The way logging works while developing plugins in Eclipse is very much different from how it works in the *real* client. When developing all logging, incl. System.out, goes to the console.
Obtaining a java.util.logging.Logger instance is easy:
Logger log = Logger.getLogger(this.getClass().getName());
I suggest you follow the above example and use the class name as the logger name which is also a best practice and the way that IBM does it.
Configuring logging in Sametime 7.5
The logs written are placed in the Sametime-directory under your using profile hereafter called the log-directory. On my Windows laptop this is “C:Documents and Settingslekkim.HQApplication DataSametime”. The logging itself is configured from the sametime.properties file in the Sametime 7.5 Connect client directory (again on my Windows laptop this is “C:Program FilesIBMSametime 7.5”).
The top of my default sametime.properties looks like this:
## G11N DNT ## Logging properties .level=INFO logger.filename=sametime.log logger.includeClassInfo=true logger.toConsole=true logger.level=ALL logger.limit=20000000 logger.count=7 org.apache.axis.level=INFO redirectSystemOutput=true ## app properties ... ...
By default log-messages goes to sametime.log.0 in the log-directory with the maximum level of INFO (top bold line). To diagnose issues increase the log level to FINE, FINER, ALL etc. Be aware that the finer levels will produce *lots* of output. Note that messages written to System.out is directed to System.err by default (the second line in bold). To get this information change the redirectSystemOutput to false.
Doing this will cause output to be written to sametime.log in the log-directory instead. Restarting the Sametime 7.5 client while redirectSystemOutput is false will rotate the previous sametime.log to sametime.log.previous.
The nitty-gritty details
It appears that most of the java.util.logging configuration is done through the rcpinstall.properties file in /plugins/com.ibm.rcp.base_126.96.36.199-20060714/config/muservice. Although I wouldn’t suggest changing the file itself it may be beneficially to peruse the file to see how it’s done.
If you really want to know that is… 😉
It appears that Sametime uses java.util.logging and that is is quite straight forward to use – once you know how… Logging levels are easily controlled from sametime.properties and extending the logging framework to do central logging should be easily accomplished.