Interface ITransform

    • Method Detail

      • processRow

        boolean processRow()
                    throws HopException
        Perform the equivalent of processing one row. Typically this means reading a row from input (getRow()) and passing a row to output (putRow)).
        Returns:
        false if no more rows can be processed or an error occurred.
        Throws:
        HopException
      • canProcessOneRow

        boolean canProcessOneRow()
        This method checks if the transform is capable of processing at least one row.

        For example, if a transform has no input records but needs at least one to function, it will return false.

        Returns:
        true if the transform can process a row.
      • init

        boolean init()
        Initialize and do work where other transforms need to wait for...
      • dispose

        void dispose()
        Dispose of this transform: close files, empty logs, etc.
      • markStart

        void markStart()
        Mark the start time of the transform.
      • markStop

        void markStop()
        Mark the end time of the transform.
      • isRunning

        boolean isRunning()
        Specified by:
        isRunning in interface IEngineComponent
        Returns:
        true if the transform is running after having been initialized
      • setRunning

        void setRunning​(boolean running)
        Flag the transform as running or not
        Parameters:
        running - the running flag to set
      • isStopped

        boolean isStopped()
        Specified by:
        isStopped in interface IEngineComponent
        Returns:
        True if the transform is marked as stopped. Execution should stop immediate.
      • setStopped

        void setStopped​(boolean stopped)
        Parameters:
        stopped - true if the transform needs to be stopped
      • setSafeStopped

        default void setSafeStopped​(boolean stopped)
        Parameters:
        stopped - true if the transform needs to be safe stopped
      • isSafeStopped

        default boolean isSafeStopped()
        Returns:
        true if transform is safe stopped.
      • isPaused

        boolean isPaused()
        Specified by:
        isPaused in interface IEngineComponent
        Returns:
        True if the transform is paused
      • stopAll

        void stopAll()
        Flags all rowsets as stopped/completed/finished.
      • pauseRunning

        void pauseRunning()
        Pause a running transform
      • resumeRunning

        void resumeRunning()
        Resume a running transform
      • getTransformName

        String getTransformName()
        Get the name of the transform.
        Returns:
        the name of the transform
      • getCopy

        int getCopy()
        Returns:
        The transforms copy number (default 0)
      • getTransformPluginId

        String getTransformPluginId()
        Returns:
        the type ID of the transform...
      • getErrors

        long getErrors()
        Get the number of errors
        Specified by:
        getErrors in interface IEngineComponent
        Returns:
        the number of errors
      • setErrors

        void setErrors​(long errors)
        Sets the number of errors
        Parameters:
        errors - the number of errors to set
      • setLinesRejected

        void setLinesRejected​(long linesRejected)
        Parameters:
        linesRejected - transforms the lines rejected by error handling.
      • getLinesRejected

        long getLinesRejected()
        Specified by:
        getLinesRejected in interface IEngineComponent
        Returns:
        Returns the lines rejected by error handling.
      • putRow

        void putRow​(IRowMeta row,
                    Object[] data)
             throws HopException
        Put a row on the destination rowsets.
        Parameters:
        row - The row to send to the destinations transforms
        Throws:
        HopException
      • setOutputDone

        void setOutputDone()
        Signal output done to destination transforms
      • addRowListener

        void addRowListener​(IRowListener rowListener)
        Add a rowlistener to the transform allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the transform.
        Specified by:
        addRowListener in interface IEngineComponent
        Parameters:
        rowListener - the rowlistener to add
      • removeRowListener

        void removeRowListener​(IRowListener rowListener)
        Remove a rowlistener from this transform.
        Specified by:
        removeRowListener in interface IEngineComponent
        Parameters:
        rowListener - the rowlistener to remove
      • getRowListeners

        List<IRowListener> getRowListeners()
        Returns:
        a list of the installed RowListeners
      • getInputRowSets

        List<IRowSet> getInputRowSets()
        Returns:
        The list of active input rowsets for the transform
      • getOutputRowSets

        List<IRowSet> getOutputRowSets()
        Returns:
        The list of active output rowsets for the transform
      • isPartitioned

        boolean isPartitioned()
        Returns:
        true if the transform is running partitioned
      • setPartitionId

        void setPartitionId​(String partitionId)
        Parameters:
        partitionId - the partitionID to set
      • getPartitionId

        String getPartitionId()
        Returns:
        the transforms partition ID
      • cleanup

        void cleanup()
        Cleanup any left-over resources for this transform.
      • initBeforeStart

        void initBeforeStart()
                      throws HopTransformException
        This method is executed by Pipeline right before the threads start and right after initialization.

        !!! A plugin implementing this method should make sure to also call super.initBeforeStart(); !!!
        Throws:
        HopTransformException - In case there is an error
      • addTransformFinishedListener

        void addTransformFinishedListener​(ITransformFinishedListener transformListener)
        Attach a transform listener to be notified when a transform finishes
        Parameters:
        transformListener - The listener to add to the transform
      • addTransformStartedListener

        void addTransformStartedListener​(ITransformStartedListener transformListener)
        Attach a transform listener to be notified when a transform starts
        Parameters:
        transformListener - The listener to add to the transform
      • isMapping

        boolean isMapping()
        Returns:
        true if the thread is a special mapping transform
      • getTransformMeta

        TransformMeta getTransformMeta()
        Returns:
        The metadata for this transform
      • rowsetInputSize

        int rowsetInputSize()
        Returns:
        The total amount of rows in the input buffers
      • rowsetOutputSize

        int rowsetOutputSize()
        Returns:
        The total amount of rows in the output buffers
      • getProcessed

        long getProcessed()
        Returns:
        The number of "processed" lines of a transform. Well, a representable metric for that anyway.
      • getResultFiles

        Map<String,​ResultFile> getResultFiles()
        Returns:
        The result files for this transform
      • getExecutionDuration

        long getExecutionDuration()
        Specified by:
        getExecutionDuration in interface IEngineComponent
        Returns:
        The number of ms that this transform has been running
      • identifyErrorOutput

        void identifyErrorOutput()
        To be used to flag an error output channel of a transform prior to execution for performance reasons.
      • setPartitioned

        void setPartitioned​(boolean partitioned)
        Parameters:
        partitioned - true if this transform is partitioned
      • setRepartitioning

        void setRepartitioning​(int partitioningMethod)
        Parameters:
        partitioningMethod - The repartitioning method
      • batchComplete

        void batchComplete()
                    throws HopException
        When using the Single threaded engine this signals to the transform that a batch of records has been processed and that no more are expected in this batch.
        Throws:
        HopException - In case an error occurs during the processing of the batch of rows.
      • startBundle

        void startBundle()
                  throws HopException
        When running in a Beam context this signals the transform that a new bundle was started. File writing transforms might want to create new files here.
        Throws:
        HopException
      • finishBundle

        void finishBundle()
                   throws HopException
        When running in a Beam context this signals the transform that a bundle was finished. File writing transforms will want to close open file(s) here.
        Throws:
        HopException
      • setMetadataProvider

        void setMetadataProvider​(IHopMetadataProvider metadataProvider)
        Pass along the metadata to use when loading external elements at runtime.
        Parameters:
        metadataProvider - The metadata to use
      • getMetadataProvider

        IHopMetadataProvider getMetadataProvider()
        Returns:
        The metadata that the transform uses to load external elements from.
      • getCurrentOutputRowSetNr

        int getCurrentOutputRowSetNr()
        Returns:
        the index of the active (current) output row set
      • setCurrentOutputRowSetNr

        void setCurrentOutputRowSetNr​(int index)
        Parameters:
        index - Sets the index of the active (current) output row set to use.
      • getCurrentInputRowSetNr

        int getCurrentInputRowSetNr()
        Returns:
        the index of the active (current) input row set
      • setCurrentInputRowSetNr

        void setCurrentInputRowSetNr​(int index)
        Parameters:
        index - Sets the index of the active (current) input row set to use.
      • addRowSetToInputRowSets

        default void addRowSetToInputRowSets​(IRowSet rowSet)
      • addRowSetToOutputRowSets

        default void addRowSetToOutputRowSets​(IRowSet rowSet)
      • getMeta

        ITransformMeta getMeta()
        Returns:
        Returns the transform specific metadata.
      • getData

        ITransformData getData()
        Get the transform data
        Returns:
        the tansform data
      • setInitStartDate

        void setInitStartDate​(Date initStartDate)
        Specified by:
        setInitStartDate in interface IEngineComponent
        Parameters:
        initStartDate - The initStartDate to set
      • setExecutionStartDate

        void setExecutionStartDate​(Date executionStartDate)
        Specified by:
        setExecutionStartDate in interface IEngineComponent
        Parameters:
        executionStartDate - The executionStartDate to set
      • setFirstRowReadDate

        void setFirstRowReadDate​(Date firstRowReadDate)
        Specified by:
        setFirstRowReadDate in interface IEngineComponent
        Parameters:
        firstRowReadDate - The firstRowReadDate to set
      • setLastRowWrittenDate

        void setLastRowWrittenDate​(Date lastRowWrittenDate)
        Specified by:
        setLastRowWrittenDate in interface IEngineComponent
        Parameters:
        lastRowWrittenDate - The lastRowWrittenDate to set
      • setExecutionEndDate

        void setExecutionEndDate​(Date executionEndDate)
        Specified by:
        setExecutionEndDate in interface IEngineComponent
        Parameters:
        executionEndDate - The executionEndDate to set