Interface ITransform
-
- All Superinterfaces:
IEngineComponent,IExtensionData,IHasLogChannel,IVariables
- All Known Implementing Classes:
AbstractTransform,BaseFileInputTransform,BaseTransform,Dummy,Injector,MissingTransform
public interface ITransform extends IVariables, IHasLogChannel, IEngineComponent, IExtensionData
The interface that any pipeline transform or plugin needs to implement.Created on 12-AUG-2004
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddRowListener(IRowListener rowListener)Add a rowlistener to the transform allowing you to inspect (or manipulate, be careful) the rows coming in or exiting the transform.default voidaddRowSetToInputRowSets(IRowSet rowSet)default voidaddRowSetToOutputRowSets(IRowSet rowSet)voidaddTransformFinishedListener(ITransformFinishedListener transformListener)Attach a transform listener to be notified when a transform finishesvoidaddTransformStartedListener(ITransformStartedListener transformListener)Attach a transform listener to be notified when a transform startsvoidbatchComplete()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.booleancanProcessOneRow()This method checks if the transform is capable of processing at least one row.voidcleanup()Cleanup any left-over resources for this transform.voiddispose()Dispose of this transform: close files, empty logs, etc.voidfinishBundle()When running in a Beam context this signals the transform that a bundle was finished.intgetCopy()intgetCurrentInputRowSetNr()intgetCurrentOutputRowSetNr()ITransformDatagetData()Get the transform datalonggetErrors()Get the number of errorslonggetExecutionDuration()DategetExecutionEndDate()Gets executionEndDateDategetExecutionStartDate()Gets executionStartDateDategetFirstRowReadDate()Gets firstRowReadDateDategetInitStartDate()Gets initStartDateList<IRowSet>getInputRowSets()DategetLastRowWrittenDate()Gets lastRowWrittenDatelonggetLinesInput()longgetLinesOutput()longgetLinesRead()longgetLinesRejected()longgetLinesUpdated()longgetLinesWritten()ILogChannelgetLogChannel()ITransformMetagetMeta()IHopMetadataProvidergetMetadataProvider()List<IRowSet>getOutputRowSets()StringgetPartitionId()IPipelineEngine<PipelineMeta>getPipeline()longgetProcessed()Map<String,ResultFile>getResultFiles()Object[]getRow()List<IRowListener>getRowListeners()EngineComponent.ComponentExecutionStatusgetStatus()Get the execution status of the componentTransformMetagetTransformMeta()StringgetTransformName()Get the name of the transform.StringgetTransformPluginId()voididentifyErrorOutput()To be used to flag an error output channel of a transform prior to execution for performance reasons.booleaninit()Initialize and do work where other transforms need to wait for...voidinitBeforeStart()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(); !!!booleanisMapping()booleanisPartitioned()booleanisPaused()booleanisRunning()default booleanisSafeStopped()booleanisStopped()voidmarkStart()Mark the start time of the transform.voidmarkStop()Mark the end time of the transform.voidpauseRunning()Pause a running transformbooleanprocessRow()Perform the equivalent of processing one row.voidputRow(IRowMeta row, Object[] data)Put a row on the destination rowsets.voidremoveRowListener(IRowListener rowListener)Remove a rowlistener from this transform.voidresumeRunning()Resume a running transformintrowsetInputSize()introwsetOutputSize()voidsetCurrentInputRowSetNr(int index)voidsetCurrentOutputRowSetNr(int index)voidsetErrors(long errors)Sets the number of errorsvoidsetExecutionEndDate(Date executionEndDate)voidsetExecutionStartDate(Date executionStartDate)voidsetFirstRowReadDate(Date firstRowReadDate)voidsetInitStartDate(Date initStartDate)voidsetLastRowWrittenDate(Date lastRowWrittenDate)voidsetLinesRejected(long linesRejected)voidsetMetadataProvider(IHopMetadataProvider metadataProvider)Pass along the metadata to use when loading external elements at runtime.voidsetOutputDone()Signal output done to destination transformsvoidsetPartitioned(boolean partitioned)voidsetPartitionId(String partitionId)voidsetRepartitioning(int partitioningMethod)voidsetRunning(boolean running)Flag the transform as running or notdefault voidsetSafeStopped(boolean stopped)voidsetStopped(boolean stopped)voidstartBundle()When running in a Beam context this signals the transform that a new bundle was started.voidstopAll()Flags all rowsets as stopped/completed/finished.voidstopRunning()Stop running operations...default Collection<TransformStatus>subStatuses()-
Methods inherited from interface org.apache.hop.pipeline.engine.IEngineComponent
getCopyNr, getInputBufferSize, getLogChannelId, getLogLevel, getLogText, getName, getOutputBufferSize, getStatusDescription, isSelected, setLogLevel
-
Methods inherited from interface org.apache.hop.core.IExtensionData
getExtensionDataMap
-
Methods inherited from interface org.apache.hop.core.variables.IVariables
copyFrom, getParentVariables, getVariable, getVariable, getVariableBoolean, getVariableNames, initializeFrom, resolve, resolve, resolve, setParentVariables, setVariable, setVariables, shareWith
-
-
-
-
Method Detail
-
getPipeline
IPipelineEngine<PipelineMeta> getPipeline()
- Returns:
- the pipeline that is executing this transform
-
processRow
boolean processRow() throws HopExceptionPerform 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.
-
stopRunning
void stopRunning() throws HopExceptionStop running operations...- Throws:
HopException
-
isRunning
boolean isRunning()
- Specified by:
isRunningin interfaceIEngineComponent- 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:
isStoppedin interfaceIEngineComponent- 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:
isPausedin interfaceIEngineComponent- 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:
getErrorsin interfaceIEngineComponent- Returns:
- the number of errors
-
setErrors
void setErrors(long errors)
Sets the number of errors- Parameters:
errors- the number of errors to set
-
getLinesInput
long getLinesInput()
- Specified by:
getLinesInputin interfaceIEngineComponent- Returns:
- Returns the linesInput.
-
getLinesOutput
long getLinesOutput()
- Specified by:
getLinesOutputin interfaceIEngineComponent- Returns:
- Returns the linesOutput.
-
getLinesRead
long getLinesRead()
- Specified by:
getLinesReadin interfaceIEngineComponent- Returns:
- Returns the linesRead.
-
getLinesWritten
long getLinesWritten()
- Specified by:
getLinesWrittenin interfaceIEngineComponent- Returns:
- Returns the linesWritten.
-
getLinesUpdated
long getLinesUpdated()
- Specified by:
getLinesUpdatedin interfaceIEngineComponent- Returns:
- Returns the linesUpdated.
-
setLinesRejected
void setLinesRejected(long linesRejected)
- Parameters:
linesRejected- transforms the lines rejected by error handling.
-
getLinesRejected
long getLinesRejected()
- Specified by:
getLinesRejectedin interfaceIEngineComponent- 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
-
getRow
Object[] getRow() throws HopException
- Returns:
- a row from the source transform(s).
- 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:
addRowListenerin interfaceIEngineComponent- Parameters:
rowListener- the rowlistener to add
-
removeRowListener
void removeRowListener(IRowListener rowListener)
Remove a rowlistener from this transform.- Specified by:
removeRowListenerin interfaceIEngineComponent- 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 HopTransformExceptionThis 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
-
getLogChannel
ILogChannel getLogChannel()
- Specified by:
getLogChannelin interfaceIEngineComponent- Specified by:
getLogChannelin interfaceIHasLogChannel- Returns:
- the logging channel 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
-
getStatus
EngineComponent.ComponentExecutionStatus getStatus()
Description copied from interface:IEngineComponentGet the execution status of the component- Specified by:
getStatusin interfaceIEngineComponent- Returns:
- the description as in
ITransformData
-
getExecutionDuration
long getExecutionDuration()
- Specified by:
getExecutionDurationin interfaceIEngineComponent- 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 HopExceptionWhen 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 HopExceptionWhen 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 HopExceptionWhen 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.
-
subStatuses
default Collection<TransformStatus> subStatuses()
-
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
-
getInitStartDate
Date getInitStartDate()
Gets initStartDate- Specified by:
getInitStartDatein interfaceIEngineComponent- Returns:
- value of initStartDate
-
setInitStartDate
void setInitStartDate(Date initStartDate)
- Specified by:
setInitStartDatein interfaceIEngineComponent- Parameters:
initStartDate- The initStartDate to set
-
getExecutionStartDate
Date getExecutionStartDate()
Gets executionStartDate- Specified by:
getExecutionStartDatein interfaceIEngineComponent- Returns:
- value of executionStartDate
-
setExecutionStartDate
void setExecutionStartDate(Date executionStartDate)
- Specified by:
setExecutionStartDatein interfaceIEngineComponent- Parameters:
executionStartDate- The executionStartDate to set
-
getFirstRowReadDate
Date getFirstRowReadDate()
Gets firstRowReadDate- Specified by:
getFirstRowReadDatein interfaceIEngineComponent- Returns:
- value of firstRowReadDate
-
setFirstRowReadDate
void setFirstRowReadDate(Date firstRowReadDate)
- Specified by:
setFirstRowReadDatein interfaceIEngineComponent- Parameters:
firstRowReadDate- The firstRowReadDate to set
-
getLastRowWrittenDate
Date getLastRowWrittenDate()
Gets lastRowWrittenDate- Specified by:
getLastRowWrittenDatein interfaceIEngineComponent- Returns:
- value of lastRowWrittenDate
-
setLastRowWrittenDate
void setLastRowWrittenDate(Date lastRowWrittenDate)
- Specified by:
setLastRowWrittenDatein interfaceIEngineComponent- Parameters:
lastRowWrittenDate- The lastRowWrittenDate to set
-
getExecutionEndDate
Date getExecutionEndDate()
Gets executionEndDate- Specified by:
getExecutionEndDatein interfaceIEngineComponent- Returns:
- value of executionEndDate
-
setExecutionEndDate
void setExecutionEndDate(Date executionEndDate)
- Specified by:
setExecutionEndDatein interfaceIEngineComponent- Parameters:
executionEndDate- The executionEndDate to set
-
-