-
Notifications
You must be signed in to change notification settings - Fork 34
Home
timtripcony edited this page Mar 17, 2013
·
5 revisions
The goal of this project is to modernize the way that we write Java code for Domino applications. Some of the results of this are as follows:
- The primary advantage of this API is that it removes the need to recycle Domino objects. Objects in the lotus.domino API have a relationship to a C++ object. If the Java object is destroyed (or reallocated to a different Domino object) without this relationship being cleaned up, the C++ object is orphaned. Since Domino has a fixed limit of how many of these C++ objects can exist at a time, it's always been crucial for Domino developers to explicitly clean these up by calling .recycle() on every Domino object. It's a pain, but it's been unavoidable... until now. The org.openntf.domino API completely removes the need for recycling. We monitor each object to ensure that, if it's about to be garbage collected, recycling happens automatically. So you can focus on what you want to do with these objects, not what happens when you don't need them anymore.
- The lotus.domino API has a notion of collections, but does not use the Java Collections API. As a result, looping through documents and view entries, for instance, is not nearly as straightforward as what most Java developers are accustomed to. Part of the problem is that we've always needed to recycle, so we couldn't just reuse the same variable over and over again... we had to create a "temp" variable to assign the next object to, recycle the current object, then set the current object to the temp object. Yuck. But the API itself doesn't feel like Java because it was originally written to feel like LotusScript, so Java code in Domino typically ends up inheriting LotusScript patterns, making it unnecessarily verbose. The org.openntf.domino API treats Domino collections like true Java Collections. So there's no need for any of the old getFirst / getNext nonsense (not to mention getNth...); instead, we can just do what other Java developers do:
for (Document eachDocument : Database.getAllDocuments()) { /* do something with each document */ }
This labor of love is still a work in progress, but a surprising amount of it is already complete. You can browse the Javadoc to get a feel for what's already included.