Search in sources :

Example 16 with Stream

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

the class FuzzyMatchMeta method getStepIOMeta.

/**
 * Returns the Input/Output metadata for this step. The generator step only produces output, does not accept input!
 */
public StepIOMetaInterface getStepIOMeta() {
    if (ioMeta == null) {
        ioMeta = new StepIOMeta(true, true, false, false, false, false);
        StreamInterface stream = new Stream(StreamType.INFO, null, BaseMessages.getString(PKG, "FuzzyMatchMeta.InfoStream.Description"), StreamIcon.INFO, null);
        ioMeta.addStream(stream);
    }
    return ioMeta;
}
Also used : StepIOMeta(org.pentaho.di.trans.step.StepIOMeta) Stream(org.pentaho.di.trans.step.errorhandling.Stream) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 17 with Stream

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

the class JavaFilterMeta method getStepIOMeta.

/**
 * Returns the Input/Output metadata for this step.
 */
public StepIOMetaInterface getStepIOMeta() {
    if (ioMeta == null) {
        ioMeta = new StepIOMeta(true, true, false, false, false, false);
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "JavaFilterMeta.InfoStream.True.Description"), StreamIcon.TRUE, null));
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "JavaFilterMeta.InfoStream.False.Description"), StreamIcon.FALSE, null));
    }
    return ioMeta;
}
Also used : StepIOMeta(org.pentaho.di.trans.step.StepIOMeta) Stream(org.pentaho.di.trans.step.errorhandling.Stream)

Example 18 with Stream

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

the class JobExecutorMeta method getStepIOMeta.

@Override
public StepIOMetaInterface getStepIOMeta() {
    if (ioMeta == null) {
        ioMeta = new StepIOMeta(true, true, true, false, true, false);
        ioMeta.addStream(new Stream(StreamType.TARGET, executionResultTargetStepMeta, BaseMessages.getString(PKG, "JobExecutorMeta.ResultStream.Description"), StreamIcon.TARGET, null));
        ioMeta.addStream(new Stream(StreamType.TARGET, resultRowsTargetStepMeta, BaseMessages.getString(PKG, "JobExecutorMeta.ResultRowsStream.Description"), StreamIcon.TARGET, null));
        ioMeta.addStream(new Stream(StreamType.TARGET, resultFilesTargetStepMeta, BaseMessages.getString(PKG, "JobExecutorMeta.ResultFilesStream.Description"), StreamIcon.TARGET, null));
    }
    return ioMeta;
}
Also used : StepIOMeta(org.pentaho.di.trans.step.StepIOMeta) Stream(org.pentaho.di.trans.step.errorhandling.Stream)

Example 19 with Stream

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

the class TransGraph method addCandidateAsHop.

