public class Environments
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Environments.ContextContainer
Simple container that stores and returns a context-local instance of the global work area.
|
private static class |
Environments.WorkArea
Stores global data relating to the state of the current context.
|
Modifier and Type | Field and Description |
---|---|
private static Environments.ContextContainer |
work
Stores context-local state variables.
|
Constructor and Description |
---|
Environments() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getEnvironmentName()
Get the current environment's name.
|
static java.lang.String |
getEnvironmentType()
Get the current environment's type.
|
static java.lang.String |
getKeyValue(java.lang.String section,
java.lang.String key)
Getting the key value from the current environment.
|
static boolean |
isCustomEnvironment()
Check if a custom environment is in use.
|
static boolean |
load(java.lang.String env,
java.lang.String directory,
boolean flagNew,
java.lang.String baseKey)
Creates application defaults implementing Progress LOAD statement.
|
static void |
setKeyValue(java.lang.String section,
java.lang.String key,
java.lang.String value)
Adds, modifies and deletes keys in current environment.
|
static java.lang.String |
unload(java.lang.String env)
Unloads specifies environment from the current one.
|
static java.lang.String |
use(java.lang.String env)
Specifies environment defaults to use in subsequent windows.
|
private static Environments.ContextContainer work
public static boolean load(java.lang.String env, java.lang.String directory, boolean flagNew, java.lang.String baseKey)
env
- The environment to create or load. Can be the registry key, initialization file.directory
- The directory path for existing initialization file or place to create
initialization file.flagNew
- If true
- the new file or registry key will be created overwriting the
possibly existed one.baseKey
- When the parameter is specified the serching is performed under the particular key
value. It is possible to specify "INI" as parameter. In this case search or creation
will be done inside initialization file specified in env parameter.true
if loaded false otherwisepublic static java.lang.String use(java.lang.String env)
env
- The environment to load. If the parameter is empty string ("") the default
environment becomes the current one.null
if the
environment can't be found.public static boolean isCustomEnvironment()
public static java.lang.String getEnvironmentName()
public static java.lang.String getEnvironmentType()
public static void setKeyValue(java.lang.String section, java.lang.String key, java.lang.String value)
section
- The name of the section containing the key to modify.key
- The name of the key key to modify or default key if not specified.value
- The new value of the key under modification.public static java.lang.String getKeyValue(java.lang.String section, java.lang.String key)
section
- The name of the section containing the key to get.key
- The name of the key key to get or default key if not specified.public static java.lang.String unload(java.lang.String env)
env
- The environment to unload. Can be the registry or initialization file.
The environment to unload should be previously loaded by load() method.null
if the
environment can't be found.