0

I am trying to learn how to write an input step plugin, which writes "hello world". I have issues in the Step class. I have serious problems writing down the processRow function as all the tutorials assume the step to have some input and use getRow ... and inherit the meta structure from the input:

Here's my class (without the processRow body):

public class Test001Plugin extends BaseStep implements StepInterface {
    private Test001PluginMeta meta;
    private Test001PluginData data;

    public Test001Plugin(StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
        Trans trans) {
    super(stepMeta, stepDataInterface, copyNr, transMeta, trans);

    }

    public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
        // Casting to step-specific implementation classes is safe
        try{
            meta = (Test001PluginMeta) smi;
            data = (Test001PluginData) sdi;
            if (  super.init(meta, data))
                {
                return true;
                }
            else return false;

           } catch ( Exception e ) {
              setErrors( 1L );
              logError( "Error initializing step", e );
              return false;
        }
    }   



    @SuppressWarnings("deprecation")
    public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {

    }
}

May you help me complete the code? or forward me to the appropriate tutorial?

Best Regards

Bruno C
  • 199
  • 13
  • Can't you look at the source for steps that generate rows? [DataGrid.java](https://github.com/pentaho/pentaho-kettle/blob/1b6a2b940bf5f3f601d109cf1b15bb2e3a9771e4/engine/src/org/pentaho/di/trans/steps/datagrid/DataGrid.java) [RowGenerator.java](https://github.com/pentaho/pentaho-kettle/blob/1b6a2b940bf5f3f601d109cf1b15bb2e3a9771e4/engine/src/org/pentaho/di/trans/steps/rowgenerator/RowGenerator.java) – bolav Dec 19 '15 at 23:28
  • At the end this is what I am doing; but I don't manage to get the full logic. For example, I don't get why the row is built by buildRow instead of being built by ProcessRow.... Why do I need to use an object matrix r = data.outputRowMeta.cloneRow( data.outputRowData ); which is then used in the following command: putRow( data.outputRowMeta, r ); instead of the following? putRow( data.outputRowMeta, data.outputRowData); I have lots of questions raised by this complex piece of code. That's why I am looking for a minimalistic example . – Bruno C Dec 21 '15 at 22:54
  • The two files does it a little different, so I guess you are able to solve it in different ways. – bolav Dec 22 '15 at 19:35

0 Answers0