Class InstallationScriptProvider.Default

Enclosing class:
InstallationScriptProvider

static final class InstallationScriptProvider.Default extends 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
  • Field Details

    • directory

      private Path directory
      The directory containing the scripts, or null if it does not exist.
    • FIRST_FILE

      private static final int FIRST_FILE
      Index of the first real file in the array given to the constructor. We set the value to 1 for skipping the PREPARE 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

      public Set<String> getAuthorities()
      Returns "EPSG" if the scripts exist in the ExternalSources subdirectory, or "unavailable" otherwise.
      Overrides:
      getAuthorities in class InstallationScriptProvider
      Returns:
      "EPSG" if the SQL scripts for installing the EPSG dataset are available, or "unavailable" otherwise.
    • getLicense

      public String getLicense(String authority, Locale locale, String mimeType)
      Returns null since the user is presumed to have downloaded the files himself.
      Specified by:
      getLicense in class InstallationResources
      Parameters:
      authority - one of the values returned by InstallationResources.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

      protected InputStream openStream(String name) throws IOException
      Opens the input stream for the SQL script of the given name.
      Specified by:
      openStream in class InstallationScriptProvider
      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.