version 1.11, 2006/01/30 16:17:36
|
version 1.12, 2006/11/14 18:34:50
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Chip Vincent (cvincent@us.ibm.com) |
|
// |
|
// Modified By: Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3614 |
|
// Vijay Eli, IBM, (vijayeli@in.ibm.com) for Bug# 3613 |
|
// Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3613 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "NormalizationPropertyOwner.h" | #include "NormalizationPropertyOwner.h" |
|
|
| |
const Uint32 NUM_PROPERTIES = sizeof(properties) / sizeof(properties[0]); | const Uint32 NUM_PROPERTIES = sizeof(properties) / sizeof(properties[0]); |
| |
NormalizationPropertyOwner::NormalizationPropertyOwner(void) |
NormalizationPropertyOwner::NormalizationPropertyOwner() |
{ | { |
_providerObjectNormalizationEnabled.reset(new ConfigProperty()); | _providerObjectNormalizationEnabled.reset(new ConfigProperty()); |
_providerObjectNormalizationModuleExclusions.reset(new ConfigProperty()); | _providerObjectNormalizationModuleExclusions.reset(new ConfigProperty()); |
} | } |
| |
void NormalizationPropertyOwner::initialize(void) |
void NormalizationPropertyOwner::initialize() |
{ | { |
for(Uint8 i = 0; i < NUM_PROPERTIES; i++) | for(Uint8 i = 0; i < NUM_PROPERTIES; i++) |
{ | { |
if(String::equalNoCase(properties[i].propertyName, "enableNormalization")) |
if (String::equalNoCase( |
{ |
properties[i].propertyName, "enableNormalization")) |
_providerObjectNormalizationEnabled->propertyName = properties[i].propertyName; |
|
_providerObjectNormalizationEnabled->defaultValue = properties[i].defaultValue; |
|
_providerObjectNormalizationEnabled->currentValue = properties[i].defaultValue; |
|
_providerObjectNormalizationEnabled->plannedValue = properties[i].defaultValue; |
|
_providerObjectNormalizationEnabled->dynamic = properties[i].dynamic; |
|
_providerObjectNormalizationEnabled->domain = properties[i].domain; |
|
_providerObjectNormalizationEnabled->domainSize = properties[i].domainSize; |
|
_providerObjectNormalizationEnabled->externallyVisible = properties[i].externallyVisible; |
|
} |
|
else if(String::equalNoCase(properties[i].propertyName, "excludeModulesFromNormalization")) |
|
{ | { |
_providerObjectNormalizationModuleExclusions->propertyName = properties[i].propertyName; |
_providerObjectNormalizationEnabled->propertyName = |
_providerObjectNormalizationModuleExclusions->defaultValue = properties[i].defaultValue; |
properties[i].propertyName; |
_providerObjectNormalizationModuleExclusions->currentValue = properties[i].defaultValue; |
_providerObjectNormalizationEnabled->defaultValue = |
_providerObjectNormalizationModuleExclusions->plannedValue = properties[i].defaultValue; |
properties[i].defaultValue; |
_providerObjectNormalizationModuleExclusions->dynamic = properties[i].dynamic; |
_providerObjectNormalizationEnabled->currentValue = |
_providerObjectNormalizationModuleExclusions->domain = properties[i].domain; |
properties[i].defaultValue; |
_providerObjectNormalizationModuleExclusions->domainSize = properties[i].domainSize; |
_providerObjectNormalizationEnabled->plannedValue = |
_providerObjectNormalizationModuleExclusions->externallyVisible = properties[i].externallyVisible; |
properties[i].defaultValue; |
|
_providerObjectNormalizationEnabled->dynamic = |
|
properties[i].dynamic; |
|
_providerObjectNormalizationEnabled->domain = |
|
properties[i].domain; |
|
_providerObjectNormalizationEnabled->domainSize = |
|
properties[i].domainSize; |
|
_providerObjectNormalizationEnabled->externallyVisible = |
|
properties[i].externallyVisible; |
|
} |
|
else if (String::equalNoCase(properties[i].propertyName, |
|
"excludeModulesFromNormalization")) |
|
{ |
|
_providerObjectNormalizationModuleExclusions->propertyName = |
|
properties[i].propertyName; |
|
_providerObjectNormalizationModuleExclusions->defaultValue = |
|
properties[i].defaultValue; |
|
_providerObjectNormalizationModuleExclusions->currentValue = |
|
properties[i].defaultValue; |
|
_providerObjectNormalizationModuleExclusions->plannedValue = |
|
properties[i].defaultValue; |
|
_providerObjectNormalizationModuleExclusions->dynamic = |
|
properties[i].dynamic; |
|
_providerObjectNormalizationModuleExclusions->domain = |
|
properties[i].domain; |
|
_providerObjectNormalizationModuleExclusions->domainSize = |
|
properties[i].domainSize; |
|
_providerObjectNormalizationModuleExclusions->externallyVisible = |
|
properties[i].externallyVisible; |
} | } |
} | } |
} | } |
| |
void NormalizationPropertyOwner::getPropertyInfo(const String & name, |
void NormalizationPropertyOwner::getPropertyInfo( |
|
const String& name, |
Array<String> & propertyInfo) const | Array<String> & propertyInfo) const |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
|
|
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
return(configProperty->defaultValue); |
return configProperty->defaultValue; |
} | } |
| |
String NormalizationPropertyOwner::getCurrentValue(const String & name)const | String NormalizationPropertyOwner::getCurrentValue(const String & name)const |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
return(configProperty->currentValue); |
return configProperty->currentValue; |
} | } |
| |
String NormalizationPropertyOwner::getPlannedValue(const String & name) const | String NormalizationPropertyOwner::getPlannedValue(const String & name) const |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
return(configProperty->plannedValue); |
return configProperty->plannedValue; |
} | } |
| |
void NormalizationPropertyOwner::initCurrentValue(const String & name, const String & value) |
void NormalizationPropertyOwner::initCurrentValue( |
|
const String& name, |
|
const String& value) |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
configProperty->currentValue = value; | configProperty->currentValue = value; |
} | } |
| |
void NormalizationPropertyOwner::initPlannedValue(const String & name, const String & value) |
void NormalizationPropertyOwner::initPlannedValue( |
|
const String& name, |
|
const String& value) |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
configProperty->plannedValue = value; | configProperty->plannedValue = value; |
} | } |
| |
void NormalizationPropertyOwner::updateCurrentValue(const String & name, const String & value) |
void NormalizationPropertyOwner::updateCurrentValue( |
|
const String& name, |
|
const String& value) |
{ | { |
// make sure the property is dynamic before updating the value. | // make sure the property is dynamic before updating the value. |
if(!isDynamic(name)) | if(!isDynamic(name)) |
|
|
configProperty->currentValue = value; | configProperty->currentValue = value; |
} | } |
| |
void NormalizationPropertyOwner::updatePlannedValue(const String & name, const String & value) |
void NormalizationPropertyOwner::updatePlannedValue( |
|
const String& name, |
|
const String& value) |
{ | { |
struct ConfigProperty * configProperty = _lookupConfigProperty(name); | struct ConfigProperty * configProperty = _lookupConfigProperty(name); |
| |
configProperty->plannedValue = value; | configProperty->plannedValue = value; |
} | } |
| |
Boolean NormalizationPropertyOwner::isValid(const String & name, |
Boolean NormalizationPropertyOwner::isValid( |
|
const String& name, |
const String & value) const | const String & value) const |
{ | { |
if(String::equalNoCase(name, "enableNormalization")) | if(String::equalNoCase(name, "enableNormalization")) |
|
|
// valid values are "true" and "false" | // valid values are "true" and "false" |
if(String::equal(value, "true") || String::equal(value, "false")) | if(String::equal(value, "true") || String::equal(value, "false")) |
{ | { |
return(true); |
return true; |
} | } |
} | } |
else if(String::equalNoCase(name, "excludeModulesFromNormalization")) | else if(String::equalNoCase(name, "excludeModulesFromNormalization")) |
|
|
| |
// TODO: validate value | // TODO: validate value |
| |
return(true); |
return true; |
} | } |
| |
return(false); |
return false; |
} | } |
| |
Boolean NormalizationPropertyOwner::isDynamic(const String & name) const | Boolean NormalizationPropertyOwner::isDynamic(const String & name) const |
|
|
return(configProperty->dynamic == IS_DYNAMIC); | return(configProperty->dynamic == IS_DYNAMIC); |
} | } |
| |
struct ConfigProperty * NormalizationPropertyOwner::_lookupConfigProperty(const String & name) const |
struct ConfigProperty* NormalizationPropertyOwner::_lookupConfigProperty( |
|
const String& name) const |
{ | { |
if(String::equalNoCase(name, _providerObjectNormalizationEnabled->propertyName)) |
if (String::equalNoCase( |
|
name, _providerObjectNormalizationEnabled->propertyName)) |
{ | { |
return(_providerObjectNormalizationEnabled.get()); |
return _providerObjectNormalizationEnabled.get(); |
} | } |
else if(String::equalNoCase(name, _providerObjectNormalizationModuleExclusions->propertyName)) |
else if (String::equalNoCase( |
|
name, _providerObjectNormalizationModuleExclusions->propertyName)) |
{ | { |
return(_providerObjectNormalizationModuleExclusions.get()); |
return _providerObjectNormalizationModuleExclusions.get(); |
} | } |
else | else |
{ | { |
throw UnrecognizedConfigProperty(name); | throw UnrecognizedConfigProperty(name); |
} | } |
| |
PEGASUS_UNREACHABLE( return(0); ) |
PEGASUS_UNREACHABLE( return 0; ) |
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |