Use Lotus Domino designer 8.5.1 to create a Java proxy

Source: Internet
Author: User

Use Domino designer 8.5.1 to create Java
Proxy

Open notes in Domino designer 8.5.1
Database File testnsf. nsf: Expand the code node, right-click the agents node, select "new agent" from the menu, select "Java" in the displayed dialog box, and name it "dataextractionagent ". 1:

Figure 1. Create a Java Agent

The system automatically creates the javaagent. Java file in the default package, which extends the Lotus. Domino. agentbase class and reloads the notesmain () method.
Listing 1. Java proxy code example

Public void notesmain (){

Try {

Session session = getsession ();

Agentcontext = session. getagentcontext ();

// (Your code goes here)

}

Catch (exception e ){

E. printstacktrace ();

}

}

The Session object can be used to obtain the Notes database or other database objects of the current agent, and call the notes Java API to perform operations such as adding, deleting, modifying, and querying database documents and reading metadata.
The agentcontext object is the runtime environment object of the Java proxy. It can be used to obtain the user-selected Notes database document list and other objects. When the Java proxy is triggered, the notesmain () of the agentbase class ()
The method is called.
Next, we can create other Java packages and classes in the Java proxy. If we need to call a third-party Java API in the Java proxy program, we can copy the dependent Java class library to the LIB/ext directory of the notes or Domino built-in JVM.
Switch to the Java view in Domino designer and find that dataextractionagent exists as an independent Java project. The newly added Java class library, agent, can be seen under Domino Java library. jar contains the business logic for reading data from the Excel file and saving it in the DB2 database. The two jar packages starting with DB2 provide APIs for operating the DB2 database.

Figure 2. display of Java proxies in the Java package View

In the Java view, you can easily complete Java proxy program development, and then return to the domino designer view to perform Java proxy testing.
Select the agents item under the Code node, get a list of all agent programs in the form on the right, right-click dataextractionagent, and select "run" to trigger the running of the agent program.

Figure 3. Test the Java Agent

The running result is a log dialog box prompting the execution of the agent.

Figure 4. Java proxy program running status

There are two ways to trigger a proxy: menu call and scheduling. The menu-called Java proxy can be deployed in the Notes
The client or Domino server, while the scheduled Java proxy can only run on Domino
Server.

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.