Objective
To create a Notes agent that uses Java AWT and NOI.
Time Required
Allow half an hour to run this sample with its supplied content and look over the
output.
Before You Begin
To run this sample you need the following products:
Follow the steps in the Domino Samples Overview to prepare for the sample.
Set up your Lotus Notes and VisualAge for Java environments to support the Domino AgentRunner by following the steps in Setting up for the AgentRunner and return to this sample.
Description
This sample automatically checks your To do list once per day for any items that are due.
A mail message will then be sent to the owners of the due items reminding them that a task
is due that day.
Export the .class File
To export the .class file from the com.ibm.ivj.examples.domino.todoagent package
in VisualAge for Java to the file system so it can be read by Notes:
When you export files to the file system, the directory path of the file is maintained.
For example, if you entered X:\VAJexport
as your export destination,
the ToDoAgent.class file will be in X:\VAJexport\com\ibm\ivj\examples\domino\todoagent.
Follow These Steps in Notes 4.6 to Set Up the Agent.
Running the Agent in Notes
Open the Java Console in Notes by selecting File - Tools - Show Java
Debug Console so you can monitor your agent. From the Actions
menu of the Domino database, select ToDoAgent. The agent will run
but the session will return Null. An AgentContext document will be created in the
AgentRunner.nsf
Using the AgentRunner
Now you are ready to run the agent in the AgentRunner.
To run your agent from the Workbench:
The Domino AgentRunner will run your agent using the AgentContext document that you created in Notes.
Create the Production Agent
When your agent runs without errors, you can create the production agent by
taking it out of 'Debug' mode.
Open your ToDoAgent class file in the Workbench. In the Source window, change what the class extends from lotus.notes.DebugAgentBase to lotus.notes.AgentBase. Click your ToDoAgent class in the All Projects window. You will be asked if you want to save your changes. Click Yes.
Export the .class File
Your agent is now in it's completed state and can be run in Notes. Export the .class
file to the file system using the Export SmartGuide. Open your agent in Notes and
reimport the ToDoAgent.class file.
Running the Agent
You now have an agent that will check your To Do list for any tasks that are due
today.
To test the agent, create a task and set the due date as today's date. Create another task with some other day as the due date. You can even assign tasks to other people. When the agent runs manually or at the time you specified, the owner of the task will receive a mail reminder that the task is due that day.