public class ResourcesDownloader extends InstallationResources
"EPSG"
for the EPSG geodetic dataset.Defined in the sis-console
module
Constructor and Description |
---|
ResourcesDownloader()
Creates a new installation scripts provider.
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
getAuthorities()
Returns the name of the authority who provides data under non-Apache terms of use.
|
String |
getLicense(String authority,
Locale locale,
String mimeType)
Returns the terms of use of the dataset provided by the given authority, or
null if none. |
Object |
getResource(String authority,
int index)
Returns an installation resource for the given authority.
|
String[] |
getResourceNames(String authority)
Returns the names of installation scripts provided by the given authority.
|
BufferedReader |
openScript(String authority,
int resource)
Returns a reader for the installation script at the given index.
|
public ResourcesDownloader()
public Set<String> getAuthorities()
ResourcesDownloader
can not ask user's agreement because there is
no Console
attached to the current Java virtual machine, then this method
returns an empty set.getAuthorities
in class InstallationResources
"EPSG"
or an empty set.public String getLicense(String authority, Locale locale, String mimeType) throws IOException
null
if none.
The terms of use can be returned in either plain text or HTML.getLicense
in class InstallationResources
authority
- one of the values returned by getAuthorities()
.mimeType
- either "text/plain"
or "text/html"
.locale
- the preferred locale for the terms of use.null
if none.IllegalArgumentException
- if the given authority
argument is not one of the expected values.IOException
- if an error occurred while reading the license file.public String[] getResourceNames(String authority) throws IOException
EPSGFactory.install(Connection)
for listing the SQL scripts to execute during EPSG dataset installation.
If that question has not already been asked, this method asks to the user if (s)he accepts
EPSG terms of use. If (s)he refuses, an AccessDeniedException
will be thrown.
getResourceNames
in class InstallationResources
authority
- one of the values returned by getAuthorities()
.IllegalArgumentException
- if the given authority
argument is not one of the expected values.IOException
- if an error occurred while fetching the script names.public Object getResource(String authority, int index) throws IOException
AccessDeniedException
will be thrown.getResource
in class InstallationResources
authority
- one of the values returned by getAuthorities()
.index
- index of the resource to get, from 0 inclusive to
getResourceNames(authority).length
exclusive.IllegalArgumentException
- if the given authority
argument is not one of the expected values.IndexOutOfBoundsException
- if the given resource
argument is out of bounds.IOException
- if an error occurred while fetching the resource.ClassLoader.getResource(String)
public BufferedReader openScript(String authority, int resource) throws IOException
EPSGFactory.install(Connection)
for getting the SQL scripts to execute during EPSG dataset installation.
If that question has not already been asked, this method asks to the user if (s)he accepts
EPSG terms of use. If (s)he refuses, an AccessDeniedException
will be thrown.
openScript
in class InstallationResources
authority
- one of the values returned by getAuthorities()
.resource
- index of the script to open, from 0 inclusive to
getResourceNames(authority).length
exclusive.IllegalArgumentException
- if the given authority
argument is not one of the expected values.IndexOutOfBoundsException
- if the given resource
argument is out of bounds.FileNotFoundException
- if the SQL script of the given name has not been found.IOException
- if an error occurred while creating the reader.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.