Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Pentaho SDK, how to define a text file input

  1. #1
    Join Date
    May 2015
    Posts
    4

    Default Pentaho SDK, how to define a text file input

    I'm trying to define a Pentaho Kettle (ktr) transformation via code. I would like to add to the transformation a Text File Input Step: http://wiki.pentaho.com/display/EAI/Text+File+Input.
    I don't know how to do this (note that I want to achieve the result in a custom Java application, not using the standard Spoon GUI). I think I should use the TextFileInputMeta class, but when I try to define the filename the trasformation doesn't work anymore (it seems empty in Spoon).

    This is the code I'm using. I think the third line has something wrong:

    PluginRegistry registry = PluginRegistry.getInstance();
    TextFileInputMeta fileInMeta = new TextFileInputMeta();
    fileInMeta.setFileName(new String[] {myFileName});
    String fileInPluginId = registry.getPluginId(StepPluginType.class, fileInMeta);
    StepMeta fileInStepMeta = new StepMeta(fileInPluginId, myStepName, fileInMeta);
    fileInStepMeta.setDraw(true);
    fileInStepMeta.setLocation(100, 200);
    transAWMMeta.addStep(fileInStepMeta);

  2. #2
    Join Date
    May 2015
    Posts
    4

    Default

    I've used CsvInputMeta class instead, it's easier and works for me. But, how can I "simulate" via code" the "get fields" button available in the Spoon GUI? Thank you.

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