From Apache OpenOffice Wiki
Jump to: navigation, search

A job in Apache OpenOffice is a UNO component that can be executed by the job execution environment upon an event. It can read and write its own set of configuration data in the configuration branch org.openoffice.Office.Jobs, and it can be activated and deactivated from a certain point in time using special time stamps. It may be started with or without an environment, and it is protected against termination and lifetime issues.

The event that starts a job can be triggered by:

  • any code in Apache OpenOffice that detects a defined state at runtime and passes an event string to the service through its interface method trigger(). The job executor looks in the configuration of Apache OpenOffice if there are any jobs registered for this event and executes them.
  • the global document event broadcaster
  • the dispatch framework, which provides for a URL schema to start jobs using a command URL. This URL schema can execute jobs in three different ways: it can issue an event for job components that are configured to wait for it, it can call a component by an alias that has been given to the component in the configuration or it can execute a job component directly by its implementation name.

If you call trigger() at the job executor or employ the global event broadcaster, the office needs a valid set of configuration data for every job you want to run. The third approach, to use a command URL, works with or without prior configuration.

The illustration below shows an example job that counts how many times it has been triggered by an event and deactivates itself when it has been executed twice. It uses its own job-specific configuration layer to store the number of times it has been invoked. This value is passed to each newly created job instance as an initialization argument, and can be checked and written back to the configuration. When the counter exceeds two, the job uses the special deactivation feature of the job execution environment. Each job can have a user timestamp and administrator timestamp to control activation and deactivation. When a job is deactivated, the execution environment updates the user timestamp value, so that subsequent events do not start this job again. It can be enabled by a newer time stamp value in the administration layer.

Flow diagram of an example job
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages