⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registeredprofile.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    //    for(i = 0, n = defaultSniaProfiles.size(); i < n; ++i)    {        if(isRequiresProfileOperation)        {            static String serverProfileId(buildProfileInstanceId(                SNIA_NAME, "Server", SNIA_VER_110));            String subprofileId = buildProfileInstanceId(                SNIA_NAME, defaultSniaProfiles[i], SNIA_VER_110);            String compoundId = serverProfileId + ":" + subprofileId;            bool unique = true;            for(Uint32 k = 0, x = instanceIDs.size(); k < x; ++k)            {                if(instanceIDs[k] == compoundId)                {                    unique = false;                    break;                }            }            if(unique)            {                instances.append(buildDependencyInstance(                    serverProfileId, PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,                    subprofileId,                    PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,                    subprofileReqProfileClass));            }        }        else        {                // We always have the Indication Subprofile                const String & currentProfile = defaultSniaProfiles[i];                String instanceId = buildProfileInstanceId(SNIA_NAME,                    defaultSniaProfiles[i], SNIA_VER_110);                bool defaultProfileUnique = true;                for(Uint32 j = 0, m = instanceIDs.size(); j < m; ++j)                {                    if(instanceIDs[j] == instanceId)                    {                        defaultProfileUnique = false;                        break;                    }                }                if(defaultProfileUnique)                {                    instances.append(buildRegisteredProfile(instanceId,                        currentProfile, SNIA_VER_110, 11 /*"SNIA"*/, String::EMPTY,                        registeredProfileClass));                    instanceIDs.append(instanceId);                }        }    }    return instances;}//// Retrieve the RegisteredProfile instances, making use of the generic// getProfileInstances function above.//Array<CIMInstance> InteropProvider::enumRegisteredProfileInstances(){    static String serverProfileName("Server");    Array<String> defaultSubprofiles;    defaultSubprofiles.append(serverProfileName);    return getProfileInstances(PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,        defaultSubprofiles);}const String indicationProfileName("Indication");const String softwareProfileName("Software");//// Retrieve the RegisteredSubProfile instances, making use of the generic// getProfileInstances function above.//Array<CIMInstance> InteropProvider::enumRegisteredSubProfileInstances(){    Array<String> defaultSubprofiles;    defaultSubprofiles.append(indicationProfileName);    defaultSubprofiles.append(softwareProfileName);    return getProfileInstances(PEGASUS_CLASSNAME_PG_REGISTEREDSUBPROFILE,        defaultSubprofiles);}//// Retrieve the SubProfileRequiresProfile instances, making use of the generic// getProfileInstances function above.//Array<CIMInstance> InteropProvider::enumSubProfileRequiresProfileInstances(){    Array<String> defaultSubprofiles;    defaultSubprofiles.append(indicationProfileName);    defaultSubprofiles.append(softwareProfileName);    return getProfileInstances(PEGASUS_CLASSNAME_PG_SUBPROFILEREQUIRESPROFILE,        defaultSubprofiles);}Array<CIMInstance> InteropProvider::enumReferencedProfileInstances(){    Array<CIMInstance> instances;    //    // Retrieve all of the ProviderReferencedProfiles provider registration    // instances. Those instances contain the lists used to create the    // ReferencedProfiles associations.    //    Array<CIMInstance> referencedProfiles = repository->enumerateInstancesForClass(        PEGASUS_NAMESPACENAME_INTEROP,        PEGASUS_CLASSNAME_PG_PROVIDERREFERENCEDPROFILES);    CIMClass providerRefProfileClass = repository->getClass(            PEGASUS_NAMESPACENAME_INTEROP,            PEGASUS_CLASSNAME_PG_PROVIDERREFERENCEDPROFILES,            false, true, false);    CIMClass referencedProfileClass = repository->getClass(            PEGASUS_NAMESPACENAME_INTEROP,            PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE,            false, true, false);    Array<String> instanceIds;    for(unsigned int i = 0, n = referencedProfiles.size(); i < n; ++i)    {        //        // Retrieve the required properties linking profile instances via        // this association.        //        CIMInstance & currentReferencedProfile = referencedProfiles[i];        Array<Uint16> registeredProfiles = getRequiredValue<Array<Uint16> >(            currentReferencedProfile,            REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILES);        Array<Uint16> dependentProfiles = getRequiredValue<Array<Uint16> >(            currentReferencedProfile,            REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILES);        Array<String> profileVersions = getRequiredValue<Array<String> >(            currentReferencedProfile,            REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILEVERSIONS);        Array<String> dependentVersions = getRequiredValue<Array<String> >(            currentReferencedProfile,            REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILEVERSIONS);        Uint32 m = registeredProfiles.size();        if(m != dependentProfiles.size() || m != profileVersions.size() ||            m != dependentVersions.size())        {            throw CIMOperationFailedException(                currentReferencedProfile.getPath().toString() +                " mismatch in num values between corresponding properties");        }        //        // Retrieve the "other" information about profiles. This is used when        // a provider supports a profile not currently listed in the Pegasus        // provider registration schema.        //        Uint32 otherProfilesIndex = 0;        Uint32 otherDependentsIndex = 0;        Uint32 numOtherProfiles = 0;        Uint32 numOtherDependents = 0;        Array<String> otherProfiles;        Array<String> otherDependentProfiles;        Array<String> otherProfileOrganizations;        Array<String> otherDependentOrganizations;        Uint32 index = currentReferencedProfile.findProperty(            REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILES);        if(index != PEG_NOT_FOUND)        {            currentReferencedProfile.getProperty(index).getValue().get(                otherProfiles);            numOtherProfiles = otherProfiles.size();        }        index = currentReferencedProfile.findProperty(            REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILES);        if(index != PEG_NOT_FOUND)        {            currentReferencedProfile.getProperty(index).getValue().get(                otherDependentProfiles);            numOtherDependents = otherDependentProfiles.size();        }        index = currentReferencedProfile.findProperty(            REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILEORGANIZATIONS);        if(index != PEG_NOT_FOUND)        {            currentReferencedProfile.getProperty(index).getValue().get(                otherProfileOrganizations);        }        index = currentReferencedProfile.findProperty(            REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILEORGANIZATIONS);        if(index != PEG_NOT_FOUND)        {            currentReferencedProfile.getProperty(index).getValue().get(                otherDependentOrganizations);        }        if(otherDependentOrganizations.size() != numOtherDependents ||            otherProfileOrganizations.size() != numOtherProfiles)        {            throw CIMOperationFailedException(                currentReferencedProfile.getPath().toString() +                " mismatch in num values between corresponding properties");        }        //        // Loop through the registered profile and dependent profile        // information gathered above.        //        for(Uint32 j = 0; j < m; ++j)        {            Uint16 currentProfile = registeredProfiles[j];            Uint16 currentDependent = dependentProfiles[j];            String profileName;            String dependentName;            String profileOrgName;            String dependentOrgName;            //            // Get information about the scoping/antecedent profile            //            if(currentProfile == 0) // Other            {                if(otherProfilesIndex == numOtherProfiles)                {                    throw CIMOperationFailedException(                        currentReferencedProfile.getPath().toString() +                        " not enough entries in property " +                        REFERENCEDPROFILES_PROPERTY_OTHERREGISTEREDPROFILES.                            getString());                }                profileName = otherProfiles[otherProfilesIndex];                profileOrgName =                    otherProfileOrganizations[otherProfilesIndex++];            }            else            {                profileName = translateValue(currentProfile,                    REFERENCEDPROFILES_PROPERTY_REGISTEREDPROFILES,                    VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME,                    providerRefProfileClass);                Uint32 index = profileName.find(Char16(':'));                PEGASUS_ASSERT(index != PEG_NOT_FOUND);                profileOrgName = profileName.subString(0, index);                profileName = profileName.subString(index+1);            }            //            // Get information about the referencing/dependent profile            //            if(currentDependent == 0) // Other            {                if(otherDependentsIndex == numOtherDependents)                {                    throw CIMOperationFailedException(                        currentReferencedProfile.getPath().toString() +                        " not enough entries in property " +                        REFERENCEDPROFILES_PROPERTY_OTHERDEPENDENTPROFILES.                            getString());                }                dependentName = otherDependentProfiles[otherDependentsIndex];                dependentOrgName =                    otherDependentOrganizations[otherDependentsIndex++];            }            else            {                dependentName = translateValue(currentProfile,                    REFERENCEDPROFILES_PROPERTY_DEPENDENTPROFILES,                    VALUEMAP_QUALIFIERNAME, VALUES_QUALIFIERNAME,                    providerRefProfileClass);                Uint32 index = dependentName.find(Char16(':'));                PEGASUS_ASSERT(index != PEG_NOT_FOUND);                dependentOrgName = dependentName.subString(0, index);                dependentName = dependentName.subString(index+1);            }            //            // Create the instanceID's for the profile and dependent profile            // and determine if this ReferencedProfile association is unique            // or if it's already been created.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -