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