Developing with Java in XPages and Domino

Since I get asked this regularly here is a quick overview of the different ways to use Java in XPages and in the classic Domino app dev model.

There are different types of XPages developers. Stephan Wissel talks about three developer types, Chris Toohey about four stages. Here is my take on what different types of XPages developers there are (not counting IBM XPages product developers and non XPages developers):

1. Developers who quickly assemble applications using Designer

Used techniques: Drag & drop in Designer, nice and simple Designer UIs, simple actions, maybe some client side JavaScript and server side JavaScript (SSJS)

Most XPages developers start in this category to get started with XPages. For some developers these techniques are sufficient when implementing simple form and/or workflow based applications.

2. The ‘usual’ XPages developers building sophisticated business applications using Designer

Used techniques: Source tabs of XPages, custom controls, script libraries, client side JavaScript and Dojo, SSJS and … Java

I’ve included Java in this category because I see more and more people using Java in XPages and there are clearly advantages of Java. While Java used to be scary for some Domino developers some time ago I’ve seen a shift happening. As discussed in Henning Schmidt’s blog I think Java is simpler and better than SSJS for various reasons:

– You can reuse existing open source Java projects in XPages applications. This document (page 5ff) describes how to import some jar files into an NSF.

– You can debug the Java code.

– You can write managed beans. Karsten Lehmann has some good samples in this blogs.

– Java is a sophisticated language and there is a lot of documentation about core Java classes and JSF available in the internet.

Since 8.5.3 there is a Java design element. However to change config-faces.xml and in order to debug you need to use the Java perspective.

3. Developers extending XPages functionality and Domino services using an Eclipse IDE

Used techniques: Deployment via OSGi bundles, development via Java in Eclipse

These developers need most skills but also can do more than others. The biggest difference to the two types above is that the deliverable is not an NSF but an Eclipse feature/OSGi bundle (deployable unit with potentially multiple plugins). The jar files can be deployed via the OpenNTF project plugins deployment or since 8.5.3 with the extended update site template (Declan Lynch describes this).

Using the Eclipse IDE and the extensibility API the core XPages functionality can be extended. This is used in the Extension Library and other OpenNTF projects like ZK spreadsheet and JQuery library. There are also simple extensibility samples on OpenNTF.

The second part of this video describes how to debug Java code from the Eclipse IDE. The OpenNTF project debug plugin allows debugging from Eclipse without having to redeploy the code to Domino in many/most cases.

In addition to the extensibility API you can also write full servlets. The OpenNTF project simple servlet shows how.

Furthermore you can extend the Domino server with OSGi tasklets. The project OSGi tasklet service proposes a new way of writing server addin tasks by using the Java OSGi programming model.

For completeness sake in the classic Domino app dev model you can implement agents and script libraries with Java. Bob Balaban describes in his blog how to write Java agents that you can debug in Designer or Eclipse (he calls this technique two headed beast).

In all cases you can use the Domino Java APIs. Java developers should also understand how memory management and garbage collection is done. Bob Balaban describes this in some of his blogs.