Package org.apache.sis.internal.system
Enum DataDirectory
- All Implemented Interfaces:
Serializable
,Comparable<DataDirectory>
,java.lang.constant.Constable
Sub-directories of
SIS_DATA
where SIS looks for EPSG database, datum shift grids and other resources.- Since:
- 0.7
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe"Databases"
directory.The"DatumChanges"
directory.The"DomainsOfValidity"
directory.The"Schemas"
directory.The"Tests" directory
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Path
The directory, ornull
if none or not yet determined.static final String
The name of the environment variable.private static short
Key of the last message logged atLevel.WARNING
, ornull
if none.private static Path
The root directory fetched from theSIS_DATA
environment variable when first needed, ornull
if none or not yet determined. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the sub-directory identified by this enum, ornull
if the parent$SIS_DATA
directory was not specified.static String
getenv()
Returns the value of "SIS_DATA" environment variable, ornull
if none.static Path
Returns the root directory fetched from theSIS_DATA
environment variable.static boolean
Returnstrue
if the "SIS_DATA" environment variable is undefined.private static void
Logs a message to the"org.apache.sis.system"
logger.static void
quiet()
Prevents the log message aboutSIS_DATA
environment variable not set.If the given path is relative, returns the path as a child of the directory represented by this enum.static DataDirectory
Returns the enum constant of this type with the specified name.static DataDirectory[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.private static void
Logs a message to the"org.apache.sis.system"
logger only if different than the last warning.
-
Enum Constant Details
-
DATABASES
The"Databases"
directory. This directory is used for storing EPSG database and other metadata. -
DATUM_CHANGES
The"DatumChanges"
directory. This directory is used for storing datum shift grids. -
DOMAINS_OF_VALIDITY
The"DomainsOfValidity"
directory. This directory is used for storing shapefiles for the CRS domains of validity. -
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
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
-
ENV
The name of the environment variable.- See Also:
-
lastWarning
private static short lastWarningKey of the last message logged atLevel.WARNING
, ornull
if none.- See Also:
-
rootDirectory
The root directory fetched from theSIS_DATA
environment variable when first needed, ornull
if none or not yet determined.- See Also:
-
directory
The directory, ornull
if none or not yet determined.- See Also:
-
-
Constructor Details
-
DataDirectory
private DataDirectory()
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
quiet
public static void quiet()Prevents the log message aboutSIS_DATA
environment variable not set. This is used for the "About" command line action only. -
warning
Logs a message to the"org.apache.sis.system"
logger only if different than the last warning. -
log
Logs a message to the"org.apache.sis.system"
logger. -
getenv
Returns the value of "SIS_DATA" environment variable, ornull
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, usegetRootDirectory()
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()Returnstrue
if the "SIS_DATA" environment variable is undefined. In case of doubt, this method returnsfalse
. This method is used for avoiding or at least delaying the log messages emitted bygetRootDirectory()
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
Returns the root directory fetched from theSIS_DATA
environment variable. If the environment variable is not set or the directory does not exist, then this method returnsnull
.- Returns:
- the root SIS data directory, or
null
if none.
-
getDirectory
Returns the sub-directory identified by this enum, ornull
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
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 theSIS_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, ornull
.- Returns:
- the path to use, or
null
if the given path was null.
-