Package org.apache.sis.setup
Enum About
- All Implemented Interfaces:
Serializable,Comparable<About>
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 classFilters the JAR files in an extension directory. -
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 shortThe resource key for this section in theVocabularyresources bundle. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAbout(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 booleanImplementation ofclasspath(String, boolean)to be invoked recursively.private static CharSequenceconcatenate(CharSequence main, CharSequence complement, boolean parenthesis) Concatenates the given strings in the format "main (complement)".private static TreeTable.NodeconcatenateSingletons(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 TreeTableReturns all known information about the current Apache SIS running environment.static TreeTableconfiguration(Set<About> sections, Locale locale, TimeZone timezone) Returns a subset of the information about the current Apache SIS running environment.private static StringBufferformat(Format df, int offset, StringBuffer buffer) Formats the given value preceded by a plus or minus sign.private static StringReturns the ISO language or country code for the given locale.private static voidIf 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 CharSequenceparenthesis(String text) Returns the given text between parenthesis.private static Filerelativize(File root, File file) Returns the given file relative to the given root, ornullif the root is not a parent of that file.static AboutReturns 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 theVocabularyresources 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, ornullfor the default.timezone- the timezone to use for formatting the dates, ornullfor 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.pathSeparatorCharseparator.asDirectories-trueif the paths are directories, orfalsefor JAR files.- Returns:
- the paths, or
nullif none.
-
classpath
private static boolean classpath(String paths, File directory, boolean asDirectories, Map<File, CharSequence> files) Implementation ofclasspath(String, boolean)to be invoked recursively. Thepathsargument may contains many path separated by one of the following separators:- If
directoryis null, thenpathsis assumed to be a system property value using theFile.pathSeparatorChar. - If
directoryis non-null, thenpathsis assumed to be aMANIFEST.MFattribute using space as the path separator.
- Parameters:
paths- the paths using the separator described above.directory- the directory ofMANIFEST.MFclasspath, ornull.asDirectories-trueif the paths are directories, orfalsefor JAR files.files- where to add the paths.- Returns:
trueif 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
TreeTablesfor more information. In particular, note that this implementation assumes that children collections areList(this is guaranteed forDefaultTreeTable.Nodeimplementations).- Parameters:
node- the root of the node to simplify.skip-truefor disabling concatenation of root node.- Returns:
- the root of the simplified tree. May be the given
nodeor 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-truefor writing the complement between parenthesis, ornull.- Returns:
- the concatenated string, or
nullif 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- theDateFormatto 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, ornullif 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
nullif none.
-