Class BaseFileInputStep<M extends BaseFileInputMeta<?,?,?>,D extends BaseFileInputStepData>

java.lang.Object
org.pentaho.di.trans.step.BaseStep
org.pentaho.di.trans.steps.file.BaseFileInputStep<M,D>
All Implemented Interfaces:
org.pentaho.di.core.ExtensionDataInterface, HasLogChannelInterface, org.pentaho.di.core.logging.LoggingObjectInterface, org.pentaho.di.core.logging.LoggingObjectLifecycleInterface, org.pentaho.di.core.variables.VariableSpace, StepInterface, IBaseFileInputStepControl
Direct Known Subclasses:
TextFileInput

public abstract class BaseFileInputStep<M extends BaseFileInputMeta<?,?,?>,D extends BaseFileInputStepData> extends BaseStep implements IBaseFileInputStepControl
This class contains base functionality for file-based input steps.
Author:
Alexander Buloichik
  • Field Details

  • Constructor Details

  • Method Details

    • init

      protected abstract boolean init()
      Content-dependent initialization.
    • createReader

      protected abstract IBaseFileInputReader createReader(M meta, D data, org.apache.commons.vfs2.FileObject file) throws Exception
      Create reader for specific file.
      Throws:
      Exception
    • init

      public boolean init(StepMetaInterface smi, StepDataInterface sdi)
      Initialize step before execute.
      Specified by:
      init in interface StepInterface
      Overrides:
      init in class BaseStep
      Parameters:
      smi - The metadata to work with
      sdi - The data to initialize
    • openNextFile

      protected boolean openNextFile()
      Open next VFS file for processing. This method will support different parallelization methods later.
    • handleOpenFileException

      protected boolean handleOpenFileException(Exception e)
    • processRow

      public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws org.pentaho.di.core.exception.KettleException
      Process next row. This methods opens next file automatically.
      Specified by:
      processRow in interface StepInterface
      Overrides:
      processRow in class BaseStep
      Parameters:
      smi - The steps metadata to work with
      sdi - The steps temporary working data to work with (database connections, result sets, caches, temporary variables, etc.)
      Returns:
      false if no more rows can be processed or an error occurred.
      Throws:
      org.pentaho.di.core.exception.KettleException
    • prepareToRowProcessing

      protected void prepareToRowProcessing() throws org.pentaho.di.core.exception.KettleException
      Prepare to process. Executed only first time row processing. It can't be possible to prepare to process in the init() phrase, because files can be in fields from previous step.
      Throws:
      org.pentaho.di.core.exception.KettleException
    • checkFeedback

      public boolean checkFeedback(long lines)
      Description copied from class: BaseStep
      Check feedback.
      Specified by:
      checkFeedback in interface IBaseFileInputStepControl
      Overrides:
      checkFeedback in class BaseStep
      Parameters:
      lines - the lines
      Returns:
      true, if successful
    • closeLastFile

      protected void closeLastFile()
      Close last opened file/
    • dispose

      public void dispose(StepMetaInterface smi, StepDataInterface sdi)
      Dispose step.
      Specified by:
      dispose in interface StepInterface
      Overrides:
      dispose in class BaseStep
      Parameters:
      smi - The metadata to work with
      sdi - The data to dispose of
    • failAfterBadFile

      public boolean failAfterBadFile(String errorMsg)
      Specified by:
      failAfterBadFile in interface IBaseFileInputStepControl
      Parameters:
      errorMsg - Message to send to rejected row if enabled
      Returns:
      If should stop processing after having problems with a file
    • fillFileAdditionalFields

      protected void fillFileAdditionalFields(D data, org.apache.commons.vfs2.FileObject file) throws org.apache.commons.vfs2.FileSystemException
      Prepare file-dependent data for fill additional fields.
      Throws:
      org.apache.commons.vfs2.FileSystemException