Search in sources :

Example 1 with IFileErrorHandler

use of org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler in project hop by apache.

the class BaseFileInputTransform method initErrorHandling.

/**
 * Initialize error handling.
 *
 * <p>TODO: should we set charset for error files from content meta ? What about case for
 * automatic charset ?
 */
private void initErrorHandling() {
    List<IFileErrorHandler> dataErrorLineHandlers = new ArrayList<>(2);
    if (meta.errorHandling.lineNumberFilesDestinationDirectory != null) {
        dataErrorLineHandlers.add(new FileErrorHandlerContentLineNumber(getPipeline().getExecutionStartDate(), resolve(meta.errorHandling.lineNumberFilesDestinationDirectory), meta.errorHandling.lineNumberFilesExtension, meta.getEncoding(), this));
    }
    if (meta.errorHandling.errorFilesDestinationDirectory != null) {
        dataErrorLineHandlers.add(new FileErrorHandlerMissingFiles(getPipeline().getExecutionStartDate(), resolve(meta.errorHandling.errorFilesDestinationDirectory), meta.errorHandling.errorFilesExtension, meta.getEncoding(), this));
    }
    data.dataErrorLineHandler = new CompositeFileErrorHandler(dataErrorLineHandlers);
}
Also used : IFileErrorHandler(org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler) FileErrorHandlerMissingFiles(org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerMissingFiles) FileErrorHandlerContentLineNumber(org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerContentLineNumber) CompositeFileErrorHandler(org.apache.hop.pipeline.transform.errorhandling.CompositeFileErrorHandler)

Example 2 with IFileErrorHandler

use of org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler in project hop by apache.

the class ExcelInput method initErrorHandling.

private void initErrorHandling() {
    List<IFileErrorHandler> errorHandlers = new ArrayList<>(2);
    if (meta.getLineNumberFilesDestinationDirectory() != null) {
        errorHandlers.add(new FileErrorHandlerContentLineNumber(getPipeline().getExecutionStartDate(), resolve(meta.getLineNumberFilesDestinationDirectory()), meta.getLineNumberFilesExtension(), "Latin1", this));
    }
    if (meta.getErrorFilesDestinationDirectory() != null) {
        errorHandlers.add(new FileErrorHandlerMissingFiles(getPipeline().getExecutionStartDate(), resolve(meta.getErrorFilesDestinationDirectory()), meta.getErrorFilesExtension(), "Latin1", this));
    }
    data.errorHandler = new CompositeFileErrorHandler(errorHandlers);
}
Also used : IFileErrorHandler(org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler) FileErrorHandlerMissingFiles(org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerMissingFiles) FileErrorHandlerContentLineNumber(org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerContentLineNumber) ArrayList(java.util.ArrayList) CompositeFileErrorHandler(org.apache.hop.pipeline.transform.errorhandling.CompositeFileErrorHandler)

Aggregations

CompositeFileErrorHandler (org.apache.hop.pipeline.transform.errorhandling.CompositeFileErrorHandler)2 FileErrorHandlerContentLineNumber (org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerContentLineNumber)2 FileErrorHandlerMissingFiles (org.apache.hop.pipeline.transform.errorhandling.FileErrorHandlerMissingFiles)2 IFileErrorHandler (org.apache.hop.pipeline.transform.errorhandling.IFileErrorHandler)2 ArrayList (java.util.ArrayList)1