/**
   * Get the working directory of a step.
   *
   * @param workflow the workflow
   * @param step the step
   * @param module the module
   * @return the working directory of a step
   */
  public DataFile workingDirectory(
      final AbstractWorkflow workflow, final AbstractStep step, final Module module) {

    checkNotNull(workflow, "workflow argument cannot be null");
    checkNotNull(step, "step argument cannot be null");
    checkNotNull(module, "module argument cannot be null");

    if (this.hadoopMode && ExecutionMode.getExecutionMode(module.getClass()).isHadoopCompatible()) {
      return workflow.getHadoopWorkingDirectory();
    }

    return workflow.getLocalWorkingDirectory();
  }
  /**
   * Get the workflow output directory of a step.
   *
   * @param workflow the workflow
   * @param step the step
   * @param module the module
   * @return the working directory of a step
   */
  public DataFile workflowDirectory(
      final AbstractWorkflow workflow, final AbstractStep step, final Module module) {

    checkNotNull(workflow, "workflow argument cannot be null");
    checkNotNull(step, "step argument cannot be null");
    checkNotNull(module, "module argument cannot be null");

    if (EoulsanAnnotationUtils.isNoOutputDirectory(module)) {
      return workflow.getOutputDirectory();
    }

    switch (this.outputTree) {
      case STEP:
        final String subDirname = step.getId() + STEP_OUTPUT_DIRECTORY_SUFFIX;
        return new DataFile(workflow.getOutputDirectory(), subDirname);

      case FLAT:
      default:
        return workflow.getOutputDirectory();
    }
  }
  /**
   * Get the output directory of the step if the outputs of the step are outputs of workflow.
   *
   * @param workflow the workflow
   * @param step the step
   * @return the output directory of the step
   */
  public DataFile defaultDirectory(
      final AbstractWorkflow workflow,
      final AbstractStep step,
      final Module module,
      final boolean copyResultsToOutput) {

    checkNotNull(workflow, "workflow argument cannot be null");
    checkNotNull(step, "step argument cannot be null");
    checkNotNull(module, "module argument cannot be null");

    if (this.hadoopMode
        && ExecutionMode.getExecutionMode(module.getClass()) == ExecutionMode.HADOOP_ONLY) {
      return workflow.getHadoopWorkingDirectory();
    }

    if (copyResultsToOutput) {
      return workflowDirectory(workflow, step, module);
    }

    return workingDirectory(workflow, step, module);
  }