Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TODO: Add, Clean, Fix (This is better than nothing)

Hi Daniel,
In that case, I recommend checking out the DummyPlugin example: http://wiki.pentaho.com/display/EAI/DummyPlugin+3+plugin+page
The code is pretty helpful.
Basically, every Transformation Step has 4 classes:
- Plugin: Main processing component
- Meta: Configuration information (How the step was configured in spoon)
- Data: Runtime data (Each running instance of the thread can keep track of state here)
- Dialog: Configuration dialog (Used in Spoon)
How to read in rows:
The Plugin is the "core" of the step and contains the all important processRow(StepMetaInterface smi, StepDataInterface sdi) method.
This method is executed continuously and the getRow() method is invoked to pull data from the input stream for processing. getInputRowMeta() can be used to fetch information about the structure of the Object array returned by getRow(); (size, type, etc...)
NOTE: Do not go by the size of the Object[] returned by getRow(), it is allocated in chunks. Get the field count for the incoming row from getInputRowMeta().
How to create new fields for output:
In the processRow(...) method you invoke putRow(meta, row) to send a row to the output stream (onto the next step). You determine what the meta is, a simple way to accomplish field addition is to copy the input row meta and add your output field meta to it. Then use that as the outputMeta.
Checkout http://source.pentaho.org/svnkettleroot/Kettle/trunk/src/org/pentaho/di/trans/steps/rowgenerator/RowGenerator.java for an example.
NOTE: RowGenerateMeta.getFields(...) is used to tell the UI what the outputMeta will be at build time. This is important to do.
Loading and Saving of step are accomplished in the StepMeta with the following four methods:
Repository:
- readRep(...)
- saveRep(...)
File:
- loadXml(...)
- getXml(...)
There is a new SDK section that you can add to if you want as well: http://wiki.pentaho.com/display/EAI/PDI+Plugin+Development
Other confusing links: http://wiki.pentaho.com/display/COM/PDI+Plugin+Loading http://wiki.pentaho.com/display/EAI/Writing+your+own+Pentaho+Data+Integration+Plug-In
Hope this helps,
-Curtis
Check out the DummyPlugin example:

...