wholefile-transformer-lib/src/main/java/com/streamsets/pipeline/stage/processor/transformer/WholeFileTransformerProcessor.java
@VisibleForTesting
  Path getAndValidateTempFilePath(Record record, String sourceFileName) throws StageException {
    RecordEL.setRecordInContext(variables, record);
    String dirPath;
    try {
      dirPath = resolveEL(tempDirElEval, variables, jobConfig.tempDir, String.class);
    } catch (ELEvalException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_04, jobConfig.tempDir);
    }

    if (Strings.isNullOrEmpty(dirPath)) {
      throw new TransformerStageCheckedException(Errors.CONVERT_02, jobConfig.tempDir);
    }

    if (Strings.isNullOrEmpty(sourceFileName)) {
      throw new TransformerStageCheckedException(Errors.CONVERT_03, FILENAME);
    }
    String fileName = jobConfig.uniquePrefix + sourceFileName + jobConfig.fileNameSuffix;
    Path tempParquetFile = Paths.get(dirPath, fileName);

    if (!tempParquetFile.isAbsolute()) {
      throw new TransformerStageCheckedException(Errors.CONVERT_05, tempParquetFile);
    }

    try {
      if (!Files.exists(tempParquetFile.getParent())) {
        Files.createDirectories(Paths.get(dirPath));
      }
    } catch (IOException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_10, tempParquetFile.toString(), ex);
    }

    // handle old temp files
    try {
      handleOldTempFiles(tempParquetFile);
    } catch (IOException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_06, tempParquetFile.toString(), ex);
    }

    return tempParquetFile;
  }
@VisibleForTesting
  Path getAndValidateTempFilePath(Record record, String sourceFileName) throws StageException {
    RecordEL.setRecordInContext(variables, record);
    String dirPath;
    try {
      dirPath = resolveEL(tempDirElEval, variables, jobConfig.tempDir, String.class);
    } catch (ELEvalException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_04, jobConfig.tempDir);
    }

    if (Strings.isNullOrEmpty(dirPath)) {
      throw new TransformerStageCheckedException(Errors.CONVERT_02, jobConfig.tempDir);
    }

    if (Strings.isNullOrEmpty(sourceFileName)) {
      throw new TransformerStageCheckedException(Errors.CONVERT_03, FILENAME);
    }
    String fileName = jobConfig.uniquePrefix + sourceFileName + jobConfig.fileNameSuffix;
    Path tempParquetFile = Paths.get(dirPath, fileName);

    if (!tempParquetFile.isAbsolute()) {
      throw new TransformerStageCheckedException(Errors.CONVERT_05, tempParquetFile);
    }

    try {
      if (!Files.exists(tempParquetFile.getParent())) {
        Files.createDirectories(Paths.get(dirPath));
      }
    } catch (IOException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_10, tempParquetFile.toString(), ex);
    }

    // handle old temp files
    try {
      handleOldTempFiles(tempParquetFile);
    } catch (IOException ex) {
      throw new TransformerStageCheckedException(Errors.CONVERT_06, tempParquetFile.toString(), ex);
    }

    return tempParquetFile;
  }
@ VisibleForTesting Path getAndValidateTempFilePath ( Record record , String sourceFileName ) throws StageException { RecordEL . setRecordInContext ( variables , record ) ; String dirPath ; try { dirPath = resolveEL ( tempDirElEval , variables , jobConfig . tempDir , String . class ) ; } catch ( ELEvalException ex ) { throw new TransformerStageCheckedException ( Errors . CONVERT_04 , jobConfig . tempDir ) ; } if ( Strings . isNullOrEmpty ( dirPath ) ) { throw new TransformerStageCheckedException ( Errors . CONVERT_02 , jobConfig . tempDir ) ; } if ( Strings . isNullOrEmpty ( sourceFileName ) ) { throw new TransformerStageCheckedException ( Errors . CONVERT_03 , FILENAME ) ; } String fileName = jobConfig . uniquePrefix + sourceFileName + jobConfig . fileNameSuffix ; Path tempParquetFile = Paths . get ( dirPath , fileName ) ; if ( ! tempParquetFile . isAbsolute ( ) ) { throw new TransformerStageCheckedException ( Errors . CONVERT_05 , tempParquetFile ) ; } try { if ( ! Files . exists ( tempParquetFile . getParent ( ) ) ) { Files . createDirectories ( Paths . get ( dirPath ) ) ; } } catch ( IOException ex ) { throw new TransformerStageCheckedException ( Errors . CONVERT_10 , tempParquetFile . toString ( ) , ex ) ; } // handle old temp files try { handleOldTempFiles ( tempParquetFile ) ; } catch ( IOException ex ) { throw new TransformerStageCheckedException ( Errors . CONVERT_06 , tempParquetFile . toString ( ) , ex ) ; } return tempParquetFile ; }
Return the temporary parquet file path and validate the path
@param record the {@link com.streamsets.pipeline.api.Record} whole file record
@param sourceFileName the source Avro file name
Return the temporary parquet file path and validate the path