Class SCMHeadEvent<P>
- Type Parameters:
P
- the (provider specific) payload.
SCMHead
instances.- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class jenkins.scm.api.SCMEvent
SCMEvent.Dispatcher<E extends SCMEvent<?>>, SCMEvent.EventQueueMetrics, SCMEvent.Type
-
Field Summary
Fields inherited from class jenkins.scm.api.SCMEvent
ORIGIN_UNKNOWN
-
Constructor Summary
ModifierConstructorDescriptionSCMHeadEvent
(SCMEvent.Type type, long timestamp, P payload) Deprecated.SCMHeadEvent
(SCMEvent.Type type, long timestamp, P payload, String origin) SCMHeadEvent
(SCMEvent.Type type, P payload) Deprecated.SCMHeadEvent
(SCMEvent.Type type, P payload, String origin) protected
SCMHeadEvent
(SCMHeadEvent<P> src) -
Method Summary
Modifier and TypeMethodDescriptiondescriptionFor
(SCM scm) Return a description of the event in the context of the suppliedSCM
.descriptionFor
(SCMNavigator navigator) Return a description of the event in the context of the suppliedSCMNavigator
.descriptionFor
(SCMSource source) Return a description of the event in the context of the suppliedSCMSource
.<O extends SCMHeadObserver>
SCMHeadObserver.Wrapped<O>Wraps aSCMHeadObserver
such that the wrapped observer will only observeSCMHead
instances mentioned in this event.static void
fireLater
(SCMHeadEvent<?> event, long delay, TimeUnit delayUnits) Fires theSCMHeadEvent
to all registeredSCMEventListener
instances after the specified delay.static void
fireNow
(SCMHeadEvent<?> event) Fires theSCMHeadEvent
to all registeredSCMEventListener
instances.abstract String
Returns the name of theSCMSource
, such as a repository name within an organization; may be used as anItem.getName()
.abstract Map<SCMHead,
SCMRevision> abstract boolean
Tests if this event applies to the suppliedSCM
.abstract boolean
isMatch
(SCMNavigator navigator) Tests if this event applies to the suppliedSCMNavigator
.boolean
Tests if this event applies to the suppliedSCMSource
.Methods inherited from class jenkins.scm.api.SCMEvent
asCauses, closeExecutorService, description, equals, executorService, getDate, getEventProcessingMetrics, getOrigin, getPayload, getTimestamp, getType, hashCode, originOf, originOf, toString
-
Constructor Details
-
SCMHeadEvent
Deprecated. -
SCMHeadEvent
public SCMHeadEvent(@NonNull SCMEvent.Type type, long timestamp, @NonNull P payload, @CheckForNull String origin) -
SCMHeadEvent
Deprecated. -
SCMHeadEvent
-
SCMHeadEvent
-
-
Method Details
-
getSourceName
Returns the name of theSCMSource
, such as a repository name within an organization; may be used as anItem.getName()
. Must be the same as the name that would be passed toSCMSourceObserver.observe(String)
by anySCMNavigator
thatisMatch(SCMNavigator)
.NOTE: if and only if
isMatch(SCMNavigator)
always returnsfalse
then the value returned here does not matter and a dummy value can be returned instead.DO NOT TRUST THE RETURN VALUES. Data from events should only be used as a rumour that requires verification.
- Returns:
- the name of the
SCMSource
-
isMatch
Tests if this event applies to the suppliedSCMSource
. -
descriptionFor
Return a description of the event in the context of the suppliedSCMSource
.- Parameters:
source
- theSCMSource
, the source must beisMatch(SCMSource)
.- Returns:
- the description or
null
if no description can be provided. - Since:
- 2.1.1
-
heads
Returns theSCMHead
for the suppliedSCMSource
that this event corresponds to.DO NOT TRUST THE RETURN VALUES. Data from events should only be used as a rumour that requires verification.
- Parameters:
source
- theSCMSource
.- Returns:
- the
SCMHead
(and optionalSCMRevision
) that this event corresponds to when considered from the point of view of the suppliedSCMSource
. The map may be empty in the case where the event is not relevant to the suppliedSCMSource
-
isMatch
Tests if this event applies to the suppliedSCM
. Implementations that returntrue
will trigger polling for the matching jobs that have enabled theSCMTrigger
and have not disabled the post commit hooksSCMTrigger.isIgnorePostCommitHooks()
.NOTE: if you are implementing
SCMHeadEvent
and you already have a separate code path responsible for notifyingSCMTrigger
then you should either remove that code path or always returnfalse
from this method. The recommendation is to consolidate onSCMHeadEvent
based triggering as that minimizes the number of times the graph of all items needs to be traversed by event listeners. -
descriptionFor
Return a description of the event in the context of the suppliedSCM
.- Parameters:
scm
- theSCM
, the scm must beisMatch(SCM)
.- Returns:
- the description or
null
if no description can be provided. - Since:
- 2.1.1
-
filter
public <O extends SCMHeadObserver> SCMHeadObserver.Wrapped<O> filter(@NonNull SCMSource source, O delegate) Wraps aSCMHeadObserver
such that the wrapped observer will only observeSCMHead
instances mentioned in this event.- Type Parameters:
O
- the type of delegate.- Parameters:
source
- theSCMSource
.delegate
- the delegate.- Returns:
- the wrapped delegate.
-
fireNow
Fires theSCMHeadEvent
to all registeredSCMEventListener
instances.- Parameters:
event
- the event to fire.
-
fireLater
Fires theSCMHeadEvent
to all registeredSCMEventListener
instances after the specified delay.- Parameters:
event
- the event to fire.delay
- how long to wait before firing the event.delayUnits
- the units of time in which the delay is expressed.