Class SCMSourceEvent<P>

java.lang.Object
jenkins.scm.api.SCMEvent<P>
jenkins.scm.api.SCMSourceEvent<P>
Type Parameters:
P - the (provider specific) payload.

public abstract class SCMSourceEvent<P> extends SCMEvent<P>
Base class for events relating to SCMSource instances.
Since:
2.0
  • Constructor Details

    • SCMSourceEvent

      @Deprecated public SCMSourceEvent(@NonNull SCMEvent.Type type, long timestamp, @NonNull P payload)
      Deprecated.
    • SCMSourceEvent

      public SCMSourceEvent(@NonNull SCMEvent.Type type, long timestamp, @NonNull P payload, @CheckForNull String origin)
    • SCMSourceEvent

      @Deprecated public SCMSourceEvent(@NonNull SCMEvent.Type type, @NonNull P payload)
      Deprecated.
    • SCMSourceEvent

      public SCMSourceEvent(@NonNull SCMEvent.Type type, @NonNull P payload, @CheckForNull String origin)
    • SCMSourceEvent

      protected SCMSourceEvent(@NonNull SCMSourceEvent<P> src)
  • Method Details

    • isMatch

      public abstract boolean isMatch(@NonNull SCMNavigator navigator)
      Tests if this event applies to the supplied SCMNavigator.
      Parameters:
      navigator - the SCMNavigator.
      Returns:
      true if and only if this event concerns the supplied SCMNavigator.
    • descriptionFor

      @CheckForNull public String descriptionFor(SCMNavigator navigator)
      Return a description of the event in the context of the supplied SCMNavigator.
      Parameters:
      navigator - the SCMNavigator, the navigator must be isMatch(SCMNavigator).
      Returns:
      the description or null if no description can be provided.
      Since:
      2.1.1
    • isMatch

      public abstract boolean isMatch(@NonNull SCMSource source)
      Tests if this event applies to the supplied SCMSource. (Calling this method for a SCMEvent.Type.CREATED logically could return true if there has been out of order or delayed delivery of events)
      Parameters:
      source - the SCMSource, the source must be isMatch(SCMSource).
      Returns:
      true if and only if this event concerns the supplied SCMSource.
    • descriptionFor

      @CheckForNull public String descriptionFor(SCMSource source)
      Return a description of the event in the context of the supplied SCMSource.
      Parameters:
      source - the SCMSource.
      Returns:
      the description or null if no description can be provided.
      Since:
      2.1.1
    • getSourceName

      @NonNull public abstract String getSourceName()
      Returns the name of the SCMSource, such as a repository name within an organization; may be used as an Item.getName(). Must be the same as the name that would be passed to SCMSourceObserver.observe(String) by any SCMNavigator that isMatch(SCMNavigator).

      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
    • fireNow

      public static void fireNow(@NonNull SCMSourceEvent<?> event)
      Fires the SCMSourceEvent to all registered SCMEventListener instances.
      Parameters:
      event - the event to fire.
    • fireLater

      public static void fireLater(@NonNull SCMSourceEvent<?> event, long delay, TimeUnit delayUnits)
      Fires the SCMSourceEvent to all registered SCMEventListener 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.