Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/HowTo/How to write a Pipelet"

(New page: == What are Pipelets == Pipelets are not standalone services, but their lifecycle and configuration is managed by the workflow engine. They are not shared by multiple workflows, each occur...)
 
(No difference)

Revision as of 02:57, 23 September 2008

What are Pipelets

Pipelets are not standalone services, but their lifecycle and configuration is managed by the workflow engine. They are not shared by multiple workflows, each occurrence of a pipelet in a workflow uses a different pipelet instance.


Implementation

  • Create a class that implements interface org.eclipse.eilf.processing.SimplePipelet.
  • The class must have a public no-argument constructor.
  • Implement void configure(PipeletConfiguration configuration). This method is called prior to process. Here you can read the PipeletConfiguration provided for the Pipelet in the pipeline. To share those properties either store the whole PipeletConfiguration in a member variable or better check the PipeletConfiguration for validity and completness and store the settings in seperate memeber variables.
  • Implement Id[] process(BlackboardService blackboard, Id[] recordIds). Here you have to place the "business logic" of your Pipelet. In most cases the result is the same as the input recordIDs, so just return it. But it is possible to return another list of Ids as result.
  • The class name must be registered in META-INF/MANIFEST.MF of the providing bundle using the header name "*EILF-Pipelets*". Then they can be detected by the SimplePipeletTracker service. Multiple classes can be registered separeted by comma.


Example

This is a template for MyPipelet.java

package org.eclipse.eilf.mypackage

import org.eclipse.eilf.blackboard.BlackboardService;
import org.eclipse.eilf.datamodel.id.Id;
import org.eclipse.eilf.processing.ProcessingException;
import org.eclipse.eilf.processing.SimplePipelet;
import org.eclipse.eilf.processing.configuration.PipeletConfiguration;
 
public class MyPipelet implements SimplePipelet {
 
  public MyPipelet(){
  }
 
  public void configure(PipeletConfiguration configuration) throws ProcessingException {
    // read the configuration properties
  }
 
  public Id[] process(BlackboardService blackboard, Id[] recordIds) throws ProcessingException {
    // process the recordIds and create a result
  }
}

And this is how to register the pipelet class in the bundle manifest MANIFEST.MF:

...
EILF-Pipelets: org.eclipse.eilf.mypackage.MyPipelet
...

Back to the top