Package jenkins.scm.api.trait
Class SCMNavigatorRequest
- java.lang.Object
-
- jenkins.scm.api.trait.SCMNavigatorRequest
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public abstract class SCMNavigatorRequest extends Object implements Closeable
Represents the context of an individual request for a call toSCMNavigator.visitSources(SCMSourceObserver)
or an equivalent method.- Since:
- 2.2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SCMNavigatorRequest.AttributeLambda
A lambda that will create the map of attributes for a specific project name.static interface
SCMNavigatorRequest.SourceLambda
A lambda that will create theSCMSource
instance for a specific project name.static interface
SCMNavigatorRequest.Witness
Callback lambda to track the results ofprocess(String, SourceLambda, AttributeLambda, Witness...)
orprocess(String, List, List, Witness...)
-
Constructor Summary
Constructors Modifier Constructor Description protected
SCMNavigatorRequest(SCMNavigator source, SCMNavigatorContext<?,?> context, SCMSourceObserver observer)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
List<SCMSourceDecorator<?,?>>
decorators()
Returns theSCMSourceDecorator
instances to apply toSCMSource
instances.boolean
isExcluded(String projectName)
Tests if the project name is excluded from the request.void
manage(Closeable closeable)
Adds managing aCloseable
into the scope of theSCMNavigatorRequest
boolean
process(String projectName, List<SCMNavigatorRequest.SourceLambda> sourceFactories, List<SCMNavigatorRequest.AttributeLambda> attributeFactories, SCMNavigatorRequest.Witness... witnesses)
Processes a named project in the scope of the current request.boolean
process(String projectName, SCMNavigatorRequest.SourceLambda sourceFactory, SCMNavigatorRequest.AttributeLambda attributeFactory, SCMNavigatorRequest.Witness... witnesses)
Processes a named project in the scope of the current request.List<SCMSourceTrait>
traits()
Returns theSCMSourceTrait
instances to apply to everySCMSource
.
-
-
-
Constructor Detail
-
SCMNavigatorRequest
protected SCMNavigatorRequest(@NonNull SCMNavigator source, @NonNull SCMNavigatorContext<?,?> context, @NonNull SCMSourceObserver observer)
Constructor.- Parameters:
source
- the source.context
- the context.observer
- the observer.
-
-
Method Detail
-
traits
@NonNull public final List<SCMSourceTrait> traits()
Returns theSCMSourceTrait
instances to apply to everySCMSource
.- Returns:
- the
SCMSourceTrait
instances to apply to everySCMSource
.
-
decorators
@NonNull public final List<SCMSourceDecorator<?,?>> decorators()
Returns theSCMSourceDecorator
instances to apply toSCMSource
instances.- Returns:
- the
SCMSourceDecorator
instances to apply toSCMSource
instances.
-
isExcluded
public final boolean isExcluded(@NonNull String projectName) throws IOException, InterruptedException
Tests if the project name is excluded from the request.- Parameters:
projectName
- the project name.- Returns:
true
if theSCMHead
is excluded.- Throws:
IOException
- if there is an I/O error.InterruptedException
- if the operation was interrupted.
-
process
public boolean process(@NonNull String projectName, @NonNull SCMNavigatorRequest.SourceLambda sourceFactory, @CheckForNull SCMNavigatorRequest.AttributeLambda attributeFactory, SCMNavigatorRequest.Witness... witnesses) throws IllegalArgumentException, IOException, InterruptedException
Processes a named project in the scope of the current request.- Parameters:
projectName
- the name of the project.sourceFactory
- the factory for instantiating aSCMSource
.attributeFactory
- (optional) factory for instantiating the attribute map.witnesses
- the witnesses to record the processing result.- Returns:
true
if and only if the request is completed,false
if the request can process additional named projects.- Throws:
IllegalArgumentException
- if the attribute factory provides attribute names that are unrecognized, or repeats already added attributes.IOException
- if there is an I/O error.InterruptedException
- if the operation was interrupted.
-
process
public boolean process(@NonNull String projectName, @NonNull List<SCMNavigatorRequest.SourceLambda> sourceFactories, @CheckForNull List<SCMNavigatorRequest.AttributeLambda> attributeFactories, SCMNavigatorRequest.Witness... witnesses) throws IllegalArgumentException, IOException, InterruptedException
Processes a named project in the scope of the current request.- Parameters:
projectName
- the name of the project.sourceFactories
- the factories for instantiating theSCMSource
instances.attributeFactories
- (optional) factories for instantiating the attribute maps.witnesses
- the witnesses to record the processing result.- Returns:
true
if and only if the request is completed,false
if the request can process additional named projects.- Throws:
IllegalArgumentException
- if an attribute factory provides attribute names that are unrecognized, or repeats already added attributes.IOException
- if there is an I/O error.InterruptedException
- if the operation was interrupted.
-
manage
public void manage(@CheckForNull Closeable closeable)
Adds managing aCloseable
into the scope of theSCMNavigatorRequest
- Parameters:
closeable
- theCloseable
to manage.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-