Package org.apache.sis.console
Class ResourcesDownloader
java.lang.Object
org.apache.sis.setup.InstallationResources
org.apache.sis.setup.OptionalInstallations
org.apache.sis.console.ResourcesDownloader
- All Implemented Interfaces:
Localized
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
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe localized answers expected from the users.private final boolean
true
if colors can be applied for ANSI X3.64 compliant terminal.private final Console
The console to use for printing EPSG terms of use and asking for agreement, ornull
if none.private final Locale
The locale to use for text display.Fields inherited from class org.apache.sis.setup.OptionalInstallations
destinationDirectory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
askUserAgreement
(String authority, String license) Asks to the user if (s)he agree to download and install the resource for the given authority.Returns the name of the authority who provides data under non-Apache terms of use.Returns the locale to use for messages shown to the user.Methods inherited from class org.apache.sis.setup.OptionalInstallations
getLicense, getResource, getResourceNames, getSpaceRequirement, openScript
Methods inherited from class org.apache.sis.setup.InstallationResources
getInstructionURL
-
Field Details
-
console
The console to use for printing EPSG terms of use and asking for agreement, ornull
if none. -
locale
The locale to use for text display. -
colors
private final boolean colorstrue
if colors can be applied for ANSI X3.64 compliant terminal. -
answers
The localized answers expected from the users. Keys are words like "Yes" or "No" and boolean values are the meaning of the keys.
-
-
Constructor Details
-
ResourcesDownloader
public ResourcesDownloader()Creates a new installation scripts provider.
-
-
Method Details
-
getLocale
Returns the locale to use for messages shown to the user.- Specified by:
getLocale
in interfaceLocalized
- Overrides:
getLocale
in classOptionalInstallations
- Returns:
- the locale of messages shown to the user.
-
getAuthorities
Returns the name of the authority who provides data under non-Apache terms of use. If thisResourcesDownloader
cannot ask user's agreement because there is noConsole
attached to the current Java virtual machine, then this method returns an empty set.- Overrides:
getAuthorities
in classOptionalInstallations
- Returns:
"EPSG"
or an empty set.
-
askUserAgreement
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 sameauthority
argument: first with a nulllicense
argument for asking if the user agrees to download the data, then with a non-nulllicense
argument for asking if the user agrees with the license terms.- Specified by:
askUserAgreement
in classOptionalInstallations
- Parameters:
authority
- one of the authorities returned byOptionalInstallations.getAuthorities()
.license
- the license, ornull
for asking if the user wants to download the data.- Returns:
- whether user accepted.
-