Package com.xebialabs.xlrelease.domain
Class PluginTask
java.lang.Object
com.xebialabs.deployit.plugin.api.udm.base.BaseConfigurationItem
com.xebialabs.xlrelease.domain.PlanItem
com.xebialabs.xlrelease.domain.Task
com.xebialabs.xlrelease.domain.PluginTask
- All Implemented Interfaces:
ConfigurationItem,Lockable,VisitableItem,Serializable,Comparable<BaseConfigurationItem>
@Metadata(label="Plugin Task",
versioned=false,
description="Task type contributed by an OSGi plugin bundle")
public class PluginTask
extends Task
The single compiled
Task behind every task type contributed by an OSGi plugin bundle.
It is never subclassed - not by the host and not by plugin authors. A bundle declares a
synthetic subtype of PluginTaskConfiguration instead, and this task carries an instance of
it by containment. That is the same split CustomScriptTask has with
PythonScript, and it is what keeps author-declared properties out of the namespace
Task occupies.
Consequently every plugin task has the task type xlrelease.PluginTask; the type a
release author picked is getConfiguration().getType(), which is also the key the host
dispatches on when it looks for the TaskExecutorExtension that implements it. This
mirrors every Jython task being xlrelease.CustomScriptTask.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringPrefix for addressing a configuration property as a fully-qualified task property - used in variable mappings and output-property addressing, mirroringCustomScriptTask.PYTHON_SCRIPT_PREFIX.Fields inherited from class com.xebialabs.xlrelease.domain.Task
CATEGORY_INPUT, CATEGORY_OUTPUT, delayDuringBlackout, DUE_SOON_THRESHOLD, executionId, failureHandler, failuresCount, hasBeenDelayed, hasBeenFlagged, IS_AUTOMATED_AND_IN_PROGRESS, maxCommentSize, originalScheduledStartDate, postponedDueToBlackout, postponedUntilEnvironmentsAreReserved, precondition, tags, taskFailureHandlerEnabled, taskRecoverOp, team, UNKNOWN_TASK_TYPE, variableMapping, waitForScheduledStartDateFields inherited from class com.xebialabs.xlrelease.domain.PlanItem
BY_TITLE, description, dueDate, endDate, flagComment, flagStatus, overdueNotified, owner, plannedDuration, scheduledStartDate, startDate, titleFields inherited from class com.xebialabs.deployit.plugin.api.udm.base.BaseConfigurationItem
id, syntheticProperties, typeFields inherited from interface com.xebialabs.deployit.plugin.api.udm.ConfigurationItem
SYNTHETIC_PROPERTIES_FIELD, TYPE_FIELD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRecords that the implementation is waiting for an external signal, with no timer.protected Changesexecute(String targetId, TaskStartOrRetryOperation operation) MirrorsContainerTask/NotificationTask/CreateReleaseTask's override:super.executemay defer the transition (blackout, unbound variables, facet/precondition checks), so theExecuteTaskActionpost-action - which is what actually dispatches toPluginTaskExecutorand submits thePluginTaskJob- is only added once the task has genuinely reachedIN_PROGRESS.MirrorsCustomScriptTask.fail: failing an in-flight task must clear the suspension, or an abort of a suspended task would leave a marker behind.freezeVariablesInCustomFields(Map<String, ValueWithInterpolation> variables, Map<String, String> passwordVariables, Changes changes, boolean freezeEvenIfUnresolved) Interpolates release variables into the configuration's input properties, mirroringCustomScriptTask.freezeVariablesInCustomFieldsminus its Jython-script-specific special cases (there is noscriptproperty to exempt here).booleanSuspended with a timer: re-enter aftergetResumeDelay()seconds.booleanSuspended with no timer: re-entered only when something callsresumeTask.booleanWhether the implementation suspended itself and expects to be re-entered - the analogue ofCustomScriptTask.hasNextScriptToExecute(), and what makes the task stayIN_PROGRESSinstead of completing.voidClears the suspension.MirrorsCustomScriptTask.retry: a retried task starts from a clean slate.voidsetConfiguration(PluginTaskConfiguration configuration) voidsetResumeDelay(Integer resumeDelay) voidsetSuspended(boolean suspended) protected booleanshouldFreezeVariableMapping(CiProperty property) Output properties are produced by execution, so they are not frozen from variables - same rule asCustomScriptTask.voidsuspendFor(Integer delaySeconds) Records that the implementation asked to be re-entered afterdelaySeconds.Methods inherited from class com.xebialabs.xlrelease.domain.Task
abort, accept, addWatcher, applyDefaults, canBeBackup, canScheduleTaskStart, canStartNow, checkDatesValidity, clearComments, clearModificationAttributes, delayDuringBlackoutHasChanged, deleteAttachment, deleteTask, fail, fail, fail, failureHandlerHasChanged, findComment, freezeVariables, fromType, fromType, generateExecutionId, getAbortScript, getAllTasks, getAttachments, getChildren, getCiUid, getComments, getContainer, getDelayedCount, getDisplayPath, getDocumentationPage, getElapsedDurationFraction, getExecutionId, getFacets, getFailureHandler, getFailuresCount, getFlaggedCount, getInputVariables, getLastStatusChangeBy, getMaxCommentSize, getOriginalScheduledStartDate, getPhase, getPrecondition, getPreconditionType, getReferencedVariableKeys, getReferencedVariables, getRelease, getReleaseOwner, getReleaseUid, getStatus, getStatusLine, getTags, getTaskRecoverOp, getTaskType, getTeam, getUnboundRequiredVariables, getUrl, getVariableMapping, getVariableUsages, getWatchers, hasAbortScript, hasBeenDelayed, hasBeenFlagged, hasBeenStarted, hasFailureHandlerScript, hasTaskRecoverOp, hasTeam, hasVariableMapping, isAborted, isAbortScriptInProgress, isActive, isAssignedTo, isAutomated, isCheckAttributes, isCompletedInAdvance, isDefaultTaskType, isDefunct, isDelayDuringBlackout, isDone, isDoneInAdvance, isDueSoon, isDueSoonNotified, isFacetInProgress, isFailed, isFailing, isFailureHandlerEnabled, isFailureHandlerInProgress, isGate, isInProgress, isLocked, isMovable, isNotYetReached, isParallelGroup, isPending, isPlanned, isPluginTaskDefinition, isPostponedDueToBlackout, isPostponedUntilEnvironmentsAreReserved, isPreconditionEnabled, isPreconditionInProgress, isSkipped, isSkippedInAdvance, isStillExecutingScript, isSupportedInWorkflow, isTaskFailureHandlerEnabled, isTaskGroup, isUpdatable, isWaitForScheduledStartDate, isWaitingForInput, lock, markAsDone, markAsFailing, ownerHasBeenReassigned, postponeUntilEnvironmentsAreReserved, preconditionHasChanged, removeWatcher, reopen, replaceTask, resetToPlanned, setAttachments, setCheckAttributes, setCiUid, setContainer, setDelayDuringBlackout, setDocumentationPage, setDueSoonNotified, setExecutionId, setFacets, setFailureHandler, setFailuresCount, setFlagStatus, setHasBeenDelayed, setHasBeenFlagged, setLocked, setMaxCommentSize, setOriginalScheduledStartDate, setPostponedDueToBlackout, setPostponedUntilEnvironmentsAreReserved, setPrecondition, setPreconditionType, setReleaseUid, setScheduledStartDate, setStatus, setStatusLine, setSupportedInWorkflow, setTags, setTaskFailureHandlerEnabled, setTaskRecoverOp, setTeam, setVariableMapping, setWaitForScheduledStartDate, setWatchers, shouldFacetBeChecked, shouldNotifyDueSoon, shouldPreconditionBeChecked, start, startNow, startPending, startWithInput, teamHasBeenReassigned, unlock, updateCommentMethods inherited from class com.xebialabs.xlrelease.domain.PlanItem
calculateDueDate, checkDatesValidity, getActualDuration, getComputedPlannedDuration, getDescription, getDueDate, getEndDate, getEndOrDueDate, getFlagComment, getFlagStatus, getOrCalculateDueDate, getOwner, getPlannedDuration, getScheduledStartDate, getStartDate, getStartOrScheduledDate, getTitle, hasDueDate, hasEndDate, hasEndOrDueDate, hasOwner, hasOwner, hasPlannedDuration, hasScheduledStartDate, hasStartDate, hasStartOrScheduledDate, hasTitle, hasTitle, hasValidStartDates, isFlagged, isOverdue, isOverdueNotified, isTitleContaining, moveChildren, setDates, setDescription, setDueDate, setEndDate, setFlagComment, setOverdueNotified, setOwner, setPlannedDuration, setStartAndEndDatesIfEmpty, setStartDate, setTitle, shouldNotifyOverdue, updateDates, updateDurationMethods inherited from class com.xebialabs.deployit.plugin.api.udm.base.BaseConfigurationItem
compareTo, equals, get$ciAttributes, get$directoryReference, get$externalProperties, get$internalId, get$referenceId, get$securedCi, get$securedDirectoryReference, get$token, get$validationMessages, getId, getName, getProperty, getPropertyDescriptor, getType, hashCode, hasProperty, set$ciAttributes, set$directoryReference, set$externalProperties, set$internalId, set$referenceId, set$securedCi, set$securedDirectoryReference, set$token, set$validationMessages, setId, setProperty, setType, toString
-
Field Details
-
PLUGIN_TASK_CONFIGURATION_PREFIX
Prefix for addressing a configuration property as a fully-qualified task property - used in variable mappings and output-property addressing, mirroringCustomScriptTask.PYTHON_SCRIPT_PREFIX. It is user-visible, so it is deliberately short and self-describing.- See Also:
-
CONFIGURATION_PROPERTY
- See Also:
-
-
Constructor Details
-
PluginTask
public PluginTask()
-
-
Method Details
-
getConfiguration
-
setConfiguration
-
isSuspended
public boolean isSuspended()Whether the implementation suspended itself and expects to be re-entered - the analogue ofCustomScriptTask.hasNextScriptToExecute(), and what makes the task stayIN_PROGRESSinstead of completing. -
hasScheduledResume
public boolean hasScheduledResume()Suspended with a timer: re-enter aftergetResumeDelay()seconds. -
isAwaitingSignal
public boolean isAwaitingSignal()Suspended with no timer: re-entered only when something callsresumeTask. -
suspendFor
Records that the implementation asked to be re-entered afterdelaySeconds.- Throws:
IllegalArgumentException- if below one second, matching the boundCustomScriptTask.schedule(String, Integer)enforces on its interval andTaskExecutionResult.suspendForenforces on its duration
-
awaitSignal
public void awaitSignal()Records that the implementation is waiting for an external signal, with no timer. -
resetSuspension
public void resetSuspension()Clears the suspension. Must happen on every terminal or restarting transition, or a stale marker would make the next execution look like a resume. -
getResumeDelay
-
setResumeDelay
-
setSuspended
public void setSuspended(boolean suspended) -
fail
MirrorsCustomScriptTask.fail: failing an in-flight task must clear the suspension, or an abort of a suspended task would leave a marker behind. Job cancellation itself isWorkManager.abortJobByTaskId's job, called separately by the abort path - not this CI's. -
retry
MirrorsCustomScriptTask.retry: a retried task starts from a clean slate. -
execute
MirrorsContainerTask/NotificationTask/CreateReleaseTask's override:super.executemay defer the transition (blackout, unbound variables, facet/precondition checks), so theExecuteTaskActionpost-action - which is what actually dispatches toPluginTaskExecutorand submits thePluginTaskJob- is only added once the task has genuinely reachedIN_PROGRESS. Without this override the task transitions to IN_PROGRESS in the UI but nothing ever runs the extension:Task.executehas no type-generic way to know a plugin task needs dispatching, since every other task family opts in the same way. -
freezeVariablesInCustomFields
public Set<String> freezeVariablesInCustomFields(Map<String, ValueWithInterpolation> variables, Map<String, String> passwordVariables, Changes changes, boolean freezeEvenIfUnresolved) Interpolates release variables into the configuration's input properties, mirroringCustomScriptTask.freezeVariablesInCustomFieldsminus its Jython-script-specific special cases (there is noscriptproperty to exempt here).- Overrides:
freezeVariablesInCustomFieldsin classTask
-
shouldFreezeVariableMapping
Output properties are produced by execution, so they are not frozen from variables - same rule asCustomScriptTask.- Overrides:
shouldFreezeVariableMappingin classTask
-