A site about Talend
Talend provides the globalMap Object where both Talend and you can store and retrieve data. This is a great place to create your global variables as well as retrieving important information about your executing Job.
globalMap is my preference for storing global data that is specific to a particular Job. This is in preference to Context Variables. This removes any blurring of global variables versus parameters that may be passed to your Job at runtime.
Talend defines globalMap as: -
private final java.util.Map
As your Job runs, information is collected about the execution of the various Components. Talend makes this information available through globalMap. A crude but easy way to see this information is to add a tJava component to the end of your job and to add the following line of code.
The component tFileExists is used to find out if a file exists; but how do you interrogate it for the answer? As is often the case, you do this through globalMap.
We've just introduced the get method. You get an object from globlMap and cast it to the correct Type. You can, of course, also put your own objects on globalMap.
globalMap.put("myObject", "Hello World!");
You may also use the component tSetGlobalVar for setting Global Variables - that is, adding values to globalMap.
For more information on the Java Map Interface, visit Java Map Interface.comments powered by Disqus