Class GiteaServers

All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, OnMaster

@Extension public class GiteaServers extends GlobalConfiguration
Represents the global configuration of Gitea servers.
  • Constructor Details

    • GiteaServers

      public GiteaServers()
      Constructor.
  • Method Details

    • get

      public static GiteaServers get()
      Gets the GiteaServers singleton.
      Returns:
      the GiteaServers singleton.
    • normalizeServerUrl

      @NonNull public static String normalizeServerUrl(@CheckForNull String serverUrl)
      Fix a serverUrl.
      Parameters:
      serverUrl - the server URL.
      Returns:
      the normalized server URL.
    • isEventFor

      public static boolean isEventFor(String serverUrl, String eventUrl)
      Checks if the supplied event url is for the specified server url (after consulting
      Parameters:
      serverUrl - the GiteaServer.getServerUrl()
      eventUrl - the event url.
      Returns:
      true if the event is a matching GiteaServer.getAliasUrl() for registered GiteaServer instances)
      Since:
      1.0.5
    • isEndpointSelectable

      public boolean isEndpointSelectable()
      Returns true if and only if there is more than one configured endpoint.
      Returns:
      true if and only if there is more than one configured endpoint.
    • getServerItems

      public ListBoxModel getServerItems()
      Populates a ListBoxModel with the endpoints.
      Returns:
      A ListBoxModel with all the endpoints
    • configure

      public boolean configure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject json) throws Descriptor.FormException
      Overrides:
      configure in class GlobalConfiguration
      Throws:
      Descriptor.FormException
    • getServers

      @NonNull public List<GiteaServer> getServers()
      Gets the list of endpoints.
      Returns:
      the list of endpoints
    • setServers

      public void setServers(@CheckForNull List<? extends GiteaServer> servers)
      Sets the list of endpoints.
      Parameters:
      servers - the list of endpoints.
    • addServer

      public boolean addServer(@NonNull GiteaServer endpoint)
      Adds an endpoint.
      Parameters:
      endpoint - the endpoint to add.
      Returns:
      true if the list of endpoints was modified
    • updateServer

      public void updateServer(@NonNull GiteaServer endpoint)
      Updates an existing endpoint (or adds if missing).
      Parameters:
      endpoint - the endpoint to update.
    • removeServer

      public boolean removeServer(@NonNull GiteaServer endpoint)
      Removes an endpoint.
      Parameters:
      endpoint - the endpoint to remove.
      Returns:
      true if the list of endpoints was modified
    • removeServer

      public boolean removeServer(@CheckForNull String serverUrl)
      Removes an endpoint.
      Parameters:
      serverUrl - the server URL to remove.
      Returns:
      true if the list of endpoints was modified
    • findServer

      @CheckForNull public GiteaServer findServer(@CheckForNull String serverUrl)
      Checks to see if the supplied server URL is defined in the global configuration.
      Parameters:
      serverUrl - the server url to check.
      Returns:
      the global configuration for the specified server url or null if not defined.