Interface RepositoryExportingCheck

All Superinterfaces:
ReadOnlyCheck
All Known Implementing Classes:
DefaultRepositoryExportingCheck

public interface RepositoryExportingCheck extends ReadOnlyCheck
Implementations of this class can be used to check whether a repository is currently being exported.
Since:
2.14.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    check(String repositoryId)
    Throws a ReadOnlyException if the repository with th id is read only.
    default String
    Returns the reason for the write protection.
    boolean
    isExporting(String repositoryId)
    Checks whether the repository with the given id is currently (that is, at this moment) being exported or not.
    default boolean
    isExporting(Repository repository)
    Checks whether the given repository is currently (that is, at this moment) being exported or not.
    default boolean
    isReadOnly(String repositoryId)
    Returns true if the repository with the given id is read only.
    <T> T
    withExportingLock(Repository repository, Supplier<T> callback)
    Asserts that the given repository is marked as being exported during the execution of the given callback.

    Methods inherited from interface sonia.scm.repository.ReadOnlyCheck

    check, isForbidden, isReadOnly, isReadOnly
  • Method Details

    • isExporting

      boolean isExporting(String repositoryId)
      Checks whether the repository with the given id is currently (that is, at this moment) being exported or not.
      Parameters:
      repositoryId - The id of the repository to check.
      Returns:
      true when the repository with the given id is currently being exported, false otherwise.
    • isExporting

      default boolean isExporting(Repository repository)
      Checks whether the given repository is currently (that is, at this moment) being exported or not. This checks the status on behalf of the id of the repository, not by the exporting flag provided by the repository itself.
      Parameters:
      repository - The repository to check.
      Returns:
      true when the given repository is currently being exported, false otherwise.
    • withExportingLock

      <T> T withExportingLock(Repository repository, Supplier<T> callback)
      Asserts that the given repository is marked as being exported during the execution of the given callback.
      Type Parameters:
      T - The return type of the callback.
      Parameters:
      repository - The repository that will be marked as being exported.
      callback - This callback will be executed.
      Returns:
      The result of the callback.
    • isReadOnly

      default boolean isReadOnly(String repositoryId)
      Description copied from interface: ReadOnlyCheck
      Returns true if the repository with the given id is read only. If this is the case, all permissions not marked "read only" will be denied fot this repository, stores for this repository cannot be written, and calling modifying commands will be prevented. If only special permissions should be forbidden without blocking stores and commands, use ReadOnlyCheck.isForbidden(String, String) instead.
      Specified by:
      isReadOnly in interface ReadOnlyCheck
      Parameters:
      repositoryId - repository id
      Returns:
      true if repository is read only
      See Also:
    • getReason

      default String getReason()
      Description copied from interface: ReadOnlyCheck
      Returns the reason for the write protection.
      Specified by:
      getReason in interface ReadOnlyCheck
    • check

      default void check(String repositoryId)
      Description copied from interface: ReadOnlyCheck
      Throws a ReadOnlyException if the repository with th id is read only.
      Specified by:
      check in interface ReadOnlyCheck
      Parameters:
      repositoryId - The id of the repository to check for.