Setting the context and globalMap variables using tJava

Although this recipe is centered on the use of tJava, it also acts as a convenient means of illustrating how the context and globalMap variables can be directly referenced from within the majority of Talend components.

Getting ready

Open jo_cook_ch05_0010_tJavaContextGlobalMap, then open the context panel, and you should see a variable named testValue.

Getting ready

How to do it…

  1. Open tMap_1 and type in the following code:
    System.out.println("tJava_1");
    context.testValue ="testValue is now initialized";
    globalMap.put("gmTestValue", "gmTestValue is now initialized");
  2. Open tMap_2 and type in the following code: ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.