Class InstallationScriptProvider.Default
java.lang.Object
org.apache.sis.setup.InstallationResources
org.apache.sis.referencing.factory.sql.InstallationScriptProvider
org.apache.sis.referencing.factory.sql.InstallationScriptProvider.Default
- Enclosing class:
- InstallationScriptProvider
The default implementation which use the scripts in the
$SIS_DATA/Databases/ExternalSources
directory, if present. This class expects the files to have those exact names where *
stands
for any characters provided that there is no ambiguity:
EPSG_*Tables.sql
EPSG_*Data.sql
EPSG_*FKeys.sql
- Since:
- 0.7
- Version:
- 0.7
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.referencing.factory.sql.InstallationScriptProvider
InstallationScriptProvider.Default
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Path
The directory containing the scripts, ornull
if it does not exist.private static final int
Index of the first real file in the array given to the constructor.Fields inherited from class org.apache.sis.referencing.factory.sql.InstallationScriptProvider
FINISH, PREPARE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns"EPSG"
if the scripts exist in theExternalSources
subdirectory, or"unavailable"
otherwise.getLicense
(String authority, Locale locale, String mimeType) Returnsnull
since the user is presumed to have downloaded the files himself.protected InputStream
openStream
(String name) Opens the input stream for the SQL script of the given name.Methods inherited from class org.apache.sis.referencing.factory.sql.InstallationScriptProvider
getResourceNames, log, openScript
Methods inherited from class org.apache.sis.setup.InstallationResources
getInstructionURL, getResource
-
Field Details
-
directory
The directory containing the scripts, ornull
if it does not exist. -
FIRST_FILE
private static final int FIRST_FILEIndex of the first real file in the array given to the constructor. We set the value to 1 for skipping thePREPARE
pseudo-file.- See Also:
-
-
Constructor Details
-
Default
Default(Locale locale) throws IOException Creates a default provider.- Parameters:
locale
- the locale for warning messages, if any.- Throws:
IOException
-
-
Method Details
-
getAuthorities
Returns"EPSG"
if the scripts exist in theExternalSources
subdirectory, or"unavailable"
otherwise.- Overrides:
getAuthorities
in classInstallationScriptProvider
- Returns:
"EPSG"
if the SQL scripts for installing the EPSG dataset are available, or"unavailable"
otherwise.
-
getLicense
Returnsnull
since the user is presumed to have downloaded the files himself.- Specified by:
getLicense
in classInstallationResources
- Parameters:
authority
- one of the values returned byInstallationResources.getAuthorities()
.locale
- the preferred locale for the terms of use.mimeType
- either"text/plain"
or"text/html"
.- Returns:
- the terms of use in plain text or HTML, or
null
if the license is presumed already accepted.
-
openStream
Opens the input stream for the SQL script of the given name.- Specified by:
openStream
in classInstallationScriptProvider
- Parameters:
name
- name of the script file to open.- Returns:
- an input stream opened of the given script file, or
null
if the resource was not found. - Throws:
IOException
- if an error occurred while opening the file.
-