Schedule plugins are used to automate server tasks. They are always entirely hosted in the Elvis plugin folder, where for example action plugins can also be hosted on an external server.
This section contains a couple tips and tricks to get you started.
The base technology used for schedule plugins is Apache ANT, a task language which allows us to automate a wide variety of processes.
ANT provides hundreds of tasks like:
- copy, delete, rename files and folders.
- create or extract ZIP files.
- perform FTP operations
- send emails.
- perform XSL transformations.
- perform SOAP webservice requests.
Some extra tasks, like if and for-each, are available via ant-contrib.
Extra Elvis tasks
Elvis provides some extra tasks as well. Usage scenarios can be found in the existing plugins. These tasks are:
- saxon-xslt - performs XSLT 2.0 transformations.
- xpath - extract information from an XML file using XPath.
- soap - performs SOAP calls to webservices.
- xmlFileList - list the contents of a directory to an XML file so it can be processed using an XSL.
- tableData2Xml - convert a CSV or Excel file to an XML file for further processing with XSL.
- xml2TableData - convert an XHTML table to a CSV or Excel file.
Bundled plugins and code samples
The easiest way of getting insight in how plugins work is to review some of the bundled action plugins we provide with the server. There are developer code samples and ready to use plugins available:
- Developer plugin samples: <Config>/plugins/samples/code_samples/schedule_plugins
- Bundled schedule plugins: <Config>/plugins/samples/schedule_plugins
You can see how they work and how they are configured. Feel free to use them as the starting point for your own plugin.
There are a few simple and easy to understand samples like hello_world showing the basic possibilities of schedule plugins. There are also technically more advanced plugins like folder_import and metadata_import.
When the schedule triggers, the ANT build file is executed. This file must be available in the root of the plugin folder and should be named ant.script.xml.
All plugin specific properties in the plugin configuration section - <config>...</config> are passed to the ANT build file as variables.
The Eclipse IDE is a suitable tool for ANT development as it supports auto-complete and error highlighting for ANT build files.
When you run your plugin, output is written to a log file, the log files are in the Elvis logs folder, grouped per plugin.