Package io.jenkins.plugins.util
Class AbstractExecution<T>
java.lang.Object
org.jenkinsci.plugins.workflow.steps.StepExecution
org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution<T>
io.jenkins.plugins.util.AbstractExecution<T>
- Type Parameters:
T- the type of the return value (useVoidif no return value is available)
- All Implemented Interfaces:
Serializable
public abstract class AbstractExecution<T>
extends org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution<T>
Base class for step executions. Provides several helper methods to obtain the defined
context
elements.- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractExecution(org.jenkinsci.plugins.workflow.steps.StepContext context) Creates a new instance ofAbstractExecution. -
Method Summary
Modifier and TypeMethodDescriptionprotected ResultHandlerCreates aResultHandlerthat sets build result of theRunor stage.protected FilePathReturns Jenkins' build folder.protected Optional<hudson.remoting.VirtualChannel>Returns aVirtualChannelto the agent where this step has been executed.protected CharsetgetCharset(String charset) Returns the default charset for the specified encoding string.protected Run<?,?> getRun()Returns the associated pipeline run.protected TaskListenerReturns theTaskListenerfor this execution.protected FilePathReturns the workspace for this job.Methods inherited from class org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution
blocksRestart, getStatus, onResume, run, start, stopMethods inherited from class org.jenkinsci.plugins.workflow.steps.StepExecution
acceptAll, acceptAll, applyAll, applyAll, getContext, getStatusBounded
-
Constructor Details
-
AbstractExecution
protected AbstractExecution(org.jenkinsci.plugins.workflow.steps.StepContext context) Creates a new instance ofAbstractExecution.- Parameters:
context- the context to use
-
-
Method Details
-
getRun
Returns the associated pipeline run.- Returns:
- the run
- Throws:
IOException- if the run could not be resolvedInterruptedException- if the user canceled the run
-
getChannel
protected Optional<hudson.remoting.VirtualChannel> getChannel() throws IOException, InterruptedExceptionReturns aVirtualChannelto the agent where this step has been executed.- Returns:
- the channel
- Throws:
IOException- if the computer could not be resolvedInterruptedException- if the user canceled the run
-
getBuildFolder
Returns Jenkins' build folder.- Returns:
- the build folder
- Throws:
IOException- if the build folder could not be resolvedInterruptedException- if the user canceled the run
-
getWorkspace
Returns the workspace for this job. If the workspace does not yet exist, then the required folders are created.- Returns:
- the workspace
- Throws:
IOException- if the workspace could not be resolvedInterruptedException- if the user canceled the execution
-
getTaskListener
Returns theTaskListenerfor this execution.- Returns:
- the task listener (or a silent listener if no task listener could be found)
- Throws:
InterruptedException- if the user canceled the executionIOException- if the task listener could not be resolved
-
getCharset
Returns the default charset for the specified encoding string. If the default encoding is empty ornull, or if the charset is not valid, then the default encoding of the platform is returned.- Parameters:
charset- identifier of the character set- Returns:
- the default charset for the specified encoding string
-
createResultHandler
Creates aResultHandlerthat sets build result of theRunor stage.- Returns:
- a
ResultHandlerthat sets the build result of theRunor stage - Throws:
InterruptedException- if the user canceled the executionIOException- if the requiredFlowNodeinstance is not found
-