Boolean UNIX_BGPPeerUsesRouteMap::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "Collection"))
			{
				CIMInstance collectionValue;
				property.getValue().get(collectionValue);
				setCollection(collectionValue);
			}
			else if (String::equal(property.getName().getString(), "Member"))
			{
				CIMInstance memberValue;
				property.getValue().get(memberValue);
				setMember(memberValue);
			}
			else if (String::equal(property.getName().getString(), "MapSequence"))
			{
				Uint16 mapSequenceValue;
				property.getValue().get(mapSequenceValue);
				setMapSequence(mapSequenceValue);
			}
	}
	return true;
}
Boolean UNIX_AssociatedSupplyCurrentSensor::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "Antecedent"))
			{
				CIMInstance antecedentValue;
				property.getValue().get(antecedentValue);
				setAntecedent(antecedentValue);
			}
			else if (String::equal(property.getName().getString(), "Dependent"))
			{
				CIMInstance dependentValue;
				property.getValue().get(dependentValue);
				setDependent(dependentValue);
			}
			else if (String::equal(property.getName().getString(), "MonitoringRange"))
			{
				Uint16 monitoringRangeValue;
				property.getValue().get(monitoringRangeValue);
				setMonitoringRange(monitoringRangeValue);
			}
	}
	return true;
}
Ejemplo n.º 3
0
ObjectNormalizer::ObjectNormalizer(
    const CIMClass& cimClass,
    Boolean includeQualifiers,
    Boolean includeClassOrigin,
    const CIMNamespaceName& nameSpace,
    SharedPtr<NormalizerContext>& context)
  : _cimClass(cimClass),
    _includeQualifiers(includeQualifiers),
    _includeClassOrigin(includeClassOrigin),
    _context(context),
    _nameSpace(nameSpace)
{
    if (!_cimClass.isUninitialized())
    {
        // ATTN: the following code is intended to expedite normalizing
        // instances and instance object paths by establishing the keys
        // once now rather than multiple times later. it is biased
        // toward providers that return many instances with many properties.

        // build a reference object path within the class
        Array<CIMKeyBinding> keys;

        for (Uint32 i = 0, n = _cimClass.getPropertyCount(); i < n; i++)
        {
            CIMConstProperty referenceProperty = _cimClass.getProperty(i);

            Uint32 pos = referenceProperty.findQualifier("key");

            if ((pos != PEG_NOT_FOUND) &&
                (referenceProperty.getQualifier(pos).getValue().equal(
                     CIMValue(true))))
            {
                if (referenceProperty.getType() == CIMTYPE_REFERENCE)
                {
                    // ATTN: a fake reference is inserted in the key so that
                    // the _BubbleSort() method in CIMObjectPath does not
                    // throw and exception. It implicitly validates keys of
                    // type REFERENCE so just place a dummy value for now.
                    // The value will be replaced by the normalized object
                    // later.
                    keys.append(CIMKeyBinding(referenceProperty.getName(),
                        "class.key=\"value\"", CIMKeyBinding::REFERENCE));
                }
                else
                {
                    keys.append(CIMKeyBinding(referenceProperty.getName(),
                        referenceProperty.getValue()));
                }
            }
        }

        // update class object path
        CIMObjectPath cimObjectPath(_cimClass.getPath());

        cimObjectPath.setKeyBindings(keys);

        _cimClass.setPath(cimObjectPath);
    }
}
Ejemplo n.º 4
0
CIMValue CIMHelper::getPropertyValue(const CIMInstance &instanceObject, String name)
{
    CIMName cname(name);
    Uint32 index = instanceObject.findProperty(cname);
    if (index == PEG_NOT_FOUND) return CIMValue();
    CIMConstProperty property = instanceObject.getProperty(index);
    return property.getValue();
}
Boolean UNIX_AssociatedTargetMaskingGroup::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "Antecedent"))
			{
				CIMInstance antecedentValue;
				property.getValue().get(antecedentValue);
				setAntecedent(antecedentValue);
			}
			else if (String::equal(property.getName().getString(), "Dependent"))
			{
				CIMInstance dependentValue;
				property.getValue().get(dependentValue);
				setDependent(dependentValue);
			}
	}
	return true;
}
Boolean UNIX_BGPServiceAttributes::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "GroupComponent"))
			{
				CIMInstance groupComponentValue;
				property.getValue().get(groupComponentValue);
				setGroupComponent(groupComponentValue);
			}
			else if (String::equal(property.getName().getString(), "PartComponent"))
			{
				CIMInstance partComponentValue;
				property.getValue().get(partComponentValue);
				setPartComponent(partComponentValue);
			}
	}
	return true;
}
Boolean UNIX_BGPServiceStatistics::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "Stats"))
			{
				CIMInstance statsValue;
				property.getValue().get(statsValue);
				setStats(statsValue);
			}
			else if (String::equal(property.getName().getString(), "Element"))
			{
				CIMInstance elementValue;
				property.getValue().get(elementValue);
				setElement(elementValue);
			}
	}
	return true;
}
Ejemplo n.º 8
0
void CIMError::setInstance(const CIMInstance& instance)
{
    for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
    {
        CIMConstProperty p = instance.getProperty(i);

        _Check("ErrorType", p, (Uint16*)0);
        _Check("OtherErrorType", p, (String*)0);
        _Check("OwningEntity", p, (String*)0);
        _Check("MessageID", p, (String*)0);
        _Check("Message", p, (String*)0);
        _Check("MessageArguments", p, (Array<String>*)0);
        _Check("PerceivedSeverity", p, (Uint16*)0);
        _Check("ProbableCause", p, (Uint16*)0);
        _Check("ProbableCauseDescription", p, (String*)0);
        _Check("RecommendedActions", p, (Array<String>*)0);
        _Check("ErrorSource", p, (String*)0);
        _Check("ErrorSourceFormat", p, (Uint16*)0);
        _Check("OtherErrorSourceFormat", p, (String*)0);
        _Check("CIMStatusCode", p, (Uint32*)0);
        _Check("CIMStatusCodeDescription", p, (String*)0);
    }

    // Verify that the instance contains all of the required properties.

    for (Uint32 i = 0; i < _numRequiredProperties; i++)
    {
        // Does inst have this property?

        Uint32 pos = instance.findProperty(_requiredProperties[i]);

        if (pos == PEG_NOT_FOUND)
        {
            char buffer[80];
            sprintf(buffer, "required property does not exist: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
        }
        // is required property non-null?
        CIMConstProperty p = instance.getProperty(pos);
        CIMValue v = p.getValue();
        if (v.isNull())
        {
            char buffer[80];
            sprintf(buffer, "required property MUST NOT be Null: %s",
                    _requiredProperties[i]);
            throw CIMException(CIM_ERR_FAILED, buffer);
        }
    }
    _inst = instance;
}
Ejemplo n.º 9
0
CIMObjectPath CIMInstanceRep::buildPath(
    const CIMConstClass& cimClass) const
{
    //--------------------------------------------------------------------------
    // Get class name:
    //--------------------------------------------------------------------------

    CIMName className = getClassName();

    //--------------------------------------------------------------------------
    // Get key names:
    //--------------------------------------------------------------------------

    Array<CIMName> keyNames;
    cimClass.getKeyNames(keyNames);

    if (keyNames.size() == 0)
        return CIMObjectPath("", CIMNamespaceName(), className);

    //--------------------------------------------------------------------------
    // Get type and value for each key (building up key bindings):
    //--------------------------------------------------------------------------

    Array<CIMKeyBinding> keyBindings;

    for (Uint32 i = 0, n = keyNames.size(); i < n; i++)
    {
        const CIMName& keyName = keyNames[i];

        Uint32 index = findProperty(keyName);
        if (index == PEG_NOT_FOUND)
        {
            throw NoSuchProperty(keyName.getString());
        }

        CIMConstProperty tmp = getProperty(index);
        keyBindings.append(CIMKeyBinding(keyName, tmp.getValue()));
    }

    return CIMObjectPath(String(), CIMNamespaceName(), className, keyBindings);
}
Boolean UNIX_BlockStatisticsManifestCollection::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "IsDefault"))
			{
				Boolean isDefaultValue;
				property.getValue().get(isDefaultValue);
				setIsDefault(isDefaultValue);
			}
	}
	return true;
}
Boolean UNIX_BIOSString::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "AttributeName"))
			{
				String attributeNameValue;
				property.getValue().get(attributeNameValue);
				setAttributeName(attributeNameValue);
			}
			else if (String::equal(property.getName().getString(), "CurrentValue"))
			{
				Array<String> currentValueValue;
				property.getValue().get(currentValueValue);
				setCurrentValue(currentValueValue);
			}
			else if (String::equal(property.getName().getString(), "DefaultValue"))
			{
				Array<String> defaultValueValue;
				property.getValue().get(defaultValueValue);
				setDefaultValue(defaultValueValue);
			}
			else if (String::equal(property.getName().getString(), "PendingValue"))
			{
				Array<String> pendingValueValue;
				property.getValue().get(pendingValueValue);
				setPendingValue(pendingValueValue);
			}
			else if (String::equal(property.getName().getString(), "IsOrderedList"))
			{
				Boolean isOrderedListValue;
				property.getValue().get(isOrderedListValue);
				setIsOrderedList(isOrderedListValue);
			}
			else if (String::equal(property.getName().getString(), "IsReadOnly"))
			{
				Boolean isReadOnlyValue;
				property.getValue().get(isReadOnlyValue);
				setIsReadOnly(isReadOnlyValue);
			}
			else if (String::equal(property.getName().getString(), "StringType"))
			{
				Uint32 stringTypeValue;
				property.getValue().get(stringTypeValue);
				setStringType(stringTypeValue);
			}
			else if (String::equal(property.getName().getString(), "MinLength"))
			{
				Uint64 minLengthValue;
				property.getValue().get(minLengthValue);
				setMinLength(minLengthValue);
			}
			else if (String::equal(property.getName().getString(), "MaxLength"))
			{
				Uint64 maxLengthValue;
				property.getValue().get(maxLengthValue);
				setMaxLength(maxLengthValue);
			}
			else if (String::equal(property.getName().getString(), "ValueExpression"))
			{
				String valueExpressionValue;
				property.getValue().get(valueExpressionValue);
				setValueExpression(valueExpressionValue);
			}
	}
	return true;
}
Boolean UNIX_CPUDiagnosticSettingData::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "ConfigurationName"))
			{
				String configurationNameValue;
				property.getValue().get(configurationNameValue);
				setConfigurationName(configurationNameValue);
			}
			else if (String::equal(property.getName().getString(), "ChangeableType"))
			{
				Uint16 changeableTypeValue;
				property.getValue().get(changeableTypeValue);
				setChangeableType(changeableTypeValue);
			}
			else if (String::equal(property.getName().getString(), "ComponentSetting"))
			{
				Array<String> componentSettingValue;
				property.getValue().get(componentSettingValue);
				setComponentSetting(componentSettingValue);
			}
			else if (String::equal(property.getName().getString(), "SoID"))
			{
				String soIDValue;
				property.getValue().get(soIDValue);
				setSoID(soIDValue);
			}
			else if (String::equal(property.getName().getString(), "SoOrgID"))
			{
				String soOrgIDValue;
				property.getValue().get(soOrgIDValue);
				setSoOrgID(soOrgIDValue);
			}
			else if (String::equal(property.getName().getString(), "HaltOnError"))
			{
				Boolean haltOnErrorValue;
				property.getValue().get(haltOnErrorValue);
				setHaltOnError(haltOnErrorValue);
			}
			else if (String::equal(property.getName().getString(), "QuickMode"))
			{
				Boolean quickModeValue;
				property.getValue().get(quickModeValue);
				setQuickMode(quickModeValue);
			}
			else if (String::equal(property.getName().getString(), "PercentOfTestCoverage"))
			{
				Uint8 percentOfTestCoverageValue;
				property.getValue().get(percentOfTestCoverageValue);
				setPercentOfTestCoverage(percentOfTestCoverageValue);
			}
			else if (String::equal(property.getName().getString(), "LoopControlParameter"))
			{
				Array<String> loopControlParameterValue;
				property.getValue().get(loopControlParameterValue);
				setLoopControlParameter(loopControlParameterValue);
			}
			else if (String::equal(property.getName().getString(), "LoopControl"))
			{
				Array<Uint16> loopControlValue;
				property.getValue().get(loopControlValue);
				setLoopControl(loopControlValue);
			}
			else if (String::equal(property.getName().getString(), "OtherLoopControlDescriptions"))
			{
				Array<String> otherLoopControlDescriptionsValue;
				property.getValue().get(otherLoopControlDescriptionsValue);
				setOtherLoopControlDescriptions(otherLoopControlDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "ResultPersistence"))
			{
				Uint32 resultPersistenceValue;
				property.getValue().get(resultPersistenceValue);
				setResultPersistence(resultPersistenceValue);
			}
			else if (String::equal(property.getName().getString(), "LogOptions"))
			{
				Array<Uint16> logOptionsValue;
				property.getValue().get(logOptionsValue);
				setLogOptions(logOptionsValue);
			}
			else if (String::equal(property.getName().getString(), "OtherLogOptionsDescriptions"))
			{
				Array<String> otherLogOptionsDescriptionsValue;
				property.getValue().get(otherLogOptionsDescriptionsValue);
				setOtherLogOptionsDescriptions(otherLogOptionsDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "LogStorage"))
			{
				Array<Uint16> logStorageValue;
				property.getValue().get(logStorageValue);
				setLogStorage(logStorageValue);
			}
			else if (String::equal(property.getName().getString(), "OtherLogStorageDescriptions"))
			{
				Array<String> otherLogStorageDescriptionsValue;
				property.getValue().get(otherLogStorageDescriptionsValue);
				setOtherLogStorageDescriptions(otherLogStorageDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "VerbosityLevel"))
			{
				Array<Uint16> verbosityLevelValue;
				property.getValue().get(verbosityLevelValue);
				setVerbosityLevel(verbosityLevelValue);
			}
			else if (String::equal(property.getName().getString(), "QueryTimeout"))
			{
				Uint32 queryTimeoutValue;
				property.getValue().get(queryTimeoutValue);
				setQueryTimeout(queryTimeoutValue);
			}
			else if (String::equal(property.getName().getString(), "NonDestructive"))
			{
				Boolean nonDestructiveValue;
				property.getValue().get(nonDestructiveValue);
				setNonDestructive(nonDestructiveValue);
			}
			else if (String::equal(property.getName().getString(), "CoreVoltages"))
			{
				Array<Real32> coreVoltagesValue;
				property.getValue().get(coreVoltagesValue);
				setCoreVoltages(coreVoltagesValue);
			}
			else if (String::equal(property.getName().getString(), "CPUSpeeds"))
			{
				Array<Real32> cPUSpeedsValue;
				property.getValue().get(cPUSpeedsValue);
				setCPUSpeeds(cPUSpeedsValue);
			}
			else if (String::equal(property.getName().getString(), "Seed"))
			{
				Uint32 seedValue;
				property.getValue().get(seedValue);
				setSeed(seedValue);
			}
	}
	return true;
}
Boolean UNIX_BIOSElement::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "InstallDate"))
			{
				CIMDateTime installDateValue;
				property.getValue().get(installDateValue);
				setInstallDate(installDateValue);
			}
			else if (String::equal(property.getName().getString(), "Name"))
			{
				String nameValue;
				property.getValue().get(nameValue);
				setName(nameValue);
			}
			else if (String::equal(property.getName().getString(), "OperationalStatus"))
			{
				Array<Uint16> operationalStatusValue;
				property.getValue().get(operationalStatusValue);
				setOperationalStatus(operationalStatusValue);
			}
			else if (String::equal(property.getName().getString(), "StatusDescriptions"))
			{
				Array<String> statusDescriptionsValue;
				property.getValue().get(statusDescriptionsValue);
				setStatusDescriptions(statusDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "Status"))
			{
				String statusValue;
				property.getValue().get(statusValue);
				setStatus(statusValue);
			}
			else if (String::equal(property.getName().getString(), "HealthState"))
			{
				Uint16 healthStateValue;
				property.getValue().get(healthStateValue);
				setHealthState(healthStateValue);
			}
			else if (String::equal(property.getName().getString(), "CommunicationStatus"))
			{
				Uint16 communicationStatusValue;
				property.getValue().get(communicationStatusValue);
				setCommunicationStatus(communicationStatusValue);
			}
			else if (String::equal(property.getName().getString(), "DetailedStatus"))
			{
				Uint16 detailedStatusValue;
				property.getValue().get(detailedStatusValue);
				setDetailedStatus(detailedStatusValue);
			}
			else if (String::equal(property.getName().getString(), "OperatingStatus"))
			{
				Uint16 operatingStatusValue;
				property.getValue().get(operatingStatusValue);
				setOperatingStatus(operatingStatusValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryStatus"))
			{
				Uint16 primaryStatusValue;
				property.getValue().get(primaryStatusValue);
				setPrimaryStatus(primaryStatusValue);
			}
			else if (String::equal(property.getName().getString(), "Version"))
			{
				String versionValue;
				property.getValue().get(versionValue);
				setVersion(versionValue);
			}
			else if (String::equal(property.getName().getString(), "SoftwareElementState"))
			{
				Uint16 softwareElementStateValue;
				property.getValue().get(softwareElementStateValue);
				setSoftwareElementState(softwareElementStateValue);
			}
			else if (String::equal(property.getName().getString(), "SoftwareElementID"))
			{
				String softwareElementIDValue;
				property.getValue().get(softwareElementIDValue);
				setSoftwareElementID(softwareElementIDValue);
			}
			else if (String::equal(property.getName().getString(), "TargetOperatingSystem"))
			{
				Uint16 targetOperatingSystemValue;
				property.getValue().get(targetOperatingSystemValue);
				setTargetOperatingSystem(targetOperatingSystemValue);
			}
			else if (String::equal(property.getName().getString(), "OtherTargetOS"))
			{
				String otherTargetOSValue;
				property.getValue().get(otherTargetOSValue);
				setOtherTargetOS(otherTargetOSValue);
			}
			else if (String::equal(property.getName().getString(), "Manufacturer"))
			{
				String manufacturerValue;
				property.getValue().get(manufacturerValue);
				setManufacturer(manufacturerValue);
			}
			else if (String::equal(property.getName().getString(), "BuildNumber"))
			{
				String buildNumberValue;
				property.getValue().get(buildNumberValue);
				setBuildNumber(buildNumberValue);
			}
			else if (String::equal(property.getName().getString(), "SerialNumber"))
			{
				String serialNumberValue;
				property.getValue().get(serialNumberValue);
				setSerialNumber(serialNumberValue);
			}
			else if (String::equal(property.getName().getString(), "CodeSet"))
			{
				String codeSetValue;
				property.getValue().get(codeSetValue);
				setCodeSet(codeSetValue);
			}
			else if (String::equal(property.getName().getString(), "IdentificationCode"))
			{
				String identificationCodeValue;
				property.getValue().get(identificationCodeValue);
				setIdentificationCode(identificationCodeValue);
			}
			else if (String::equal(property.getName().getString(), "LanguageEdition"))
			{
				String languageEditionValue;
				property.getValue().get(languageEditionValue);
				setLanguageEdition(languageEditionValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryBIOS"))
			{
				Boolean primaryBIOSValue;
				property.getValue().get(primaryBIOSValue);
				setPrimaryBIOS(primaryBIOSValue);
			}
			else if (String::equal(property.getName().getString(), "ListOfLanguages"))
			{
				Array<String> listOfLanguagesValue;
				property.getValue().get(listOfLanguagesValue);
				setListOfLanguages(listOfLanguagesValue);
			}
			else if (String::equal(property.getName().getString(), "CurrentLanguage"))
			{
				String currentLanguageValue;
				property.getValue().get(currentLanguageValue);
				setCurrentLanguage(currentLanguageValue);
			}
			else if (String::equal(property.getName().getString(), "LoadedStartingAddress"))
			{
				Uint64 loadedStartingAddressValue;
				property.getValue().get(loadedStartingAddressValue);
				setLoadedStartingAddress(loadedStartingAddressValue);
			}
			else if (String::equal(property.getName().getString(), "LoadedEndingAddress"))
			{
				Uint64 loadedEndingAddressValue;
				property.getValue().get(loadedEndingAddressValue);
				setLoadedEndingAddress(loadedEndingAddressValue);
			}
			else if (String::equal(property.getName().getString(), "LoadUtilityInformation"))
			{
				String loadUtilityInformationValue;
				property.getValue().get(loadUtilityInformationValue);
				setLoadUtilityInformation(loadUtilityInformationValue);
			}
			else if (String::equal(property.getName().getString(), "ReleaseDate"))
			{
				CIMDateTime releaseDateValue;
				property.getValue().get(releaseDateValue);
				setReleaseDate(releaseDateValue);
			}
			else if (String::equal(property.getName().getString(), "SystemBIOSMajorRelease"))
			{
				Uint8 systemBIOSMajorReleaseValue;
				property.getValue().get(systemBIOSMajorReleaseValue);
				setSystemBIOSMajorRelease(systemBIOSMajorReleaseValue);
			}
			else if (String::equal(property.getName().getString(), "SystemBIOSMinorRelease"))
			{
				Uint8 systemBIOSMinorReleaseValue;
				property.getValue().get(systemBIOSMinorReleaseValue);
				setSystemBIOSMinorRelease(systemBIOSMinorReleaseValue);
			}
			else if (String::equal(property.getName().getString(), "EmbeddedControllerFirmwareMajorRelease"))
			{
				Uint8 embeddedControllerFirmwareMajorReleaseValue;
				property.getValue().get(embeddedControllerFirmwareMajorReleaseValue);
				setEmbeddedControllerFirmwareMajorRelease(embeddedControllerFirmwareMajorReleaseValue);
			}
			else if (String::equal(property.getName().getString(), "EmbeddedControllerFirmwareMinorRelease"))
			{
				Uint8 embeddedControllerFirmwareMinorReleaseValue;
				property.getValue().get(embeddedControllerFirmwareMinorReleaseValue);
				setEmbeddedControllerFirmwareMinorRelease(embeddedControllerFirmwareMinorReleaseValue);
			}
			else if (String::equal(property.getName().getString(), "RegistryURIs"))
			{
				Array<String> registryURIsValue;
				property.getValue().get(registryURIsValue);
				setRegistryURIs(registryURIsValue);
			}
	}
	return true;
}
Boolean UNIX_BatchSAP::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "InstallDate"))
			{
				CIMDateTime installDateValue;
				property.getValue().get(installDateValue);
				setInstallDate(installDateValue);
			}
			else if (String::equal(property.getName().getString(), "Name"))
			{
				String nameValue;
				property.getValue().get(nameValue);
				setName(nameValue);
			}
			else if (String::equal(property.getName().getString(), "OperationalStatus"))
			{
				Array<Uint16> operationalStatusValue;
				property.getValue().get(operationalStatusValue);
				setOperationalStatus(operationalStatusValue);
			}
			else if (String::equal(property.getName().getString(), "StatusDescriptions"))
			{
				Array<String> statusDescriptionsValue;
				property.getValue().get(statusDescriptionsValue);
				setStatusDescriptions(statusDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "Status"))
			{
				String statusValue;
				property.getValue().get(statusValue);
				setStatus(statusValue);
			}
			else if (String::equal(property.getName().getString(), "HealthState"))
			{
				Uint16 healthStateValue;
				property.getValue().get(healthStateValue);
				setHealthState(healthStateValue);
			}
			else if (String::equal(property.getName().getString(), "CommunicationStatus"))
			{
				Uint16 communicationStatusValue;
				property.getValue().get(communicationStatusValue);
				setCommunicationStatus(communicationStatusValue);
			}
			else if (String::equal(property.getName().getString(), "DetailedStatus"))
			{
				Uint16 detailedStatusValue;
				property.getValue().get(detailedStatusValue);
				setDetailedStatus(detailedStatusValue);
			}
			else if (String::equal(property.getName().getString(), "OperatingStatus"))
			{
				Uint16 operatingStatusValue;
				property.getValue().get(operatingStatusValue);
				setOperatingStatus(operatingStatusValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryStatus"))
			{
				Uint16 primaryStatusValue;
				property.getValue().get(primaryStatusValue);
				setPrimaryStatus(primaryStatusValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledState"))
			{
				Uint16 enabledStateValue;
				property.getValue().get(enabledStateValue);
				setEnabledState(enabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "OtherEnabledState"))
			{
				String otherEnabledStateValue;
				property.getValue().get(otherEnabledStateValue);
				setOtherEnabledState(otherEnabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "RequestedState"))
			{
				Uint16 requestedStateValue;
				property.getValue().get(requestedStateValue);
				setRequestedState(requestedStateValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledDefault"))
			{
				Uint16 enabledDefaultValue;
				property.getValue().get(enabledDefaultValue);
				setEnabledDefault(enabledDefaultValue);
			}
			else if (String::equal(property.getName().getString(), "TimeOfLastStateChange"))
			{
				CIMDateTime timeOfLastStateChangeValue;
				property.getValue().get(timeOfLastStateChangeValue);
				setTimeOfLastStateChange(timeOfLastStateChangeValue);
			}
			else if (String::equal(property.getName().getString(), "AvailableRequestedStates"))
			{
				Array<Uint16> availableRequestedStatesValue;
				property.getValue().get(availableRequestedStatesValue);
				setAvailableRequestedStates(availableRequestedStatesValue);
			}
			else if (String::equal(property.getName().getString(), "TransitioningToState"))
			{
				Uint16 transitioningToStateValue;
				property.getValue().get(transitioningToStateValue);
				setTransitioningToState(transitioningToStateValue);
			}
			else if (String::equal(property.getName().getString(), "SystemCreationClassName"))
			{
				String systemCreationClassNameValue;
				property.getValue().get(systemCreationClassNameValue);
				setSystemCreationClassName(systemCreationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "SystemName"))
			{
				String systemNameValue;
				property.getValue().get(systemNameValue);
				setSystemName(systemNameValue);
			}
			else if (String::equal(property.getName().getString(), "CreationClassName"))
			{
				String creationClassNameValue;
				property.getValue().get(creationClassNameValue);
				setCreationClassName(creationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "BatchProtocol"))
			{
				Array<Uint16> batchProtocolValue;
				property.getValue().get(batchProtocolValue);
				setBatchProtocol(batchProtocolValue);
			}
			else if (String::equal(property.getName().getString(), "BatchProtocolInfo"))
			{
				Array<String> batchProtocolInfoValue;
				property.getValue().get(batchProtocolInfoValue);
				setBatchProtocolInfo(batchProtocolInfoValue);
			}
	}
	return true;
}
Boolean UNIX_BlockStatisticsManifest::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "ElementType"))
			{
				Uint16 elementTypeValue;
				property.getValue().get(elementTypeValue);
				setElementType(elementTypeValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeStartStatisticTime"))
			{
				Boolean includeStartStatisticTimeValue;
				property.getValue().get(includeStartStatisticTimeValue);
				setIncludeStartStatisticTime(includeStartStatisticTimeValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeStatisticTime"))
			{
				Boolean includeStatisticTimeValue;
				property.getValue().get(includeStatisticTimeValue);
				setIncludeStatisticTime(includeStatisticTimeValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeTotalIOs"))
			{
				Boolean includeTotalIOsValue;
				property.getValue().get(includeTotalIOsValue);
				setIncludeTotalIOs(includeTotalIOsValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesTransferred"))
			{
				Boolean includeKBytesTransferredValue;
				property.getValue().get(includeKBytesTransferredValue);
				setIncludeKBytesTransferred(includeKBytesTransferredValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeIOTimeCounter"))
			{
				Boolean includeIOTimeCounterValue;
				property.getValue().get(includeIOTimeCounterValue);
				setIncludeIOTimeCounter(includeIOTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadIOs"))
			{
				Boolean includeReadIOsValue;
				property.getValue().get(includeReadIOsValue);
				setIncludeReadIOs(includeReadIOsValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadHitIOs"))
			{
				Boolean includeReadHitIOsValue;
				property.getValue().get(includeReadHitIOsValue);
				setIncludeReadHitIOs(includeReadHitIOsValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadIOTimeCounter"))
			{
				Boolean includeReadIOTimeCounterValue;
				property.getValue().get(includeReadIOTimeCounterValue);
				setIncludeReadIOTimeCounter(includeReadIOTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadHitIOTimeCounter"))
			{
				Boolean includeReadHitIOTimeCounterValue;
				property.getValue().get(includeReadHitIOTimeCounterValue);
				setIncludeReadHitIOTimeCounter(includeReadHitIOTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesRead"))
			{
				Boolean includeKBytesReadValue;
				property.getValue().get(includeKBytesReadValue);
				setIncludeKBytesRead(includeKBytesReadValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteIOs"))
			{
				Boolean includeWriteIOsValue;
				property.getValue().get(includeWriteIOsValue);
				setIncludeWriteIOs(includeWriteIOsValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteHitIOs"))
			{
				Boolean includeWriteHitIOsValue;
				property.getValue().get(includeWriteHitIOsValue);
				setIncludeWriteHitIOs(includeWriteHitIOsValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteIOTimeCounter"))
			{
				Boolean includeWriteIOTimeCounterValue;
				property.getValue().get(includeWriteIOTimeCounterValue);
				setIncludeWriteIOTimeCounter(includeWriteIOTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteHitIOTimeCounter"))
			{
				Boolean includeWriteHitIOTimeCounterValue;
				property.getValue().get(includeWriteHitIOTimeCounterValue);
				setIncludeWriteHitIOTimeCounter(includeWriteHitIOTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesWritten"))
			{
				Boolean includeKBytesWrittenValue;
				property.getValue().get(includeKBytesWrittenValue);
				setIncludeKBytesWritten(includeKBytesWrittenValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeIdleTimeCounter"))
			{
				Boolean includeIdleTimeCounterValue;
				property.getValue().get(includeIdleTimeCounterValue);
				setIncludeIdleTimeCounter(includeIdleTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeMaintOp"))
			{
				Boolean includeMaintOpValue;
				property.getValue().get(includeMaintOpValue);
				setIncludeMaintOp(includeMaintOpValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeMaintTimeCounter"))
			{
				Boolean includeMaintTimeCounterValue;
				property.getValue().get(includeMaintTimeCounterValue);
				setIncludeMaintTimeCounter(includeMaintTimeCounterValue);
			}
			else if (String::equal(property.getName().getString(), "CSVSequence"))
			{
				Array<String> cSVSequenceValue;
				property.getValue().get(cSVSequenceValue);
				setCSVSequence(cSVSequenceValue);
			}
			else if (String::equal(property.getName().getString(), "CSVRateSequence"))
			{
				Array<String> cSVRateSequenceValue;
				property.getValue().get(cSVRateSequenceValue);
				setCSVRateSequence(cSVRateSequenceValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesReadRate"))
			{
				Boolean includeKBytesReadRateValue;
				property.getValue().get(includeKBytesReadRateValue);
				setIncludeKBytesReadRate(includeKBytesReadRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesTransferredRate"))
			{
				Boolean includeKBytesTransferredRateValue;
				property.getValue().get(includeKBytesTransferredRateValue);
				setIncludeKBytesTransferredRate(includeKBytesTransferredRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeKBytesWrittenRate"))
			{
				Boolean includeKBytesWrittenRateValue;
				property.getValue().get(includeKBytesWrittenRateValue);
				setIncludeKBytesWrittenRate(includeKBytesWrittenRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeMaintOpRate"))
			{
				Boolean includeMaintOpRateValue;
				property.getValue().get(includeMaintOpRateValue);
				setIncludeMaintOpRate(includeMaintOpRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeRateIntervalEndTime"))
			{
				Boolean includeRateIntervalEndTimeValue;
				property.getValue().get(includeRateIntervalEndTimeValue);
				setIncludeRateIntervalEndTime(includeRateIntervalEndTimeValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeRateIntervalStartTime"))
			{
				Boolean includeRateIntervalStartTimeValue;
				property.getValue().get(includeRateIntervalStartTimeValue);
				setIncludeRateIntervalStartTime(includeRateIntervalStartTimeValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadHitIOsRate"))
			{
				Boolean includeReadHitIOsRateValue;
				property.getValue().get(includeReadHitIOsRateValue);
				setIncludeReadHitIOsRate(includeReadHitIOsRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeReadIOsRate"))
			{
				Boolean includeReadIOsRateValue;
				property.getValue().get(includeReadIOsRateValue);
				setIncludeReadIOsRate(includeReadIOsRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeTotalIOsRate"))
			{
				Boolean includeTotalIOsRateValue;
				property.getValue().get(includeTotalIOsRateValue);
				setIncludeTotalIOsRate(includeTotalIOsRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteHitIOsRate"))
			{
				Boolean includeWriteHitIOsRateValue;
				property.getValue().get(includeWriteHitIOsRateValue);
				setIncludeWriteHitIOsRate(includeWriteHitIOsRateValue);
			}
			else if (String::equal(property.getName().getString(), "IncludeWriteIOsRate"))
			{
				Boolean includeWriteIOsRateValue;
				property.getValue().get(includeWriteIOsRateValue);
				setIncludeWriteIOsRate(includeWriteIOsRateValue);
			}
			else if (String::equal(property.getName().getString(), "RateElementType"))
			{
				Uint16 rateElementTypeValue;
				property.getValue().get(rateElementTypeValue);
				setRateElementType(rateElementTypeValue);
			}
	}
	return true;
}
Ejemplo n.º 16
0
void CIMPropertyRep::resolve(
    DeclContext* declContext,
    const CIMNamespaceName& nameSpace,
    Boolean isInstancePart,
    const CIMConstProperty& inheritedProperty,
    Boolean propagateQualifiers)
{
    PEGASUS_ASSERT(!inheritedProperty.isUninitialized());

    // Check the type:

    if (!inheritedProperty.getValue().typeCompatible(_value))
    {
        if (!(
            (inheritedProperty.getValue().getType() == CIMTYPE_OBJECT) &&
            (_value.getType() == CIMTYPE_STRING) &&
            (_qualifiers.find(PEGASUS_QUALIFIERNAME_EMBEDDEDOBJECT)
                 != PEG_NOT_FOUND) &&
            (inheritedProperty.getValue().isArray() == _value.isArray())
            ) &&
            !(
            (inheritedProperty.getValue().getType() == CIMTYPE_INSTANCE) &&
            (_value.getType() == CIMTYPE_STRING) &&
            (_qualifiers.find(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE)
                 != PEG_NOT_FOUND) &&
            (inheritedProperty.getValue().isArray() == _value.isArray())
            ))
        {
            throw TypeMismatchException();
        }
    }

    // Validate the qualifiers of the property (according to
    // superClass's property with the same name). This method
    // will throw an exception if the validation fails.

    CIMScope scope = CIMScope::PROPERTY;

    if (_value.getType() == CIMTYPE_REFERENCE)
        scope = CIMScope::REFERENCE;

    // Test the reference class name against the inherited property
    if (_value.getType() == CIMTYPE_REFERENCE ||
        _value.getType() == CIMTYPE_INSTANCE)
    {
        CIMName inheritedClassName;
        Array<CIMName> classNames;

        if (_value.getType() == CIMTYPE_INSTANCE)
        {
            Uint32 pos = inheritedProperty.findQualifier(
                             PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);
            if (pos != PEG_NOT_FOUND)
            {
                String qualStr;
                inheritedProperty.getQualifier(pos).getValue().get(qualStr);
                inheritedClassName = qualStr;
            }

            if (_value.isArray())
            {
                Array<CIMInstance> embeddedInstances;
                _value.get(embeddedInstances);
                for (Uint32 i = 0, n = embeddedInstances.size(); i < n; ++i)
                {
                    classNames.append(embeddedInstances[i].getClassName());
                }
            }
            else
            {
                CIMInstance embeddedInst;
                _value.get(embeddedInst);
                classNames.append(embeddedInst.getClassName());
            }
        }
        else
        {
            CIMName referenceClass;
            if (_referenceClassName.isNull())
            {
                CIMObjectPath reference;
                _value.get(reference);
                referenceClass = reference.getClassName();
            }
            else
            {
                referenceClass = _referenceClassName;
            }

            inheritedClassName = inheritedProperty.getReferenceClassName();
            classNames.append(referenceClass);
        }

        // This algorithm is friendly to arrays of embedded instances. It
        // remembers the class names that are found to be subclasses of the
        // inherited class name retrieved from the inherited property. This
        // ensures that any branch in the inheritance hierarchy will only be
        // traversed once. This provides significant optimization given that
        // most elements of an array of embedded instances will probably be of
        // very closely related types.
        Array<CIMName> successTree;
        successTree.append(inheritedClassName);
        for (Uint32 i = 0, n = classNames.size(); i < n; ++i)
        {
            Array<CIMName> traversalHistory;
            CIMName currentName = classNames[i];
            Boolean found = false;
            while (!found && !currentName.isNull())
            {
                for (Uint32 j = 0, m = successTree.size(); j < m; ++j)
                {
                    if (currentName == successTree[j])
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    traversalHistory.append(currentName);
                    CIMClass currentClass = declContext->lookupClass(
                            nameSpace, currentName);
                    if (currentClass.isUninitialized())
                    {
                        throw PEGASUS_CIM_EXCEPTION(
                            CIM_ERR_INVALID_PARAMETER, currentName.getString());
                    }
                    currentName = currentClass.getSuperClassName();
                }
            }

            if (!found)
            {
                throw TypeMismatchException();
            }

            successTree.appendArray(traversalHistory);
        }
    }

    _qualifiers.resolve(
        declContext, nameSpace, scope, isInstancePart,
        inheritedProperty._rep->_qualifiers, propagateQualifiers);

    _classOrigin = inheritedProperty.getClassOrigin();
}
Boolean UNIX_BinarySensor::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "InstallDate"))
			{
				CIMDateTime installDateValue;
				property.getValue().get(installDateValue);
				setInstallDate(installDateValue);
			}
			else if (String::equal(property.getName().getString(), "Name"))
			{
				String nameValue;
				property.getValue().get(nameValue);
				setName(nameValue);
			}
			else if (String::equal(property.getName().getString(), "OperationalStatus"))
			{
				Array<Uint16> operationalStatusValue;
				property.getValue().get(operationalStatusValue);
				setOperationalStatus(operationalStatusValue);
			}
			else if (String::equal(property.getName().getString(), "StatusDescriptions"))
			{
				Array<String> statusDescriptionsValue;
				property.getValue().get(statusDescriptionsValue);
				setStatusDescriptions(statusDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "Status"))
			{
				String statusValue;
				property.getValue().get(statusValue);
				setStatus(statusValue);
			}
			else if (String::equal(property.getName().getString(), "HealthState"))
			{
				Uint16 healthStateValue;
				property.getValue().get(healthStateValue);
				setHealthState(healthStateValue);
			}
			else if (String::equal(property.getName().getString(), "CommunicationStatus"))
			{
				Uint16 communicationStatusValue;
				property.getValue().get(communicationStatusValue);
				setCommunicationStatus(communicationStatusValue);
			}
			else if (String::equal(property.getName().getString(), "DetailedStatus"))
			{
				Uint16 detailedStatusValue;
				property.getValue().get(detailedStatusValue);
				setDetailedStatus(detailedStatusValue);
			}
			else if (String::equal(property.getName().getString(), "OperatingStatus"))
			{
				Uint16 operatingStatusValue;
				property.getValue().get(operatingStatusValue);
				setOperatingStatus(operatingStatusValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryStatus"))
			{
				Uint16 primaryStatusValue;
				property.getValue().get(primaryStatusValue);
				setPrimaryStatus(primaryStatusValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledState"))
			{
				Uint16 enabledStateValue;
				property.getValue().get(enabledStateValue);
				setEnabledState(enabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "OtherEnabledState"))
			{
				String otherEnabledStateValue;
				property.getValue().get(otherEnabledStateValue);
				setOtherEnabledState(otherEnabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "RequestedState"))
			{
				Uint16 requestedStateValue;
				property.getValue().get(requestedStateValue);
				setRequestedState(requestedStateValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledDefault"))
			{
				Uint16 enabledDefaultValue;
				property.getValue().get(enabledDefaultValue);
				setEnabledDefault(enabledDefaultValue);
			}
			else if (String::equal(property.getName().getString(), "TimeOfLastStateChange"))
			{
				CIMDateTime timeOfLastStateChangeValue;
				property.getValue().get(timeOfLastStateChangeValue);
				setTimeOfLastStateChange(timeOfLastStateChangeValue);
			}
			else if (String::equal(property.getName().getString(), "AvailableRequestedStates"))
			{
				Array<Uint16> availableRequestedStatesValue;
				property.getValue().get(availableRequestedStatesValue);
				setAvailableRequestedStates(availableRequestedStatesValue);
			}
			else if (String::equal(property.getName().getString(), "TransitioningToState"))
			{
				Uint16 transitioningToStateValue;
				property.getValue().get(transitioningToStateValue);
				setTransitioningToState(transitioningToStateValue);
			}
			else if (String::equal(property.getName().getString(), "AllocationState"))
			{
				String allocationStateValue;
				property.getValue().get(allocationStateValue);
				setAllocationState(allocationStateValue);
			}
			else if (String::equal(property.getName().getString(), "SystemCreationClassName"))
			{
				String systemCreationClassNameValue;
				property.getValue().get(systemCreationClassNameValue);
				setSystemCreationClassName(systemCreationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "SystemName"))
			{
				String systemNameValue;
				property.getValue().get(systemNameValue);
				setSystemName(systemNameValue);
			}
			else if (String::equal(property.getName().getString(), "CreationClassName"))
			{
				String creationClassNameValue;
				property.getValue().get(creationClassNameValue);
				setCreationClassName(creationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "DeviceID"))
			{
				String deviceIDValue;
				property.getValue().get(deviceIDValue);
				setDeviceID(deviceIDValue);
			}
			else if (String::equal(property.getName().getString(), "PowerManagementSupported"))
			{
				Boolean powerManagementSupportedValue;
				property.getValue().get(powerManagementSupportedValue);
				setPowerManagementSupported(powerManagementSupportedValue);
			}
			else if (String::equal(property.getName().getString(), "PowerManagementCapabilities"))
			{
				Array<Uint16> powerManagementCapabilitiesValue;
				property.getValue().get(powerManagementCapabilitiesValue);
				setPowerManagementCapabilities(powerManagementCapabilitiesValue);
			}
			else if (String::equal(property.getName().getString(), "Availability"))
			{
				Uint16 availabilityValue;
				property.getValue().get(availabilityValue);
				setAvailability(availabilityValue);
			}
			else if (String::equal(property.getName().getString(), "StatusInfo"))
			{
				Uint16 statusInfoValue;
				property.getValue().get(statusInfoValue);
				setStatusInfo(statusInfoValue);
			}
			else if (String::equal(property.getName().getString(), "LastErrorCode"))
			{
				Uint32 lastErrorCodeValue;
				property.getValue().get(lastErrorCodeValue);
				setLastErrorCode(lastErrorCodeValue);
			}
			else if (String::equal(property.getName().getString(), "ErrorDescription"))
			{
				String errorDescriptionValue;
				property.getValue().get(errorDescriptionValue);
				setErrorDescription(errorDescriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ErrorCleared"))
			{
				Boolean errorClearedValue;
				property.getValue().get(errorClearedValue);
				setErrorCleared(errorClearedValue);
			}
			else if (String::equal(property.getName().getString(), "OtherIdentifyingInfo"))
			{
				Array<String> otherIdentifyingInfoValue;
				property.getValue().get(otherIdentifyingInfoValue);
				setOtherIdentifyingInfo(otherIdentifyingInfoValue);
			}
			else if (String::equal(property.getName().getString(), "PowerOnHours"))
			{
				Uint64 powerOnHoursValue;
				property.getValue().get(powerOnHoursValue);
				setPowerOnHours(powerOnHoursValue);
			}
			else if (String::equal(property.getName().getString(), "TotalPowerOnHours"))
			{
				Uint64 totalPowerOnHoursValue;
				property.getValue().get(totalPowerOnHoursValue);
				setTotalPowerOnHours(totalPowerOnHoursValue);
			}
			else if (String::equal(property.getName().getString(), "IdentifyingDescriptions"))
			{
				Array<String> identifyingDescriptionsValue;
				property.getValue().get(identifyingDescriptionsValue);
				setIdentifyingDescriptions(identifyingDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "AdditionalAvailability"))
			{
				Array<Uint16> additionalAvailabilityValue;
				property.getValue().get(additionalAvailabilityValue);
				setAdditionalAvailability(additionalAvailabilityValue);
			}
			else if (String::equal(property.getName().getString(), "MaxQuiesceTime"))
			{
				Uint64 maxQuiesceTimeValue;
				property.getValue().get(maxQuiesceTimeValue);
				setMaxQuiesceTime(maxQuiesceTimeValue);
			}
			else if (String::equal(property.getName().getString(), "LocationIndicator"))
			{
				Uint16 locationIndicatorValue;
				property.getValue().get(locationIndicatorValue);
				setLocationIndicator(locationIndicatorValue);
			}
			else if (String::equal(property.getName().getString(), "SensorType"))
			{
				Uint16 sensorTypeValue;
				property.getValue().get(sensorTypeValue);
				setSensorType(sensorTypeValue);
			}
			else if (String::equal(property.getName().getString(), "OtherSensorTypeDescription"))
			{
				String otherSensorTypeDescriptionValue;
				property.getValue().get(otherSensorTypeDescriptionValue);
				setOtherSensorTypeDescription(otherSensorTypeDescriptionValue);
			}
			else if (String::equal(property.getName().getString(), "PossibleStates"))
			{
				Array<String> possibleStatesValue;
				property.getValue().get(possibleStatesValue);
				setPossibleStates(possibleStatesValue);
			}
			else if (String::equal(property.getName().getString(), "CurrentState"))
			{
				String currentStateValue;
				property.getValue().get(currentStateValue);
				setCurrentState(currentStateValue);
			}
			else if (String::equal(property.getName().getString(), "PollingInterval"))
			{
				Uint64 pollingIntervalValue;
				property.getValue().get(pollingIntervalValue);
				setPollingInterval(pollingIntervalValue);
			}
			else if (String::equal(property.getName().getString(), "SensorContext"))
			{
				String sensorContextValue;
				property.getValue().get(sensorContextValue);
				setSensorContext(sensorContextValue);
			}
			else if (String::equal(property.getName().getString(), "CurrentReading"))
			{
				Boolean currentReadingValue;
				property.getValue().get(currentReadingValue);
				setCurrentReading(currentReadingValue);
			}
			else if (String::equal(property.getName().getString(), "ExpectedReading"))
			{
				Boolean expectedReadingValue;
				property.getValue().get(expectedReadingValue);
				setExpectedReading(expectedReadingValue);
			}
			else if (String::equal(property.getName().getString(), "InterpretationOfTrue"))
			{
				String interpretationOfTrueValue;
				property.getValue().get(interpretationOfTrueValue);
				setInterpretationOfTrue(interpretationOfTrueValue);
			}
			else if (String::equal(property.getName().getString(), "InterpretationOfFalse"))
			{
				String interpretationOfFalseValue;
				property.getValue().get(interpretationOfFalseValue);
				setInterpretationOfFalse(interpretationOfFalseValue);
			}
	}
	return true;
}
Ejemplo n.º 18
0
void CIMPropertyRep::resolve(
    DeclContext* declContext,
    const CIMNamespaceName& nameSpace,
    Boolean isInstancePart,
    const CIMConstProperty& inheritedProperty,
    Boolean propagateQualifiers)
{
    PEGASUS_ASSERT(!inheritedProperty.isUninitialized());

    // Check the type:

    if (!inheritedProperty.getValue().typeCompatible(_value))
    {
        if (!(
            (inheritedProperty.getValue().getType() == CIMTYPE_OBJECT) &&
            (_value.getType() == CIMTYPE_STRING) &&
            (_qualifiers.find(CIMName("EmbeddedObject")) != PEG_NOT_FOUND) &&
            (inheritedProperty.getValue().isArray() == _value.isArray())
            ))
        {
            throw TypeMismatchException();
        }
    }

    // Validate the qualifiers of the property (according to
    // superClass's property with the same name). This method
    // will throw an exception if the validation fails.

    CIMScope scope = CIMScope::PROPERTY;

    if (_value.getType() == CIMTYPE_REFERENCE)
	scope = CIMScope::REFERENCE;

    // Test the reference class name against the inherited property
    if (_value.getType() == CIMTYPE_REFERENCE)
    {
        CIMName inheritedReferenceClassName = inheritedProperty.getReferenceClassName();
        CIMName referenceClassName;
        if(!_referenceClassName.isNull() && !_value.isNull())
        {
            CIMObjectPath valuePath;
            _value.get(valuePath);
            referenceClassName = valuePath.getClassName();
            bool found = _referenceClassName.equal(referenceClassName);
            while(!found)
            {
                CIMClass referenceClass = declContext->lookupClass(nameSpace, referenceClassName);
                if(referenceClass.isUninitialized())
                {
                    throw PEGASUS_CIM_EXCEPTION(
                      CIM_ERR_NOT_FOUND, referenceClassName.getString());
                }
                referenceClassName = referenceClass.getSuperClassName();
                if(referenceClassName.isNull())
                    throw TypeMismatchException();

                found = inheritedReferenceClassName.equal(referenceClassName);
            }
        }
        else if(!_referenceClassName.isNull())
        {
            referenceClassName = _referenceClassName;
        }
        else if(!_value.isNull())
        {
            CIMObjectPath valuePath;
            _value.get(valuePath);
            referenceClassName = valuePath.getClassName();
        }

        if(!referenceClassName.isNull())
        {
            bool found = inheritedReferenceClassName.equal(referenceClassName);
            while(!found)
            {
                CIMClass referenceClass = declContext->lookupClass(nameSpace, referenceClassName);
                if(referenceClass.isUninitialized())
                {
                    throw PEGASUS_CIM_EXCEPTION(
                        CIM_ERR_NOT_FOUND, referenceClassName.getString());
                }
                referenceClassName = referenceClass.getSuperClassName();
                if(referenceClassName.isNull())
                    throw TypeMismatchException();

                found = inheritedReferenceClassName.equal(referenceClassName);
            }
        }
    }

    _qualifiers.resolve(
	declContext,
	nameSpace,
	scope,
	isInstancePart,
	inheritedProperty._rep->_qualifiers,
	propagateQualifiers);

    _classOrigin = inheritedProperty.getClassOrigin();
}
Ejemplo n.º 19
0
void CIMInstanceRep::resolve(
    DeclContext* context,
    const CIMNamespaceName& nameSpace,
    CIMConstClass& cimClassOut,
    Boolean propagateQualifiers)
{
    // ATTN: Verify that references are initialized.

    if (!context)
        throw NullPointer();

    //----------------------------------------------------------------------
    // First obtain the class:
    //----------------------------------------------------------------------

    CIMConstClass cimClass =
        context->lookupClass(nameSpace, _reference.getClassName());

    if (cimClass.isUninitialized())
        throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_CLASS,
            _reference.getClassName().getString ());

    cimClassOut = cimClass;

    //----------------------------------------------------------------------
    // Disallow instantiation of abstract classes.
    //----------------------------------------------------------------------

    if (cimClass.isAbstract())
        throw InstantiatedAbstractClass(_reference.getClassName().getString ());

    //----------------------------------------------------------------------
    // Validate and propagate qualifiers.
    //----------------------------------------------------------------------
    _qualifiers.resolve(
        context,
        nameSpace,
        (cimClass.isAssociation()) ? CIMScope::ASSOCIATION : CIMScope::CLASS,
        false,
        cimClass._rep->_qualifiers,
        propagateQualifiers);

    //----------------------------------------------------------------------
    // First iterate the properties of this instance and verify that
    // each one is defined in the class and then resolve each one.
    //----------------------------------------------------------------------

    CIMName className = cimClass.getClassName();

    for (Uint32 i = 0, n = _properties.size(); i < n; i++)
    {
        CIMProperty& property = _properties[i];

        Uint32 index = cimClass.findProperty(property.getName());

        if (index == PEG_NOT_FOUND)
        {
            //
            //  Allow addition of Creator property to Indication Subscription,
            //  Filter and Handler instances
            //
// l10n add language property support
            if (!(((className.equal
                    (CIMName (PEGASUS_CLASSNAME_INDSUBSCRIPTION))) ||
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))) ||
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_INDHANDLER_CIMXML))) ||
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_LSTNRDST_CIMXML))) ||
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_INDHANDLER_SNMP))) ||
#ifdef  PEGASUS_ENABLE_SYSTEM_LOG_HANDLER
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG))) ||
#endif
#ifdef  PEGASUS_ENABLE_EMAIL_HANDLER
                (className.equal
                    (CIMName (PEGASUS_CLASSNAME_LSTNRDST_EMAIL))) ||
#endif
                (className.equal (CIMName (PEGASUS_CLASSNAME_INDFILTER)))) &&
                ((property.getName ().equal
                    (CIMName (PEGASUS_PROPERTYNAME_INDSUB_CREATOR))) ||
                (property.getName ().equal
                    (CIMName (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS))) ||
                (property.getName ().equal
                    (CIMName (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS))))))
            {
                throw NoSuchProperty(property.getName().getString ());
            }
        }
        else
        {
            // resolve the property
            Resolver::resolveProperty (property, context, nameSpace, true,
                cimClass.getProperty (index), propagateQualifiers);
        }
    }

    //----------------------------------------------------------------------
    // Inject all properties from the class that are not included in the
    // instance. Copy over the class-origin and set the propagated flag
    // to true. NOTE: The propagated flag indicates that the property
    // was not part of the property set input with the create and
    // was inherited from the default in the class (see cimxml spec sect 3.1.5)
    //----------------------------------------------------------------------

    for (Uint32 i = 0, m = 0, n = cimClass.getPropertyCount(); i < n; i++)
    {
        CIMConstProperty property = cimClass.getProperty(i);
        const CIMName& name = property.getName();

        // See if this instance already contains a property with this name:

        Boolean found = false;

        for (Uint32 j = m, s = _properties.size(); j < s; j++)
        {
            if (name.equal(_properties[j].getName()))
            {
                found = true;
                break;
            }
        }

        if (!found)
        {
            CIMProperty p;
            if (propagateQualifiers)
            {
                p = property.clone();
            }
            else
            {
                p = CIMProperty(
                    property.getName(),
                    property.getValue(),
                    property.getArraySize(),
                    property.getReferenceClassName(),
                    property.getClassOrigin(),
                    property.getPropagated());
            }
            p.setPropagated(true);
            _properties.insert(m++, p);
        }
    }
}
Ejemplo n.º 20
0
void InteropProvider::initProvider()
{
    if(providerInitialized)
        return;
    // Placed METHOD_ENTER trace statement after checking whether the
    // provider is initialized because this method will be called for every
    // operation through the InteropProvider, and this method is only
    // interesting the first time it is successfully run.
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::initProvider()");

    AutoMutex lock(interopMut);
    if(!providerInitialized)
    {
        //
        // Initialize the object manager instance for the CIM Server, and
        // retrieve the object manager's name property. This is retrieved once
        // and stored for use in constructing other instances requiring its
        // value.
        //
        CIMInstance objectManager = getObjectManagerInstance();
        objectManager.getProperty(objectManager.findProperty(
            OM_PROPERTY_NAME)).getValue().get(objectManagerName);

        //
        // Determine whether the CIMOM should be gathering statistical data
        // based on the GatherStatisticalData property in the object manager.
        //
        Uint32 gatherDataIndex = objectManager.findProperty(
            OM_PROPERTY_GATHERSTATISTICALDATA);
        if(gatherDataIndex != PEG_NOT_FOUND)
        {
            CIMConstProperty gatherDataProp =
                objectManager.getProperty(gatherDataIndex);
            if (gatherDataProp.getType() == CIMTYPE_BOOLEAN)
            {
                CIMValue gatherDataVal  = gatherDataProp.getValue();
                if (!gatherDataVal.isNull())
                {
                    Boolean gatherData;
                    gatherDataVal.get(gatherData);
                    if (gatherData == true)
                    {
                        StatisticalData* sd = StatisticalData::current();
                        sd->setCopyGSD(true);
                    }
                }
            }
        }

        // Cache this class definition for use later.
        profileCapabilitiesClass = repository->getClass(
            PEGASUS_NAMESPACENAME_INTEROP,
            PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES,
            false,
            true,
            false);

        providerClassifications.append(Uint16(5)); // "Instrumentation"

        // initialize namespaces.
        initializeNamespaces();

        // Now cache the Registration info used for ElementConformsToProfile
        cacheProfileRegistrationInfo();

        providerInitialized = true;
    }
    PEG_METHOD_EXIT();
}
Boolean UNIX_CPUDiagnosticTest::loadInstance(const CIMInstance &instance)
{
	clearInstance();
	Uint32 propertyCount = instance.getPropertyCount();
	for(Uint32 i = 0; i < propertyCount; i++) {
		CIMConstProperty property = instance.getProperty(i);
			if (String::equal(property.getName().getString(), "InstanceID"))
			{
				String instanceIDValue;
				property.getValue().get(instanceIDValue);
				setInstanceID(instanceIDValue);
			}
			else if (String::equal(property.getName().getString(), "Caption"))
			{
				String captionValue;
				property.getValue().get(captionValue);
				setCaption(captionValue);
			}
			else if (String::equal(property.getName().getString(), "Description"))
			{
				String descriptionValue;
				property.getValue().get(descriptionValue);
				setDescription(descriptionValue);
			}
			else if (String::equal(property.getName().getString(), "ElementName"))
			{
				String elementNameValue;
				property.getValue().get(elementNameValue);
				setElementName(elementNameValue);
			}
			else if (String::equal(property.getName().getString(), "Generation"))
			{
				Uint64 generationValue;
				property.getValue().get(generationValue);
				setGeneration(generationValue);
			}
			else if (String::equal(property.getName().getString(), "InstallDate"))
			{
				CIMDateTime installDateValue;
				property.getValue().get(installDateValue);
				setInstallDate(installDateValue);
			}
			else if (String::equal(property.getName().getString(), "Name"))
			{
				String nameValue;
				property.getValue().get(nameValue);
				setName(nameValue);
			}
			else if (String::equal(property.getName().getString(), "OperationalStatus"))
			{
				Array<Uint16> operationalStatusValue;
				property.getValue().get(operationalStatusValue);
				setOperationalStatus(operationalStatusValue);
			}
			else if (String::equal(property.getName().getString(), "StatusDescriptions"))
			{
				Array<String> statusDescriptionsValue;
				property.getValue().get(statusDescriptionsValue);
				setStatusDescriptions(statusDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "Status"))
			{
				String statusValue;
				property.getValue().get(statusValue);
				setStatus(statusValue);
			}
			else if (String::equal(property.getName().getString(), "HealthState"))
			{
				Uint16 healthStateValue;
				property.getValue().get(healthStateValue);
				setHealthState(healthStateValue);
			}
			else if (String::equal(property.getName().getString(), "CommunicationStatus"))
			{
				Uint16 communicationStatusValue;
				property.getValue().get(communicationStatusValue);
				setCommunicationStatus(communicationStatusValue);
			}
			else if (String::equal(property.getName().getString(), "DetailedStatus"))
			{
				Uint16 detailedStatusValue;
				property.getValue().get(detailedStatusValue);
				setDetailedStatus(detailedStatusValue);
			}
			else if (String::equal(property.getName().getString(), "OperatingStatus"))
			{
				Uint16 operatingStatusValue;
				property.getValue().get(operatingStatusValue);
				setOperatingStatus(operatingStatusValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryStatus"))
			{
				Uint16 primaryStatusValue;
				property.getValue().get(primaryStatusValue);
				setPrimaryStatus(primaryStatusValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledState"))
			{
				Uint16 enabledStateValue;
				property.getValue().get(enabledStateValue);
				setEnabledState(enabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "OtherEnabledState"))
			{
				String otherEnabledStateValue;
				property.getValue().get(otherEnabledStateValue);
				setOtherEnabledState(otherEnabledStateValue);
			}
			else if (String::equal(property.getName().getString(), "RequestedState"))
			{
				Uint16 requestedStateValue;
				property.getValue().get(requestedStateValue);
				setRequestedState(requestedStateValue);
			}
			else if (String::equal(property.getName().getString(), "EnabledDefault"))
			{
				Uint16 enabledDefaultValue;
				property.getValue().get(enabledDefaultValue);
				setEnabledDefault(enabledDefaultValue);
			}
			else if (String::equal(property.getName().getString(), "TimeOfLastStateChange"))
			{
				CIMDateTime timeOfLastStateChangeValue;
				property.getValue().get(timeOfLastStateChangeValue);
				setTimeOfLastStateChange(timeOfLastStateChangeValue);
			}
			else if (String::equal(property.getName().getString(), "AvailableRequestedStates"))
			{
				Array<Uint16> availableRequestedStatesValue;
				property.getValue().get(availableRequestedStatesValue);
				setAvailableRequestedStates(availableRequestedStatesValue);
			}
			else if (String::equal(property.getName().getString(), "TransitioningToState"))
			{
				Uint16 transitioningToStateValue;
				property.getValue().get(transitioningToStateValue);
				setTransitioningToState(transitioningToStateValue);
			}
			else if (String::equal(property.getName().getString(), "SystemCreationClassName"))
			{
				String systemCreationClassNameValue;
				property.getValue().get(systemCreationClassNameValue);
				setSystemCreationClassName(systemCreationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "SystemName"))
			{
				String systemNameValue;
				property.getValue().get(systemNameValue);
				setSystemName(systemNameValue);
			}
			else if (String::equal(property.getName().getString(), "CreationClassName"))
			{
				String creationClassNameValue;
				property.getValue().get(creationClassNameValue);
				setCreationClassName(creationClassNameValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryOwnerName"))
			{
				String primaryOwnerNameValue;
				property.getValue().get(primaryOwnerNameValue);
				setPrimaryOwnerName(primaryOwnerNameValue);
			}
			else if (String::equal(property.getName().getString(), "PrimaryOwnerContact"))
			{
				String primaryOwnerContactValue;
				property.getValue().get(primaryOwnerContactValue);
				setPrimaryOwnerContact(primaryOwnerContactValue);
			}
			else if (String::equal(property.getName().getString(), "StartMode"))
			{
				String startModeValue;
				property.getValue().get(startModeValue);
				setStartMode(startModeValue);
			}
			else if (String::equal(property.getName().getString(), "Started"))
			{
				Boolean startedValue;
				property.getValue().get(startedValue);
				setStarted(startedValue);
			}
			else if (String::equal(property.getName().getString(), "LoSID"))
			{
				String loSIDValue;
				property.getValue().get(loSIDValue);
				setLoSID(loSIDValue);
			}
			else if (String::equal(property.getName().getString(), "LoSOrgID"))
			{
				String loSOrgIDValue;
				property.getValue().get(loSOrgIDValue);
				setLoSOrgID(loSOrgIDValue);
			}
			else if (String::equal(property.getName().getString(), "Characteristics"))
			{
				Array<Uint16> characteristicsValue;
				property.getValue().get(characteristicsValue);
				setCharacteristics(characteristicsValue);
			}
			else if (String::equal(property.getName().getString(), "OtherCharacteristicDescription"))
			{
				String otherCharacteristicDescriptionValue;
				property.getValue().get(otherCharacteristicDescriptionValue);
				setOtherCharacteristicDescription(otherCharacteristicDescriptionValue);
			}
			else if (String::equal(property.getName().getString(), "OtherCharacteristicsDescriptions"))
			{
				Array<String> otherCharacteristicsDescriptionsValue;
				property.getValue().get(otherCharacteristicsDescriptionsValue);
				setOtherCharacteristicsDescriptions(otherCharacteristicsDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "IsInUse"))
			{
				Boolean isInUseValue;
				property.getValue().get(isInUseValue);
				setIsInUse(isInUseValue);
			}
			else if (String::equal(property.getName().getString(), "ResourcesUsed"))
			{
				Array<Uint16> resourcesUsedValue;
				property.getValue().get(resourcesUsedValue);
				setResourcesUsed(resourcesUsedValue);
			}
			else if (String::equal(property.getName().getString(), "TestTypes"))
			{
				Array<Uint16> testTypesValue;
				property.getValue().get(testTypesValue);
				setTestTypes(testTypesValue);
			}
			else if (String::equal(property.getName().getString(), "OtherTestTypesDescriptions"))
			{
				Array<String> otherTestTypesDescriptionsValue;
				property.getValue().get(otherTestTypesDescriptionsValue);
				setOtherTestTypesDescriptions(otherTestTypesDescriptionsValue);
			}
			else if (String::equal(property.getName().getString(), "CPUTestType"))
			{
				Uint16 cPUTestTypeValue;
				property.getValue().get(cPUTestTypeValue);
				setCPUTestType(cPUTestTypeValue);
			}
			else if (String::equal(property.getName().getString(), "OtherCPUTestTypeDescription"))
			{
				String otherCPUTestTypeDescriptionValue;
				property.getValue().get(otherCPUTestTypeDescriptionValue);
				setOtherCPUTestTypeDescription(otherCPUTestTypeDescriptionValue);
			}
	}
	return true;
}
Ejemplo n.º 22
0
CIMProperty ObjectNormalizer::processProperty(
    CIMConstProperty& referenceProperty,
    CIMConstProperty& instProperty,
    Boolean includeQualifiers,
    Boolean includeClassOrigin,
    NormalizerContext* context,
    const CIMNamespaceName& nameSpace)
{
    // check name
    if (!referenceProperty.getName().equal(instProperty.getName()))
    {
        MessageLoaderParms message(
            "Common.ObjectNormalizer.INVALID_PROPERTY_NAME",
            "Invalid property name: $0",
            instProperty.getName().getString());

        throw CIMException(CIM_ERR_FAILED, message);
    }

    // check type
    CIMType referencePropType = referenceProperty.getType();
    CIMType instPropType = instProperty.getType();
    if (referencePropType != instPropType)
    {
        MessageLoaderParms message(
            "Common.ObjectNormalizer.INVALID_PROPERTY_TYPE",
            "Invalid property type: $0",
            instProperty.getName().getString());

        throw CIMException(CIM_ERR_FAILED, message);
    }

    // TODO: check array size?

    CIMProperty normalizedProperty(
        referenceProperty.getName(),
        referenceProperty.getValue(),   // default value
        referenceProperty.getArraySize(),
        referenceProperty.getReferenceClassName(),
        CIMName(),
        false);

    // TODO: check override (especially for references)?

    // update value
    if (!instProperty.getValue().isNull())
    {
        normalizedProperty.setValue(instProperty.getValue());
    }

    // update class origin
    if (includeClassOrigin)
    {
        normalizedProperty.setClassOrigin(referenceProperty.getClassOrigin());
    }

    // add qualifiers
    if (includeQualifiers)
    {
        // propagate class property qualifiers
        for (Uint32 i=0, n = referenceProperty.getQualifierCount(); i < n; i++)
        {
            CIMConstQualifier referenceQualifier =
                referenceProperty.getQualifier(i);

            Uint32 pos =
                instProperty.findQualifier(referenceQualifier.getName());

            // update value if qualifier is present in the specified property
            if (pos != PEG_NOT_FOUND)
            {
                CIMConstQualifier cimQualifier = instProperty.getQualifier(pos);

                CIMQualifier normalizedQualifier =
                    _processQualifier(
                        referenceQualifier,
                        cimQualifier);

                normalizedProperty.addQualifier(normalizedQualifier);
            }
            else
            {
                normalizedProperty.addQualifier(referenceQualifier.clone());
            }
        }
    }
#ifdef PEGASUS_SNIA_INTEROP_COMPATIBILITY
    else if (referenceProperty.getType() == CIMTYPE_INSTANCE)
    {
        Uin32 refPos = referenceProperty.findQualifier(
                           PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);
        Uin32 cimPos = instProperty.findQualifier(
                           PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);
        if (refPos != PEG_NOT_FOUND && cimPos == PEG_NOT_FOUND)
        {
            instProperty.addQualifier(refProperty.getQualifier(pos));
        }
    }
#endif

    // Check the type of the embedded instance against the class specified by
    // the EmbeddedInstance qualifier. We can only do this if the context
    // is non-zero.
    if (context != 0)
    {
        if (referenceProperty.getType() == CIMTYPE_INSTANCE)
        {
            Uint32 pos = referenceProperty.findQualifier(
                             PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE);

            PEGASUS_ASSERT(pos != PEG_NOT_FOUND);

            String qualClassStr;
            referenceProperty.getQualifier(pos).getValue().get(
                qualClassStr);
            CIMName embedInstClassName(qualClassStr);
            Array<CIMName> embeddedInstSubclasses =
                context->enumerateClassNames(nameSpace, embedInstClassName,
                    true);
            embeddedInstSubclasses.append(embedInstClassName);

            Array<CIMInstance> embeddedInstances;
            if (referenceProperty.isArray())
            {
                instProperty.getValue().get(embeddedInstances);
            }
            else
            {
                CIMInstance embeddedInst;
                instProperty.getValue().get(embeddedInst);
                embeddedInstances.append(embeddedInst);
            }

            Array<CIMClass> embeddedClassDefs;
            for (Uint32 i = 0, n = embeddedInstances.size(); i < n; ++i)
            {
                CIMInstance& currentInstance = embeddedInstances[i];
                CIMName currentClassName = currentInstance.getClassName();
                if (Contains(embeddedInstSubclasses, currentClassName))
                {
                    CIMClass embeddedClassDef;
                    bool found = false;
                    for (Uint32 j = 0, m = embeddedClassDefs.size(); j < m;
                        ++j)
                    {
                        CIMClass& tmpClassDef = embeddedClassDefs[j];
                        if (tmpClassDef.getClassName() == currentClassName)
                        {
                            embeddedClassDef = tmpClassDef;
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        embeddedClassDef = context->getClass(nameSpace,
                            currentClassName);
                        embeddedClassDefs.append(embeddedClassDef);
                    }

                    SharedPtr<NormalizerContext> tmpContext(context->clone());
                    ObjectNormalizer tmpNormalizer(embeddedClassDef,
                        includeQualifiers, includeClassOrigin, nameSpace,
                        tmpContext);
                    if (currentInstance.getPath().getKeyBindings().size()==0)
                    {
                        currentInstance.setPath(
                            currentInstance.buildPath(embeddedClassDef));
                    }
                    embeddedInstances[i] =
                        tmpNormalizer.processInstance(currentInstance);
                }
                else
                {
                    MessageLoaderParms message(
                        "Common.ObjectNormalizer."
                            "INVALID_EMBEDDED_INSTANCE_TYPE",
                        "Found embedded instance of type $0: was expecting "
                            "$1 for property $2",
                        currentClassName.getString(),
                        qualClassStr,
                        instProperty.getName().getString());

                    throw CIMException(CIM_ERR_FAILED, message);
                }
            }

            if (referenceProperty.isArray())
            {
              normalizedProperty.setValue(CIMValue(embeddedInstances));
            }
            else
            {
              normalizedProperty.setValue(CIMValue(embeddedInstances[0]));
            }
        }
    }
    return normalizedProperty;
}
Ejemplo n.º 23
0
void ConfigSettingProvider::_modifyInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const CIMInstance& modifiedIns,
    const CIMPropertyList& propertyList,
    Uint32 timeoutSeconds)
    {
        PEG_METHOD_ENTER(TRC_CONFIG,
            "ConfigSettingProvider::_modifyInstance()");

        //
        // get userName
        //
        String userName;
        try
        {
            IdentityContainer container = context.get(IdentityContainer::NAME);
            userName = container.getUserName();
        }
        catch (...)
        {
            userName = String::EMPTY;
        }

        //
        // verify user authorizations
        // z/OS: authorization check is done in CIMOpReqAuth already
        //
#ifndef PEGASUS_OS_ZOS
        if (userName != String::EMPTY)
        {
            _verifyAuthorization(userName);
        }
#endif
        // NOTE: Qualifiers are not processed by this provider, so the
        // IncludeQualifiers flag is ignored.

        //
        // check if the class name requested is PG_ConfigSetting
        //
        if (!instanceReference.getClassName().equal (PG_CONFIG_SETTING))
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
                instanceReference.getClassName().getString());
        }

        //
        // validate key bindings
        //
        Array<CIMKeyBinding> kbArray = instanceReference.getKeyBindings();
        if ( (kbArray.size() != 1) ||
             (!kbArray[0].getName().equal (PROPERTY_NAME)))
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION_L(
                CIM_ERR_INVALID_PARAMETER,
                MessageLoaderParms(
                    "ControlProviders.ConfigSettingProvider."
                        "ConfigSettingProvider."
                        "INVALID_INSTANCE_NAME",
                    "Invalid instance name"));

        }

        String configPropertyName = kbArray[0].getValue();

        // Modification of the entire instance is not supported by this provider
        if (propertyList.isNull())
        {
            PEG_METHOD_EXIT();
            //l10n
            //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
            //"Modification of entire instance");
            throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
                  MessageLoaderParms(
                      "ControlProviders.ConfigSettingProvider."
                          "ConfigSettingProvider."
                          "MODIFICATION_OF_ENTIRE_INSTANCE",
                     "Modification of entire instance"));
        }

        Boolean currentValueModified = false;
        Boolean plannedValueModified = false;

        for (Uint32 i = 0; i < propertyList.size(); ++i)
        {
            CIMName propertyName = propertyList[i];
            if (propertyName.equal (CURRENT_VALUE))
            {
                currentValueModified = true;
            }
            else if (propertyName.equal (PLANNED_VALUE))
            {
                plannedValueModified = true;
            }
            else
            {
                PEG_METHOD_EXIT();

                throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
                    MessageLoaderParms(
                        "ControlProviders.ConfigSettingProvider."
                            "ConfigSettingProvider."
                            "MODIFICATION_NOT_SUPPORTED",
                        "Modification of property \"$0\"",
                        propertyName.getString()));
            }
        }

        String preValue;
        String currentValue;
        String plannedValue;
        Boolean currentValueIsNull = false;
        Boolean plannedValueIsNull = false;

        //
        // Get the current value from the instance
        //
        Uint32 pos = modifiedIns.findProperty(CURRENT_VALUE);
        if (pos == PEG_NOT_FOUND)
        {
            currentValueIsNull = true;
        }
        else
        {
            CIMConstProperty prop = modifiedIns.getProperty(pos);
            try
            {
                prop.getValue().get(currentValue);
            }
            catch (Exception& e)
            {
                PEG_METHOD_EXIT();
                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
            }
        }

        //
        // Get the planned value from the instance
        //
        pos = modifiedIns.findProperty(PLANNED_VALUE);
        if (pos == PEG_NOT_FOUND)
        {
            plannedValueIsNull = true;
        }
        else
        {
            CIMConstProperty prop = modifiedIns.getProperty(pos);
            try
            {
                prop.getValue().get(plannedValue);
            }
            catch (Exception& e)
            {
                PEG_METHOD_EXIT();
                throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
            }
        }

        try
        {
            //
            // Update the current value, if requested
            //
            if (currentValueModified)
            {
                preValue = _configManager->getCurrentValue(configPropertyName);

                if ( !_configManager->updateCurrentValue(
                    configPropertyName,
                    currentValue,
                    userName,
                    timeoutSeconds,
                    currentValueIsNull))
                {
                    PEG_METHOD_EXIT();

                    throw PEGASUS_CIM_EXCEPTION_L(
                        CIM_ERR_FAILED,
                        MessageLoaderParms(
                            "ControlProviders.ConfigSettingProvider."
                                "ConfigSettingProvider."
                                "UPDATE_CURRENT_VALUE_FAILED",
                            "Failed to update the current value."));
                }

                // It is unset, get current value which is default
                if (currentValueIsNull)
                {
                    currentValue = _configManager->getCurrentValue(
                        configPropertyName);
                }

               // send notify config change message to Handler Service
               if(String::equal(configPropertyName,
                      "maxIndicationDeliveryRetryAttempts")||
                  String::equal(configPropertyName,
                      "minIndicationDeliveryRetryInterval"))
               {
                   _sendNotifyConfigChangeMessage(
                       configPropertyName,
                       currentValue,
                       userName,
                       PEGASUS_QUEUENAME_INDHANDLERMANAGER,
                       true);
               }

                // send notify config change message to ProviderManager Service
                _sendNotifyConfigChangeMessage(
                    configPropertyName,
                    currentValue,
                    userName,
                    PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
                    true);

               PEG_AUDIT_LOG(logSetConfigProperty(userName, configPropertyName,
                   preValue, currentValue, false));
            }

            //
            // Update the planned value, if requested
            //
            if (plannedValueModified)
            {
                preValue = _configManager->getPlannedValue(configPropertyName);

                if ( !_configManager->updatePlannedValue(
                    configPropertyName, plannedValue, plannedValueIsNull) )
                {
                    PEG_METHOD_EXIT();

                    throw PEGASUS_CIM_EXCEPTION_L(
                        CIM_ERR_FAILED,
                        MessageLoaderParms(
                            "ControlProviders.ConfigSettingProvider."
                                "ConfigSettingProvider."
                                "UPDATE_PLANNED_VALUE_FAILED",
                            "Failed to update the planned value."));
                }

                // It is unset, get planned value which is default
                if (plannedValueIsNull)
                {
                    plannedValue = _configManager->getPlannedValue(
                        configPropertyName);

                    if (String::equal(configPropertyName,
                           "maxIndicationDeliveryRetryAttempts") ||
                        String::equal(configPropertyName,
                            "minIndicationDeliveryRetryInterval"))
                    {
                        _sendNotifyConfigChangeMessage(
                            configPropertyName,
                            plannedValue,
                            userName,
                            PEGASUS_QUEUENAME_INDHANDLERMANAGER,
                            false);
                    }
                }

                // send notify config change message to ProviderManager Service
                _sendNotifyConfigChangeMessage(
                    configPropertyName,
                    plannedValue,
                    userName,
                    PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP,
                    false);

               PEG_AUDIT_LOG(logSetConfigProperty(userName, configPropertyName,
                   preValue, plannedValue, true));
            }
        }
        catch (const NonDynamicConfigProperty& ndcp)
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION(
                CIM_ERR_NOT_SUPPORTED, ndcp.getMessage());
        }
        catch (const InvalidPropertyValue& ipv)
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION(
                CIM_ERR_FAILED, ipv.getMessage());
        }
        catch (const UnrecognizedConfigProperty&)
        {
            PEG_METHOD_EXIT();
            throw PEGASUS_CIM_EXCEPTION_L(
                CIM_ERR_NOT_FOUND,
                MessageLoaderParms(
                    "ControlProviders.ConfigSettingProvider."
                        "ConfigSettingProvider."
                        "CONFIG_PROPERTY_NOT_FOUND",
                    "Configuration property \"$0\"",
                    configPropertyName));
        }

        PEG_METHOD_EXIT();
        return;
    }