Note: The use of internal plug-ins such as Scheduled plug-ins has been deprecated in Assets Server 6.73. These plug-ins should instead be implemented as an API, Webhook, or via WoodWing Connect.
Scheduled plug-ins are one of the ways of extending the functionality of Assets Server. They are always entirely hosted in the Assets Server plug-in folder — in contrast to for example Action plug-ins can also be hosted on an external server.
This article contains tips and tricks to get you started.
Manually running a Scheduled plug-in
To manually run a Scheduled plug-in, do the following;
Step 1. Access the Management console by doing one of the following:
- Access the following URL and log in using system administrator credentials (a 'Super user' account):
<Assets Server URL>/console
- In Assets, access the Avatar menu and choose Management Console.
Step 2. From the menu, choose Plugins, followed by Scheduled plugins.
Step 3. Expand the plug-in that you want to execute and click Execute plugin.
Figure: The Version Cleanup plug-in expanded on the Scheduled plug-ins page.
Resetting a blocked plug-in
Info: This feature requires Assets Server 6.64 or higher.
When a server with jobRunnerEnabled=true set is unexpectedly shut down or loses connection to the cluster, a Scheduled plug-in that was running at that time might still have status Scheduled assigned when the server is restarted. While in that state, the plug-in is locked.
To reset the plug-in so that it can be run again, click Reset plugin. The plug-in is then re-scheduled for next execution according to its configuration, any locks are removed and the plug-in can be run again manually or by schedule.
ANT tasks
The base technology used for schedule plug-ins is Apache ANT, a task language which makes it possible for us to automate a wide variety of processes.
Standard tasks
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 Assets Server tasks
Assets Server 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.
Sample plug-ins and code samples
The easiest way of getting insight in how plug-ins work is to review some of the sample 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
- Sample 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.
Build file
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.
Development environment
The Eclipse IDE is a suitable tool for ANT development as it supports auto-complete and error highlighting for ANT build files.
Log files
When you run your plug-in, output is written to a log file, the log files are in the logs folder, grouped per plug-in.
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.