Interface TaskExecutionContext
- All Superinterfaces:
TaskAbortContext
TaskExecutorExtension gets to see and change about the task it is running.
Deliberately narrow, and deliberately free of configuration-item types: no Type,
Descriptor, PropertyDescriptor or Task appears in any signature here.
Properties are addressed by the names declared in the bundle's type-definitions.xml, so
an extension can be unit-tested with a hand-written stub of this interface and no running server.
Instances are supplied per execution and are not thread-safe. Do not retain
one beyond the TaskExecutorExtension.execute(com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext) call that received it, and do not use one
from a thread you started - its state is written back to the task when execute returns.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisResume()Whether this is a re-entry rather than the first execution of this task - that is, whether a previous call returnedTaskExecutionResult.suspendFor(java.time.Duration)orTaskExecutionResult.awaitSignal().voidAppends a line to the task's execution log - the output a release author reads in the UI when they open the task.voidsetOutputProperty(String name, Object value) Sets an output property declared on the task's configuration type.voidsetStatusLine(String statusLine) Sets the task's status line - the short, single-line summary shown next to the task in the release flow, replacing any previous value.Methods inherited from interface com.xebialabs.xlrelease.osgi.api.tasks.TaskAbortContext
getInputProperties, getInputProperty, getInputProperty, getOutputProperty, getReleaseId, getTaskId, getTaskType
-
Method Details
-
isResume
boolean isResume()Whether this is a re-entry rather than the first execution of this task - that is, whether a previous call returnedTaskExecutionResult.suspendFor(java.time.Duration)orTaskExecutionResult.awaitSignal().This is the hook for writing a state machine in one method: branch on it, and read what the previous entry left in the output properties. Note that because job delivery is at-least-once, a
truehere does not guarantee the previous entry's work happened exactly once. -
setOutputProperty
Sets an output property declared on the task's configuration type. Values are persisted whenexecutereturns, and are visible to later tasks in the release through variable interpolation - and to the next entry of this same extension after a suspend, which is how state is carried across a wait.- Parameters:
name- the property name as declared intype-definitions.xmlvalue- the value;nullwithdraws this execution's pending write, leaving the persisted property unchanged — it does NOT clear a previously persisted value (the property layer substitutes declared defaults for null). To visibly reset a property, write a sentinel such as an empty string.- Throws:
IllegalArgumentException- if no such property is declared on this type
-
log
Appends a line to the task's execution log - the output a release author reads in the UI when they open the task. This is the plugin's user-facing output channel, and the first place someone will look when a task did something unexpected.Distinct from server logging: use your own SLF4J logger for anything aimed at an operator reading server logs rather than at the release author.
Sensitive values are not scrubbed automatically. Do not log credentials.
-
setStatusLine
Sets the task's status line - the short, single-line summary shown next to the task in the release flow, replacing any previous value. Use it for progress ("waiting for build #431"), not for detail; detail belongs inlog(String).Especially useful before suspending, so the release author can see why a task is still in progress.
-