Java access control for Domino objects

Source: Internet
Author: User

Java accesses Domino objects through the Lotus. Domino advanced package. According to the runtime environment, the interfaces in this package are implemented in one of the other two packages:

Lotus. Domino. Local provides the ability to call notes/Domino Software on the same computer.

Lotus. Domino. CSO provides calling from the Domino server accessed through a remote connection.

For local access, JavaProgramRun on a computer where the Notes client or Domino server is installed. The local class is built by JNI (Java Native Interface) to access the Notes/Domino binary files in the same process as JVM (Java Virtual Machine. For remote access, Java uses the Common Object Request Broker Architecture to request services provided by the Domino server. The remote class accesses the server through the TCP/IP network using CORBA. Remote Access consists of the following two parts:

The client obtains the initial object of the server over HTTP as the IOR (interoperable object reference ).

The client uses the IIOP connection to further obtain other objects.

In Lotus. Domino, The notesfactory class provides createsession and other methods to enable access to Domino objects in Java applications and servlets. The extraordinary call method determines whether the access is local or remote. To compile a Java program using the Lotus. Domino package, the class path must contain notes. Jar (local) or ncso. Jar (remote ). For example:
Set classpath = % classpath %; C: \ Lotus \ domino \ notes. jar or set classpath = % classpath %; C: \ Lotus \ domino \ data \ domino \ Java \ ncso. jar. jar can be found in any program directory installed in Notes/Domino. Ncso. jar can be found in the domino \ Java directory under the domino designer or Domino server data directory.

Local call

The createsession call has no parameters. If the first parameter is null or the first parameter is a null string, it indicates a local call. BelowCodeIs equivalent:

Session S = notesfactory. createsession ()

Session S = notesfactory. createsession (string) null)

Session S = notesfactory. createsession ("")

Convert null to string to avoid overload conflicts. To implement local calls from the application and Servlet, the path must contain the Notes/Domino program directory, and the class path must contain the notes. jar in the Notes/Domino program directory. For example:

Set path: = % PATH %; C: \ Lotus \ domino

Set classpath: = % classpath %; C: \ Lotus \ domino \ notes. Jar

Notes. jar contains Lotus. Domino and Lotus. Domino. Loca packages. The notesthread class is required for local calls. The notesthread class extends java. Lang. Thread, including the initialization and termination code for Domino. You have three options:

Execute the thread by continuing.

Run the thread through the runnable interface.

Use static methods to execute threads.

Execute the thread by continuing
To continue to execute the thread, You need to extend notesthread, not thread, and contain the runnotes method, not the run method. The notesthread thread can be started using the start method like any other thread. This method is easier to use than static methods (discussed later) and is not prone to errors.

Import Lotus. Domino .*;

Public class myclass extends notesthread

{

Public static void main (string argv [])

{

Myclass T = new myclass ();

T. Start ();

}

Public void runnotes () // entry point for notes thread

{

Try

{

Session S = notesfactory. createsession ();

// Operational code goes here

}

Catch (exception E)

{

E. printstacktrace ();

}

}

}

 

-

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.