Class WorkingDirectoryExecutionContextView

java.lang.Object
org.openrewrite.DelegatingExecutionContext
org.openrewrite.scheduling.WorkingDirectoryExecutionContextView
All Implemented Interfaces:
ExecutionContext

@Incubating(since="8.12.0") public class WorkingDirectoryExecutionContextView extends DelegatingExecutionContext
Recipes that need to write (or download somehow and read) resources from disk as part of their operation can use this view to receive a safe directory to use. This directory will not be created unless requested by a recipe, and will be deleted by RecipeScheduler at the end of each cycle. Each recipe in a recipe list will get its own directory to use so there is no cross-contamination of the directory between recipes.
  • Field Details

  • Method Details

    • view

    • setRoot

      public void setRoot(Path path)
      This should not be called from recipes, but only from tools that are creating instantiating recipe runs directly. These tools should select a directory that are appropriate to their context and ensure they are cleaned up.
      Parameters:
      path - The root directory from which individual recipe(+cycle) working directories will be created.
    • getWorkingDirectory

      public Path getWorkingDirectory()
      Returns:
      A working directory that a recipe may write to. Created only when a recipe requests it by calling this method, and deleted at the end of the recipe cycle.