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