Interface ScmProtocol

All Known Subinterfaces:
HttpScmProtocol, SshScmProtocol

@ThreadSafe public interface ScmProtocol
An extension point for declaring an Scm's support for a protocol and for generating protocol-specific clone URLs for repositories of that kind.

This extension point is not used to implement such a protocol, merely to indicate that it is supported.

Note: Implementations of this interface are required to be thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
     
    getCloneUrl(com.atlassian.bitbucket.repository.Repository repository, com.atlassian.bitbucket.user.ApplicationUser user)
    Retrieves the clone URL specific to this protocol for the supplied repository and, if appropriate, tailored to the supplied user.
     
    default boolean
    Determines if this protocol supports the specified SCM.
    boolean
    Determines if this protocol supports the SCM with specified ID.
  • Method Details

    • getBaseUrl

      @Nonnull String getBaseUrl()
      Returns:
      the base URL to use when formatting clone URLs, which must not be null
      Since:
      5.0
    • getCloneUrl

      @Nullable String getCloneUrl(@Nonnull com.atlassian.bitbucket.repository.Repository repository, @Nullable com.atlassian.bitbucket.user.ApplicationUser user)
      Retrieves the clone URL specific to this protocol for the supplied repository and, if appropriate, tailored to the supplied user. Implementations must handle the case where there is no such user active.
      Parameters:
      repository - the repository to calculate the clone URL against
      user - the possibly null user to tailor the clone URL for if this is appropriate to the protocol
      Returns:
      the calculated clone URL or null if this cannot be calculated for any reason
    • getName

      @Nonnull String getName()
      Returns:
      the name of the protocol e.g. "ssh" or "http". The name must be lowercase.
    • supports

      default boolean supports(@Nonnull Scm scm)
      Determines if this protocol supports the specified SCM.
      Parameters:
      scm - the scm
      Returns:
      true if this protocol is supported for the supplied Scm or false otherwise
    • supports

      boolean supports(@Nonnull String scmId)
      Determines if this protocol supports the SCM with specified ID.
      Parameters:
      scmId - the ID of the scm
      Returns:
      true if this protocol is supported for the supplied SCM or false otherwise
      Since:
      5.0