version 1.33, 2006/08/08 17:47:10
|
version 1.34, 2006/11/14 18:34:49
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Nag Boranna (nagaraja_boranna@hp.com) |
|
// |
|
// Modified By: Sushma Fernandes, Hewlett-Packard Company |
|
// (sushma_fernandes@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3612 |
|
// Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3610 |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// |
|
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
This class reads configuration properties from the config file, maps the | This class reads configuration properties from the config file, maps the |
properties to owners, and implements access methods. | properties to owners, and implements access methods. |
*/ | */ |
|
|
class PEGASUS_CONFIG_LINKAGE ConfigManager | class PEGASUS_CONFIG_LINKAGE ConfigManager |
{ | { |
|
|
private: | private: |
| |
/** | /** |
|
|
*/ | */ |
static ConfigManager* _instance; | static ConfigManager* _instance; |
| |
|
|
/** Constructor. */ | /** Constructor. */ |
ConfigManager(); | ConfigManager(); |
| |
|
|
/** | /** |
Initialize config property with the value specified as a | Initialize config property with the value specified as a |
command line option. | command line option. |
|
|
load config properties from the file | load config properties from the file |
| |
@exception CannotRenameFile if failed to rename the config file. | @exception CannotRenameFile if failed to rename the config file. |
@exception CannotOpenFile if failed to set permissions on the config file. |
@exception CannotOpenFile if failed to set permissions on the config |
|
file. |
@exception ConfigFileSyntaxError if there are synatx error | @exception ConfigFileSyntaxError if there are synatx error |
while parsing the config files. | while parsing the config files. |
*/ | */ |
|
|
| |
| |
/** | /** |
Initialize config property owners and add them to the property owner table |
Initialize config property owners and add them to the property owner |
|
table |
*/ | */ |
void _initPropertyTable(); | void _initPropertyTable(); |
| |
|
|
/** | /** |
HashTable used to identify fixed values. | HashTable used to identify fixed values. |
*/ | */ |
typedef HashTable<String, |
typedef HashTable<String, const char*, EqualFunc<String>, HashFunc<String> > |
const char*,EqualFunc<String>,HashFunc<String> > FixedValueTable; |
FixedValueTable; |
| |
/* | /* |
friend declaration needed by some compilers to allow OwnerTable and | friend declaration needed by some compilers to allow OwnerTable and |
|
|
}; | }; |
| |
/** | /** |
HashTable to store the config property names and |
HashTable to store the config property names and property owners |
property owners |
|
*/ | */ |
AutoPtr<PropertyTable> _propertyTable; //PEP101 |
AutoPtr<PropertyTable> _propertyTable; |
| |
/** | /** |
Handler to access the config files. | Handler to access the config files. |
*/ | */ |
AutoPtr<ConfigFileHandler> _configFileHandler; //PEP101 |
AutoPtr<ConfigFileHandler> _configFileHandler; |
| |
/** | /** |
Pegasus home variable | Pegasus home variable |
|
|
*/ | */ |
static const String PEGASUS_HOME_DEFAULT; | static const String PEGASUS_HOME_DEFAULT; |
| |
|
|
/** | /** |
Property Owners | Property Owners |
| |
|
|
*/ | */ |
static ConfigManager* getInstance(); | static ConfigManager* getInstance(); |
| |
|
|
/** | /** |
Terminate the ConfigManager. | Terminate the ConfigManager. |
*/ | */ |
static void destroy( void ); |
static void destroy(); |
|
|
/** | /** |
Initialize the current value of a config property. | Initialize the current value of a config property. |
| |
|
|
/** | /** |
Update current value of a property. | Update current value of a property. |
| |
@param propertyName The name of the property to update (eg. "httpPort"). |
@param propertyName The name of the property to update |
|
(e.g., "httpPort"). |
@param propertyValue The new value of the property. If the value is | @param propertyValue The new value of the property. If the value is |
null, the property should be reset to its default |
null, the property should be reset to its default value. |
value. |
@param unset Specifies whether the property should be updated or unset. |
@param unset Specifies whether the property should be updated |
|
or unset. |
|
@return true if the property found and updated, else false. | @return true if the property found and updated, else false. |
| |
@exception NonDynamicConfigProperty if property is not dynamic. | @exception NonDynamicConfigProperty if property is not dynamic. |
|
|
/** | /** |
Update planned value of a property. | Update planned value of a property. |
| |
@param propertyName The name of the property to update (eg. "httpPort"). |
@param propertyName The name of the property to update |
|
(e.g., "httpPort"). |
@param propertyValue The new value of the property. If the value is | @param propertyValue The new value of the property. If the value is |
null, the property should be reset to its default |
null, the property should be reset to its default value. |
value. |
@param unset Specifies whether the property should be updated or unset. |
@param unset Specifies whether the property should be updated |
|
or unset. |
|
@return Boolean True if the property found and updated. | @return Boolean True if the property found and updated. |
| |
@exception NonDynamicConfigProperty if property is not dynamic. | @exception NonDynamicConfigProperty if property is not dynamic. |
|
|
const String& value, | const String& value, |
Boolean unset); | Boolean unset); |
| |
|
|
/** | /** |
Validate the value of a property. | Validate the value of a property. |
| |
|
|
*/ | */ |
String getDefaultValue(const String& name) const; | String getDefaultValue(const String& name) const; |
| |
|
|
/** | /** |
Get current value of the specified property. | Get current value of the specified property. |
| |
|
|
*/ | */ |
String getCurrentValue(const String& name) const; | String getCurrentValue(const String& name) const; |
| |
|
|
/** | /** |
Get planned value of the specified property. | Get planned value of the specified property. |
| |
|
|
*/ | */ |
String getPlannedValue(const String& name) const; | String getPlannedValue(const String& name) const; |
| |
|
|
/** | /** |
Get all the attributes of the specified property. | Get all the attributes of the specified property. |
| |
|
|
*/ | */ |
void getPropertyInfo(const String& name, Array<String>& propertyInfo) const; | void getPropertyInfo(const String& name, Array<String>& propertyInfo) const; |
| |
|
|
/** | /** |
Get a list of all the property names. | Get a list of all the property names. |
| |
@param propertyNames List containing all the property names. | @param propertyNames List containing all the property names. |
@param includeHiddenProperties Boolean indicating whether hidden | @param includeHiddenProperties Boolean indicating whether hidden |
properties should be included in the |
properties should be included in the returned list. |
returned list. |
|
*/ | */ |
void getAllPropertyNames( | void getAllPropertyNames( |
Array<String>& propertyNames, | Array<String>& propertyNames, |
|
|
@exception NoSuchFile if the specified config file does not exist. | @exception NoSuchFile if the specified config file does not exist. |
@exception FileNotReadable if the specified config file is not readable. | @exception FileNotReadable if the specified config file is not readable. |
@exception CannotRenameFile if failed to rename the config file. | @exception CannotRenameFile if failed to rename the config file. |
@exception CannotOpenFile if failed to set permissions on the config file. |
@exception CannotOpenFile if failed to set permissions on the config |
@exception ConfigFileSyntaxError if there is synatx error |
file. |
|
@exception ConfigFileSyntaxError if there is syntax error |
while parsing the config files. | while parsing the config files. |
@exception InvalidPropertyValue if validation fails for a config property |
@exception InvalidPropertyValue if validation fails for a config |
in either file. |
property in either file. |
@exception UnrecognizedConfigProperty if a config property specified in | @exception UnrecognizedConfigProperty if a config property specified in |
either file is not defined. | either file is not defined. |
*/ | */ |
void mergeConfigFiles(const String& currentFile, const String& plannedFile); |
void mergeConfigFiles( |
|
const String& currentFile, |
|
const String& plannedFile); |
| |
/** | /** |
Merge the config properties from the default planned config file | Merge the config properties from the default planned config file |
|
|
@exception NoSuchFile if the default config file does not exist. | @exception NoSuchFile if the default config file does not exist. |
@exception FileNotReadable if the default config file is not readable. | @exception FileNotReadable if the default config file is not readable. |
@exception CannotRenameFile if failed to rename the config file. | @exception CannotRenameFile if failed to rename the config file. |
@exception CannotOpenFile if failed to set permissions on the config file. |
@exception CannotOpenFile if failed to set permissions on the config |
|
file. |
@exception ConfigFileSyntaxError if there are synatx error | @exception ConfigFileSyntaxError if there are synatx error |
while parsing the config files. | while parsing the config files. |
@exception InvalidPropertyValue if validation fails for a config property |
@exception InvalidPropertyValue if validation fails for a config |
in either file. |
property in either file. |
@exception UnrecognizedConfigProperty if a config property specified in | @exception UnrecognizedConfigProperty if a config property specified in |
either file is not defined. | either file is not defined. |
*/ | */ |
void mergeConfigFiles(); | void mergeConfigFiles(); |
| |
|
|
/** | /** |
Merge option values from the command line. | Merge option values from the command line. |
| |
|
|
*/ | */ |
void mergeCommandLine(int& argc, char**& argv); | void mergeCommandLine(int& argc, char**& argv); |
| |
|
|
/** | /** |
Get Pegasus Home | Get Pegasus Home |
*/ | */ |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif /* Pegasus_ConfigManager_h */ | #endif /* Pegasus_ConfigManager_h */ |
|
|