Class SCMSourceCriteria.Probe

java.lang.Object
jenkins.scm.api.SCMSourceCriteria.Probe
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SCMProbe
Enclosing interface:
SCMSourceCriteria

public abstract static class SCMSourceCriteria.Probe extends Object implements Serializable
A probe for a branch candidate. Inspectors can tell whether a file path exists. Implement SCMProbe not this
See Also:
  • Constructor Details

    • Probe

      public Probe()
  • Method Details

    • name

      public abstract String name()
      Returns the name of the potential head.
      Returns:
      the name of the potential head.
    • lastModified

      public abstract long lastModified()
      Returns the time that the potential head was last modified.
      Returns:
      A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
    • exists

      @Deprecated public abstract boolean exists(@NonNull String path) throws IOException
      Deprecated.
      Checks if the path, relative to the head candidate root, exists or not. The results of this method should be cached where possible but can involve a remote network call.
      Parameters:
      path - the path.
      Returns:
      true iff the path exists (may be a file or a directory or a symlink or whatever).
      Throws:
      IOException - if a remote network call failed and the result is therefore indeterminate.
    • stat

      public SCMProbeStat stat(@NonNull String path) throws IOException
      Checks if the path, relative to the head candidate root, exists or not. The results of this method should be cached where possible but can involve a remote network call.
      Parameters:
      path - the path.
      Returns:
      The results of the check.
      Throws:
      IOException - if a remote network call failed and the result is therefore indeterminate.
      Since:
      2.0
    • getRoot

      @CheckForNull public SCMFile getRoot()
      Returns the SCMFile of the root of this head candidate if such deep introspection can be cheaply provided by the version control system in question.

      When available, this provides more capabilities to analyze what's in the repository. Given the frequency of SCMSourceCriteria.isHead(SCMSourceCriteria.Probe, hudson.model.TaskListener) call, this method needs to be used with caution.

      Returns:
      the SCMFile of the root of this head candidate or null if this is not available.