java.lang.Object
com.microsoft.azure.management.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 Details

    • 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.
  • Method Details

    • create

      public static IndexableTaskItem create(FunctionalTaskItem taskItem)
      Creates an IndexableTaskItem from provided FunctionalTaskItem.
      Parameters:
      taskItem - functional TaskItem
      Returns:
      IndexableTaskItem
    • taskGroup

      public TaskGroup taskGroup()
      Specified by:
      taskGroup in interface TaskGroup.HasTaskGroup
      Returns:
      the TaskGroup this this TaskItem as root.
    • clear

      public void clear()
      Clear the result produced by the task.
    • key

      public String key()
      Specified by:
      key in interface Indexable
      Returns:
      the index key.
    • 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
    • addeDependency

      protected String addeDependency(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()
      Specified by:
      result in interface TaskItem
      Returns:
      the result of the task invocation
    • beforeGroupInvoke

      public void beforeGroupInvoke()
      Description copied from interface: TaskItem
      The method that gets called before invoking all the tasks in the TaskGroup this task belongs to.
      Specified by:
      beforeGroupInvoke in interface TaskItem
    • isHot

      public boolean isHot()
      Specified by:
      isHot in interface TaskItem
      Returns:
      true if the observable returned by invokeAsync(cxt) is a hot observable, false if its a cold observable.
    • invokeAsync

      public rx.Observable<Indexable> invokeAsync(TaskGroup.InvocationContext context)
      Description copied from interface: TaskItem
      The method that gets called to perform the unit of work asynchronously.
      Specified by:
      invokeAsync in interface TaskItem
      Parameters:
      context - the context shared across the the all task items in the group this task item belongs to.
      Returns:
      an observable upon subscription does the unit of work and produces result of type Indexable
    • invokeAfterPostRunAsync

      public rx.Completable invokeAfterPostRunAsync(boolean isGroupFaulted)
      Description copied from interface: TaskItem
      The 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:
      invokeAfterPostRunAsync in interface TaskItem
      Parameters:
      isGroupFaulted - true if one or more tasks in the group this TaskItem belongs to are in faulted state.
      Returns:
      a completable representing any asynchronous work initiated
    • invokeTaskAsync

      protected abstract rx.Observable<Indexable> invokeTaskAsync(TaskGroup.InvocationContext context)
    • voidIndexable

      protected Indexable voidIndexable()
      Returns:
      an instance of VoidIndexable with key same as the key of this TaskItem.
    • voidObservable

      protected rx.Observable<Indexable> voidObservable()
      Returns:
      an Observable upon subscription emits VoidIndexable with key same as the key of this TaskItem