JAVA/CORBA CLASSES
You can call the Domino Objects from a Java program by importing the lotus.domino package. The program can be coded as an application, a Domino agent, an applet, or a servlet. Local calls access run-time code on the local computer, which must have Domino installed. CORBA-based remote (IIOP) calls access run-time code from a remote Domino server; in this case, the local computer need not have Domino installed. Compilation must be on a computer with Domino Designer installed.
Note Notes/Domino Release 7 supports the Sun Java(TM) 2 Platform, Technology Edition, v 1.4.2. To avoid incompatibilities: do not run Java agents compiled under Release 7 on earlier Domino servers or Notes clients; do not use Release 7 Java archives (Notes.jar, domtags.jar) on Java platforms earler than v. 1.4.2.
Note The lotus.domino package has the same content as the Release 4.6 lotus.notes package plus new classes, methods, and other enhancements. The Release 4.6 lotus.notes package continues to be supported for backward compatibility only; it does not contain the new classes, methods, and other enhancements.
Requirements
Server requirements
CORBA-based remote (IIOP) calls require access to a Domino server.
The HTTP task is not required to be running for DIIOP to be used. Ensure that the server notes.ini file contains the following line:
ServerTasks=<any other tasks>,diiop
Or you can start the task later with the load console command.
Note The JavaMaxHeapsize should not be decreased below a value of 64M, or a runtime error will occur when attempting to execute nhttp.exe. If a value for JavaMaxHeapsize is not set in the server notes.ini file, a value of 64M will be used.
The server document in the Domino Directory (under Server\Servers) must permit and restrict remote calls as desired. Right-click on a field description to display an extended description.
SSL security for CORBA-based Domino Object applications/applets builds on the Web Server SSL security. You must first set up the Web server security using the "Domino R5 Certificate Authority" application.
Designer requirements
Compilation of a Java program using the lotus.domino package requires installation of Domino Designer Release 5 or greater.
For stand-alone applications, include Notes.jar from the appropriate Java library subdirectory of the Notes program directory and domino\java\NCSO.jar or domino\java\NCSO.cab from the Notes data directory in the classpath. For example:
set CLASSPATH=.;c:\notes\jvm\lib\ext\Notes.jar set CLASSPATH=.;c:\notes\data\domino\java\NCSO.jar
Notes.jar contains the high-level lotus.domino package, the lotus.domino.local package for local calls, and the old lotus.notes package. The NCSO archive contains the high-level lotus.domino package and the lotus.domino.cso package for remote calls. Strictly, you do not need the NCSO archive if you are not compiling remote calls and you do not need Notes.jar if you are not compiling local calls or old calls.
The two NCSO archives have identical content but differ in the archiving technique:
Note Earlier releases used NCSO.jar (uncompressed) and NCSOC.jar (compressed).
import lotus.domino.*;
Run-time requirements
A computer running a Java application that makes local Domino calls must contain Domino Server, Domino Designer, or Notes Client, and must include Notes.jar in the classpath.
A computer running a Java application that makes remote Domino calls need not contain Domino or Notes, but must contain one of the NCSO archives and must include it in the classpath.
A computer running a Domino agent that makes Domino calls must include Notes.jar in the classpath.
A computer running an applet that makes Domino calls needs no Domino software or classpath assignments. The applet must be loaded from a computer containing a Domino server.
Note Do not use NCSOW.jar in the classpath for executing remote (IIOP) calls in a WebSphereR environment. NCSOW.jar is no longer kitted as it was starting with Release 5.0.4. You can continue to run programs that use NCSOW.jar on R5 servers, but not on Release 6 servers. The NCSO archives work with both R5 and Release 6 servers.
Memory management for Java objects
When Java is used to create an object, two objects are created, a Java object and Notes back-end (C++) object. If the Java object is set to null, flagging it for garbage collection, the C++ object is not affected. To have both the Java object and the C++ object marked for garbage collection, you must use the recycle method.
If objects are created from within a Java agent, all created objects (both Java and C++) are destroyed when the agent ends. However, you should consider using the recycle method for long running agents or agents that create a large number of objects. When using servlets, JSPs or stand-alone Java applications, the recycle method must be used to remove the back-end objects.
Recycling a parent, such as a document, will recycle all of its children, such as items. Recycling the session will recycle every object that has been used from it.
Calling the lotus.domino package
The following guidelines apply to Java programs calling into the lotus.domino package:
Each thread of an application making local calls must initialize a NotesThread object. This includes AWT threads that access the Domino Objects. Listener threads must use the static methods because they cannot inherit from NotesThread.
See "Multithreading issues" under the NotesThread class.
If an applet creates a thread containing Domino calls, the thread code must use NotesThread for local Domino calls but not remote (IIOP) calls. Use AppletBase.isLocal() to determine the environment. Use NotesThread.sinitThread for initialization and NotesThread.stermThread for termination. Thread creation includes handling AWT events.
See the examples for clarification.
For applets stored in a Domino database, "Applet uses Notes CORBA classes" under Java Applet - Java Applet Properties must be checked.
The user and pwd parameters of NotesFactory.createSession and AppletBase.openSession must be a user name and Internet password in the Domino Directory on the server being accessed. If a name and password are not specified, anonymous access must be permitted by the server.
For Single Sign-on to a Domino or WebSphere server, use createSession(String host, String token), createSession(String host, org.omg.SecurityLevel2.Credentials token), createSession(String host, null), or createSession(String host, HttpServletRequest request).
Note Single Sign-on is new with Release 5.0.5.
To enable SSL (Secure Sockets Layer), use NotesFactory.createSession(String host, String args[], String user, String pwd) and specify "-ORBEnableSSLSecurity" for args(0).
The lotus.domino classes allow you to access named databases, views, documents, and other back-end objects. The following lotus.domino classes are for direct, public use: