📄 elementconformstoprofile.cpp
字号:
propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_CLASSNAME); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); currentCapabilities.getProperty(propIndex).getValue().get( currentName); if(elementClass.equal(CIMName(currentName))) { propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); Array<String> namespaces; currentCapabilities.getProperty(propIndex).getValue().get( namespaces); return namespaces; } } } } throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, "Could not find provider capabilities registered for module " + moduleName + ", provider " + providerName + ", and class " + elementClass.getString());}//// Method that caches certain profile registration information. Specifically,// information pertaining to the ElementConformsToProfofile association// implementation is kept here.//void InteropProvider::cacheProfileRegistrationInfo(){ Array<CIMInstance> instances; Array<CIMInstance> providerCapabilitiesInstances; // Retrieve all of the provider profile registration info Array<CIMName> propList; propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME); propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME); propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION); propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE); propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE); propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION); propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS); Array<CIMInstance> providerProfileInstances = repository->enumerateInstancesForClass(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, true, false, false, CIMPropertyList(propList)); CIMClass elementConformsClass = repository->getClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE, false, true, false); CIMClass registeredProfileClass = repository->getClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE, false, true, false); Array<CIMInstance> capabilities; // Loop through the provider profile info to determine what profiles are // supported by what providers, and to build the ElementConformsToProfile // associations. for(Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i) { CIMInstance & currentProfileInstance = providerProfileInstances[i]; String moduleName = getRequiredValue<String>(currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME); String providerName = getRequiredValue<String>(currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERNAME); String profileName; Uint16 profileOrganization = 0; String profileVersion; String organizationName; Array<String> profileNames; // Not going to use this info Array<String> profileVersions; // Not going to use this info Array<Uint16> profileOrganizations; // Not going to use this info Array<String> profileOrganizationNames; // Not going to use this info String profileId = extractProfileInfo(currentProfileInstance, profileCapabilitiesClass, registeredProfileClass, profileName, profileVersion, profileOrganization, organizationName, profileNames, profileVersions, profileOrganizations, profileOrganizationNames, true); Uint32 propIndex = currentProfileInstance.findProperty( PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS); Array<CIMName> elementPropArray; elementPropArray.append( ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD); elementPropArray.append( ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT); CIMPropertyList elementPropList(elementPropArray); Array<CIMName> conformingElementsForProfile; Array<CIMNamespaceName> elementNamespacesForProfile; Array<String> elementClasses; currentProfileInstance.getProperty(propIndex).getValue().get( elementClasses); //if(propIndex == PEG_NOT_FOUND) if(elementClasses.size() == 0) { // Get the namespaces in which this provider operates and trim down // the list of capabilities instaces to just those that are related // to this one. String moduleName = getRequiredValue<String>( currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME); String providerName = getRequiredValue<String>( currentProfileInstance, CAPABILITIES_PROPERTY_PROVIDERNAME); if(capabilities.size() == 0) { Array<CIMName> propList; propList.append( PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME); propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME); propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME); capabilities = repository->enumerateInstancesForClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, true, false, false); } Array<CIMInstance> capabilitiesForProvider; Array<CIMNamespaceName> namespacesForProvider; Array<CIMNameArray> subclassesForNamespace; for(Uint32 j = 0, m = capabilities.size(); j < m; ++j) { CIMInstance & currentInstance = capabilities[j]; String curModuleName = getRequiredValue<String>( currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME); String curProviderName = getRequiredValue<String>( currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME); if(curModuleName == moduleName && curProviderName == providerName) { CIMName currentClass(getRequiredValue<String>( currentInstance, PROVIDERCAPABILITIES_PROPERTY_CLASSNAME)); capabilitiesForProvider.append(currentInstance); StringArray curNamespaces = getRequiredValue<StringArray>(currentInstance, PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); Sint32 z = 0; Sint32 y = curNamespaces.size(); // If one of the namespaces is Interop, then continue bool interopNamespaceFound = false; for(; z < y; ++z) { if(CIMNamespaceName(curNamespaces[z]) == PEGASUS_NAMESPACENAME_INTEROP) { interopNamespaceFound = true; break; } } if(interopNamespaceFound) continue; // See if the current namespaces are already listed for(Sint32 z = 0, y = curNamespaces.size(); z < y; ++z) { Sint32 foundIndex = -1; CIMNamespaceName curNamespace = curNamespaces[z]; Uint32 k = 0; Uint32 x = namespacesForProvider.size(); for(; k < x; ++k) { if(curNamespace == namespacesForProvider[k]) { foundIndex = (Sint32)k; break; } } if(foundIndex == -1) { // Get all the subclasses of // ElementConformsToProfile in the namespace and // cache them. foundIndex = namespacesForProvider.size(); Array<CIMName> subClasses = repository->enumerateClassNames(curNamespace, PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE, true); subClasses.append( PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE ); namespacesForProvider.append(curNamespace); subclassesForNamespace.append(subClasses); } // Now search to see if the current class is one of the // subclasses in this namespace, and finally, if it is // add it to the list Array<CIMName> & subClasses = subclassesForNamespace[foundIndex]; for(k = 0, x = subClasses.size(); k < x; ++k) { if(subClasses[k] == currentClass) { String dynamicElement = PEGASUS_DYNAMIC + currentClass.getString(); conformingElementsForProfile.append( dynamicElement); elementNamespacesForProfile.append( curNamespace); } } } } } } else { //Array<String> elementClasses; //currentProfileInstance.getProperty(propIndex).getValue().get( // elementClasses); for(Uint32 j = 0, m = elementClasses.size(); j < m; ++j) { CIMName elementClass(elementClasses[j]); Array<String> searchNamespaces = findProviderNamespacesForElement( moduleName, providerName, elementClass, repository, providerCapabilitiesInstances); Uint32 k = 0; Uint32 x = searchNamespaces.size(); for(; k < x; ++k) { conformingElementsForProfile.append(elementClass); elementNamespacesForProfile.append(searchNamespaces[k]); } } } Sint32 foundIndex = -1; for(Sint32 j = 0, m = profileIds.size(); j < m; ++j) { if(profileIds[j] == profileId) { foundIndex = j; break; } } if(foundIndex >= 0) { // Append the results to already existing entries conformingElements[foundIndex].appendArray( conformingElementsForProfile); elementNamespaces[foundIndex].appendArray( elementNamespacesForProfile); } else { profileIds.append(profileId); conformingElements.append(conformingElementsForProfile); elementNamespaces.append(elementNamespacesForProfile); } }}PEGASUS_NAMESPACE_END// END_OF_FILE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -