Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: java and Kettle

  1. #1
    Join Date
    Jun 2007
    Posts
    128

    Default java and Kettle

    Hi ,

    I have some java api to convert my binary file into ascii.So what I would like to know is how can we use this java api in Kettle and instead of creating ascii files i want to load data directly into database.
    How can we use custom java api in Kettle?

    Thanks
    Sreelatha

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Look at the test cases under the test directory. Some of them build the whole transformation with the java interface of Kettle.

    For most people trying to embed transformations the least effort will probably be to reuse code from pan, so that you load transformations in your java application which you can still maintain via spoon (which is not possible if you build the whole transformation in java).

    Regards,
    Sven

  3. #3
    Join Date
    Jun 2007
    Posts
    128

    Default

    Hi,

    Can you please elaborate on this.
    I didn't understand how can we use the java application as transformation in spoon.

    Thanks
    Sreelatha

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Wongly understood question.

    If you want to use your own java bits and pieces in a transformation there are basically 2 ways:
    1) Use javascript step (putting the jar file for your own bits and pieces in the libext directory of kettle)... the way to do this is in the FAQ. Search for javascript and then for Package.
    2) Write your own step.

    Regards,
    Sven

  5. #5
    Join Date
    Jun 2007
    Posts
    128

    Default

    Hi,

    I didn't find information related to calling a custom java class from java script.As mentioned I created a jar file and put it in libext .
    Can you tell me how should i call that?

    Thanks
    Sreelatha

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    In 2.5 you could do something like...

    Code:
    var value = Packages.be.ibridge.kettle.core.value.Value.getInstance();
    value.setName("name_of_field");
    value.setValue("value_of_field"); // possibly using types other than String
    row.addValue(value);
    If you use "Packages.your class name instantiation method" it should work.

    Regards,
    Sven

  7. #7
    Join Date
    Jun 2007
    Posts
    128

    Default

    Hi,

    My class name is First.
    Var value=Packages.First should work .Is it so?

    Thanks
    Sreelatha

  8. #8
    Join Date
    May 2006
    Posts
    4,882

    Default

    That's the proper access way, but you need to first instantiate your class of course... ... in my example getInstance of that particular class is used to return an object.

    Regards,
    Sven

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 - 2019 Hitachi Vantara Corporation. All Rights Reserved.