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 SummaryNested 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 SummaryConstructorsModifierConstructorDescriptionprotectedSCMSourceRequest(SCMSource source, SCMSourceContext<?, ?> context, TaskListener listener) Constructor.
- 
Method SummaryModifier 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- 
SCMSourceRequestprotected SCMSourceRequest(@NonNull SCMSource source, @NonNull SCMSourceContext<?, ?> context, @CheckForNull TaskListener listener) Constructor.- Parameters:
- source- the source.
- context- the context.
- listener- the (optional)- TaskListener.
 
 
- 
- 
Method Details- 
isExcludedTests if theSCMHeadis excluded from the request.- Parameters:
- head- the- SCMHead.
- Returns:
- trueif the- SCMHeadis excluded.
- Throws:
- IOException- if there is an I/O error.
- InterruptedException- if the operation was interrupted.
 
- 
isTrustedTests if theSCMHeadis trusted.- Parameters:
- head- the- SCMHead.
- Returns:
- trueif the- SCMHeadis trusted.
- Throws:
- IOException- if there is an I/O error.
- InterruptedException- if the operation was interrupted.
 
- 
getCriteriaReturns theSCMSourceCriteriabeing used for this request.- Returns:
- the SCMSourceCriteriabeing used for this request.
 
- 
processpublic 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 of- SCMHead.
- R- the type of- SCMRevision.
- Parameters:
- head- the- SCMHeadto process.
- revision- the- SCMRevision(assuming revision creation is very cheap).
- probeFactory- factory method that creates the- SCMProbe.
- witnesses- any- SCMSourceRequest.Witnessinstances to be informed of the observation result.
- Returns:
- trueif the- SCMHeadObserverfor this request has completed observing,- falseto continue processing.
- Throws:
- IOException- if there was an I/O error.
- InterruptedException- if the processing was interrupted.
 
- 
processpublic 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 of- SCMHead.
- R- the type of- SCMRevision.
- Parameters:
- head- the- SCMHeadto process.
- revisionFactory- factory method that creates the- SCMRevision(assuming creation is cheap).
- probeFactory- factory method that creates the- SCMProbe.
- witnesses- any- SCMSourceRequest.Witnessinstances to be informed of the observation result.
- Returns:
- trueif the- SCMHeadObserverfor this request has completed observing,- falseto continue processing.
- Throws:
- IOException- if there was an I/O error.
- InterruptedException- if the processing was interrupted.
 
- 
processpublic 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 of- SCMHead.
- I- the type of the intermediary operation result.
- R- the type of- SCMRevision.
- Parameters:
- head- the- SCMHeadto process.
- intermediateFactory- factory method that provides the seed information for both the- SCMSourceRequest.ProbeLambdaand the- SCMSourceRequest.LazyRevisionLambda.
- probeFactory- factory method that creates the- SCMProbe.
- revisionFactory- factory method that creates the- SCMRevision.
- witnesses- any- SCMSourceRequest.Witnessinstances to be informed of the observation result.
- Returns:
- trueif the- SCMHeadObserverfor this request has completed observing,- falseto continue processing.
- Throws:
- IOException- if there was an I/O error.
- InterruptedException- if the processing was interrupted.
 
- 
isCompletepublic boolean isComplete()Checks if this request has been completed, that is if itsSCMHeadObserverhas stoppedSCMHeadObserver.isObserving().- Returns:
- trueif and only if the request is completed.
 
- 
listenerReturns theTaskListenerto use for this request.- Returns:
- the TaskListenerto use for this request.
 
- 
manageAdds managing aCloseableinto the scope of theSCMSourceRequest- Parameters:
- closeable- the- Closeableto manage.
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-