Dom| Server Summary: This article applies aspectj to the development of the Notes database on the Domino server,
This enables Domino to have some aspect-oriented features.
Keywords: Lotus domino/notes, Lotus Domino diiop for Java, AspectJ.
The purpose of this paper is how to apply ASPECTJ to Domino's development so that Domino has some features to face. Based on the actual application of ASPECTJ in Domino project, the author makes a brief introduction for beginners. The source code for the instance is provided at the end of this article.
Here's a step-by-step explanation:
The first step: ASPECTJ Development environment Configuration
In the actual project development because of the present ASPECTJ integration development environment is very few, therefore the author chooses the simplest is also the present more effective development tool: EditPlus. Before using EditPlus, set the Classpath as follows:
System.out.println ("Outprinter () work!"); Output to the Domino console
}
}
And the agent supporting the following aspects:
Aspect Aspectjtest
{
Define the Outprinter () method in the Pointcut mycut () Capture agent
Pointcut Mycut ():
Call (public void outprinter ());
Notify before the tangency Point arrives
Before ():
Mycut ()
{
Output to the Domino console
System.out.println ("... before ...");
}
}
Analysis of these two pieces of code is known: if the aspectjtest agent is running properly, then in the Domino console output
"Outprinter () work!" Before the output "... before", and this may be our purpose.
Step three: Make Files.lst file and finish compiling
The file is a text file, and some of its groups aspectj the compiler to complete the Make-file function. Here to note that: the author in the EditPlus to generate Files.lst files, and Javaagent.java, Aspectjtest.java file together are placed in
D:\aspectjpro directory.
Next you can select the "AspectJ" item on the "Tools" menu to compile the agent with aspect-oriented features. Generate Javaagent.class and Aspectjtest.class files. Of course, you can also manually compile them with the following command line: ajc-d "."-argfile Files.lst
This requires you to make the appropriate path settings: Ajc.bat in the D:\aspectj\bin directory.
Step Fourth: Create Database Test.nsf and test forms and aspectjtest agents
Create a TEST.NSF database on the server and create a test form in the TEST.NSF database, and put a button in the Test form. Takes "AspectJ Test" as the name, and the button's formula is @command ([Toolsrunmacro]; "Aspectjtest")
Fifth step: Establish Aspectjtest Agent
Note that when establishing a aspectjtest agent, you must make the following selections in the proxy properties:
Agent Name: Aspectjtest
Runtime selection: Agent List selection.
Taget::none
Next, select "Imported Java" and "Reimport class files" to introduce the class file: Aspectjrt.jar, Aspectjtest.class, Javaagent.class.
Note that the D:\aspectj\lib\aspectjrt.jar is copied to the D:\aspectjpro directory here.
Browse the form test in the browser and press the button "AspectJ test" and you will see the output in the Domino console:
"... before ..."
"Outprinter () work!"
We see the "... before" output substituting "outprinter () work!" Ago, this is also our purpose.
This program example works well under Lotus Domino R6.5 and is very stable.
Conclusion: This article has successfully introduced the ASPECTJ-oriented language in Domino, although it is simple but demonstrates that domino can have some aspect-oriented features.
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.