Elvis 5 Schedule plug-ins - development
Schedule plug-ins are used to automate server tasks. They are always entirely hosted in the Elvis plug-in folder, where for example action plug-ins 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 plug-ins 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 plug-ins. 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 plug-ins and code samples
The easiest way of getting insight in how plug-ins work is to review some of the bundled action plug-ins we provide with the server. There are developer code samples and ready to use plug-ins available:
- Developer plug-in samples: <Config>/plugins/samples/code_samples/schedule_plugins
- Bundled schedule plug-ins: <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 plug-in.
There are a few simple and easy to understand samples like hello_world showing the basic possibilities of schedule plug-ins. There are also technically more advanced plug-ins 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 plug-in folder and should be named ant.script.xml.
All plug-in specific properties in the plug-in 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 plug-in, output is written to a log file, the log files are in the Elvis logs folder, grouped per plug-in.