Package jenkins.scm.api.trait
Class SCMSourceRequest
java.lang.Object
jenkins.scm.api.trait.SCMSourceRequest
- All Implemented Interfaces:
Closeable,AutoCloseable
Represents the context of an individual request for a call to
SCMSource.retrieve(SCMSourceCriteria, SCMHeadObserver, SCMHeadEvent, TaskListener) or an equivalent method.- Since:
- 2.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA lambda that produces an intermediate summary used to drive creation of theSCMSourceCriteria.ProbeandSCMRevisioninstances.static interfaceSCMSourceRequest.LazyRevisionLambda<H extends SCMHead,R extends SCMRevision, I> A lambda that will create theSCMRevisioninstance for a specificSCMHeadusing the intermediate value produced by aSCMSourceRequest.IntermediateLambda.static interfaceSCMSourceRequest.ProbeLambda<H extends SCMHead,I> A lambda that will create aSCMSourceCriteria.Probe(ideally aSCMProbebut for legacy code migration we useSCMSourceCriteria.Probe) for a specifiedSCMHeadand either aSCMRevisionor some other type created by aSCMSourceRequest.IntermediateLambda.static interfaceSCMSourceRequest.RevisionLambda<H extends SCMHead,R extends SCMRevision> A lambda that will create theSCMRevisioninstance for a specificSCMHead.static interfaceSCMSourceRequest.Witness<H extends SCMHead,R extends SCMRevision> Callback lambda to track the results ofprocess(SCMHead, IntermediateLambda, ProbeLambda, LazyRevisionLambda, Witness[]) -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSCMSourceRequest(SCMSource source, SCMSourceContext<?, ?> context, TaskListener listener) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final List<SCMSourceCriteria>Returns theSCMSourceCriteriabeing used for this request.booleanChecks if this request has been completed, that is if itsSCMHeadObserverhas stoppedSCMHeadObserver.isObserving().final booleanisExcluded(SCMHead head) Tests if theSCMHeadis excluded from the request.final booleanTests if theSCMHeadis trusted.listener()Returns theTaskListenerto use for this request.voidAdds managing aCloseableinto the scope of theSCMSourceRequestfinal <H extends SCMHead,I, R extends SCMRevision>
booleanprocess(H head, SCMSourceRequest.IntermediateLambda<I> intermediateFactory, SCMSourceRequest.ProbeLambda<H, I> probeFactory, SCMSourceRequest.LazyRevisionLambda<H, R, I> revisionFactory, SCMSourceRequest.Witness... witnesses) Processes a head in the context of the current request where an intermediary operation is required before theSCMRevisioncan be instantiated.final <H extends SCMHead,R extends SCMRevision>
booleanprocess(H head, SCMSourceRequest.RevisionLambda<H, R> revisionFactory, SCMSourceRequest.ProbeLambda<H, R> probeFactory, SCMSourceRequest.Witness... witnesses) Processes a head in the context of the current request.final <H extends SCMHead,R extends SCMRevision>
booleanprocess(H head, R revision, SCMSourceRequest.ProbeLambda<H, R> probeFactory, SCMSourceRequest.Witness... witnesses) Processes a head in the context of the current request.
-
Constructor Details
-
SCMSourceRequest
protected SCMSourceRequest(@NonNull SCMSource source, @NonNull SCMSourceContext<?, ?> context, @CheckForNull TaskListener listener) Constructor.- Parameters:
source- the source.context- the context.listener- the (optional)TaskListener.
-
-
Method Details
-
isExcluded
Tests if theSCMHeadis excluded from the request.- Parameters:
head- theSCMHead.- Returns:
trueif theSCMHeadis excluded.- Throws:
IOException- if there is an I/O error.InterruptedException- if the operation was interrupted.
-
isTrusted
Tests if theSCMHeadis trusted.- Parameters:
head- theSCMHead.- Returns:
trueif theSCMHeadis trusted.- Throws:
IOException- if there is an I/O error.InterruptedException- if the operation was interrupted.
-
getCriteria
Returns theSCMSourceCriteriabeing used for this request.- Returns:
- the
SCMSourceCriteriabeing used for this request.
-
process
public final <H extends SCMHead,R extends SCMRevision> boolean process(@NonNull H head, @NonNull R revision, @NonNull SCMSourceRequest.ProbeLambda<H, R> probeFactory, @NonNull SCMSourceRequest.Witness... witnesses) throws IOException, InterruptedExceptionProcesses a head in the context of the current request.- Type Parameters:
H- the type ofSCMHead.R- the type ofSCMRevision.- Parameters:
head- theSCMHeadto process.revision- theSCMRevision(assuming revision creation is very cheap).probeFactory- factory method that creates theSCMProbe.witnesses- anySCMSourceRequest.Witnessinstances to be informed of the observation result.- Returns:
trueif theSCMHeadObserverfor this request has completed observing,falseto continue processing.- Throws:
IOException- if there was an I/O error.InterruptedException- if the processing was interrupted.
-
process
public final <H extends SCMHead,R extends SCMRevision> boolean process(@NonNull H head, @NonNull SCMSourceRequest.RevisionLambda<H, R> revisionFactory, @NonNull SCMSourceRequest.ProbeLambda<H, throws IOException, InterruptedExceptionR> probeFactory, @NonNull SCMSourceRequest.Witness... witnesses) Processes a head in the context of the current request.- Type Parameters:
H- the type ofSCMHead.R- the type ofSCMRevision.- Parameters:
head- theSCMHeadto process.revisionFactory- factory method that creates theSCMRevision(assuming creation is cheap).probeFactory- factory method that creates theSCMProbe.witnesses- anySCMSourceRequest.Witnessinstances to be informed of the observation result.- Returns:
trueif theSCMHeadObserverfor this request has completed observing,falseto continue processing.- Throws:
IOException- if there was an I/O error.InterruptedException- if the processing was interrupted.
-
process
public final <H extends SCMHead,I, boolean processR extends SCMRevision> (@NonNull H head, @CheckForNull SCMSourceRequest.IntermediateLambda<I> intermediateFactory, @NonNull SCMSourceRequest.ProbeLambda<H, I> probeFactory, @NonNull SCMSourceRequest.LazyRevisionLambda<H, throws IOException, InterruptedExceptionR, I> revisionFactory, @NonNull SCMSourceRequest.Witness... witnesses) Processes a head in the context of the current request where an intermediary operation is required before theSCMRevisioncan be instantiated.- Type Parameters:
H- the type ofSCMHead.I- the type of the intermediary operation result.R- the type ofSCMRevision.- Parameters:
head- theSCMHeadto process.intermediateFactory- factory method that provides the seed information for both theSCMSourceRequest.ProbeLambdaand theSCMSourceRequest.LazyRevisionLambda.probeFactory- factory method that creates theSCMProbe.revisionFactory- factory method that creates theSCMRevision.witnesses- anySCMSourceRequest.Witnessinstances to be informed of the observation result.- Returns:
trueif theSCMHeadObserverfor this request has completed observing,falseto continue processing.- Throws:
IOException- if there was an I/O error.InterruptedException- if the processing was interrupted.
-
isComplete
public boolean isComplete()Checks if this request has been completed, that is if itsSCMHeadObserverhas stoppedSCMHeadObserver.isObserving().- Returns:
trueif and only if the request is completed.
-
listener
Returns theTaskListenerto use for this request.- Returns:
- the
TaskListenerto use for this request.
-
manage
Adds managing aCloseableinto the scope of theSCMSourceRequest- Parameters:
closeable- theCloseableto manage.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-