Class GiteaConnectionFactory

java.lang.Object
org.jenkinsci.plugin.gitea.client.spi.GiteaConnectionFactory
Direct Known Subclasses:
DefaultGiteaConnectionFactory

public abstract class GiteaConnectionFactory extends Object
The SPI for instantiating GiteaConnection implementations from Gitea. All the ServiceLoader registered implementations will be filtered to only those that canOpen(Gitea). In the event of multiple implementations, the one with the highest priority(Gitea) will be selected and then open(Gitea) will be called.
  • Constructor Details

    • GiteaConnectionFactory

      public GiteaConnectionFactory()
  • Method Details

    • canOpen

      public abstract boolean canOpen(@NonNull Gitea gitea)
      SPI: confirm that this factory can open connections to the supplied builder.
      Parameters:
      gitea - the builder.
      Returns:
      true if connections can be opened.
    • priority

      public long priority(@NonNull Gitea gitea)
      SPI: return the priority with which this factory claims ownership of the supplied URL and authentication. This method's return value is only valid after canOpen(Gitea) has returned true.
      Parameters:
      gitea - the builder.
      Returns:
      the priority.
    • open

      @NonNull public abstract GiteaConnection open(@NonNull Gitea gitea) throws IOException, InterruptedException
      SPI: open the connection to the supplied URL with the supplied authentication.
      Parameters:
      gitea - the builder.
      Returns:
      the connection.
      Throws:
      IOException - if the connection could not be opened.
      InterruptedException - if interrupted while opening the connection.