Search in sources :

Example 41 with StepMetaDataCombi

use of org.pentaho.di.trans.step.StepMetaDataCombi in project pentaho-kettle by pentaho.

the class Trans method findDataInterface.

/**
 * Find the data interface for the step with the specified name.
 *
 * @param name
 *          the step name
 * @return the step data interface
 */
public StepDataInterface findDataInterface(String name) {
    if (steps == null) {
        return null;
    }
    for (int i = 0; i < steps.size(); i++) {
        StepMetaDataCombi sid = steps.get(i);
        StepInterface rt = sid.step;
        if (rt.getStepname().equalsIgnoreCase(name)) {
            return sid.data;
        }
    }
    return null;
}
Also used : StepInterface(org.pentaho.di.trans.step.StepInterface) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 42 with StepMetaDataCombi

use of org.pentaho.di.trans.step.StepMetaDataCombi in project pentaho-kettle by pentaho.

the class Trans method findMappingInput.

/**
 * Gets the mapping inputs for each step in the transformation.
 *
 * @return an array of MappingInputs
 */
public MappingInput[] findMappingInput() {
    if (steps == null) {
        return null;
    }
    List<MappingInput> list = new ArrayList<>();
    // Look in threads and find the MappingInput step thread...
    for (int i = 0; i < steps.size(); i++) {
        StepMetaDataCombi smdc = steps.get(i);
        StepInterface step = smdc.step;
        if (step.getStepID().equalsIgnoreCase("MappingInput")) {
            list.add((MappingInput) step);
        }
    }
    return list.toArray(new MappingInput[list.size()]);
}
Also used : MappingInput(org.pentaho.di.trans.steps.mappinginput.MappingInput) StepInterface(org.pentaho.di.trans.step.StepInterface) ArrayList(java.util.ArrayList) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 43 with StepMetaDataCombi

use of org.pentaho.di.trans.step.StepMetaDataCombi in project pentaho-kettle by pentaho.

the class Trans method findStepInterface.

/**
 * Find the executing step copy for the step with the specified name and copy number
 *
 * @param stepname
 *          the step name
 * @param copynr
 * @return the executing step found or null if no copy could be found.
 */
public StepInterface findStepInterface(String stepname, int copyNr) {
    if (steps == null) {
        return null;
    }
    for (int i = 0; i < steps.size(); i++) {
        StepMetaDataCombi sid = steps.get(i);
        StepInterface stepInterface = sid.step;
        if (stepInterface.getStepname().equalsIgnoreCase(stepname) && sid.copy == copyNr) {
            return stepInterface;
        }
    }
    return null;
}
Also used : StepInterface(org.pentaho.di.trans.step.StepInterface) StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 44 with StepMetaDataCombi

use of org.pentaho.di.trans.step.StepMetaDataCombi in project pentaho-kettle by pentaho.

the class Trans method getEnded.

/**
 * Gets the number of steps in the transformation that are in an end state, such as Finished, Halted, or Stopped.
 *
 * @return the number of ended steps
 */
public int getEnded() {
    int nrEnded = 0;
    if (steps == null) {
        return 0;
    }
    for (int i = 0; i < steps.size(); i++) {
        StepMetaDataCombi sid = steps.get(i);
        StepDataInterface data = sid.data;
        if ((sid.step != null && !sid.step.isRunning()) || // Should normally not be needed anymore, status is kept in data.
        data.getStatus() == // Finished processing
        StepExecutionStatus.STATUS_FINISHED || // Not launching because of init error
        data.getStatus() == StepExecutionStatus.STATUS_HALTED || // Stopped because of an error
        data.getStatus() == StepExecutionStatus.STATUS_STOPPED) {
            nrEnded++;
        }
    }
    return nrEnded;
}
Also used : StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi) StepDataInterface(org.pentaho.di.trans.step.StepDataInterface) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 45 with StepMetaDataCombi

use of org.pentaho.di.trans.step.StepMetaDataCombi in project pentaho-kettle by pentaho.

the class TransPartitioningTest method getStepByName.

private StepInterface getStepByName(String name) {
    List<StepMetaDataCombi> combiList = trans.getSteps();
    for (StepMetaDataCombi item : combiList) {
        if (item.step.toString().equals(name)) {
            return item.step;
        }
    }
    fail("Test error, can't find step with name: " + name);
    // and this will never happens.
    return null;
}
Also used : StepMetaDataCombi(org.pentaho.di.trans.step.StepMetaDataCombi)

Aggregations

StepMetaDataCombi (org.pentaho.di.trans.step.StepMetaDataCombi)55 StepInterface (org.pentaho.di.trans.step.StepInterface)21 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)18 Test (org.junit.Test)13 KettleException (org.pentaho.di.core.exception.KettleException)10 ArrayList (java.util.ArrayList)8 StepMeta (org.pentaho.di.trans.step.StepMeta)8 Trans (org.pentaho.di.trans.Trans)7 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)6 KettleValueException (org.pentaho.di.core.exception.KettleValueException)6 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)6 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)6 RowSet (org.pentaho.di.core.RowSet)5 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)5 TransMeta (org.pentaho.di.trans.TransMeta)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 Before (org.junit.Before)4 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)4 KettleFileException (org.pentaho.di.core.exception.KettleFileException)4