Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: trying to avoid duplicate code in UDJC

  1. #1
    Join Date
    Feb 2017
    Posts
    23

    Default trying to avoid duplicate code in UDJC

    I have one Java method that I use in many UDJC steps among multiple transformations.
    The method involves accessing parent/root jobs and setting/updating various variables.

    I've created jars and reused basic java functions before.
    However, this method involves traversing Jobs, using Kettle method calls.

    Is there a way to create a single global/static method that uses Kettle methods instead of cut/pasting the method everywhere?

  2. #2
    Join Date
    Aug 2016
    Posts
    239

    Default

    Not that I know of. It would most likely need to jars as you mention. Maybe you could add the kettle core library to the external jar?

    Or you could put the UDJC step in a sub-transformation?

  3. #3
    Join Date
    Apr 2008
    Posts
    4,639

    Default

    You could develop a plug-in...

  4. #4
    Join Date
    Aug 2016
    Posts
    239

    Default

    How would that help to share code between UDJC steps?

  5. #5
    Join Date
    Apr 2008
    Posts
    4,639

    Default

    Since a plug-in is Java code, the plug-in can contain the method (thus allowing it to be reused), and then call the appropriate UDJC.
    Basically, extend the UDJC step to call the particular method. Then you're not cut/pasting the method, and ensures consistency of version of the method in use across the transforms.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2017 Pentaho Corporation. All Rights Reserved.