BackPrevious Page Next PageNext

Scheduling a Customized Task Using User Task

In order to provide the means to run tasks defined outside of JReport on JReport Server, and to just use JReport Server's schedule function, JReport provides a task named User Task. With this task, you can implement a customized task with the schedule properties. After creating a class that implements the UserTask interface in the jet.server.api package and adding the class to the class path, you can then submit the task either from a server web page or by calling Server API methods. The task can then be run by the server at the scheduled times just as if it were a report.

To schedule a customized task using User Task:

  1. Create a task class that implements the UserTask interface and add the path of the class file to the ADDCLASSPATH variable in setenv.bat, which is located in <install_root>\bin. You can find the interface in the jet.server.api package available in <install_root>\help\api. JReport provides a demo class APIDemoDynamicExportTask.java in <install_root>\help\samples\APIServer for your reference.
  2. Create a task properties file defining the formats of exporting the task. For example, the content of the properties file is:

    jrs.rst=result_rtf
    jrs.pdf=true
    jrs.text=true
    jrs.excel=true
    jrs.ps=true
    jrs.html=result_html

  3. Submit the task either from a server web page or by calling Server API methods. The task can then be run by the server.

Click My Tasks on the system toolbar. When the task is being performed, you can see a record of it in the Running table and on completion it will be put into the Completed table.

Note: You can either schedule to use the Default Task or the User Task at one time. If you specify to schedule a report as a default task, you will not be able to schedule it as a user task, and vice versa.

BackPrevious Page Next PageNext