JMP102 – Eating the Elephant A Java Jumpstart (Paul Calhoun, Lotusphere 2012)


The title reflects also a bit of the presentation. The presentation contains 162 slides so you better prepare yourself for a long journey.

Here a summary of the lessons learned. I divided the presentation into categories.

Section Java language fundamentals

A lot of focus on this. Not so much news here.

Section Java Domino Objects

  • Only implements the “Back End” objects.
    • Exposed via:lotus.domino.*
  • No Notes Client UI access.
  • You (the Domino Developer) already know 98.67 percent of all of the Java class names for the Domino Back End Objects.
  • Drop “Notes” from the front of the LotusScript class names equals Java class names.

LotusScript Class Name

  • NotesSession
  • NotesDatabase
  • NotesView
  • NotesDocument
  • NotesItem

Java Class Name

  • Session
  • Database
  • View
  • Document
  • Item


These Java Classes don’t exist in LotusScript:

  • AgentBase
  • AppletBase and JAppletBase
  • NotesError
  • NotesException
  • NotesFactory
  • NotesThread


  • Java has no “Variant” data type.

Section Java Agents

  • Java Agents MUST extend AgentBase
  • Java Agents MUST use the NotesMain() method as the entry point for their functional code
  • The getSession() method creates a Session object


  • The Default Agent Code only catches generic exceptions
  • Add an additional catch block for NotesExceptions:

import lotus.domino.*;
public class MyFirstAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
}catch(NotesException ne){
} catch(Exception e) {

DDE Tip Snippets Eclipse view

An overlooked feature in DDE how to store and share re-usable code, e.g. Java code.

Java in XPages

  • Java Code can be called from any Server Side JavaScript (SSJS) event in the XPage

Section Third party Java libraries

Using Third Party Java Libraries in XPages:

  • Unzip the downloaded file to an accessible drive.

Add to the Application or Deploy to the Server?

  • Access to the library API can be accomplished two ways:
    • Adding it directly to the (every) application that will be using it.
      • Not a best practice but sometimes necessary for portability or when deploying .jars to the Domino server is not an option.
    • Adding it to the Domino server.
      • Best practice.
      • It is then available to all applications that will utilize it.
      • It can be “upgraded” to the next version and then is globally available

Regardless of the choice, the code is written the exact same way.

  • This allows for deployment using either option and then changing it later

Adding the Jar to the Domino Server.

  • Library class and jar archives can be added to the xsp folder in the Domino program directory.

Adding the Jar to a Specific Application

  • The POI jar can also be added to a specific application.
  • Switch to the Package Explorer view.
  • Expand the Virtual Project folder.
  • Expand WebContent | WEB-INF.
  • If a “lib” folder already exists, add the jar file to this folder.
  • If the “lib” folder does not exist, then create the folder and add the jar file.


Example XAgent Code

The XAgent (an XPage with no UI design elements) code will be used by all three use cases to create the spreadsheet.

  • The code is in the beforeRenderResponse event.

Import the Needed Packages in XPages.

  • This makes the classes in the included jar file available to the SSJS code.
  • The org.apache.poi.hssf.usermodel package contains all the classes needed to create the Excel spreadsheet.

//import the appropriate java packages

3 Use Cases

There are three primary use cases explained for exporting Domino data to Excel:

  • All documents in a view.
  • Selected documents in a view.
  • Document collections from a query.


This session gives a good introduction of Java fundamentals, introduces Java for LotusScript developers and touches Java in XPages.

In the XPages section 3 use cases for an XAgent is explained that uses a third party Java library.

I am not sure if the code of the export use cases is available for public?


One thought on “JMP102 – Eating the Elephant A Java Jumpstart (Paul Calhoun, Lotusphere 2012)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s