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

public abstract class SCMHeadObserver extends Object
Something that observes SCMHead and corresponding SCMRevision details.
  • 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 an IOException.
      InterruptedException - if processing of the observation was interrupted
    • isObserving

      public boolean isObserving()
      Returns information about whether the observer wants more results.
      Returns:
      true if the observer is still observing or false to signal that it is ok to stop early.
    • getIncludes

      @CheckForNull public Set<SCMHead> getIncludes()
      Returns the subset of SCMHead instances that this observer is interested in or null if interested in all SCMHead instances.

      Implementations should not assume that the getIncludes() will be honoured. This method is designed to provide a hint to SCMSource implementations.

      Returns:
      the subset of SCMHead instances that this observer is interested in or null.
      Since:
      2.0
    • allOf

      @NonNull public static SCMHeadObserver.AllFinished allOf(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.
      Parameters:
      observers - the observers to wrap.
      Returns:
      a wrapped observer.
    • first

      @NonNull public static SCMHeadObserver.OneFinished first(SCMHeadObserver... observers)
      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

      @NonNull public static SCMHeadObserver.Collector collect()
      Creates an observer that collects all the heads and revisions.
      Returns:
      an observer that collects all the heads and revisions.
    • select

      @NonNull public static SCMHeadObserver.Selector select(@NonNull SCMHead head)
      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 delegate
      heads - the head to watch out for.
      Returns:
      an observer that wraps the supplied delegate.
    • named

      @NonNull public static SCMHeadObserver.Named named(@NonNull String headName)
      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

      @NonNull public static SCMHeadObserver.Any 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

      @NonNull public static SCMHeadObserver.None 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