We used scheduled code in our XPage apps to do things like pre-building dashboards and storing the data in the application scope.
There is no simple way to schedule Java code that has been written for use with XPages. The best solution I have found has been to use “XAgents” and to poll the corresponding URLs somehow.
I have tried this using various methods but it has not been straight forwards due to authentication issues and having to deal with SSL certificates.
The best solution I have come up with to date is to use the linux “cron” task and the wget command which is typically used to download data via the web. This can be configured using the crontab -e command line utility or easier still by using webmin.
Step 1 – create an internet site mapped to localhost. On this site disable session authentication as it seems to cause spurious issues with automated remote calls. Also disable any settings that force traffic to use SSL.
Step 2 – from the command line in linux test your proposed wget command – something like :
wget –user=USERNAME –password=XXXX “http://localhost/apps/aw.nsf/xp_f_process_bad_actors.xsp?source=Cron”
Step 3 – add this as a scheduled task using crontab -e or webmin as shown below
@hourly wget –user=USERNAME –password=XXXX “http://localhost/apps/aw.nsf/xp_f_process_bad_actors.xsp?source=Cron”
Additional Notes
The download files when you run test downloads from webmin will be stored in /usr/libexec/webmin/cron/.. although if you schedule the task with a user such as Apache ( as shown above ) then no file is actually saved because of a permissions failure
The cron log is at /var/log/cron
Your Domino username and password will be stored in plain text in the crontab files and in the logs
You could also use bash script files and schedule these via Domino Program Documents
Thoughts for a future iteration
Making the trigger urls accessible via an anonymous user using sessionassigner somehow