Hemi JavaScript Framework
Hemi.util.config
Description
The Configuration class imports and parses XML for providing application level configuration.
Class Index
static Hemi.util.config
version 3.1.0
Static initializer for new Config objects.
Index
Method Index
- public newInstance: Creates and returns a new Config instance.
Methods
newInstance
Creates and returns a new Config instance.
Syntax
c = newInstance(
s, h, a
)
Parameters
- s as variant : XML Document representing config data, or string representing path to XML file.
- h as variant (optional): String representinga function or a function pointer to be invoked when the config data has been loaded, if the loading is asynchronous.
- a as boolean (optional): Bit indicating whether the loading is asynchronous.
Returns
c as Config: Returns a new Wire instance.
Hemi.util.ConfigInstance
version 3.1.0
Service for sending messages, and sending and receiving publication broadcasts.
Index
Object Index
Property Index
- public object_config (internal): Object API structure for storing sub structures: object_config.pointers and object_config.status.
- public object_id (internal): Unique instance identifier.
- public object_type (internal): The type of this object.
- public object_version (internal): Version of the object class.
- public ready_state (internal): Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Method Index
- public clearConfig: Clears internal hashmaps of config data.
- public destroy: Clears internal pointers and data, preparing the object for destruction.
- public getObjectId: Returns the unique id of the object.
- public getObjectType: Returns the type of the object.
- public getObjectVersion: Returns the version of the object.
- public getParam: Returns the value of the specified ConfigObject.
- public getParams: Returns an array of ConfigObjects.
- public getPointers: Returns the object_config.pointers sub structure.
- public getReadyState: Returns the state of the object.
- public getStatus: Returns the object_config.status sub structure.
- public init: Initializes an empty configuration.
- public load: Loads the specified configuration file.
- public parseConfig (internal): Parses the specified XML document for config data.
- public reload: Clears internal hashmaps and reloads config data from original source.
- public serialize: Serializes the current configuration into an XML document.
- public setAttrNameName: Specifies the attribute used to identify the config data name.
- public setAttrValueName: Specifies the attribute used to identify the config data value.
- public setElementName: Specifies the element that holds a single config item.
- public setElementParentName: Specifies the root element that holds the config data.
- public setParam: Sets a parameter value.
- public sigterm: Sends a termination signal to this object, causing it to be destroyed.
- public writeParam: Sets a parameter value.
Objects
ConfigObject
Properties
- name as String: The name of the config key.
- value as String: The value of the config key.
Properties
object_config
Object API structure for storing sub structures: object_config.pointers and object_config.status.
Syntax
object = object.object_config
object_id
Unique instance identifier.
Syntax
String = object.object_id
object_type
The type of this object.
Syntax
String = object.object_type
object_version
Version of the object class.
Syntax
String = object.object_version
ready_state
Object load and execution state. Follows: 0 unitialized, 1 through 3 variant, 4 ready, 5 destroyed.
Syntax
int = object.ready_state
Methods
clearConfig
Clears internal hashmaps of config data.
Syntax
void clearConfig(
)
destroy
Clears internal pointers and data, preparing the object for destruction.
Syntax
void destroy(
)
getObjectId
Returns the unique id of the object.
Syntax
i = getObjectId(
)
Returns
i as String: The unique object instance id.
getObjectType
Returns the type of the object.
Syntax
t = getObjectType(
)
Returns
t as String: The type of the object instance.
getObjectVersion
Returns the version of the object.
Syntax
v = getObjectVersion(
)
Returns
v as String: The version of the object instance.
getParam
Returns the value of the specified ConfigObject.
Syntax
v = getParam(
x
)
Parameters
- x as variant : String or integer representing the index or name of the config value to return.
Returns
v as String: Value of the specified ConfigObject.
getParams
Returns an array of ConfigObjects.
Syntax
a = getParams(
)
Returns
a as array: Array of ConfigObjects
getPointers
Returns the object_config.pointers sub structure.
Syntax
o = getPointers(
)
Returns
o as object: The object_config.pointers substructure.
getReadyState
Returns the state of the object.
Syntax
s = getReadyState(
)
Returns
s as int: The object ready state.
getStatus
Returns the object_config.status sub structure.
Syntax
o = getStatus(
)
Returns
o as object: The object_config.status substructure.
init
Initializes an empty configuration.
Syntax
void init(
)
load
Loads the specified configuration file.
Syntax
void load(
p, h, a
)
Parameters
- p as String : Path to the XML-based configuration.
- h as function (optional): Function pointer to be invoked when the config data has been loaded, if the loading is asynchronous.
- a as boolean (optional): Bit indicating whether the loading is asynchronous.
parseConfig
Parses the specified XML document for config data.
Syntax
void parseConfig(
o
)
Parameters
- o as XMLDocument : XML Document representing the config data.
reload
Clears internal hashmaps and reloads config data from original source.
Syntax
void reload(
)
serialize
Serializes the current configuration into an XML document.
Syntax
xml = serialize(
XMLDocument
)
Parameters
- XMLDocument as XMLDocument (optional): XMLDocument onto which the parameters are serialized.
Returns
xml as XMLDocument: XMLDocument representing the parameters.
setAttrNameName
Specifies the attribute used to identify the config data name.
Syntax
void setAttrNameName(
n
)
Parameters
- n as String : Name of the attribute used to identify a config data item. The default value is
setAttrValueName
Specifies the attribute used to identify the config data value.
Syntax
void setAttrValueName(
n
)
Parameters
- n as String : Name of the attribute used to identify a config data value. The default value is
setElementName
Specifies the element that holds a single config item.
Syntax
void setElementName(
n
)
Parameters
- n as String : Name of the element containing and individual config item. The default value is
setElementParentName
Specifies the root element that holds the config data.
Syntax
void setElementParentName(
n
)
Parameters
- n as String : Name of the root element containing the config data.
setParam
Sets a parameter value.
Syntax
b = setParam(
name, value
)
Parameters
- name as String : String representing the name of the config value.
- value as String : String representing the value.
Returns
b as boolean: Bit indicating whether the operation succeeded
sigterm
Sends a termination signal to this object, causing it to be destroyed.
Syntax
void sigterm(
)
writeParam
Sets a parameter value.
Syntax
b = writeParam(
XMLDocument, name, value
)
Parameters
- XMLDocument as XMLDocument : XMLDocument onto which the parameters are serialized.
- name as String : String representing the name of the config value.
- value as String : String representing the value.
Returns
b as boolean: Bit indicating whether the operation succeeded
[ Hemi JavaScript Framework - Stephen W. Cote, 2002 - 2009. ]