# Class ResourcesDownloader

Object
InstallationResources
OptionalInstallations
ResourcesDownloader

All Implemented Interfaces:
  `Localized`

public class ResourcesDownloader extends OptionalInstallations
A provider for data licensed under different terms of use than the Apache license. This class is in charge of downloading the data if necessary and asking user's agreement before to install them. Authorities managed by the current implementation are:

- `"EPSG"` for the EPSG geodetic dataset.

Since:
  0.7

- ## Field Summary

  ### Fields inherited from class OptionalInstallations

  `destinationDirectory`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ResourcesDownloader()`
  Creates a new installation scripts provider.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `askUserAgreement(String authority, String license)`
  Asks to the user if (s)he agree to download and install the resource for the given authority.
  `Set<String>`
  `getAuthorities()`
  Returns the name of the authority who provides data under non-Apache terms of use.
  `Locale`
  `getLocale()`
  Returns the locale to use for messages shown to the user.

  ### Methods inherited from class OptionalInstallations

  `getLicense, getResource, getResourceNames, getSpaceRequirement, openScript`

  ### Methods inherited from class InstallationResources

  `getInstructionURL, load`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ResourcesDownloader

    public ResourcesDownloader()
    Creates a new installation scripts provider.

- ## Method Details

  - ### getLocale

    public Locale getLocale()
    Returns the locale to use for messages shown to the user.
    Specified by:
      `getLocale` in interface `Localized`
    Overrides:
      `getLocale` in class `OptionalInstallations`
    Returns:
      the locale of messages shown to the user.

  - ### getAuthorities

    public Set<String> getAuthorities()
    Returns the name of the authority who provides data under non-Apache terms of use. If this `ResourcesDownloader` cannot ask user's agreement because there is no `Console` attached to the current Java virtual machine or the console is not a terminal, then this method returns an empty set.
    Overrides:
      `getAuthorities` in class `OptionalInstallations`
    Returns:
      `"EPSG"` or an empty set in this class cannot ask user's agreement.

  - ### askUserAgreement

    protected boolean askUserAgreement(String authority, String license)
    Asks to the user if (s)he agree to download and install the resource for the given authority. This method may be invoked twice for the same `authority` argument: first with a null `license` argument for asking if the user agrees to download the data, then with a non-null `license` argument for asking if the user agrees with the license terms.
    Specified by:
      `askUserAgreement` in class `OptionalInstallations`
    Parameters:
      `authority` - "EPSG".
      `license` - the license, or `null` for asking if the user wants to download the data.
    Returns:
      whether user accepted.