Class DefaultTaskExecutionContext

java.lang.Object
com.xebialabs.xlrelease.domain.tasks.plugin.DefaultTaskExecutionContext
All Implemented Interfaces:
com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext, com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext

public class DefaultTaskExecutionContext extends Object implements com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext
The host's TaskExecutionContext, backed by a PluginTask and its configuration.

Reads come straight from the configuration CI; writes are buffered rather than applied to the CI. That is not an optimisation - the CI a worker holds is a detached copy, and the only supported way to persist task changes is to hand results back through the release actor (which ScriptResultsService then applies). Writing directly here would appear to work and silently lose data.

Not thread-safe, and not intended to outlive one execute call.

  • Constructor Details

    • DefaultTaskExecutionContext

      public DefaultTaskExecutionContext(com.xebialabs.xlrelease.domain.PluginTask task, boolean resume)
  • Method Details

    • getTaskId

      public String getTaskId()
      Specified by:
      getTaskId in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • getReleaseId

      public String getReleaseId()
      Specified by:
      getReleaseId in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • getTaskType

      public String getTaskType()
      Specified by:
      getTaskType in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • isResume

      public boolean isResume()
      Specified by:
      isResume in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext
    • getInputProperty

      public <T> Optional<T> getInputProperty(String name, Class<T> type)
      Specified by:
      getInputProperty in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • getInputProperties

      public Map<String,Object> getInputProperties()
      Specified by:
      getInputProperties in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • setOutputProperty

      public void setOutputProperty(String name, Object value)
      Specified by:
      setOutputProperty in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext
    • getOutputProperty

      public <T> Optional<T> getOutputProperty(String name, Class<T> type)
      Specified by:
      getOutputProperty in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
    • log

      public void log(String message)
      Specified by:
      log in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext
    • setStatusLine

      public void setStatusLine(String statusLine)
      Specified by:
      setStatusLine in interface com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext
    • toResults

      public PluginTaskResults toResults(Integer resumeDelaySeconds, boolean awaitSignal)
      Everything the extension wrote, ready to hand back through the release actor.
      Parameters:
      resumeDelaySeconds - from a suspendFor outcome, else null
      awaitSignal - true for an awaitSignal outcome
    • getExecutionLog

      public String getExecutionLog()