Injector

Description

Injector was created for those people that are developing special purpose transformations and want to 'inject' rows into the transformation using the Kettle API and Java. Among other things you can build 'headless' transformations with it: transformations that have no input at design time: do not read from file or database.

Options

Option

Definition

Step name

The name of this step as it appears in the transformation workspace.

Fieldname

Specify the field name of the rows to inject.

Type

Specify the type of data.

Length

For Number: Total number of significant figures in a number; For String: total length of string; For Date: length of printed output of the string.

Precision

For Number: Number of floating point digits; For String, Date, Boolean: unused.

Example

Here is some information on how to do it:

  • You can ask a Trans object for a RowProducer object
  • Also see the unit test case: org.pentaho.di.trans.RowProducerTest
  • Use this type of code:
    Trans trans = new Trans(... TransMeta ...);
    trans.prepareExecution(args);
    RowProcuder rp = trans.addRowProducer(String stepname, int stepCopy);
    
    After that you start the threads in the transformation. Then you can inject the rows while the transformation is running:
    trans.startThreads();
    ...
    rp.putRow(some row you need to inject);
    ...
    
    You can also specify the rows you are expecting to be injected. This makes it easier to build transformations because you have the meta-data at design time.

See also the PDI SDK: "Embedding and Extending Pentaho Data Integration" within the Developer Guides