ShowTable of Contents
The XPages2Eclipse feature described in this article works similar to a technique called "XAgents", covered by blog posts of Chris Toohey and Stephan Wissel:
Such an agent is useful when there is a need to programmatically create web content, e.g. web pages in a Domino based Content Management System, Office documents and spreadsheets, captcha graphics for authentication or to implement your own REST service.
So if there already is such a mechanism, why did we develop our own?
Well, when working with those XPages based agents, we faced several issues that our implementation solves:
Call code in other database
This works on the web, because you can request content of other databases without problems as long as the current user has sufficient access rights.
But unfortunately it's not possible with XAgents in the local Notes Client (XPiNC). There you can only call such an agent in the currently open database. You would need to move all your configuration code into the application database to make this work, which messes up your architecture.
Parallel execution of requests
Routing many requests through a single XAgent XPage leads to bad application performance. The reason is that, up to Lotus Notes/Domino 8.5.2, code in an XPage runs sequentially for a single user. So if you let one XPage do a long running operation (e.g. output a large file or process many documents as part of a REST call), other XPages for the same user will wait until the operation is done (for experts: the XPage code is synchronizing on the HttpSession object while your code is invoked).
Our implementation in XPages2Eclipse does not do such a synchronization. Code execution occurs in parallel, only limited by the number of HTTP threads in the web server. You get maximum throughput.
Cache control for developers
An an XPages developer, you probably have experienced the issue that changes you make in Domino Designer sometimes are not visible after a page reload in the browser. The reason is that the XPages runtime caches the code for performance reasons and you often have to do a "restart task http" on your development server (which also restarts the JVM running XPages). This might be ok for web development on a local Domino server, but it's a real pain for XPiNC development. In that case, you have to restart the Notes client including Domino Designer!
XPages2Eclipse does have (OSGi) console commands that you can use to clear the caches we use: one for SSJS library content and another one for any Java class that your code is using.
Access to Notes Client APIs
In such a scenario, you could feed your UI elements through your own REST API and also implement the whole application logik as REST calls - a very clean approach, because the UI is completely separated from the backend code.
And since we found out that the technology is also very useful for Domino applications on the web (even without the "eclipseconnection" object), we added a switch to make it work on Domino servers.
-call code in other Notes databases, even in the local Lotus Notes client, clear separation of application code and a modular architecture
-performance gains compared to XAgent approach (XPage
Activation on Domino server
-Notes.ini variable for activation (global / per database)
-Highly optimized for performance
-SSJS library contents, Java class files and resources cached in memory
-OSGI commands to flush caches
x2ejs drop all
x2ejs drop -n-
x2ecl drop all
x2ecl drop -n-
-code checks design element signature for all included libraries