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 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 venkat.puvvada 1.12 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 venkat.puvvada 1.12 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 venkat.puvvada 1.12 if (regOrg == regOrgNo)
|
324 s.manicka 1.5 {
|
325 venkat.puvvada 1.12 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.11 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, 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 CIMPropertyList(propList));
470
|
471 a.dunfey 1.1 CIMClass elementConformsClass = repository->getClass(
472 PEGASUS_NAMESPACENAME_INTEROP,
473 PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE,
474 false, true, false);
475 CIMClass registeredProfileClass = repository->getClass(
476 PEGASUS_NAMESPACENAME_INTEROP,
477 PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE,
478 false, true, false);
479 Array<CIMInstance> capabilities;
480
481 // Loop through the provider profile info to determine what profiles are
482 // supported by what providers, and to build the ElementConformsToProfile
483 // associations.
|
484 kumpf 1.4 for (Uint32 i = 0, n = providerProfileInstances.size(); i < n; ++i)
|
485 a.dunfey 1.1 {
486 CIMInstance & currentProfileInstance = providerProfileInstances[i];
487 String moduleName = getRequiredValue<String>(currentProfileInstance,
488 CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
489 String providerName = getRequiredValue<String>(currentProfileInstance,
490 CAPABILITIES_PROPERTY_PROVIDERNAME);
491 String profileName;
492 Uint16 profileOrganization = 0;
493 String profileVersion;
494 String organizationName;
495 Array<String> profileNames; // Not going to use this info
496 Array<String> profileVersions; // Not going to use this info
497 Array<Uint16> profileOrganizations; // Not going to use this info
498 Array<String> profileOrganizationNames; // Not going to use this info
|
499 venkat.puvvada 1.6 Array<String> providerModuleNames; // Not going to use this info
500 Array<String> providerNames; // Not going to use this info
501
|
502 a.dunfey 1.1 String profileId = extractProfileInfo(currentProfileInstance,
503 profileCapabilitiesClass,
504 registeredProfileClass,
505 profileName,
506 profileVersion,
507 profileOrganization,
508 organizationName,
509 profileNames,
510 profileVersions,
511 profileOrganizations,
512 profileOrganizationNames,
|
513 venkat.puvvada 1.6 providerModuleNames,
514 providerNames,
|
515 a.dunfey 1.1 true);
|
516 venkat.puvvada 1.6
|
517 a.dunfey 1.1 Uint32 propIndex = currentProfileInstance.findProperty(
518 PROFILECAPABILITIES_PROPERTY_CONFORMINGELEMENTS);
519
520 Array<CIMName> elementPropArray;
521 elementPropArray.append(
522 ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD);
523 elementPropArray.append(
524 ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT);
525 CIMPropertyList elementPropList(elementPropArray);
526
527 Array<CIMName> conformingElementsForProfile;
528 Array<CIMNamespaceName> elementNamespacesForProfile;
529
530 Array<String> elementClasses;
531 currentProfileInstance.getProperty(propIndex).getValue().get(
532 elementClasses);
|
533 kumpf 1.4 //if (propIndex == PEG_NOT_FOUND)
534 if (elementClasses.size() == 0)
|
535 a.dunfey 1.1 {
536 // Get the namespaces in which this provider operates and trim down
537 // the list of capabilities instaces to just those that are related
538 // to this one.
|
539 kumpf 1.4 if (capabilities.size() == 0)
|
540 a.dunfey 1.1 {
|
541 kumpf 1.7 Array<CIMName> capPropList;
542 capPropList.append(
|
543 a.dunfey 1.1 PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME);
|
544 kumpf 1.7 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME);
545 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
546 capPropList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME);
|
547 a.dunfey 1.1 capabilities = repository->enumerateInstancesForClass(
548 PEGASUS_NAMESPACENAME_INTEROP,
|
549 kumpf 1.11 PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false);
|
550 a.dunfey 1.1 }
551 Array<CIMInstance> capabilitiesForProvider;
552 Array<CIMNamespaceName> namespacesForProvider;
553 Array<CIMNameArray> subclassesForNamespace;
|
554 kumpf 1.4 for (Uint32 j = 0, m = capabilities.size(); j < m; ++j)
|
555 a.dunfey 1.1 {
556 CIMInstance & currentInstance = capabilities[j];
557 String curModuleName = getRequiredValue<String>(
558 currentInstance, CAPABILITIES_PROPERTY_PROVIDERMODULENAME);
559 String curProviderName = getRequiredValue<String>(
560 currentInstance, CAPABILITIES_PROPERTY_PROVIDERNAME);
|
561 kumpf 1.4 if (curModuleName == moduleName &&
|
562 a.dunfey 1.1 curProviderName == providerName)
563 {
564 CIMName currentClass(getRequiredValue<String>(
565 currentInstance,
566 PROVIDERCAPABILITIES_PROPERTY_CLASSNAME));
567 capabilitiesForProvider.append(currentInstance);
568 StringArray curNamespaces =
569 getRequiredValue<StringArray>(currentInstance,
570 PROVIDERCAPABILITIES_PROPERTY_NAMESPACES);
571 Sint32 z = 0;
572 Sint32 y = curNamespaces.size();
573
574 // If one of the namespaces is Interop, then continue
575 bool interopNamespaceFound = false;
|
576 kumpf 1.4 for (; z < y; ++z)
|
577 a.dunfey 1.1 {
|
578 kumpf 1.4 if (CIMNamespaceName(curNamespaces[z]) ==
|
579 a.dunfey 1.1 PEGASUS_NAMESPACENAME_INTEROP)
580 {
581 interopNamespaceFound = true;
582 break;
583 }
584 }
|
585 kumpf 1.4 if (interopNamespaceFound)
|
586 a.dunfey 1.1 continue;
587
588 // See if the current namespaces are already listed
|
589 kumpf 1.7 for (Sint32 w = 0; w < y; ++w)
|
590 a.dunfey 1.1 {
591 Sint32 foundIndex = -1;
|
592 kumpf 1.7 CIMNamespaceName curNamespace = curNamespaces[w];
|
593 a.dunfey 1.1 Uint32 k = 0;
594 Uint32 x = namespacesForProvider.size();
|
595 kumpf 1.4 for (; k < x; ++k)
|
596 a.dunfey 1.1 {
|
597 kumpf 1.4 if (curNamespace == namespacesForProvider[k])
|
598 a.dunfey 1.1 {
599 foundIndex = (Sint32)k;
600 break;
601 }
602 }
|
603 kumpf 1.4 if (foundIndex == -1)
|
604 a.dunfey 1.1 {
605 // Get all the subclasses of
606 // ElementConformsToProfile in the namespace and
607 // cache them.
608 foundIndex = namespacesForProvider.size();
|
609 kumpf 1.10 Array<CIMName> subClasses =
|
610 a.dunfey 1.1 repository->enumerateClassNames(curNamespace,
611 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE,
612 true);
613 subClasses.append(
614 PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE
615 );
616 namespacesForProvider.append(curNamespace);
617 subclassesForNamespace.append(subClasses);
618 }
619
620 // Now search to see if the current class is one of the
621 // subclasses in this namespace, and finally, if it is
622 // add it to the list
623 Array<CIMName> & subClasses =
624 subclassesForNamespace[foundIndex];
|
625 kumpf 1.4 for (k = 0, x = subClasses.size(); k < x; ++k)
|
626 a.dunfey 1.1 {
|
627 kumpf 1.4 if (subClasses[k] == currentClass)
|
628 a.dunfey 1.1 {
629 String dynamicElement = PEGASUS_DYNAMIC +
630 currentClass.getString();
631 conformingElementsForProfile.append(
632 dynamicElement);
633 elementNamespacesForProfile.append(
634 curNamespace);
635 }
636 }
637 }
638 }
639 }
640 }
641 else
642 {
643 //Array<String> elementClasses;
644 //currentProfileInstance.getProperty(propIndex).getValue().get(
645 // elementClasses);
|
646 kumpf 1.4 for (Uint32 j = 0, m = elementClasses.size(); j < m; ++j)
|
647 a.dunfey 1.1 {
648 CIMName elementClass(elementClasses[j]);
649 Array<String> searchNamespaces =
650 findProviderNamespacesForElement(
651 moduleName, providerName,
652 elementClass,
653 repository,
654 providerCapabilitiesInstances);
655 Uint32 k = 0;
656 Uint32 x = searchNamespaces.size();
|
657 kumpf 1.4 for (; k < x; ++k)
|
658 a.dunfey 1.1 {
659 conformingElementsForProfile.append(elementClass);
660 elementNamespacesForProfile.append(searchNamespaces[k]);
661 }
662 }
663 }
664
665 Sint32 foundIndex = -1;
|
666 kumpf 1.4 for (Sint32 j = 0, m = profileIds.size(); j < m; ++j)
|
667 a.dunfey 1.1 {
|
668 kumpf 1.4 if (profileIds[j] == profileId)
|
669 a.dunfey 1.1 {
670 foundIndex = j;
671 break;
672 }
673 }
674
|
675 kumpf 1.4 if (foundIndex >= 0)
|
676 a.dunfey 1.1 {
677 // Append the results to already existing entries
678 conformingElements[foundIndex].appendArray(
679 conformingElementsForProfile);
680 elementNamespaces[foundIndex].appendArray(
681 elementNamespacesForProfile);
682 }
683 else
684 {
685 profileIds.append(profileId);
686 conformingElements.append(conformingElementsForProfile);
687 elementNamespaces.append(elementNamespacesForProfile);
688 }
689 }
690 }
691
|
692 a.dunfey 1.2 PEGASUS_NAMESPACE_END
|
693 a.dunfey 1.1 // END_OF_FILE
|