public class EnvironmentDaemon extends java.lang.Object implements EnvironmentAccessor
Modifier and Type | Field and Description |
---|---|
private EnvironmentReader |
currentEnv
The currently loaded environment to use instead of default.
|
private EnvironmentReader |
defaultEnv
The default environment to use when load() and use() was not specified.
|
private java.util.Map<java.lang.String,EnvironmentReader> |
envMap
Map to store environments for possible reuse.
|
private boolean |
isGui
Client type
|
private boolean |
isReadOnly
INI files read only property
|
private static java.lang.Object |
modToken
Token used to authenticate with the dispatcher when registering APIs.
|
Constructor and Description |
---|
EnvironmentDaemon(Session session,
boolean single,
boolean isWin)
Create an instance and export its API to the network.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getBooleanKeyValue(java.lang.String section,
java.lang.String key,
java.lang.Boolean defValue)
Getting the boolean key value from the current environment.
|
java.lang.String |
getEnvironmentName()
Get the current environment's name.
|
java.lang.String |
getEnvironmentType()
Get the current environment's type.
|
java.lang.String |
getKeyValue(java.lang.String section,
java.lang.String key)
Getting the key value from the current environment.
|
private boolean |
getReadOnly()
Get environments read only flag.
|
boolean |
isCustomEnvironment()
Check if a custom environment is in use.
|
boolean |
load(java.lang.String env,
java.lang.String directory,
boolean flagNew,
java.lang.String baseKey)
Creates application defaults implementing Progress LOAD statement.
|
void |
setDefaultEnvironment(java.lang.String iniFile)
Sets the default environment to a stanza ini file, overwriting any default registry for
WIN32.
|
void |
setKeyValue(java.lang.String section,
java.lang.String key,
java.lang.String value)
Adds, modifies and deletes keys in current environment.
|
void |
unload(java.lang.String env)
Unloads specifies environment from the current one.
|
void |
use(java.lang.String env)
Specifies environment defaults to use in subsequent windows.
|
private static java.lang.Object modToken
private EnvironmentReader defaultEnv
private EnvironmentReader currentEnv
private java.util.Map<java.lang.String,EnvironmentReader> envMap
private boolean isGui
private boolean isReadOnly
public EnvironmentDaemon(Session session, boolean single, boolean isWin)
session
- The server session to get the properties.single
- true
to startup within the server process which must bypass the
shared infrastructure initialization. Use false
for the normal
client JVM startup.isWin
- true
if this is an WIN32 environment backed up by a default.public boolean load(java.lang.String env, java.lang.String directory, boolean flagNew, java.lang.String baseKey)
load
in interface EnvironmentAccessor
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 searching 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 void use(java.lang.String env)
use
in interface EnvironmentAccessor
env
- The environment to load. If the parameter is empty string ("") the default
environment becomes the current one.public boolean isCustomEnvironment()
isCustomEnvironment
in interface EnvironmentAccessor
public java.lang.String getEnvironmentName()
getEnvironmentName
in interface EnvironmentAccessor
public java.lang.String getEnvironmentType()
getEnvironmentType
in interface EnvironmentAccessor
public void setKeyValue(java.lang.String section, java.lang.String key, java.lang.String value)
setKeyValue
in interface EnvironmentAccessor
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 java.lang.String getKeyValue(java.lang.String section, java.lang.String key)
getKeyValue
in interface EnvironmentAccessor
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 java.lang.Boolean getBooleanKeyValue(java.lang.String section, java.lang.String key, java.lang.Boolean defValue)
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.defValue
- The default value, to be returned when the value does not exist
in the environment.defValue
if the value
does not exist in the environment.public void unload(java.lang.String env)
unload
in interface EnvironmentAccessor
env
- The environment to unload. Can be the registry or initialization file. The
environment to unload should be previously loaded by load() method.public void setDefaultEnvironment(java.lang.String iniFile)
iniFile
- The name of the ini file backing the stanzas.private boolean getReadOnly()
true
the
environments INI files are loaded as resources from remote server jar files otherwise
will follow default behavior and INI files are loaded from client file system.