Enum DataDirectory

java.lang.Object
java.lang.Enum<DataDirectory>
org.apache.sis.internal.system.DataDirectory
All Implemented Interfaces:
Serializable, Comparable<DataDirectory>

public enum DataDirectory extends Enum<DataDirectory>
Sub-directories of SIS_DATA where SIS looks for EPSG database, datum shift grids and other resources.
Since:
0.7
Version:
1.0
Author:
Martin Desruisseaux (Geomatys)
  • Enum Constant Details

    • DATABASES

      public static final DataDirectory DATABASES
      The "Databases" directory. This directory is used for storing EPSG database and other metadata.
    • DATUM_CHANGES

      public static final DataDirectory DATUM_CHANGES
      The "DatumChanges" directory. This directory is used for storing datum shift grids.
    • DOMAINS_OF_VALIDITY

      public static final DataDirectory DOMAINS_OF_VALIDITY
      The "DomainsOfValidity" directory. This directory is used for storing shapefiles for the CRS domains of validity.
    • SCHEMAS

      public static final DataDirectory SCHEMAS
      The "Schemas" directory. This directory contains XML schemas published by ISO. If this directory is present, it should contain a "iso/19115/-3" sub-directory among others.
      See Also:
    • TESTS

      public static final DataDirectory TESTS
      The "Tests" directory. This directory is used for optional test files that are too large for inclusion in source code repository. This is used at build time of Apache SIS project, but not used during normal execution.
  • Field Details

  • Method Details

    • values

      public static DataDirectory[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DataDirectory valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • quiet

      public static void quiet()
      Prevents the log message about SIS_DATA environment variable not set. This is used for the "About" command line action only.
    • getenv

      public static String getenv() throws SecurityException
      Returns the value of "SIS_DATA" environment variable, or null if none. This method does not perform any logging and does not verify if the directory exists. If the intent is to perform I/O operations, use getRootDirectory() instead.
      Returns:
      the "SIS_DATA" environment variable, or null if none.
      Throws:
      SecurityException - if this method is not allowed to query the environment variable.
      Since:
      0.8
      See Also:
    • isUndefined

      public static boolean isUndefined()
      Returns true if the "SIS_DATA" environment variable is undefined. In case of doubt, this method returns false. This method is used for avoiding or at least delaying the log messages emitted by getRootDirectory() when a fallback exists in absence of any user attempt to configure the system.
      Returns:
      true if the "SIS_DATA" environment variable is unset.
      Since:
      0.8
    • getRootDirectory

      public static Path getRootDirectory()
      Returns the root directory fetched from the SIS_DATA environment variable. If the environment variable is not set or the directory does not exist, then this method returns null.
      Returns:
      the root SIS data directory, or null if none.
    • getDirectory

      public Path getDirectory()
      Returns the sub-directory identified by this enum, or null if the parent $SIS_DATA directory was not specified. If the $SIS_DATA directory exists but not the sub-directory, then this method creates the sub-directory.
      Returns:
      the sub-directory, or null if unspecified.
    • resolve

      public Path resolve(Path file)
      If the given path is relative, returns the path as a child of the directory represented by this enum. If no valid directory is configured by the SIS_DATA environment variable, then the relative path is returned as-is.

      This method is invoked for files that may be user-specified, for example datum shift file specified in ParameterValue.

      Parameters:
      file - the path to resolve, or null.
      Returns:
      the path to use, or null if the given path was null.