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
ConstructorsModifierConstructorDescriptionSCMHeadEvent(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) protectedSCMHeadEvent(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 aSCMHeadObserversuch that the wrapped observer will only observeSCMHeadinstances mentioned in this event.static voidfireLater(SCMHeadEvent<?> event, long delay, TimeUnit delayUnits) Fires theSCMHeadEventto all registeredSCMEventListenerinstances after the specified delay.static voidfireNow(SCMHeadEvent<?> event) Fires theSCMHeadEventto all registeredSCMEventListenerinstances.abstract StringReturns the name of theSCMSource, such as a repository name within an organization; may be used as anItem.getName().abstract Map<SCMHead,SCMRevision> abstract booleanTests if this event applies to the suppliedSCM.abstract booleanisMatch(SCMNavigator navigator) Tests if this event applies to the suppliedSCMNavigator.booleanTests 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 anySCMNavigatorthatisMatch(SCMNavigator).NOTE: if and only if
isMatch(SCMNavigator)always returnsfalsethen 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
nullif no description can be provided. - Since:
- 2.1.1
-
heads
Returns theSCMHeadfor the suppliedSCMSourcethat 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 returntruewill trigger polling for the matching jobs that have enabled theSCMTriggerand have not disabled the post commit hooksSCMTrigger.isIgnorePostCommitHooks().NOTE: if you are implementing
SCMHeadEventand you already have a separate code path responsible for notifyingSCMTriggerthen you should either remove that code path or always returnfalsefrom this method. The recommendation is to consolidate onSCMHeadEventbased 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
nullif no description can be provided. - Since:
- 2.1.1
-
filter
public <O extends SCMHeadObserver> SCMHeadObserver.Wrapped<O> filter(@NonNull SCMSource source, O delegate) Wraps aSCMHeadObserversuch that the wrapped observer will only observeSCMHeadinstances mentioned in this event.- Type Parameters:
O- the type of delegate.- Parameters:
source- theSCMSource.delegate- the delegate.- Returns:
- the wrapped delegate.
-
fireNow
Fires theSCMHeadEventto all registeredSCMEventListenerinstances.- Parameters:
event- the event to fire.
-
fireLater
Fires theSCMHeadEventto all registeredSCMEventListenerinstances 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.