Skip to content

Instantly share code, notes, and snippets.

@mattyb149
Created September 14, 2012 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattyb149/3724213 to your computer and use it in GitHub Desktop.
Save mattyb149/3724213 to your computer and use it in GitHub Desktop.
PDI UDJC code to get Step Plugin info
import org.pentaho.di.core.plugins.*;
import org.pentaho.di.core.row.*;
import java.util.List;
String type;
String id;
String name;
String description;
String libraries;
String imagefile;
String classname;
String category;
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
// First, get a row from the default input hop
//
Object[] r = getRow();
// If the row object is null, we are done processing.
//
if (r == null) {
setOutputDone();
return false;
}
// It is always safest to call createOutputRow() to ensure that your output row's Object[] is large
// enough to handle any new fields you are creating in this step.
//
RowBuffer rowBuffer = PluginRegistry.getInstance().getPluginInformation(StepPluginType.class);
RowMetaInterface rmi = rowBuffer.getRowMeta();
int numCols = rmi.size();
List pluginInfo = rowBuffer.getBuffer();
int numRows = pluginInfo.size();
for(int rowNum=0;rowNum<numRows;rowNum++) {
Object[] pluginInfoCols = (Object[])pluginInfo.get(rowNum);
Object[] outputRow = createOutputRow(r, numCols);
for(int i=0;i<numCols;i++) {
ValueMetaInterface v = rmi.getValueMeta(i);
outputRow[i] = v.getString(pluginInfoCols[i]);
}
putRow(data.outputRowMeta, outputRow);
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment