Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Orion/Documentation/Developer Guide/Long running operations in services and plugins
< Orion | Documentation | Developer Guide
Contents
Long running operations in services and plugins
Methods in Orion plugins may run asychronusly returning a promise (see orion/Deferred.js). The result of the method should be returned by calling deferred.resolve or deferred.reject methods. If you wish to report progress you should use deferred.progress method. Progress information will be reported on UI if argument passed to progress method describes an operations, with API as fallows:
Operation Description
- type
- String one of: loadstart, progress, error, abort, load, loadend
- timestamp
- Long the time when the operation war run
- lengthComputable
- Boolean true if the progress is deterministic
- loaded
- Integer Optional applicable if lengthComputable is true, number of items loaded/process
- total
- Integer Optional applicable if lengthComputable is true, total number of items to load/process
- location
- URL Optional the location of task where we can find more details and perform operations like update.
Important! this attribute should not be present if this operation status is only important when current page is opened. If operation should be tracked also outside of the current page, for instance in All Operations page plugin provider is required to provide Operation Service. - expires
- Long timestamp to which the operation will be available under given location
Operation Service
Service methods
- getOperation(location)
- Returns promise that should act the same way as the one that started the operation. When operation is running updates in format of Operation Description should be returned by deferred.progress. When operation is finished returned promise should be resolved or rejected containing operation result. If operation was finished before getOperation was called the returned promise should be resolved straight away.
- removeCompletedOperations()
- Removes all completed operations tracked by this Operation Service, returns an array of locations of operations that are left.
- removeOperation(location)
- Removed operation represented by this location.
Service properties
- name
- String Name of the service
- pattern
- String or URI the base URI for Operations location or the pattern that should match the location. Based on this property services will be matched with given operation location.