1 martin 1.8 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.9 //
|
3 martin 1.8 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.9 //
|
10 martin 1.8 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.9 //
|
17 martin 1.8 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.9 //
|
20 martin 1.8 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.9 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.8 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.9 //
|
28 martin 1.8 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.4 //
|
30 s.manicka 1.5 //%////////////////////////////////////////////////////////////////////////////
|
31 a.dunfey 1.1
32
33 ///////////////////////////////////////////////////////////////////////////////
34 // Interop Provider - This provider services those classes from the
35 // DMTF Interop schema in an implementation compliant with the SMI-S v1.1
36 // Server Profile
37 //
38 // Please see PG_ServerProfile20.mof in the directory
39 // $(PEGASUS_ROOT)/Schemas/Pegasus/InterOp/VER20 for retails regarding the
40 // classes supported by this control provider.
41 //
|
42 kumpf 1.10 // Interop forces all creates to the PEGASUS_NAMESPACENAME_INTEROP
43 // namespace. There is a test on each operation that returns
|
44 a.dunfey 1.1 // the Invalid Class CIMDError
45 // This is a control provider and as such uses the Tracer functions
46 // for data and function traces. Since we do not expect high volume
47 // use we added a number of traces to help diagnostics.
48 ///////////////////////////////////////////////////////////////////////////////
49
50 #include "InteropProvider.h"
51 #include "InteropProviderUtils.h"
52 #include "InteropConstants.h"
53
54 PEGASUS_USING_STD;
|
55 a.dunfey 1.2 PEGASUS_NAMESPACE_BEGIN
|
56 a.dunfey 1.1
57 //
58 // Given the two references in the association, this function creates an
59 // instance of the PG_ElementConformsToProfile class.
60 //
61 CIMInstance buildElementConformsToProfile(
62 const CIMObjectPath & currentProfile,
63 const CIMObjectPath & currentElement,
64 const CIMClass & elementConformsClass)
65 {
66 Array<CIMName> elementPropArray;
67 elementPropArray.append(
68 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
69 elementPropArray.append(
70 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
71 CIMPropertyList elementPropList(elementPropArray);
72
73 CIMInstance tmpInstance =
74 elementConformsClass.buildInstance(false, false,
75 elementPropList);
76 setPropertyValue(tmpInstance,
77 a.dunfey 1.1 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD,
78 currentProfile);
79 setPropertyValue(tmpInstance,
80 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT,
81 currentElement);
82 tmpInstance.setPath(tmpInstance.buildPath(
83 elementConformsClass));
84 return tmpInstance;
85 }
86
|
87 s.manicka 1.5 Array<CIMInstance> InteropProvider::enumElementConformsToProfileRPRPInstances(
|
88 kumpf 1.10 const OperationContext & opContext,
|
89 s.manicka 1.5 const CIMNamespaceName & opNamespace)
90 {
91 CIMClass elementConformsClass = repository->getClass(
92 PEGASUS_NAMESPACENAME_INTEROP,
93 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE_RP_RP,
94 false, true, false);
95
96 Array<CIMInstance> instances;
97 CIMObjectPath smisVersionProfile, profRegProfile;
98
99 if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
100 {
|
101 kumpf 1.10 //Add associations between the 1.2 SMIS-Version profile and all
102 //the version 1.2.0 profiles and subprofiles.
|
103 s.manicka 1.5 smisVersionProfile = buildDependencyReference(
104 hostName,
105 buildProfileInstanceId(SNIA_NAME, "SMI-S", SNIA_VER_120),
106 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
107
|
108 kumpf 1.10 Array<CIMInstance> profileInstances =
|
109 s.manicka 1.5 enumRegisteredProfileInstances();
|
110 kumpf 1.10 Array<CIMInstance> subprofileInstances =
|
111 s.manicka 1.5 enumRegisteredSubProfileInstances();
112 profileInstances.appendArray(subprofileInstances);
113 Array<CIMInstance> profilesForVersion = getProfilesForVersion(
|
114 venkat.puvvada 1.12 profileInstances, SNIA_NUM, 1, 2, 0);
|
115 s.manicka 1.5 for (Uint32 i = 0, n = profilesForVersion.size(); i < n; ++i)
116 {
117 instances.append(buildElementConformsToProfile(
118 smisVersionProfile,
|
119 kumpf 1.10 profilesForVersion[i].getPath(),
|
120 s.manicka 1.5 elementConformsClass));
121 }
122 }
123 return instances;
124 }
125
|
126 a.dunfey 1.1 //
127 // Enumerates all of the ElementConformsToProfile association instances.
128 //
129 Array<CIMInstance> InteropProvider::enumElementConformsToProfileInstances(
130 const OperationContext & opContext, const CIMNamespaceName & opNamespace)
131 {
132 CIMClass elementConformsClass = repository->getClass(
133 PEGASUS_NAMESPACENAME_INTEROP,
134 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
135 false, true, false);
136
137 AutoMutex holder(interopMut);
138 Array<CIMInstance> instances;
139 verifyCachedInfo();
140 // Loop through the cached profile Id's and related info about its
141 // conforming elements.
|
142 kumpf 1.4 for (Uint32 i = 0, n = profileIds.size(); i < n; ++i)
|
143 a.dunfey 1.1 {
144 String & profileId = profileIds[i];
145 Array<CIMName> & elementList = conformingElements[i];
146 Array<CIMNamespaceName> & namespaceList = elementNamespaces[i];
147 Array<CIMObjectPath> conformingElementPaths;
|
148 kumpf 1.4 for (Uint32 j = 0, m = elementList.size(); j < m; ++j)
|
149 a.dunfey 1.1 {
150 CIMName & currentElement = elementList[j];
151 CIMNamespaceName & currentNamespace = namespaceList[j];
152
|
153 kumpf 1.4 if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP ||
|
154 a.dunfey 1.1 opNamespace == currentNamespace)
155 {
156 String currentElementStr(currentElement.getString());
|
157 kumpf 1.4 if (currentElementStr.find(PEGASUS_DYNAMIC) == 0)
|
158 a.dunfey 1.1 {
159 // If the provider profile registration did not provide a
160 // list of conforming elements (presumably because there is
161 // no such definite list), then the provider is required
162 // to provide instances of ElementConformsToProfile in the
163 // vendor namespace, so we do not generate instances.
|
164 kumpf 1.4 if (opNamespace != PEGASUS_NAMESPACENAME_INTEROP)
|
165 a.dunfey 1.1 {
166 continue;
167 }
168 CIMName subclassName(
169 currentElementStr.subString(PEGASUS_DYNAMIC_LEN));
170 Array<CIMInstance> elementConformsInstances =
171 cimomHandle.enumerateInstances(opContext,
172 currentNamespace, subclassName, true, false, false,
173 true, CIMPropertyList());
174
175 // Retrieve the Conforming Element
|
176 kumpf 1.4 for (Uint32 k = 0, x = elementConformsInstances.size();
|
177 a.dunfey 1.1 k < x; ++k)
178 {
179 CIMInstance & currentInstance =
180 elementConformsInstances[k];
181
|
182 kumpf 1.4 // NOCHKSRC
|
183 a.dunfey 1.1 // Make sure that the current instance points to the
184 // current profile ID.
185 CIMObjectPath profilePath =
186 getRequiredValue<CIMObjectPath>(
187 elementConformsInstances[k],
188 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
|
189 kumpf 1.4 // DOCHKSRC
|
190 a.dunfey 1.1 const Array<CIMKeyBinding> & keys =
191 profilePath.getKeyBindings();
|
192 kumpf 1.4 if (keys.size() != 1)
|
193 a.dunfey 1.1 continue;
|
194 kumpf 1.4 if (keys.size() == 1 && keys[0].getValue() == profileId)
|
195 a.dunfey 1.1 {
|
196 kumpf 1.4 // NOCHKSRC
|
197 a.dunfey 1.1 conformingElementPaths.append(
198 getRequiredValue<CIMObjectPath>(
199 currentInstance,
200 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT));
|
201 kumpf 1.4 // DOCHKSRC
|
202 a.dunfey 1.1 }
203 }
204 }
205 else
206 {
207 // All of the instances of the current element in the
208 // corresponding namespace conform to the current profile.
209 Array<CIMObjectPath> paths =
210 cimomHandle.enumerateInstanceNames(opContext,
211 currentNamespace, currentElement);
212 // Set the namespace in the paths just in case
|
213 kumpf 1.4 for (Uint32 k = 0, x = paths.size();
|
214 a.dunfey 1.1 k < x; ++k)
215 {
216 CIMObjectPath & curPath = paths[k];
217 curPath.setNameSpace(currentNamespace);
218 curPath.setHost(hostName);
219 }
220 conformingElementPaths.appendArray(paths);
221 }
222 }
223 }
224
225 // Create the object path for the RegisteredProfile using the given
226 // profileId.
227 CIMObjectPath profilePath = buildDependencyReference(
228 hostName, profileIds[i], PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
229
230 // Build all of the ElementConformsToProfile instances for the current
231 // profile.
|
232 kumpf 1.4 for (Uint32 k = 0, x = conformingElementPaths.size(); k < x; ++k)
|
233 a.dunfey 1.1 {
234 instances.append(buildElementConformsToProfile(profilePath,
235 conformingElementPaths[k], elementConformsClass));
236 }
237 }
238
239 // Now add the default instance: the association between the Server Profile
240 // and the ObjectManager (if we're in the Interop namespace)
|
241 kumpf 1.4 if (opNamespace == PEGASUS_NAMESPACENAME_INTEROP)
|
242 a.dunfey 1.1 {
|
243 s.manicka 1.5 // Build up the Object Path for the server profile version 1.1.0
244 CIMObjectPath serverProfile = buildDependencyReference(
245 hostName,
|
246 a.dunfey 1.1 buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_110),
247 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
248 // Retrieve the Object Manager instance
249 CIMInstance objManager = getObjectManagerInstance();
250
|
251 s.manicka 1.5 instances.append(
252 buildElementConformsToProfile(
253 serverProfile,
|
254 kumpf 1.10 objManager.getPath(),
|
255 s.manicka 1.5 elementConformsClass));
256
257 // Build up the Object Path for the server profile ver 1.2.0
258 // and add the elementconformstoprofile association instance
259 serverProfile = buildDependencyReference(
260 hostName,
261 buildProfileInstanceId(SNIA_NAME, "Server", SNIA_VER_120),
262 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE);
263 instances.append(
264 buildElementConformsToProfile(
265 serverProfile,
|
266 kumpf 1.10 objManager.getPath(),
|
267 s.manicka 1.5 elementConformsClass));
|
268 kumpf 1.10
|
269 a.dunfey 1.1 }
|
270 s.manicka 1.5 return instances;
271 }
272
273 //Method that filters the registered profile or registered subprofile instances
|
274 venkat.puvvada 1.12 //whose versions are greater or equal to the given version.
|
275 s.manicka 1.5 Array<CIMInstance> InteropProvider::getProfilesForVersion(
276 Array<CIMInstance>& profiles,
|
277 venkat.puvvada 1.12 Uint16 regOrg,
278 Uint32 majorVer,
279 Uint32 minorVer,
280 Uint32 updateVer)
|
281 s.manicka 1.5 {
|
282 venkat.puvvada 1.12 static const String SMISProfileName("SMI-S");
|
283 venkat.puvvada 1.13 static const String SNIAIndicationProfileName("Indication");
284 static const String DMTFIndicationProfileName("Indications");
|
285 venkat.puvvada 1.12 static const String ServerProfileName("Server");
286 static const String SoftwareProfileName("Software");
287
|
288 s.manicka 1.5 Array<CIMInstance> instances;
289 instances.clear();
290 for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
291 {
292 String versionNumber;
293 String profileName;
|
294 venkat.puvvada 1.12 Uint16 regOrgNo;
295
|
296 s.manicka 1.5 Uint32 index = profiles[i].findProperty("RegisteredVersion");
297 if (index != PEG_NOT_FOUND)
298 {
299 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
300 if (!tmpVal.isNull())
301 {
302 tmpVal.get(versionNumber);
303 }
304 }
305 index = profiles[i].findProperty("RegisteredName");
306 if (index != PEG_NOT_FOUND)
307 {
308 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
309 if (!tmpVal.isNull())
310 {
311 tmpVal.get(profileName);
312 }
313 }
|
314 venkat.puvvada 1.12 index = profiles[i].findProperty("RegisteredOrganization");
315 if (index != PEG_NOT_FOUND)
316 {
317 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
318 if (!tmpVal.isNull())
319 {
320 tmpVal.get(regOrgNo);
321 }
322 }
|
323 a.dunfey 1.1
|
324 venkat.puvvada 1.12 if (regOrg == regOrgNo)
|
325 s.manicka 1.5 {
|
326 venkat.puvvada 1.12 if (profileName == ServerProfileName ||
|
327 venkat.puvvada 1.13 (regOrg == SNIA_NUM &&
328 profileName == SNIAIndicationProfileName) ||
329 (regOrg == DMTF_NUM
330 && profileName == DMTFIndicationProfileName) ||
|
331 venkat.puvvada 1.12 profileName == SoftwareProfileName)
332 {
333 if (VersionUtil::isVersionGreaterOrEqual(
334 versionNumber, majorVer, minorVer, updateVer))
335 {
336 instances.append(profiles[i]);
337 }
338 }
339 else if (profileName != SMISProfileName)
340 {
341 instances.append(profiles[i]);
342 }
|
343 s.manicka 1.5 }
344 }
|
345 a.dunfey 1.1 return instances;
346 }
347
348
349 typedef Array<String> StringArray;
350
351 void InteropProvider::verifyCachedInfo()
352 {
|
353 venkat.puvvada 1.6 if (!updateProfileCache.get())
354 {
355 return;
356 }
357 // At present cache will be rebuilt in the following conditions.
358 // (1) When instances of PG_ProviderProfileCapabilities is created
359 // or deleted.
360 // (2) When Provider and ProviderCapabilities instances
361 // are created or Provider, ProviderModule and ProviderCapabilities
362 // instance are deleted.
363 // (3) When Provider or ProviderModule is disabled or enabled.
364 AutoMutex mtx(interopMut);
365 if (updateProfileCache.get())
366 {
367 initializeNamespaces();
368 cacheProfileRegistrationInfo();
369 updateProfileCache--;
370 }
|
371 a.dunfey 1.1 }
372
373 //
374 // Function that determines in which namespaces a provider supports a given
375 // class. This information is needed to properly implement the
376 // ElementConformsToProfile association.
377 //
378 Array<String> findProviderNamespacesForElement(
379 const String & moduleName, const String & providerName,
380 const CIMName & elementClass, CIMRepository * repository,
381 Array<CIMInstance> & providerCapabilitiesInstances)
382 {
383 Array<CIMInstance> capabilities;
|
384 kumpf 1.4 if (providerCapabilitiesInstances.size() == 0)
|
385 a.dunfey 1.1 {
386 Array<CIMName> propList;
387 propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
388 propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
389 propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
390 propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
391 capabilities = repository->enumerateInstancesForClass(
392 PEGASUS_NAMESPACENAME_INTEROP,
|
393 kumpf 1.11 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
|
394 a.dunfey 1.1 }
395 else
396 {
397 capabilities = providerCapabilitiesInstances;
398 }
399
|
400 kumpf 1.4 for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
|
401 a.dunfey 1.1 {
402 CIMInstance & currentCapabilities = capabilities[i];
403 Uint32 propIndex = currentCapabilities.findProperty(
404 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
405 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
406 String currentName;
407 currentCapabilities.getProperty(propIndex).getValue().get(
408 currentName);
|
409 kumpf 1.4 if (currentName == moduleName)
|
410 a.dunfey 1.1 {
411 propIndex = currentCapabilities.findProperty(
412 PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
413 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
414 currentCapabilities.getProperty(propIndex).getValue().get(
415 currentName);
|
416 kumpf 1.4 if (currentName == providerName)
|
417 a.dunfey 1.1 {
418 propIndex = currentCapabilities.findProperty(
419 PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
420 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
421 currentCapabilities.getProperty(propIndex).getValue().get(
422 currentName);
|
423 kumpf 1.4 if (elementClass.equal(CIMName(currentName)))
|
424 a.dunfey 1.1 {
425 propIndex = currentCapabilities.findProperty(
426 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
427 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
428 Array<String> namespaces;
429 currentCapabilities.getProperty(propIndex).getValue().get(
430 namespaces);
431 return namespaces;
432 }
433 }
434 }
435 }
436
437 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
438 "Could not find provider capabilities registered for module " +
439 moduleName + ", provider " + providerName + ", and class " +
440 elementClass.getString());
441 }
442
443 //
444 // Method that caches certain profile registration information. Specifically,
445 a.dunfey 1.1 // information pertaining to the ElementConformsToProfofile association
446 // implementation is kept here.
447 //
448 void InteropProvider::cacheProfileRegistrationInfo()
449 {
450 Array<CIMInstance> instances;
451 Array<CIMInstance> providerCapabilitiesInstances;
|
452 venkat.puvvada 1.6
453 // Clear existing cache
454 profileIds.clear();
455 conformingElements.clear();
456 elementNamespaces.clear();
457
|
458 a.dunfey 1.1 // Retrieve all of the provider profile registration info
459 Array<CIMName> propList;
460 propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
461 propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
462 propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
463 propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
464 propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
465 propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
466 propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
|
467 venkat.puvvada 1.6
|
468 kumpf 1.10 Array<CIMInstance> providerProfileInstances =
|
469 venkat.puvvada 1.6 enumProviderProfileCapabilityInstances(
470 true,
471 false,
472 false,
473 CIMPropertyList(propList));
474
|
475 a.dunfey 1.1 CIMClass elementConformsClass = repository->getClass(
476 PEGASUS_NAMESPACENAME_INTEROP,
477 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
478 false, true, false);
479 CIMClass registeredProfileClass = repository->getClass(
480 PEGASUS_NAMESPACENAME_INTEROP,
481 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
482 false, true, false);
483 Array<CIMInstance> capabilities;
484
485 // Loop through the provider profile info to determine what profiles are
486 // supported by what providers, and to build the ElementConformsToProfile
487 // associations.
|
488 kumpf 1.4 for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
|
489 a.dunfey 1.1 {
490 CIMInstance & currentProfileInstance = providerProfileInstances[i];
491 String moduleName = getRequiredValue<String>(currentProfileInstance,
492 CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
493 String providerName = getRequiredValue<String>(currentProfileInstance,
494 CAPABILITIES_PROPERTY_PROVIDERNAME);
495 String profileName;
496 Uint16 profileOrganization = 0;
497 String profileVersion;
498 String organizationName;
499 Array<String> profileNames; // Not going to use this info
500 Array<String> profileVersions; // Not going to use this info
501 Array<Uint16> profileOrganizations; // Not going to use this info
502 Array<String> profileOrganizationNames; // Not going to use this info
|
503 venkat.puvvada 1.6 Array<String> providerModuleNames; // Not going to use this info
504 Array<String> providerNames; // Not going to use this info
505
|
506 a.dunfey 1.1 String profileId = extractProfileInfo(currentProfileInstance,
507 profileCapabilitiesClass,
508 registeredProfileClass,
509 profileName,
510 profileVersion,
511 profileOrganization,
512 organizationName,
513 profileNames,
514 profileVersions,
515 profileOrganizations,
516 profileOrganizationNames,
|
517 venkat.puvvada 1.6 providerModuleNames,
518 providerNames,
|
519 a.dunfey 1.1 true);
|
520 venkat.puvvada 1.6
|
521 a.dunfey 1.1 Uint32 propIndex = currentProfileInstance.findProperty(
522 PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
523
524 Array<CIMName> elementPropArray;
525 elementPropArray.append(
526 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
527 elementPropArray.append(
528 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
529 CIMPropertyList elementPropList(elementPropArray);
530
531 Array<CIMName> conformingElementsForProfile;
532 Array<CIMNamespaceName> elementNamespacesForProfile;
533
534 Array<String> elementClasses;
535 currentProfileInstance.getProperty(propIndex).getValue().get(
536 elementClasses);
|
537 kumpf 1.4 //if (propIndex == PEG_NOT_FOUND)
538 if (elementClasses.size() == 0)
|
539 a.dunfey 1.1 {
540 // Get the namespaces in which this provider operates and trim down
541 // the list of capabilities instaces to just those that are related
542 // to this one.
|
543 kumpf 1.4 if (capabilities.size() == 0)
|
544 a.dunfey 1.1 {
|
545 kumpf 1.7 Array<CIMName> capPropList;
546 capPropList.append(
|
547 a.dunfey 1.1 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
|
548 kumpf 1.7 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
549 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
550 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
|
551 a.dunfey 1.1 capabilities = repository->enumerateInstancesForClass(
552 PEGASUS_NAMESPACENAME_INTEROP,
|
553 kumpf 1.11 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
|
554 a.dunfey 1.1 }
555 Array<CIMInstance> capabilitiesForProvider;
556 Array<CIMNamespaceName> namespacesForProvider;
557 Array<CIMNameArray> subclassesForNamespace;
|
558 kumpf 1.4 for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
|
559 a.dunfey 1.1 {
560 CIMInstance & currentInstance = capabilities[j];
561 String curModuleName = getRequiredValue<String>(
562 currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
563 String curProviderName = getRequiredValue<String>(
564 currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
|
565 kumpf 1.4 if (curModuleName == moduleName &&
|
566 a.dunfey 1.1 curProviderName == providerName)
567 {
568 CIMName currentClass(getRequiredValue<String>(
569 currentInstance,
570 PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
571 capabilitiesForProvider.append(currentInstance);
572 StringArray curNamespaces =
573 getRequiredValue<StringArray>(currentInstance,
574 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
575 Sint32 z = 0;
576 Sint32 y = curNamespaces.size();
577
578 // If one of the namespaces is Interop, then continue
579 bool interopNamespaceFound = false;
|
580 kumpf 1.4 for (; z < y; ++z)
|
581 a.dunfey 1.1 {
|
582 kumpf 1.4 if (CIMNamespaceName(curNamespaces[z]) ==
|
583 a.dunfey 1.1 PEGASUS_NAMESPACENAME_INTEROP)
584 {
585 interopNamespaceFound = true;
586 break;
587 }
588 }
|
589 kumpf 1.4 if (interopNamespaceFound)
|
590 a.dunfey 1.1 continue;
591
592 // See if the current namespaces are already listed
|
593 kumpf 1.7 for (Sint32 w = 0; w < y; ++w)
|
594 a.dunfey 1.1 {
595 Sint32 foundIndex = -1;
|
596 kumpf 1.7 CIMNamespaceName curNamespace = curNamespaces[w];
|
597 a.dunfey 1.1 Uint32 k = 0;
598 Uint32 x = namespacesForProvider.size();
|
599 kumpf 1.4 for (; k < x; ++k)
|
600 a.dunfey 1.1 {
|
601 kumpf 1.4 if (curNamespace == namespacesForProvider[k])
|
602 a.dunfey 1.1 {
603 foundIndex = (Sint32)k;
604 break;
605 }
606 }
|
607 kumpf 1.4 if (foundIndex == -1)
|
608 a.dunfey 1.1 {
609 // Get all the subclasses of
610 // ElementConformsToProfile in the namespace and
611 // cache them.
612 foundIndex = namespacesForProvider.size();
|
613 kumpf 1.10 Array<CIMName> subClasses =
|
614 a.dunfey 1.1 repository->enumerateClassNames(curNamespace,
615 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
616 true);
617 subClasses.append(
618 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
619 );
620 namespacesForProvider.append(curNamespace);
621 subclassesForNamespace.append(subClasses);
622 }
623
624 // Now search to see if the current class is one of the
625 // subclasses in this namespace, and finally, if it is
626 // add it to the list
627 Array<CIMName> & subClasses =
628 subclassesForNamespace[foundIndex];
|
629 kumpf 1.4 for (k = 0, x = subClasses.size(); k < x; ++k)
|
630 a.dunfey 1.1 {
|
631 kumpf 1.4 if (subClasses[k] == currentClass)
|
632 a.dunfey 1.1 {
633 String dynamicElement = PEGASUS_DYNAMIC +
634 currentClass.getString();
635 conformingElementsForProfile.append(
636 dynamicElement);
637 elementNamespacesForProfile.append(
638 curNamespace);
639 }
640 }
641 }
642 }
643 }
644 }
645 else
646 {
647 //Array<String> elementClasses;
648 //currentProfileInstance.getProperty(propIndex).getValue().get(
649 // elementClasses);
|
650 kumpf 1.4 for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
|
651 a.dunfey 1.1 {
652 CIMName elementClass(elementClasses[j]);
653 Array<String> searchNamespaces =
654 findProviderNamespacesForElement(
655 moduleName, providerName,
656 elementClass,
657 repository,
658 providerCapabilitiesInstances);
659 Uint32 k = 0;
660 Uint32 x = searchNamespaces.size();
|
661 kumpf 1.4 for (; k < x; ++k)
|
662 a.dunfey 1.1 {
663 conformingElementsForProfile.append(elementClass);
664 elementNamespacesForProfile.append(searchNamespaces[k]);
665 }
666 }
667 }
668
669 Sint32 foundIndex = -1;
|
670 kumpf 1.4 for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
|
671 a.dunfey 1.1 {
|
672 kumpf 1.4 if (profileIds[j] == profileId)
|
673 a.dunfey 1.1 {
674 foundIndex = j;
675 break;
676 }
677 }
678
|
679 kumpf 1.4 if (foundIndex >= 0)
|
680 a.dunfey 1.1 {
681 // Append the results to already existing entries
682 conformingElements[foundIndex].appendArray(
683 conformingElementsForProfile);
684 elementNamespaces[foundIndex].appendArray(
685 elementNamespacesForProfile);
686 }
687 else
688 {
689 profileIds.append(profileId);
690 conformingElements.append(conformingElementsForProfile);
691 elementNamespaces.append(elementNamespacesForProfile);
692 }
693 }
694 }
695
|
696 a.dunfey 1.2 PEGASUS_NAMESPACE_END
|
697 a.dunfey 1.1 // END_OF_FILE
|