Package org.openrewrite.scheduling
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 Summary
FieldsFields inherited from interface org.openrewrite.ExecutionContext
CURRENT_CYCLE, CURRENT_RECIPE, DATA_TABLES, REQUIRE_PRINT_EQUALS_INPUT, RUN_TIMEOUT -
Method Summary
Modifier and TypeMethodDescriptionvoidThis should not be called from recipes, but only from tools that are creating instantiating recipe runs directly.view(ExecutionContext ctx) Methods inherited from class org.openrewrite.DelegatingExecutionContext
getMessage, getOnError, getOnTimeout, pollMessage, putMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.ExecutionContext
addObserver, computeMessage, getCycle, getCycleDetails, getMessage, getObservers, pollMessage, putCurrentRecipe, putMessageInCollection, putMessageInSet
-
Field Details
-
WORKING_DIRECTORY_ROOT
- See Also:
-
-
Method Details
-
view
-
setRoot
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
- 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.
-