Package jenkins.scm.api
Class SCMHeadObserver
java.lang.Object
jenkins.scm.api.SCMHeadObserver
- Direct Known Subclasses:
SCMHeadObserver.AllFinished,SCMHeadObserver.Any,SCMHeadObserver.Collector,SCMHeadObserver.Named,SCMHeadObserver.None,SCMHeadObserver.OneFinished,SCMHeadObserver.Selector,SCMHeadObserver.Wrapped
Something that observes
SCMHead and corresponding SCMRevision details.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn observer that wraps multiple observers and keeps observing as long as one of the wrapped observers wants to.static classAn observer that picks the first revision it can find.static classAn observer that collects the observedSCMHeads andSCMRevisions.static classSCMHeadObserver.Filter<O extends SCMHeadObserver>ASCMHeadObserverthat filters theSCMHeadinstances that will be observed by the wrappedSCMHeadObserver.static classAn observer that collects theSCMRevisionof a namedSCMHeadand then stops observing.static final classAn observer that is already finished.static classAn observer that wraps multiple observers and keeps observing until one of the wrapped observers stops observing.static classAn observer that collects theSCMRevisionof a specificSCMHeadand then stops observing.static classSCMHeadObserver.Wrapped<O extends SCMHeadObserver>Base class for anSCMHeadObserverthat wraps anotherSCMHeadObserverwhile allowing access to the original observer viaSCMHeadObserver.Wrapped.unwrap(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SCMHeadObserver.AllFinishedallOf(SCMHeadObserver... observers) Wraps multiple observers returning a combined observer that remains observing as long as at least one of the wrapped observers is still observing.static SCMHeadObserver.Anyany()Creates an observer that selects the first revision it finds.static SCMHeadObserver.Collectorcollect()Creates an observer that collects all the heads and revisions.static <O extends SCMHeadObserver>
SCMHeadObserver.Filter<O>Creates an observer that filters a delegates observer to the specified headsstatic SCMHeadObserver.OneFinishedfirst(SCMHeadObserver... observers) Wraps multiple observers returning a combined observer that remains observing until one of the wrapped observers stops observing.booleanReturns information about whether the observer wants more results.static SCMHeadObserver.NamedCreates an observer that selects the revision of a specific head.static SCMHeadObserver.Nonenone()Creates an observer that selects the first revision it finds.abstract voidobserve(SCMHead head, SCMRevision revision) Observes a head and current revision.static SCMHeadObserver.SelectorCreates an observer that selects the revision of a specific head.
-
Constructor Details
-
SCMHeadObserver
public SCMHeadObserver()
-
-
Method Details
-
observe
public abstract void observe(@NonNull SCMHead head, @NonNull SCMRevision revision) throws IOException, InterruptedException Observes a head and current revision.- Parameters:
head- the head.revision- the revision.- Throws:
IOException- if processing of the observation could not be completed due to anIOException.InterruptedException- if processing of the observation was interrupted
-
isObserving
public boolean isObserving()Returns information about whether the observer wants more results.- Returns:
trueif the observer is still observing orfalseto signal that it is ok to stop early.
-
getIncludes
Returns the subset ofSCMHeadinstances that this observer is interested in ornullif interested in allSCMHeadinstances.Implementations should not assume that the
getIncludes()will be honoured. This method is designed to provide a hint toSCMSourceimplementations.- Returns:
- the subset of
SCMHeadinstances that this observer is interested in ornull. - Since:
- 2.0
-
allOf
Wraps multiple observers returning a combined observer that remains observing as long as at least one of the wrapped observers is still observing.- Parameters:
observers- the observers to wrap.- Returns:
- a wrapped observer.
-
first
Wraps multiple observers returning a combined observer that remains observing until one of the wrapped observers stops observing.- Parameters:
observers- the observers to wrap.- Returns:
- a wrapped observer.
-
collect
Creates an observer that collects all the heads and revisions.- Returns:
- an observer that collects all the heads and revisions.
-
select
Creates an observer that selects the revision of a specific head.- Parameters:
head- the head to watch out for.- Returns:
- an observer that selects the revision of a specific head.
-
filter
@NonNull public static <O extends SCMHeadObserver> SCMHeadObserver.Filter<O> filter(O delegate, SCMHead... heads) Creates an observer that filters a delegates observer to the specified heads- Type Parameters:
O- the type of observer that will be filtered.- Parameters:
delegate- the delegateheads- the head to watch out for.- Returns:
- an observer that wraps the supplied delegate.
-
named
Creates an observer that selects the revision of a specific head.- Parameters:
headName- the head to watch out for.- Returns:
- an observer that selects the revision of a specific head.
- Since:
- 2.0
-
any
Creates an observer that selects the first revision it finds. Also useful for quick checks of non-empty.- Returns:
- an observer that selects the first revision of a any head.
- Since:
- 2.0
-
none
Creates an observer that selects the first revision it finds. Also useful for quick checks of non-empty.- Returns:
- an observer that selects the first revision of a any head.
- Since:
- 2.2.0
-