Created
September 15, 2012 03:10
-
-
Save mattyb149/3726209 to your computer and use it in GitHub Desktop.
UDJC PDI step acting as Input generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ | |
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(pluginInfoCols, numCols); | |
for(int i=0;i<numCols;i++) { | |
ValueMetaInterface v = rmi.getValueMeta(i); | |
try { | |
outputRow[i] = v.getString(pluginInfoCols[i]); | |
} | |
catch(Exception e){} | |
} | |
putRow(data.outputRowMeta, outputRow); | |
} | |
setOutputDone(); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment