Class Downloads

java.lang.Object
hudson.model.DownloadService.Downloadable
io.jenkins.plugins.dotnet.data.Downloads
All Implemented Interfaces:
ExtensionPoint

@Extension public final class Downloads extends DownloadService.Downloadable
A data file containing the available .NET SDK installer packages.
  • Constructor Details

    • Downloads

      @DataBoundConstructor public Downloads()
      Creates a new Downloads downloadable.
  • Method Details

    • getPackage

      @CheckForNull public Downloads.Package getPackage(@CheckForNull String version, @CheckForNull String release, @CheckForNull String sdk, @CheckForNull String url)
      Gets a package for a particular SDK, via its download link.
      Parameters:
      version - The name of the version containing the release to which the package belongs.
      release - The name of the release containing the SDK to which the package belongs.
      sdk - The name of the SDK to which the package belongs.
      url - The download link for the package.
      Returns:
      The requested package, or null if it was not found.
    • getRelease

      @CheckForNull public Downloads.Release getRelease(@CheckForNull String version, @CheckForNull String name)
      Gets a release, via its name.
      Parameters:
      version - The name of the version containing the release.
      name - The name of the release.
      Returns:
      The requested release, or null if it was not found.
    • getSdk

      @CheckForNull public Downloads.Sdk getSdk(@CheckForNull String name)
      Gets an SDK, via its name.
      Parameters:
      name - The name of the SDK.
      Returns:
      The requested SDK, or null if it was not found.
    • getSdk

      @CheckForNull public Downloads.Sdk getSdk(@CheckForNull String version, @CheckForNull String release, @CheckForNull String name)
      Gets a release-specific SDK, via its name.
      Parameters:
      version - The name of the version containing the release to which the SDK belongs.
      release - The name of the release containing the SDK.
      name - The name of the SDK.
      Returns:
      The requested SDK, or null if it was not found.
    • getVersion

      @CheckForNull public Downloads.Version getVersion(@CheckForNull String name)
      Gets a version, via its name.
      Parameters:
      name - The name of the version.
      Returns:
      The requested version, or null if it was not found.
    • addPackages

      @NonNull public ListBoxModel addPackages(@NonNull ListBoxModel model, @CheckForNull String sdk)
      Adds the available packages for a specific SDK to a list box.
      Parameters:
      model - The list box to add the packages to.
      sdk - The name of the SDK containing the packages to add.
      Returns:
      The updated list box.
    • addReleases

      @NonNull public ListBoxModel addReleases(@NonNull ListBoxModel model, @CheckForNull String version, boolean includePreview)
      Adds the available releases for a specific version to a list box.
      Parameters:
      model - The list box to add the releases to.
      version - The name of the version containing the releases to add.
      includePreview - Indicates whether preview releases should be included.
      Returns:
      The updated list box.
    • addSdks

      @NonNull public ListBoxModel addSdks(@NonNull ListBoxModel model, @CheckForNull String version, @CheckForNull String release)
      Adds the available SDKs for a specific release to a list box.
      Parameters:
      model - The list box to add the SDKs to.
      version - The name of the version containing the release.
      release - The name of the release containing the SDKs to add.
      Returns:
      The updated list box.
    • addVersions

      @NonNull public ListBoxModel addVersions(@NonNull ListBoxModel model)
      Adds the available .NET versions to a list box.
      Parameters:
      model - The list box to add the versions to.
      Returns:
      The updated list box.
    • getInstance

      @NonNull public static Downloads getInstance()
      Gets the (single) instance of Downloads.
      Returns:
      An instance of Downloads, loaded with all available SDK installation packages for all .NET versions/releases.
    • getSdks

      @NonNull public Collection<Downloads.Sdk> getSdks()
      Gets all known .NET SDKs.
      Returns:
      All known .NET SDKs.
    • getVersions

      @NonNull public Collection<Downloads.Version> getVersions()
      Gets all known .NET versions.
      Returns:
      All known .NET versions.
    • readJsonObjectArray

      @NonNull public static <T> Map<String,T> readJsonObjectArray(@NonNull net.sf.json.JSONObject o, @NonNull String prop, @NonNull Function<net.sf.json.JSONObject,T> convert, @NonNull Function<T,String> createKey)
      Reads a JSON property containing an array of objects, converting them to a map of typed Java objects.
      Type Parameters:
      T - The specific Java object type to create from the array elements.
      Parameters:
      o - The JSON object to take the property from.
      prop - The name of the property to process.
      convert - A function to convert an array element to the desired Java object.
      createKey - A function to determine the key to use for a given (already-converted) object.
      Returns:
      The resulting map.
    • readJsonStringArray

      @NonNull public static List<String> readJsonStringArray(@NonNull net.sf.json.JSONObject o, @NonNull String prop)
      Reads a JSON property containing an array of strings.
      Parameters:
      o - The JSON object to take the property from.
      prop - The name of the property to process.
      Returns:
      The resulting list of strings.