public class Configuration extends Object
config/worldwind.xml
and
registers all the information there. The information can subsequently be retrieved via the class' various
getValue
methods. Many World Wind start-up objects query this information to determine the classes to
create. For example, the first World Wind object created by an application is typically a WorldWindowGLCanvas
. During construction that class causes World Wind's internal classes to
be constructed, using the names of those classes drawn from the Configuration singleton, this class.
The default World Wind configuration document is config/worldwind.xml
. This can be changed by setting
the Java property gov.nasa.worldwind.config.file
to a different file name or a valid URL prior to
creating any World Wind object or invoking any static methods of World Wind classes, including the Configuration
class. When an application specifies a different configuration location it typically does so in its main method prior
to using World Wind. If a file is specified its location must be on the classpath. (The contents of application and
World Wind jar files are typically on the classpath, in which case the configuration file may be in the jar file.)
Additionally, an application may set another Java property, gov.nasa.worldwind.app.config.document
, to a
file name or URL whose contents contain configuration values to override those of the primary configuration document.
World Wind overrides only those values in this application document, it leaves all others to the value specified in
the primary document. Applications usually specify an override document in order to specify the initial layers in the
model.
See config/worldwind.xml
for documentation on setting configuration values.
Configuration values can also be set programatically via setValue(String, Object)
, but they are
not retroactive so affect only Configuration queries made subsequent to setting the value.
Note: Prior to September of 2009, configuration properties were read from the file
config/worldwind.properties
. An alternate file could be specified via the
gov.nasa.worldwind.config.file
Java property. These mechanisms remain available but are deprecated.
World Wind no longer contains a worldwind.properties
file. If worldwind.properties
or its
replacement as specified through the Java property exists at run-time and can be found via the classpath,
configuration values specified by that mechanism are given precedence over values specified by the new mechanism.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_LOGGER_NAME |
Modifier and Type | Method and Description |
---|---|
static Boolean |
getBooleanValue(String key)
Return as a Boolean the value associated with a specified key.
|
static Boolean |
getBooleanValue(String key,
Boolean defaultValue)
Return as a Boolean the value associated with a specified key.
|
static String |
getCurrentUserAppDataDirectory()
Returns the path to the current user's application data directory.
|
static String |
getCurrentWorkingDirectory()
Returns the path to the application's current working directory.
|
static Double |
getDoubleValue(String key)
Return as an Double the value associated with a specified key.
|
static Double |
getDoubleValue(String key,
Double defaultValue)
Return as an Double the value associated with a specified key.
|
static Element |
getElement(String xpathExpression)
Returns a specified element of an XML configuration document.
|
static Integer |
getIntegerValue(String key)
Return as an Integer the value associated with a specified key.
|
static Integer |
getIntegerValue(String key,
Integer defaultValue)
Return as an Integer the value associated with a specified key.
|
static float |
getJavaVersion()
Returns the version of the Java virtual machine.
|
static Long |
getLongValue(String key)
Return as an Long the value associated with a specified key.
|
static Long |
getLongValue(String key,
Long defaultValue)
Return as an Long the value associated with a specified key.
|
static GLProfile |
getMaxCompatibleGLProfile()
Returns the highest OpenGL profile available on the current graphics device that is compatible with World Wind.
|
static GLCapabilities |
getRequiredGLCapabilities()
Returns a
GLCapabilities identifying graphics features required by World Wind. |
static String |
getStringValue(String key)
Return as a string the value associated with a specified key.
|
static String |
getStringValue(String key,
String defaultValue)
Return as a string the value associated with a specified key.
|
static String |
getSystemTempDirectory()
Returns the path to the operating system's temp directory.
|
static String |
getUserHomeDirectory()
Returns the path to the application user's home directory.
|
static boolean |
hasKey(String key)
Determines whether a key exists in the configuration.
|
static void |
insertConfigurationDocument(String fileName) |
static boolean |
isLinuxOS()
Determines whether the operating system is Linux operating system.
|
static boolean |
isMacOS()
Determines whether the operating system is a Mac operating system.
|
static boolean |
isSolarisOS()
Determines whether the operating system is Solaris operating system.
|
static boolean |
isUnixOS()
Determines whether the operating system is Unix operating system.
|
static boolean |
isWindows7OS()
Determines whether the operating system is Windows 7 operating system.
|
static boolean |
isWindowsOS()
Determines whether the operating system is Windows operating system.
|
static boolean |
isWindowsVistaOS()
Determines whether the operating system is Windows Vista operating system.
|
static boolean |
isWindowsXPOS()
Determines whether the operating system is Windows XP operating system.
|
static void |
removeKey(String key)
Removes a key and its value from the configuration if the configuration contains the key.
|
static void |
setValue(String key,
Object value)
Adds a key and value to the configuration, or changes the value associated with the key if the key is already in
the configuration.
|
public static final String DEFAULT_LOGGER_NAME
public static Boolean getBooleanValue(String key)
key
- the key for the desired value.public static Boolean getBooleanValue(String key, Boolean defaultValue)
key
- the key for the desired value.defaultValue
- the value to return if the key does not exist.public static String getCurrentUserAppDataDirectory()
Operating System | Path |
---|---|
Mac OS X | ~/Library/Application Support |
Windows | ~\\Application Data |
Linux, Unix, Solaris | ~/ |
public static String getCurrentWorkingDirectory()
public static Double getDoubleValue(String key)
key
- the key for the desired value.public static Double getDoubleValue(String key, Double defaultValue)
key
- the key for the desired value.defaultValue
- the value to return if the key does not exist.public static Element getElement(String xpathExpression)
xpathExpression
- an XPath expression identifying the element of interest.NullPointerException
- if the XPath expression is null.public static Integer getIntegerValue(String key)
key
- the key for the desired value.public static Integer getIntegerValue(String key, Integer defaultValue)
key
- the key for the desired value.defaultValue
- the value to return if the key does not exist.public static float getJavaVersion()
public static Long getLongValue(String key)
key
- the key for the desired value.public static Long getLongValue(String key, Long defaultValue)
key
- the key for the desired value.defaultValue
- the value to return if the key does not exist.public static GLProfile getMaxCompatibleGLProfile()
public static GLCapabilities getRequiredGLCapabilities()
GLCapabilities
identifying graphics features required by World Wind. The
capabilities instance returned requests the maximum OpenGL profile supporting GL fixed function operations, a
frame buffer with 8 bits each of red, green, blue and alpha, a 24-bit depth buffer, double buffering, and if the
Java property "gov.nasa.worldwind.stereo.mode" is set to "device", device supported stereo.public static String getStringValue(String key)
key
- the key for the desired value.public static String getStringValue(String key, String defaultValue)
key
- the key for the desired value.defaultValue
- the value to return if the key does not exist.public static String getSystemTempDirectory()
public static String getUserHomeDirectory()
public static boolean hasKey(String key)
key
- the key of interest.public static void insertConfigurationDocument(String fileName)
public static boolean isLinuxOS()
public static boolean isMacOS()
public static boolean isSolarisOS()
public static boolean isUnixOS()
public static boolean isWindows7OS()
public static boolean isWindowsOS()
public static boolean isWindowsVistaOS()
public static boolean isWindowsXPOS()
public static void removeKey(String key)
key
- the key of interest.