try
{
final Repository repository = connectToRepository(logWriter);
try
{
final TransMeta transMeta = loadTransformation(repository, resourceManager, resourceKey);
transMeta.setArguments(params);
final Trans trans = new Trans(transMeta);
for (int i = 0; i < definedVariableNames.length; i++)
{
final ParameterMapping mapping = definedVariableNames[i];
final String sourceName = mapping.getName();
final String variableName = mapping.getAlias();
final Object value = parameters.get(sourceName);
if (value != null)
{
trans.setParameterValue(variableName, String.valueOf(value));
}
}
transMeta.setInternalKettleVariables();
trans.prepareExecution(transMeta.getArguments());
TableProducer tableProducer = null;
final List stepList = trans.getSteps();
for (int i = 0; i < stepList.size(); i++)
{
final StepMetaDataCombi metaDataCombi = (StepMetaDataCombi) stepList.get(i);
if (stepName.equals(metaDataCombi.stepname) == false)
{
continue;
}
final RowMetaInterface row = transMeta.getStepFields(stepName);
tableProducer = new TableProducer(row, queryLimit, stopOnError);
metaDataCombi.step.addRowListener(tableProducer);
break;
}