Bug 4137 - In the RI, the applyTo attribute in the chunk properties doesn't work as expected
In the RI, the applyTo attribute in the chunk properties doesn't work as expe...
Status: CLOSED FIXED
Product: jbatch
Classification: Unclassified
Component: source
1
Macintosh Mac OS
: P5 normal
: ---
Assigned To: cvignola
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-20 15:29 UTC by jfullam
Modified: 2013-01-16 18:39 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jfullam 2012-09-20 15:29:08 UTC
When applyTo property is used, the RI actually applies the property to all artifact types within the chunk type step (reader, writer, and processor).
Comment 1 cvignola 2012-10-05 18:31:32 UTC
This is an RI/spec sychronization issue.  The applyTo attribute was removed in the early draft review copy of the spec.  #{<artifact-name>['<property-name>']} (section 5.2.1.1) is the replacement fo applyTo.
Comment 2 kmukher 2012-10-09 14:11:52 UTC
The #{<artifact-name>['<property-name>']} syntax seems to imply that the source of the property is from <artifact-name> instead of the target of the property injection. 

It seems to be more natural and readable to express the target of a property injection through an XML attribute instead of through an expression language. 
If the property target is part of the expression language we will have to parse the EL twice or store the target separately as a hidden attribute of the property after the initial parsing only to retrieve that information again later; so why not just separate it up front and make it a visible attribute?

In section 5.8.1 of the spec there is an example similar to the one below. There the target is the artifact type instead of the artifact name. I don't really have much of preference either way, but I believe the general convention is to target a property to a bean/artifact id.

<chunk reader="MyReader" writer="MyWriter>
    <properties merge="true">
        <property name="globalFile" value="/tmp/golbal.txt" />
        <property name="infile" value="/tmp/input.txt" target="reader,writer"/>
        <property name="outfile" value="/tmp/output.txt" target="writer"/>
    </properties>
</chunk>
Comment 3 cvignola 2013-01-16 16:06:10 UTC
applyTo has been dropped from the spec