|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sap.ip.me.api.conf.Configuration
The configuration class offers some methods to read and write properties and
to save the configuration.
There are three levels of property sets. The set with the highest priority
is the temporary and arguments set. This property set contains all
properties that are passed while Mobile Engine startup or are set
temporaryly. The next level is the custom property set. The default location
of the file that represents this property set is
. All properties that are set by the framework or the applications and that
should resist after Mobile Engine restart have to use this configuration
level. The configuration level with the lowest priority is the default
property set. This property set is delivered with the Mobile Engine
framework and contains all basic configurations of the Mobile Engine.
The configuration is implemented as a singleton. You can get the instance of
the configuration with Configuration.getInstance()
. While
initialization a set of default properties is loaded. After that the
File.separator + "settings" + File.separator + "MobileEngine.config"
file out of the Mobile Engine installation path will be loaded. For a
description of the property keys and their possible values you can see the
documentation of the class PropertyKeys
.
PropertyKeys
Method Summary | |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Returns the boolean value for a given key from the
configuration. |
java.lang.String |
getDecodedProperty(java.lang.String key)
Returns the decoded value for a given key from the configuration. |
static java.lang.String |
getInstallationDirectory()
Get the installation directory of the Mobile Engine. |
static Configuration |
getInstance()
Returns the singleton instance of the configuration class. |
java.lang.Object |
getInstanceForType(java.lang.String key)
Returns the one and only singleton instance of a class by calling getInstace method
that is configured within the Mobile Engine Configuration . |
int |
getInt(java.lang.String key,
int defaultValue)
Returns the int value for a given key from the configuration.
|
static java.lang.String |
getJVMVendorName()
Gets the java VM vendor name. |
java.util.Vector |
getKeysWithPrefix(java.lang.String prefix)
Returns a vector with keys that have the common prefix (given as parameter). |
long |
getLong(java.lang.String key,
long defaultValue)
Returns the long value for a given key from the
configuration. |
static java.lang.String |
getMERuntime()
Gets the Mobile Engine runtime. |
static java.lang.String |
getOperatingSystemName()
Gets the operating system name. |
java.lang.String |
getProperty(java.lang.String key)
Returns the value for a given key from the configuration. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Returns the value for a given key from the configuration. |
static java.lang.String |
getSettingsFolder()
Get the settings folder of the Mobile Engine. |
java.lang.Object |
getSingletonInstanceForType(java.lang.String key)
Returns the one and only one singleton instance of a class based on key which is configured within the Mobile Engine Configuration . |
void |
loadConfiguration(java.lang.String configurationFile)
This method is for framework internal use only. |
void |
setBoolean(java.lang.String key,
boolean value)
Sets the given property (key-value). |
void |
setDefaultProperty(java.lang.String key,
java.lang.String value)
Puts the key-value-pair into the user independent configuration (default level). |
void |
setEncodedProperty(java.lang.String key,
java.lang.String value)
Puts the key-value-pair into the configuration. |
void |
setInt(java.lang.String key,
int value)
Sets the given property (key-value). |
void |
setLong(java.lang.String key,
long value)
Sets the given property (key-value). |
void |
setProperty(java.lang.String key,
java.lang.String value)
Puts the key-value-pair into the configuration (custom configuration level). |
void |
setTemporary(java.lang.String key,
java.lang.String value)
Puts the key-value-pair into the configuration (temporary level). |
void |
setTraceInitialized()
|
void |
switchUserConfiguration(java.lang.String username)
This method is for framework internal use only. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void setTraceInitialized()
public static final java.lang.String getJVMVendorName()
public static final java.lang.String getOperatingSystemName()
public static final java.lang.String getMERuntime()
public static final java.lang.String getSettingsFolder()
null
if
not yet initialized. The String ends with a File.separatorChar
.
null
iff
not yet initialized.public static final java.lang.String getInstallationDirectory()
null
if not yet initialized. This method returns the same as Configuration.getInstance().getProperty(PropertyKeys.INSTALLATION_DIRECTORY)
.
null
iff installation directory not yet initialized.public static Configuration getInstance()
public void loadConfiguration(java.lang.String configurationFile)
\settings\MobileEngine.config
Any exception will be printed to System.err
because logging
is possibly not initialized yet.
configurationFile
- The name of the custom configuration file.public void switchUserConfiguration(java.lang.String username)
username
- Switches to user specific configuration.public void setTemporary(java.lang.String key, java.lang.String value)
key
- The key must not be null
.value
- The value must not be null
.public void setProperty(java.lang.String key, java.lang.String value)
key
- The key must not be null
.value
- The value must not be null
.public void setDefaultProperty(java.lang.String key, java.lang.String value)
key
- The key must not be null
.value
- The value must not be null
.public java.lang.String getProperty(java.lang.String key)
temporary
property set. If the key
was not defined within the temporary properties, the key will be searched
within the custom properties and finally within the default properties. If
the key is not defined in one of these property sets null
will be returned.
key
- The key
null
if property key
was not defined.public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- The keydefaultValue
- The default value. Used if key was not defined.
getProperty(java.lang.String)
public boolean getBoolean(java.lang.String key, boolean defaultValue)
boolean
value for a given key from the
configuration. If the key was not defined within the configuration, the
given default value will be returned. The search order is temporary
properties, custom properties and default properties.
key
- The keydefaultValue
- The default value. Used if key was not defined.
getProperty(java.lang.String)
public void setBoolean(java.lang.String key, boolean value)
key
- The keyvalue
- The boolean
value.setProperty(java.lang.String,
java.lang.String)
public int getInt(java.lang.String key, int defaultValue)
int
value for a given key from the configuration.
If the key was not defined within the configuration, the given default
value will be returned. The search order is temporary properties, custom
properties and default properties.
key
- The keydefaultValue
- The default value. Used if key was not defined.
getProperty(java.lang.String)
public void setInt(java.lang.String key, int value)
key
- The keyvalue
- The int
value.setProperty(java.lang.String,
java.lang.String)
public long getLong(java.lang.String key, long defaultValue)
long
value for a given key from the
configuration. If the key was not defined within the configuration, the
given default value will be returned. The search order is temporary
properties, custom properties and default properties.
key
- The keydefaultValue
- The default value. Used if key was not defined.
getProperty(java.lang.String)
public void setLong(java.lang.String key, long value)
key
- The keyvalue
- The long
value.setProperty(java.lang.String,
java.lang.String)
public void setEncodedProperty(java.lang.String key, java.lang.String value)
key
- The keyvalue
- The value that should be encoded. If value is null
the empty string will be put into the configurationsetProperty(java.lang.String,
java.lang.String)
public java.lang.String getDecodedProperty(java.lang.String key)
key
- The key
getProperty(java.lang.String)
public java.util.Vector getKeysWithPrefix(java.lang.String prefix)
prefix
- The prefix for searched keys
public java.lang.Object getSingletonInstanceForType(java.lang.String key)
Configuration
. The value
for that key has to be a full qualified class name. If there are any
exceptions while creating the instance a FactoryException
(RuntimeException) will be thrown.
key
- The Configuration
key for the class that has to be
instantiated.
Configuration
for the key that was provided by the
import parameter.FactoryException
public java.lang.Object getInstanceForType(java.lang.String key)
getInstace
method
that is configured within the Mobile Engine Configuration
. The value
for that key has to be a full qualified class name. If there are any
exceptions while creating the instance a FactoryException
(RuntimeException) will be thrown.
key
- The Configuration
key for the class that has to be
instantiated.
Configuration
for the key that was provided by the
import parameter.FactoryException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |