The TaskBean IO Mapping interface allows a user to configure how TaskBeans can communicate with each other when a Job is run. A Job that is composed of multiple TaskBeans, can configure the TaskBeans to communicate with each other. A TaskBean has the option of exposing properties via its output JavaBean that can be passed to other TaskBeans that execute after it in the Job workflow. These output properties can be passed to the input JavaBean properties of other TaskBeans. The result of this is that the output of one TaskBean functions as the input to another TaskBean.
If a TaskBean does not wish to communicate with other TaskBeans, then you will not need to use this feature. But the power of building components really comes into play when you can get components, that have no prior knowledge of each other, to be able to collaborate by passing information between each other.
The user, using a GUI, can pick and choose which outputs map to which inputs for each interconnected output/input TaskBean pair. There are restrictions in how the output/input mappings can work, especially when the output/input types are not identical. The types must be compatible based on what is referred to as "widening conversion rules". The GUI automatically takes care of deciding which output/input properties are compatible, so the user does not need to deal with it directly, but it can be helpful for some user to understand the details. They are as follows:
The widening conversions rules described in this section detail how to map an output
JavaBean property to an input JavaBean property when the properties are not of the exact
same Java type. Narrowing conversions are not allowed. So for example, this means that going
from an
Two general forms of data conversion are possible between an output JavaBean property and input JavaBean property when widening conversion occurs:
1) Java Core Reflection Data Conversion Spec (basic widening conversion as defined by the Java spec)The Extended conversion is allowed when the input JavaBean is a String/StringBuffer. Given that all Java Objects support the toString() method, any object can be converted and mapped to a String or StringBuffer. Primitive types are also mapped to String or StringBuffer by first wrapping them into corresponding objects. The Extended conversion rules are considered a form of "widening" conversion. Thus converting to a String or StringBuffer is considered permissible.
Special Array Mapping Rules:
There are some special rules to consider when dealing with Java Arrays.
These rules pertain to the
use of Arrays in either an output JavaBean and/or input JavaBean. Arrays
allow for some special behavior when mapping occurs. There are
three types of output JavaBean to input JavaBean mapping rules to consider:
Input JavaBean Considerations:
If a BeanInfo object exists for an input JavaBean, it will be used during the
mapping processes between TaskBeans to determine which input JavaBean properties
are exposed for mapping. The developer can use this to control what input JavaBean
properties are exposed for mapping from other TaskBeans. By defining a BeanInfo class for
the input JavaBean, this allows the TaskBean developer to control what
JavaBean properties are exposed to other TaskBeans and which are not exposed.
If a BeanInfo object is not available for an input JavaBean, then only properties
with public setter/getter methods will be exposed for mapping between TaskBeans.
Output JavaBean Considerations:
No custom BeanInfo will be used for the output bean. Output Beans are reflected
to find their getter methods/properties. All properties with getter methods
are available for passing to the input JavaBean properties of other TaskBeans.
Arrays and Aggregation Considerations:
Array properties can be used to allow one or more output JavaBeans
to aggregate into an input JavaBean. It is really up to the
TaskBean developer to implement the setter method of the property method such that it
aggregates/appends to the input JavaBean property Array or not.