Skip to main content

Port Java components

Embedded Java is where most of a Talend migration's hand work is. The importer translates what it recognises, keeps everything else, and flags every Java component in the report, so none is missed.

What the importer did​

TalendIn HopWhat you do
tJavaRowUser Defined Java ClassRecognised idioms are translated; check them. Code it could not translate is listed per idiom in the report, with its line, and kept as a comment.
tJavaFlex main partUser Defined Java ClassAs tJavaRow.
tJavaFlex start and end partsComment in the same classThey run once, not per row. Port them by hand.
tJavaUser Defined Java ClassCode is translated where possible, otherwise commented out; always flagged.

For each flagged component​

  1. Find it in the report's Needs review table: the reason names the code that was not translated.
  2. Open the User Defined Java Class in Hop GUI. The original code is in the class, as a comment where it was not translated.
  3. Decide whether it needs Java at all. Much Talend Java code does what a Hop transform does: string handling (Calculator, String operations), date formatting (Select values), lookups (Stream lookup, Database lookup), counters (Add sequence). A transform is easier to maintain than a class.
  4. If it does need code, port it into the class. Talend's globalMap and context become Hop variables (getVariable, setVariable); Talend routines have to be ported or replaced.
  5. Re-run the comparison from Validate a migration for that job.

Code that runs once​

tJava and the start and end parts of tJavaFlex usually set variables, open resources or log. In Hop those belong in the workflow around the pipeline: a JavaScript action, a Set variables action, or a Write to log action. Move them there rather than into a transform that runs per row.