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 marek 1.10.2.1 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 marek 1.10.2.1 //whose versions are greater or equal to the given version.
|
275 s.manicka 1.5 Array<CIMInstance> InteropProvider::getProfilesForVersion(
276 Array<CIMInstance>& profiles,
|
277 marek 1.10.2.1 Uint16 regOrg,
278 Uint32 majorVer,
279 Uint32 minorVer,
280 Uint32 updateVer)
|
281 s.manicka 1.5 {
|
282 marek 1.10.2.1 static const String SMISProfileName("SMI-S");
283 static const String IndicationProfileName("Indication");
284 static const String ServerProfileName("Server");
285 static const String SoftwareProfileName("Software");
286
|
287 s.manicka 1.5 Array<CIMInstance> instances;
288 instances.clear();
289 for (Uint32 i = 0, n = profiles.size(); i < n; ++i)
290 {
291 String versionNumber;
292 String profileName;
|
293 marek 1.10.2.1 Uint16 regOrgNo;
294
|
295 s.manicka 1.5 Uint32 index = profiles[i].findProperty("RegisteredVersion");
296 if (index != PEG_NOT_FOUND)
297 {
298 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
299 if (!tmpVal.isNull())
300 {
301 tmpVal.get(versionNumber);
302 }
303 }
304 index = profiles[i].findProperty("RegisteredName");
305 if (index != PEG_NOT_FOUND)
306 {
307 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
308 if (!tmpVal.isNull())
309 {
310 tmpVal.get(profileName);
311 }
312 }
|
313 marek 1.10.2.1 index = profiles[i].findProperty("RegisteredOrganization");
314 if (index != PEG_NOT_FOUND)
315 {
316 const CIMValue &tmpVal = profiles[i].getProperty(index).getValue();
317 if (!tmpVal.isNull())
318 {
319 tmpVal.get(regOrgNo);
320 }
321 }
|
322 a.dunfey 1.1
|
323 marek 1.10.2.1 if (regOrg == regOrgNo)
|
324 s.manicka 1.5 {
|
325 marek 1.10.2.1 if (profileName == ServerProfileName ||
326 profileName == IndicationProfileName ||
327 profileName == SoftwareProfileName)
328 {
329 if (VersionUtil::isVersionGreaterOrEqual(
330 versionNumber, majorVer, minorVer, updateVer))
331 {
332 instances.append(profiles[i]);
333 }
334 }
335 else if (profileName != SMISProfileName)
336 {
337 instances.append(profiles[i]);
338 }
|
339 s.manicka 1.5 }
340 }
|
341 a.dunfey 1.1 return instances;
342 }
343
344
345 typedef Array<String> StringArray;
346
347 void InteropProvider::verifyCachedInfo()
348 {
|
349 venkat.puvvada 1.6 if (!updateProfileCache.get())
350 {
351 return;
352 }
353 // At present cache will be rebuilt in the following conditions.
354 // (1) When instances of PG_ProviderProfileCapabilities is created
355 // or deleted.
356 // (2) When Provider and ProviderCapabilities instances
357 // are created or Provider, ProviderModule and ProviderCapabilities
358 // instance are deleted.
359 // (3) When Provider or ProviderModule is disabled or enabled.
360 AutoMutex mtx(interopMut);
361 if (updateProfileCache.get())
362 {
363 initializeNamespaces();
364 cacheProfileRegistrationInfo();
365 updateProfileCache--;
366 }
|
367 a.dunfey 1.1 }
368
369 //
370 // Function that determines in which namespaces a provider supports a given
371 // class. This information is needed to properly implement the
372 // ElementConformsToProfile association.
373 //
374 Array<String> findProviderNamespacesForElement(
375 const String & moduleName, const String & providerName,
376 const CIMName & elementClass, CIMRepository * repository,
377 Array<CIMInstance> & providerCapabilitiesInstances)
378 {
379 Array<CIMInstance> capabilities;
|
380 kumpf 1.4 if (providerCapabilitiesInstances.size() == 0)
|
381 a.dunfey 1.1 {
382 Array<CIMName> propList;
383 propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
384 propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
385 propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
386 propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
387 capabilities = repository->enumerateInstancesForClass(
388 PEGASUS_NAMESPACENAME_INTEROP,
|
389 kumpf 1.3 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false);
|
390 a.dunfey 1.1 }
391 else
392 {
393 capabilities = providerCapabilitiesInstances;
394 }
395
|
396 kumpf 1.4 for (Uint32 i = 0, n = capabilities.size(); i < n; ++i)
|
397 a.dunfey 1.1 {
398 CIMInstance & currentCapabilities = capabilities[i];
399 Uint32 propIndex = currentCapabilities.findProperty(
400 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
401 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
402 String currentName;
403 currentCapabilities.getProperty(propIndex).getValue().get(
404 currentName);
|
405 kumpf 1.4 if (currentName == moduleName)
|
406 a.dunfey 1.1 {
407 propIndex = currentCapabilities.findProperty(
408 PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
409 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
410 currentCapabilities.getProperty(propIndex).getValue().get(
411 currentName);
|
412 kumpf 1.4 if (currentName == providerName)
|
413 a.dunfey 1.1 {
414 propIndex = currentCapabilities.findProperty(
415 PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
416 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
417 currentCapabilities.getProperty(propIndex).getValue().get(
418 currentName);
|
419 kumpf 1.4 if (elementClass.equal(CIMName(currentName)))
|
420 a.dunfey 1.1 {
421 propIndex = currentCapabilities.findProperty(
422 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
423 PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND);
424 Array<String> namespaces;
425 currentCapabilities.getProperty(propIndex).getValue().get(
426 namespaces);
427 return namespaces;
428 }
429 }
430 }
431 }
432
433 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND,
434 "Could not find provider capabilities registered for module " +
435 moduleName + ", provider " + providerName + ", and class " +
436 elementClass.getString());
437 }
438
439 //
440 // Method that caches certain profile registration information. Specifically,
441 a.dunfey 1.1 // information pertaining to the ElementConformsToProfofile association
442 // implementation is kept here.
443 //
444 void InteropProvider::cacheProfileRegistrationInfo()
445 {
446 Array<CIMInstance> instances;
447 Array<CIMInstance> providerCapabilitiesInstances;
|
448 venkat.puvvada 1.6
449 // Clear existing cache
450 profileIds.clear();
451 conformingElements.clear();
452 elementNamespaces.clear();
453
|
454 a.dunfey 1.1 // Retrieve all of the provider profile registration info
455 Array<CIMName> propList;
456 propList.append(CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
457 propList.append(CAPABILITIES_PROPERTY_PROVIDERNAME);
458 propList.append(PROFILECAPABILITIES_PROPERTY_PROFILEVERSION);
459 propList.append(PROFILECAPABILITIES_PROPERTY_REGISTEREDPROFILE);
460 propList.append(PROFILECAPABILITIES_PROPERTY_OTHERREGISTEREDPROFILE);
461 propList.append(PROFILECAPABILITIES_PROPERTY_OTHERPROFILEORGANIZATION);
462 propList.append(PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
|
463 venkat.puvvada 1.6
|
464 kumpf 1.10 Array<CIMInstance> providerProfileInstances =
|
465 venkat.puvvada 1.6 enumProviderProfileCapabilityInstances(
466 true,
467 false,
468 false,
469 false,
470 CIMPropertyList(propList));
471
|
472 a.dunfey 1.1 CIMClass elementConformsClass = repository->getClass(
473 PEGASUS_NAMESPACENAME_INTEROP,
474 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
475 false, true, false);
476 CIMClass registeredProfileClass = repository->getClass(
477 PEGASUS_NAMESPACENAME_INTEROP,
478 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
479 false, true, false);
480 Array<CIMInstance> capabilities;
481
482 // Loop through the provider profile info to determine what profiles are
483 // supported by what providers, and to build the ElementConformsToProfile
484 // associations.
|
485 kumpf 1.4 for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
|
486 a.dunfey 1.1 {
487 CIMInstance & currentProfileInstance = providerProfileInstances[i];
488 String moduleName = getRequiredValue<String>(currentProfileInstance,
489 CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
490 String providerName = getRequiredValue<String>(currentProfileInstance,
491 CAPABILITIES_PROPERTY_PROVIDERNAME);
492 String profileName;
493 Uint16 profileOrganization = 0;
494 String profileVersion;
495 String organizationName;
496 Array<String> profileNames; // Not going to use this info
497 Array<String> profileVersions; // Not going to use this info
498 Array<Uint16> profileOrganizations; // Not going to use this info
499 Array<String> profileOrganizationNames; // Not going to use this info
|
500 venkat.puvvada 1.6 Array<String> providerModuleNames; // Not going to use this info
501 Array<String> providerNames; // Not going to use this info
502
|
503 a.dunfey 1.1 String profileId = extractProfileInfo(currentProfileInstance,
504 profileCapabilitiesClass,
505 registeredProfileClass,
506 profileName,
507 profileVersion,
508 profileOrganization,
509 organizationName,
510 profileNames,
511 profileVersions,
512 profileOrganizations,
513 profileOrganizationNames,
|
514 venkat.puvvada 1.6 providerModuleNames,
515 providerNames,
|
516 a.dunfey 1.1 true);
|
517 venkat.puvvada 1.6
|
518 a.dunfey 1.1 Uint32 propIndex = currentProfileInstance.findProperty(
519 PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
520
521 Array<CIMName> elementPropArray;
522 elementPropArray.append(
523 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
524 elementPropArray.append(
525 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
526 CIMPropertyList elementPropList(elementPropArray);
527
528 Array<CIMName> conformingElementsForProfile;
529 Array<CIMNamespaceName> elementNamespacesForProfile;
530
531 Array<String> elementClasses;
532 currentProfileInstance.getProperty(propIndex).getValue().get(
533 elementClasses);
|
534 kumpf 1.4 //if (propIndex == PEG_NOT_FOUND)
535 if (elementClasses.size() == 0)
|
536 a.dunfey 1.1 {
537 // Get the namespaces in which this provider operates and trim down
538 // the list of capabilities instaces to just those that are related
539 // to this one.
|
540 kumpf 1.4 if (capabilities.size() == 0)
|
541 a.dunfey 1.1 {
|
542 kumpf 1.7 Array<CIMName> capPropList;
543 capPropList.append(
|
544 a.dunfey 1.1 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
|
545 kumpf 1.7 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
546 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
547 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
|
548 a.dunfey 1.1 capabilities = repository->enumerateInstancesForClass(
549 PEGASUS_NAMESPACENAME_INTEROP,
|
550 kumpf 1.3 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false,
|
551 a.dunfey 1.1 false);
552 }
553 Array<CIMInstance> capabilitiesForProvider;
554 Array<CIMNamespaceName> namespacesForProvider;
555 Array<CIMNameArray> subclassesForNamespace;
|
556 kumpf 1.4 for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
|
557 a.dunfey 1.1 {
558 CIMInstance & currentInstance = capabilities[j];
559 String curModuleName = getRequiredValue<String>(
560 currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
561 String curProviderName = getRequiredValue<String>(
562 currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
|
563 kumpf 1.4 if (curModuleName == moduleName &&
|
564 a.dunfey 1.1 curProviderName == providerName)
565 {
566 CIMName currentClass(getRequiredValue<String>(
567 currentInstance,
568 PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
569 capabilitiesForProvider.append(currentInstance);
570 StringArray curNamespaces =
571 getRequiredValue<StringArray>(currentInstance,
572 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
573 Sint32 z = 0;
574 Sint32 y = curNamespaces.size();
575
576 // If one of the namespaces is Interop, then continue
577 bool interopNamespaceFound = false;
|
578 kumpf 1.4 for (; z < y; ++z)
|
579 a.dunfey 1.1 {
|
580 kumpf 1.4 if (CIMNamespaceName(curNamespaces[z]) ==
|
581 a.dunfey 1.1 PEGASUS_NAMESPACENAME_INTEROP)
582 {
583 interopNamespaceFound = true;
584 break;
585 }
586 }
|
587 kumpf 1.4 if (interopNamespaceFound)
|
588 a.dunfey 1.1 continue;
589
590 // See if the current namespaces are already listed
|
591 kumpf 1.7 for (Sint32 w = 0; w < y; ++w)
|
592 a.dunfey 1.1 {
593 Sint32 foundIndex = -1;
|
594 kumpf 1.7 CIMNamespaceName curNamespace = curNamespaces[w];
|
595 a.dunfey 1.1 Uint32 k = 0;
596 Uint32 x = namespacesForProvider.size();
|
597 kumpf 1.4 for (; k < x; ++k)
|
598 a.dunfey 1.1 {
|
599 kumpf 1.4 if (curNamespace == namespacesForProvider[k])
|
600 a.dunfey 1.1 {
601 foundIndex = (Sint32)k;
602 break;
603 }
604 }
|
605 kumpf 1.4 if (foundIndex == -1)
|
606 a.dunfey 1.1 {
607 // Get all the subclasses of
608 // ElementConformsToProfile in the namespace and
609 // cache them.
610 foundIndex = namespacesForProvider.size();
|
611 kumpf 1.10 Array<CIMName> subClasses =
|
612 a.dunfey 1.1 repository->enumerateClassNames(curNamespace,
613 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
614 true);
615 subClasses.append(
616 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
617 );
618 namespacesForProvider.append(curNamespace);
619 subclassesForNamespace.append(subClasses);
620 }
621
622 // Now search to see if the current class is one of the
623 // subclasses in this namespace, and finally, if it is
624 // add it to the list
625 Array<CIMName> & subClasses =
626 subclassesForNamespace[foundIndex];
|
627 kumpf 1.4 for (k = 0, x = subClasses.size(); k < x; ++k)
|
628 a.dunfey 1.1 {
|
629 kumpf 1.4 if (subClasses[k] == currentClass)
|
630 a.dunfey 1.1 {
631 String dynamicElement = PEGASUS_DYNAMIC +
632 currentClass.getString();
633 conformingElementsForProfile.append(
634 dynamicElement);
635 elementNamespacesForProfile.append(
636 curNamespace);
637 }
638 }
639 }
640 }
641 }
642 }
643 else
644 {
645 //Array<String> elementClasses;
646 //currentProfileInstance.getProperty(propIndex).getValue().get(
647 // elementClasses);
|
648 kumpf 1.4 for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
|
649 a.dunfey 1.1 {
650 CIMName elementClass(elementClasses[j]);
651 Array<String> searchNamespaces =
652 findProviderNamespacesForElement(
653 moduleName, providerName,
654 elementClass,
655 repository,
656 providerCapabilitiesInstances);
657 Uint32 k = 0;
658 Uint32 x = searchNamespaces.size();
|
659 kumpf 1.4 for (; k < x; ++k)
|
660 a.dunfey 1.1 {
661 conformingElementsForProfile.append(elementClass);
662 elementNamespacesForProfile.append(searchNamespaces[k]);
663 }
664 }
665 }
666
667 Sint32 foundIndex = -1;
|
668 kumpf 1.4 for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
|
669 a.dunfey 1.1 {
|
670 kumpf 1.4 if (profileIds[j] == profileId)
|
671 a.dunfey 1.1 {
672 foundIndex = j;
673 break;
674 }
675 }
676
|
677 kumpf 1.4 if (foundIndex >= 0)
|
678 a.dunfey 1.1 {
679 // Append the results to already existing entries
680 conformingElements[foundIndex].appendArray(
681 conformingElementsForProfile);
682 elementNamespaces[foundIndex].appendArray(
683 elementNamespacesForProfile);
684 }
685 else
686 {
687 profileIds.append(profileId);
688 conformingElements.append(conformingElementsForProfile);
689 elementNamespaces.append(elementNamespacesForProfile);
690 }
691 }
692 }
693
|
694 a.dunfey 1.2 PEGASUS_NAMESPACE_END
|
695 a.dunfey 1.1 // END_OF_FILE
|