Package org.apache.sis.setup
Enum About
- All Implemented Interfaces:
Serializable
,Comparable<About>
,java.lang.constant.Constable
Provides information about the Apache SIS running environment.
This class collects information from various places like
Version.SIS
,
System.getProperties()
, Locale.getDefault()
or TimeZone.getDefault()
.
This class does not collect every possible information. Instead, it tries to focus on the most
important information for SIS, as determined by experience in troubleshooting.
Some of those information are:
- Version numbers (SIS, Java, Operation system).
- Default locale, timezone and character encoding.
- Current directory, user home and Java home.
- Libraries on the classpath and extension directories.
- Since:
- 0.3
- Version:
- 0.8
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Filters the JAR files in an extension directory.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInformation about the libraries.Information about default locale, timezone and character encoding.Information about logging.Information about user home directory, java installation directory or other kind of data.Information about available plugins.Information about software version numbers. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final short
The resource key for this section in theVocabulary
resources bundle. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
About
(short resourceKey) Creates a new section to be formatted using the given resource. -
Method Summary
Modifier and TypeMethodDescriptionprivate static Map<File,
CharSequence> Returns a map of all JAR files or class directories found in the given paths, associated to a description obtained from theirMETA-INF/MANIFEST.MF
.private static boolean
Implementation ofclasspath(String, boolean)
to be invoked recursively.private static CharSequence
concatenate
(CharSequence main, CharSequence complement, boolean parenthesis) Concatenates the given strings in the format "main (complement)".private static TreeTable.Node
concatenateSingletons
(TreeTable.Node node, boolean skip) For every branch containing only one child and no value, merges in-place that branch and the node together.static TreeTable
Returns all known information about the current Apache SIS running environment.static TreeTable
configuration
(Set<About> sections, Locale locale, TimeZone timezone) Returns a subset of the information about the current Apache SIS running environment.private static StringBuffer
format
(Format df, int offset, StringBuffer buffer) Formats the given value preceded by a plus or minus sign.private static String
Returns the ISO language or country code for the given locale.private static void
If a file path in the given node or any children follow the Maven pattern, remove the artifact name and version numbers redundancies in order to make the name more compact.private static CharSequence
parenthesis
(String text) Returns the given text between parenthesis.private static File
relativize
(File root, File file) Returns the given file relative to the given root, ornull
if the root is not a parent of that file.static About
Returns the enum constant of this type with the specified name.static About[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
VERSIONS
Information about software version numbers. This section includes:- Apache SIS version
- Java runtime version and vendor
- Operation system name and version
- EPSG geodetic dataset in use
-
LOCALIZATION
Information about default locale, timezone and character encoding. This section includes:- Default locale, completed by ISO 3-letter codes
- Default timezone, completed by timezone offset
- Current date and time in the default timezone
- Default character encoding
-
PLUGINS
Information about available plugins. This section includes:- List of data store implementations
- Since:
- 0.8
-
LOGGING
Information about logging. -
PATHS
Information about user home directory, java installation directory or other kind of data. This section includes:- User directory
- Default directory
- SIS data directory
- Temporary directory
- Java home directory
-
LIBRARIES
Information about the libraries. This section includes:- JAR files in the extension directories
- JAR files and directories in the application classpath
-
-
Field Details
-
resourceKey
private final short resourceKeyThe resource key for this section in theVocabulary
resources bundle.
-
-
Constructor Details
-
About
private About(short resourceKey) Creates a new section to be formatted using the given resource.
-
-
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
-
configuration
Returns all known information about the current Apache SIS running environment. The information are formatted using the system default locale and timezone.This convenience method is equivalent to the following code:
- Returns:
- configuration information, as a tree for grouping some configuration by sections.
-
configuration
Returns a subset of the information about the current Apache SIS running environment.- Parameters:
sections
- the section for which information are desired.locale
- the locale to use for formatting the texts in the tree, ornull
for the default.timezone
- the timezone to use for formatting the dates, ornull
for the default.- Returns:
- configuration information, as a tree for grouping some configuration by sections.
-
classpath
Returns a map of all JAR files or class directories found in the given paths, associated to a description obtained from theirMETA-INF/MANIFEST.MF
.- Parameters:
paths
- the paths using theFile.pathSeparatorChar
separator.asDirectories
-true
if the paths are directories, orfalse
for JAR files.- Returns:
- the paths, or
null
if none.
-
classpath
private static boolean classpath(String paths, File directory, boolean asDirectories, Map<File, CharSequence> files) Implementation ofclasspath(String, boolean)
to be invoked recursively. Thepaths
argument may contains many path separated by one of the following separators:- If
directory
is null, thenpaths
is assumed to be a system property value using theFile.pathSeparatorChar
. - If
directory
is non-null, thenpaths
is assumed to be aMANIFEST.MF
attribute using space as the path separator.
- Parameters:
paths
- the paths using the separator described above.directory
- the directory ofMANIFEST.MF
classpath, ornull
.asDirectories
-true
if the paths are directories, orfalse
for JAR files.files
- where to add the paths.- Returns:
true
if the given map has been changed as a result of this method call.
- If
-
omitMavenRedundancy
If a file path in the given node or any children follow the Maven pattern, remove the artifact name and version numbers redundancies in order to make the name more compact. For example, this method replaces"org/opengis/geoapi/3.0.0/geoapi-3.0.0.jar"
by"org/opengis/(…)/geoapi-3.0.0.jar"
. -
concatenateSingletons
For every branch containing only one child and no value, merges in-place that branch and the node together. This method is used for simplifying depth trees into something less verbose. However for any column other thanNAME
, this method preserves the values of the child node but lost all value of the parent node. For this reason, we perform the merge only if the parent has no value.See the "Reduce the depth of a tree" example in
TreeTables
for more information. In particular, note that this implementation assumes that children collections areList
(this is guaranteed forDefaultTreeTable.Node
implementations).- Parameters:
node
- the root of the node to simplify.skip
-true
for disabling concatenation of root node.- Returns:
- the root of the simplified tree. May be the given
node
or a child.
-
concatenate
private static CharSequence concatenate(CharSequence main, CharSequence complement, boolean parenthesis) Concatenates the given strings in the format "main (complement)". Any of the given strings can be null.- Parameters:
main
- the main string to show first, ornull
.complement
- the string to show after the main one, ornull
.parenthesis
-true
for writing the complement between parenthesis, ornull
.- Returns:
- the concatenated string, or
null
if all components are null.
-
parenthesis
Returns the given text between parenthesis. -
getCode
Returns the ISO language or country code for the given locale. Whether we use 2-letters or 3-letters code shall be consistent withValueConverter
. -
format
Formats the given value preceded by a plus or minus sign. This method is used for formatting timezone offset.- Parameters:
df
- theDateFormat
to use for formatting the offset.offset
- the offset to format, as a positive or negative value.buffer
- the buffer where to format the offset.- Returns:
- the given buffer, returned for convenience.
-
relativize
Returns the given file relative to the given root, ornull
if the root is not a parent of that file.- Parameters:
root
- the root directory (typically Java home or user home directory).file
- the file to make relative to the root.- Returns:
- the file relative to the given root, or
null
if none.
-