Developing Your Own Tasks
Table of Contents
org.lenya.cms.task.Task
Every task must implement the org.lenya.cms.task.Task
interface.
The easiest way to develop your own task is to extend the AbstractTask
class.
Its parameterize()
method simply replaces old parameter values with new
ones. All you have to do is implementing the execute(String contextPath)
method.
You may wonder why we pass the contextPath
as a method parameter
since we already pass it as a task parameter. This ensures that the task is always
able to access the Lenya CMS directory, even if it is not created by a TaskAction
or a TaskJob
. Furthermore, if you enter a task in the jobs.xml
file manually, you won't have to provide a hard-coded servlet-context
parameter.