Class IndexableTaskItem
- java.lang.Object
-
- com.azure.resourcemanager.resources.fluentcore.dag.IndexableTaskItem
-
- All Implemented Interfaces:
TaskGroup.HasTaskGroup,TaskItem,Indexable
public abstract class IndexableTaskItem extends Object implements Indexable, TaskItem, TaskGroup.HasTaskGroup
An index-able TaskItem with a TaskGroup.
-
-
Constructor Summary
Constructors Constructor Description IndexableTaskItem()Creates a TaskItem which is index-able using a random UUID.IndexableTaskItem(ResourceManagerUtils.InternalRuntimeContext internalContext)Creates a TaskItem which is index-able using a random UUID.IndexableTaskItem(String key)Creates a TaskItem which is index-able using provided key.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringaddDependency(FunctionalTaskItem dependency)Add a dependency task item for this task item.protected StringaddDependency(TaskGroup.HasTaskGroup dependency)Add a dependency for this task item.protected StringaddDependency(Appliable<? extends Indexable> appliable)Add an appliable dependency for this task item.protected StringaddDependency(Creatable<? extends Indexable> creatable)Add a creatable dependency for this task item.protected StringaddDependency(Executable<? extends Indexable> executable)Add an executable dependency for this task item.StringaddPostRunDependent(FunctionalTaskItem dependent)Add a "post-run" dependent task item for this task item.StringaddPostRunDependent(TaskGroup.HasTaskGroup dependent)Add a "post-run" dependent for this task item.protected StringaddPostRunDependent(Appliable<? extends Indexable> appliable)Add an appliable "post-run" dependent for this task item.protected StringaddPostRunDependent(Creatable<? extends Indexable> creatable)Add a creatable "post-run" dependent for this task item.protected StringaddPostRunDependent(Executable<? extends Indexable> executable)Add an executable "post-run" dependent for this task item.voidbeforeGroupInvoke()The method that gets called before invoking all the tasks in theTaskGroupthis task belongs to.voidclear()Clear the result produced by the task.static IndexableTaskItemcreate(FunctionalTaskItem taskItem)Creates an IndexableTaskItem from provided FunctionalTaskItem.static IndexableTaskItemcreate(FunctionalTaskItem taskItem, ResourceManagerUtils.InternalRuntimeContext internalContext)Creates an IndexableTaskItem from provided FunctionalTaskItem.Mono<Void>invokeAfterPostRunAsync(boolean isGroupFaulted)The method that gets called after invocation of "post run" task items depends on this TaskItem.Mono<Indexable>invokeAsync(TaskGroup.InvocationContext context)The method that gets called to perform the unit of work asynchronously.protected abstract Mono<Indexable>invokeTaskAsync(TaskGroup.InvocationContext context)Invokes a task asynchronously.booleanisHot()Stringkey()Indexableresult()TaskGrouptaskGroup()protected <T extends Indexable>
TtaskResult(String key)Get result of one of the task that belongs to this task's task group.protected IndexablevoidIndexable()protected Mono<Indexable>voidPublisher()
-
-
-
Constructor Detail
-
IndexableTaskItem
public IndexableTaskItem(String key)
Creates a TaskItem which is index-able using provided key.- Parameters:
key- the unique key to index this TaskItem
-
IndexableTaskItem
public IndexableTaskItem()
Creates a TaskItem which is index-able using a random UUID.
-
IndexableTaskItem
public IndexableTaskItem(ResourceManagerUtils.InternalRuntimeContext internalContext)
Creates a TaskItem which is index-able using a random UUID.- Parameters:
internalContext- the internal runtime context
-
-
Method Detail
-
create
public static IndexableTaskItem create(FunctionalTaskItem taskItem)
Creates an IndexableTaskItem from provided FunctionalTaskItem.- Parameters:
taskItem- functional TaskItem- Returns:
- IndexableTaskItem
-
create
public static IndexableTaskItem create(FunctionalTaskItem taskItem, ResourceManagerUtils.InternalRuntimeContext internalContext)
Creates an IndexableTaskItem from provided FunctionalTaskItem.- Parameters:
taskItem- functional TaskIteminternalContext- the internal runtime context- Returns:
- IndexableTaskItem
-
taskGroup
public TaskGroup taskGroup()
- Specified by:
taskGroupin interfaceTaskGroup.HasTaskGroup- Returns:
- the TaskGroup this this TaskItem as root.
-
clear
public void clear()
Clear the result produced by the task.
-
addDependency
protected String addDependency(FunctionalTaskItem dependency)
Add a dependency task item for this task item.- Parameters:
dependency- the dependency task item.- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result the task item
-
addDependency
protected String addDependency(TaskGroup.HasTaskGroup dependency)
Add a dependency for this task item.- Parameters:
dependency- the dependency.- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result of root task in the given dependency task group
-
addDependency
protected String addDependency(Creatable<? extends Indexable> creatable)
Add a creatable dependency for this task item.- Parameters:
creatable- the creatable dependency.- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve created dependency
-
addDependency
protected String addDependency(Appliable<? extends Indexable> appliable)
Add an appliable dependency for this task item.- Parameters:
appliable- the appliable dependency.- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve updated dependency
-
addDependency
protected String addDependency(Executable<? extends Indexable> executable)
Add an executable dependency for this task item.- Parameters:
executable- the executable dependency- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve result of executing the executable dependency
-
addPostRunDependent
public String addPostRunDependent(FunctionalTaskItem dependent)
Add a "post-run" dependent task item for this task item.- Parameters:
dependent- the "post-run" dependent task item.- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result of root task in the given dependent task group
-
addPostRunDependent
public String addPostRunDependent(TaskGroup.HasTaskGroup dependent)
Add a "post-run" dependent for this task item.- Parameters:
dependent- the "post-run" dependent.- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result of root task in the given dependent task group
-
addPostRunDependent
protected String addPostRunDependent(Creatable<? extends Indexable> creatable)
Add a creatable "post-run" dependent for this task item.- Parameters:
creatable- the creatable "post-run" dependent.- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve created "post-run" dependent
-
addPostRunDependent
protected String addPostRunDependent(Appliable<? extends Indexable> appliable)
Add an appliable "post-run" dependent for this task item.- Parameters:
appliable- the appliable "post-run" dependent.- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve updated "post-run" dependent
-
addPostRunDependent
protected String addPostRunDependent(Executable<? extends Indexable> executable)
Add an executable "post-run" dependent for this task item.- Parameters:
executable- the executable "post-run" dependent- Returns:
- the key to be used as parameter to taskResult(string) method to retrieve result of executing the executable "post-run" dependent
-
taskResult
protected <T extends Indexable> T taskResult(String key)
Get result of one of the task that belongs to this task's task group.- Type Parameters:
T- the actual type of the task result- Parameters:
key- the task key- Returns:
- the task result, null will be returned if task has not produced a result yet
-
result
public Indexable result()
-
beforeGroupInvoke
public void beforeGroupInvoke()
Description copied from interface:TaskItemThe method that gets called before invoking all the tasks in theTaskGroupthis task belongs to.- Specified by:
beforeGroupInvokein interfaceTaskItem
-
isHot
public boolean isHot()
-
invokeAsync
public Mono<Indexable> invokeAsync(TaskGroup.InvocationContext context)
Description copied from interface:TaskItemThe method that gets called to perform the unit of work asynchronously.- Specified by:
invokeAsyncin interfaceTaskItem- Parameters:
context- the context shared across the the all task items in the group this task item belongs to.- Returns:
- a
Monoupon subscription does the unit of work and produces result of typeIndexable
-
invokeAfterPostRunAsync
public Mono<Void> invokeAfterPostRunAsync(boolean isGroupFaulted)
Description copied from interface:TaskItemThe method that gets called after invocation of "post run" task items depends on this TaskItem.This method will be invoked only if this TaskItem had "post run" dependents.
- Specified by:
invokeAfterPostRunAsyncin interfaceTaskItem- Parameters:
isGroupFaulted- true if one or more tasks in the group this TaskItem belongs to are in faulted state.- Returns:
- a
Fluxrepresenting any asynchronous work initiated
-
invokeTaskAsync
protected abstract Mono<Indexable> invokeTaskAsync(TaskGroup.InvocationContext context)
Invokes a task asynchronously.- Parameters:
context- Context of the invocation.- Returns:
- an Observable upon subscription emits
Indexable.
-
voidIndexable
protected Indexable voidIndexable()
- Returns:
- an instance of
VoidIndexablewith key same as the key of this TaskItem.
-
voidPublisher
protected Mono<Indexable> voidPublisher()
- Returns:
- an Observable upon subscription emits
VoidIndexablewith key same as the key of this TaskItem
-
-