public abstract class SCMSource extends hudson.model.AbstractDescribableImpl<SCMSource> implements hudson.ExtensionPoint
SCMSource is responsible for fetching SCMHead and corresponding SCMRevision instances from
which it can build SCM instances that are configured to check out the specific SCMHead at the
specified SCMRevision.
Each SCMSource is owned by a SCMSourceOwner, if you need to find all the owners use
SCMSourceOwners.all() to iterate through them, e.g. to notify SCMSource instances of push
notification from the server they source SCMHeads from.
NOTE: This layer does not cache remote calls but can cache intermediary results. For example,
with Subversion it is acceptable to cache the last revisions of various directory entries to minimize network
round trips, but any of the calls to fetch(TaskListener),
fetch(SCMHeadObserver, hudson.model.TaskListener) or
fetch(SCMHead, hudson.model.TaskListener) must
involve at least one network round trip to validate any cached information.| Modifier | Constructor and Description |
|---|---|
protected |
SCMSource(String id)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
hudson.scm.SCM |
build(SCMHead head)
Builds a
SCM instance for the specified head. |
abstract hudson.scm.SCM |
build(SCMHead head,
SCMRevision revision)
Builds a
SCM instance for the specified head and revision, no validation of the
head is performed, a revision for a different head or source will be treated as equivalent to a
null revision. |
protected hudson.model.TaskListener |
defaultListener(hudson.model.TaskListener listener)
Turns a possibly
null TaskListener reference into a guaranteed non-null reference. |
boolean |
equals(Object o) |
<O extends SCMHeadObserver> |
fetch(O observer,
hudson.model.TaskListener listener)
Fetches the latest heads and corresponding revisions.
|
SCMRevision |
fetch(SCMHead head,
hudson.model.TaskListener listener)
Gets the current head revision of the specified head.
|
Set<SCMHead> |
fetch(hudson.model.TaskListener listener)
Fetches the current list of heads.
|
protected SCMSourceCriteria |
getCriteria()
Returns the branch criteria.
|
String |
getId()
The ID of this source.
|
SCMSourceOwner |
getOwner()
Gets the owner.
|
int |
hashCode() |
protected abstract void |
retrieve(SCMHeadObserver observer,
hudson.model.TaskListener listener)
Fetches the latest heads and corresponding revisions.
|
protected SCMRevision |
retrieve(SCMHead head,
hudson.model.TaskListener listener)
Gets the current head revision of the specified head.
|
protected Set<SCMHead> |
retrieve(hudson.model.TaskListener listener)
Fetches the current list of heads.
|
void |
setOwner(SCMSourceOwner owner)
Sets the owner.
|
String |
toString() |
protected SCMSource(@CheckForNull
String id)
id - the id or null.@NonNull public final String getId()
public final void setOwner(@CheckForNull
SCMSourceOwner owner)
owner - the owner.@CheckForNull public final SCMSourceOwner getOwner()
@CheckForNull protected final SCMSourceCriteria getCriteria()
@NonNull public final <O extends SCMHeadObserver> O fetch(@NonNull O observer, @CheckForNull hudson.model.TaskListener listener) throws IOException, InterruptedException
observer - an optional observer of interim results.listener - the task listenerIOExceptionInterruptedException@NonNull
protected abstract void retrieve(@NonNull
SCMHeadObserver observer,
@NonNull
hudson.model.TaskListener listener)
throws IOException,
InterruptedException
observer - an optional observer of interim results.listener - the task listener.IOExceptionInterruptedException@NonNull public final Set<SCMHead> fetch(@CheckForNull hudson.model.TaskListener listener) throws IOException, InterruptedException
listener - the task listenerIOExceptionInterruptedException@NonNull protected Set<SCMHead> retrieve(@NonNull hudson.model.TaskListener listener) throws IOException, InterruptedException
listener - the task listenerIOExceptionInterruptedException@CheckForNull public final SCMRevision fetch(@NonNull SCMHead head, @CheckForNull hudson.model.TaskListener listener) throws IOException, InterruptedException
head - the head.listener - the task listenernull if the head no longer exists.IOExceptionInterruptedException@CheckForNull protected SCMRevision retrieve(@NonNull SCMHead head, @NonNull hudson.model.TaskListener listener) throws IOException, InterruptedException
head - the head.listener - the task listenernull if the head no longer exists.IOExceptionInterruptedException@NonNull
public abstract hudson.scm.SCM build(@NonNull
SCMHead head,
@CheckForNull
SCMRevision revision)
SCM instance for the specified head and revision, no validation of the
head is performed, a revision for a different head or source will be treated as equivalent to a
null revision.head - the head.revision - the revision or null.SCM instance.@NonNull
public final hudson.scm.SCM build(@NonNull
SCMHead head)
SCM instance for the specified head.head - the head.SCM instance@NonNull
protected final hudson.model.TaskListener defaultListener(@CheckForNull
hudson.model.TaskListener listener)
null TaskListener reference into a guaranteed non-null reference.listener - a possibly null TaskListener reference.TaskListener.Copyright © 2004-2013. All Rights Reserved.