@Retention(value=RUNTIME) @Target(value=METHOD) public @interface OperationMethod
For each INPUT/OUTPUT type association you must create a new method in an operation and annotate it using this annotation. The set of input types available in an operation are the operation accepted types and the set of output types are the operation produced types. A produced type will become the input type for the next operation in the chain, that will be dispatched to the right method that know how to consume the type.
When an operation provides 2 methods accepting the same input type the chain will need to take a decision to determine the best way to continue. A common algorithm to find the right path until the end of the chain is backtracking: from a set of potential nodes one is selected to be visited (randomly or not). If the node is a dead end then another node from the set is taken until the path to the last node is created.
A chain may have no paths until the last operation. In this case the chain is invalid and the chain processor will
trigger an error. Also, a chain can provide multiple paths to the last operation. To help the engine to find the best
path until the last operation you can use the
priority() attribute to specify which method is preferred. The
default priority is 0 (e.g. no priority). Higher priorities have more chance to be selected when a conflict occurs.
If no user priority is specified (i.e. priority is 0) then the default priority is used. Here is how the default
priority is computed (the top most case has the greater priority):
The class owning the annotated method must be annotated using
public abstract Class<? extends OutputCollector> collector
It means that when such a method is called with an input type of
Iterable (where INPUT is the
declared method input type) the method will be iteratively called to generate all the outputs and collect them
using the given OutputCollector.
public abstract int priority
Copyright © 2015 Nuxeo SA. All rights reserved.