Package jenkins.scm.api
Class SCMFileSystem.Builder
- java.lang.Object
-
- jenkins.scm.api.SCMFileSystem.Builder
-
- All Implemented Interfaces:
ExtensionPoint
- Enclosing class:
- SCMFileSystem
public abstract static class SCMFileSystem.Builder extends Object implements ExtensionPoint
Extension point that allows different plugins to implementSCMFileSystem
classes for the sameSCM
orSCMSource
and let Jenkins pick the most capable for any specificSCM
implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SCMFileSystem
build(Item owner, SCM scm, SCMRevision rev)
Given aSCM
this should try to build a correspondingSCMFileSystem
instance that reflects the content at the specifiedSCMRevision
.SCMFileSystem
build(Item owner, SCM scm, SCMRevision rev, Run<?,?> _build)
Given aSCM
this should try to build a correspondingSCMFileSystem
instance that reflects the content at the specifiedSCMRevision
.SCMFileSystem
build(SCMSource source, SCMHead head, SCMRevision rev)
Given aSCMSource
, aSCMHead
and aSCMRevision
this method should try to build a correspondingSCMFileSystem
instance that reflects the content of the specifiedSCMHead
at the specifiedSCMRevision
.abstract boolean
supports(SCM source)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCM
.boolean
supports(SCMDescriptor<?> descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMDescriptor
.abstract boolean
supports(SCMSource source)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSource
.boolean
supports(SCMSourceDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSourceDescriptor
.protected abstract boolean
supportsDescriptor(SCMDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMDescriptor
.protected abstract boolean
supportsDescriptor(SCMSourceDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSourceDescriptor
.
-
-
-
Method Detail
-
supports
public abstract boolean supports(SCM source)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCM
.- Parameters:
source
- theSCM
.- Returns:
true
if and only if the suppliedSCM
is supported by thisSCMFileSystem.Builder
,false
ifbuild(Item, SCM, SCMRevision)
will always returnnull
.
-
supports
public abstract boolean supports(SCMSource source)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSource
.- Parameters:
source
- theSCMSource
.- Returns:
true
if and only if the suppliedSCMSource
is supported by thisSCMFileSystem.Builder
,false
ifbuild(SCMSource, SCMHead, SCMRevision)
will always returnnull
.
-
supports
public final boolean supports(SCMDescriptor<?> descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMDescriptor
.- Parameters:
descriptor
- theSCMDescriptor
- Returns:
- the return value of
supportsDescriptor(SCMDescriptor)
if implemented, otherwise, it will return true if one of the following is true: theSCM
for the descriptor is the enclosing class of this builder class, the builder andSCM
are in the same package, or the builder is in a child package of theSCM
. - Since:
- 2.3.0
-
supportsDescriptor
protected abstract boolean supportsDescriptor(SCMDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMDescriptor
.- Parameters:
descriptor
- theSCMDescriptor
- Returns:
true
if and only if the suppliedSCMSourceDescriptor
'sSCMDescriptor
class is supported by thisSCMFileSystem.Builder
.- Since:
- 2.3.0
-
supports
public final boolean supports(SCMSourceDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSourceDescriptor
.- Parameters:
descriptor
- theSCMSourceDescriptor
- Returns:
- the return value of
supportsDescriptor(SCMSourceDescriptor)
if implemented, otherwise, it will return true if one of the following is true: theSCMSource
for the descriptor is the enclosing class of this builder class, the builder andSCMSource
are in the same package, or the builder is in a child package of theSCMSource
. - Since:
- 2.3.0
-
supportsDescriptor
protected abstract boolean supportsDescriptor(SCMSourceDescriptor descriptor)
Checks if thisSCMFileSystem.Builder
supports the suppliedSCMSourceDescriptor
.- Parameters:
descriptor
- theSCMSourceDescriptor
- Returns:
true
if and only if the suppliedSCMSourceDescriptor
'sSCMSource
class is supported by thisSCMFileSystem.Builder
,false
ifbuild(SCMSource, SCMHead, SCMRevision)
will always returnnull
, andfalse
by default for compatibility.- Since:
- 2.3.0
-
build
@CheckForNull public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull SCMRevision rev) throws IOException, InterruptedException
Given aSCM
this should try to build a correspondingSCMFileSystem
instance that reflects the content at the specifiedSCMRevision
. If theSCM
is supported but not for a fixed revision, best effort is acceptable as the most capableSCMFileSystem
will be returned to the caller.- Parameters:
owner
- the owner of theSCM
scm
- theSCM
.rev
- the specifiedSCMRevision
.- Returns:
- the corresponding
SCMFileSystem
ornull
if this builder cannot create aSCMFileSystem
for the specifiedSCM
. - Throws:
IOException
- if the attempt to create aSCMFileSystem
failed due to an IO error (such as the remote system being unavailable)InterruptedException
- if the attempt to create aSCMFileSystem
was interrupted.
-
build
@CheckForNull public SCMFileSystem build(@NonNull SCMSource source, @NonNull SCMHead head, @CheckForNull SCMRevision rev) throws IOException, InterruptedException
Given aSCMSource
, aSCMHead
and aSCMRevision
this method should try to build a correspondingSCMFileSystem
instance that reflects the content of the specifiedSCMHead
at the specifiedSCMRevision
. If theSCMSource
is supported but not for a fixed revision, best effort is acceptable as the most capableSCMFileSystem
will be returned to the caller.- Parameters:
source
- theSCMSource
.head
- the specifiedSCMHead
.rev
- the specifiedSCMRevision
.- Returns:
- the corresponding
SCMFileSystem
ornull
if there is none. - Throws:
IOException
- if the attempt to create aSCMFileSystem
failed due to an IO error (such as the remote system being unavailable)InterruptedException
- if the attempt to create aSCMFileSystem
was interrupted.
-
build
@CheckForNull public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull SCMRevision rev, @CheckForNull Run<?,?> _build) throws IOException, InterruptedException
Given aSCM
this should try to build a correspondingSCMFileSystem
instance that reflects the content at the specifiedSCMRevision
. If theSCM
is supported but not for a fixed revision, best effort is acceptable as the most capableSCMFileSystem
will be returned to the caller. If theRun
is provided, it can be used to alter the behavior. For example, variables in the branch name can be expanded based on current build properties, etc.- Parameters:
owner
- the owner of theSCM
scm
- theSCM
.rev
- the specifiedSCMRevision
._build
- the specifiedRun
.- Returns:
- the corresponding
SCMFileSystem
ornull
if this builder cannot create aSCMFileSystem
for the specifiedSCM
. - Throws:
IOException
- if the attempt to create aSCMFileSystem
failed due to an IO error (such as the remote system being unavailable)InterruptedException
- if the attempt to create aSCMFileSystem
was interrupted.
-
-