private void addCandidateAsHop(int mouseX, int mouseY) {
    boolean forward = startHopStep != null;
    StepMeta fromStep = candidate.getFromStep();
    StepMeta toStep = candidate.getToStep();
    // See what the options are.
    // - Does the source step has multiple stream options?
    // - Does the target step have multiple input stream options?
    // 
    List<StreamInterface> streams = new ArrayList<>();
    StepIOMetaInterface fromIoMeta = fromStep.getStepMetaInterface().getStepIOMeta();
    List<StreamInterface> targetStreams = fromIoMeta.getTargetStreams();
    if (forward) {
        streams.addAll(targetStreams);
    }
    StepIOMetaInterface toIoMeta = toStep.getStepMetaInterface().getStepIOMeta();
    List<StreamInterface> infoStreams = toIoMeta.getInfoStreams();
    if (!forward) {
        streams.addAll(infoStreams);
    }
    if (forward) {
        if (fromIoMeta.isOutputProducer() && toStep.equals(currentStep)) {
            streams.add(new Stream(StreamType.OUTPUT, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.MainOutputOfStep"), StreamIcon.OUTPUT, null));
        }
        if (fromStep.supportsErrorHandling() && toStep.equals(currentStep)) {
            streams.add(new Stream(StreamType.ERROR, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.ErrorHandlingOfStep"), StreamIcon.ERROR, null));
        }
    } else {
        if (toIoMeta.isInputAcceptor() && fromStep.equals(currentStep)) {
            streams.add(new Stream(StreamType.INPUT, toStep, BaseMessages.getString(PKG, "Spoon.Hop.MainInputOfStep"), StreamIcon.INPUT, null));
        }
        if (fromStep.supportsErrorHandling() && fromStep.equals(currentStep)) {
            streams.add(new Stream(StreamType.ERROR, fromStep, BaseMessages.getString(PKG, "Spoon.Hop.ErrorHandlingOfStep"), StreamIcon.ERROR, null));
        }
    }
    // 
    if (forward) {
        streams.addAll(fromStep.getStepMetaInterface().getOptionalStreams());
    } else {
        streams.addAll(toStep.getStepMetaInterface().getOptionalStreams());
    }
    // 
    if (streams.size() > 1) {
        // Show a pop-up menu with all the possible options...
        // 
        Menu menu = new Menu(canvas);
        for (final StreamInterface stream : streams) {
            MenuItem item = new MenuItem(menu, SWT.NONE);
            item.setText(Const.NVL(stream.getDescription(), ""));
            item.setImage(getImageFor(stream));
            item.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    addHop(stream);
                }
            });
        }
        menu.setLocation(canvas.toDisplay(mouseX, mouseY));
        menu.setVisible(true);
        return;
    }
    if (streams.size() == 1) {
        addHop(streams.get(0));
    } else {
        return;
    }
    /*
     *
     * if (transMeta.findTransHop(candidate) == null) { spoon.newHop(transMeta, candidate); } if (startErrorHopStep) {
     * addErrorHop(); } if (startTargetHopStream != null) { // Auto-configure the target in the source step... //
     * startTargetHopStream.setStepMeta(candidate.getToStep());
     * startTargetHopStream.setStepname(candidate.getToStep().getName()); startTargetHopStream = null; }
     */
    candidate = null;
    selectedSteps = null;
    startHopStep = null;
    endHopLocation = null;
    startErrorHopStep = false;
// redraw();
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ArrayList(java.util.ArrayList) SelectionEvent(org.eclipse.swt.events.SelectionEvent) StepIOMetaInterface(org.pentaho.di.trans.step.StepIOMetaInterface) Stream(org.pentaho.di.trans.step.errorhandling.Stream) MenuItem(org.eclipse.swt.widgets.MenuItem) XulMenu(org.pentaho.ui.xul.containers.XulMenu) Menu(org.eclipse.swt.widgets.Menu) StepMeta(org.pentaho.di.trans.step.StepMeta) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 20 with Stream

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

the class StreamLookupTest method mockProcessRowMeta.

private StreamLookupMeta mockProcessRowMeta(boolean memoryPreservationActive) throws KettleStepException {
    StreamLookupMeta meta = smh.processRowsStepMetaInterface;
    StepMeta lookupStepMeta = when(mock(StepMeta.class).getName()).thenReturn("Lookup").getMock();
    doReturn(lookupStepMeta).when(smh.transMeta).findStep("Lookup");
    StepIOMeta stepIOMeta = new StepIOMeta(true, true, false, false, false, false);
    stepIOMeta.addStream(new Stream(StreamInterface.StreamType.INFO, lookupStepMeta, null, StreamIcon.INFO, null));
    doReturn(stepIOMeta).when(meta).getStepIOMeta();
    doReturn(new String[] { "Id" }).when(meta).getKeylookup();
    doReturn(new String[] { "Id" }).when(meta).getKeystream();
    doReturn(new String[] { "Value" }).when(meta).getValue();
    doReturn(memoryPreservationActive).when(meta).isMemoryPreservationActive();
    doReturn(false).when(meta).isUsingSortedList();
    doReturn(false).when(meta).isUsingIntegerPair();
    doReturn(new int[] { -1 }).when(meta).getValueDefaultType();
    doReturn(new String[] { "" }).when(meta).getValueDefault();
    doReturn(new String[] { "Value" }).when(meta).getValueName();
    doReturn(new String[] { "Value" }).when(meta).getValue();
    doCallRealMethod().when(meta).getFields(any(RowMetaInterface.class), anyString(), any(RowMetaInterface[].class), any(StepMeta.class), any(VariableSpace.class), any(Repository.class), any(IMetaStore.class));
    return meta;
}
Also used : Repository(org.pentaho.di.repository.Repository) StepIOMeta(org.pentaho.di.trans.step.StepIOMeta) VariableSpace(org.pentaho.di.core.variables.VariableSpace) Stream(org.pentaho.di.trans.step.errorhandling.Stream) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore)

Aggregations

Stream (org.pentaho.di.trans.step.errorhandling.Stream)20 StepIOMeta (org.pentaho.di.trans.step.StepIOMeta)15 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)11 StepIOMetaInterface (org.pentaho.di.trans.step.StepIOMetaInterface)4 ArrayList (java.util.ArrayList)3 Repository (org.pentaho.di.repository.Repository)3 StepMeta (org.pentaho.di.trans.step.StepMeta)2 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 ResourceBundle (java.util.ResourceBundle)1 Set (java.util.Set)1 StringTokenizer (java.util.StringTokenizer)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 UUID (java.util.UUID)1