1 martin 1.36 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.37 //
|
3 martin 1.36 // 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.37 //
|
10 martin 1.36 // 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.37 //
|
17 martin 1.36 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.37 //
|
20 martin 1.36 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.37 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.36 // 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.37 //
|
28 martin 1.36 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32
33 ///////////////////////////////////////////////////////////////////////////////
|
34 chip 1.20 //
|
35 mike 1.2 // This file has implementation for the default property owner class.
36 //
37 ///////////////////////////////////////////////////////////////////////////////
38
39 #include "DefaultPropertyOwner.h"
|
40 yi.zhou 1.26 #include "ConfigManager.h"
41 #include <Pegasus/Common/AuditLogger.h>
|
42 kavita.gupta 1.30 #include <Pegasus/Common/StringConversion.h>
|
43 kavita.gupta 1.35 #include <Pegasus/Common/HTTPAcceptor.h>
44 #include <Pegasus/Common/HTTPConnection.h>
|
45 venkat.puvvada 1.42 #include <Pegasus/Common/CIMMessage.h>
46 #include <Pegasus/Common/CIMNameCast.h>
|
47 marek 1.47 #include <Pegasus/Common/HostAddress.h>
|
48 marek 1.49 #include "ConfigExceptions.h"
|
49 marek 1.47
|
50 mike 1.2
51 PEGASUS_USING_STD;
52
53 PEGASUS_NAMESPACE_BEGIN
54
55
56 ///////////////////////////////////////////////////////////////////////////////
57 // DefaultPropertyOwner
58 //
|
59 chip 1.20 // When a new property is added with the default owner, make sure to add
60 // the property name and the default attributes of that property in
|
61 mike 1.2 // the table below.
62 ///////////////////////////////////////////////////////////////////////////////
63
64 static struct ConfigPropertyRow properties[] =
65 {
|
66 kumpf 1.14 #include "DefaultPropertyTable.h"
|
67 mike 1.2 };
68
69 const Uint32 NUM_PROPERTIES = sizeof(properties) / sizeof(properties[0]);
70
71
72 /** Constructors */
73 DefaultPropertyOwner::DefaultPropertyOwner()
74 {
|
75 a.arora 1.17 _configProperties.reset(new ConfigProperty[NUM_PROPERTIES]);
|
76 mike 1.2 }
77
78
79 /**
|
80 kumpf 1.27 Initialize the config properties.
|
81 mike 1.2 */
82 void DefaultPropertyOwner::initialize()
83 {
84 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
85 {
|
86 a.arora 1.17 (_configProperties.get())[i].propertyName = properties[i].propertyName;
87 (_configProperties.get())[i].defaultValue = properties[i].defaultValue;
88 (_configProperties.get())[i].currentValue = properties[i].defaultValue;
89 (_configProperties.get())[i].plannedValue = properties[i].defaultValue;
90 (_configProperties.get())[i].dynamic = properties[i].dynamic;
|
91 kumpf 1.27 (_configProperties.get())[i].externallyVisible =
92 properties[i].externallyVisible;
|
93 mike 1.2 }
94 }
95
96
|
97 chip 1.20 /**
|
98 kumpf 1.27 Get information about the specified property.
|
99 mike 1.2 */
100 void DefaultPropertyOwner::getPropertyInfo(
|
101 chip 1.20 const String& name,
|
102 vijay.eli 1.23 Array<String>& propertyInfo) const
|
103 mike 1.2 {
104 propertyInfo.clear();
105
106 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
107 {
|
108 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
109 mike 1.2 {
|
110 kumpf 1.27 propertyInfo.append(_configProperties.get()[i].propertyName);
111 propertyInfo.append(_configProperties.get()[i].defaultValue);
112 propertyInfo.append(_configProperties.get()[i].currentValue);
113 propertyInfo.append(_configProperties.get()[i].plannedValue);
|
114 karl 1.48
|
115 kumpf 1.27 if (_configProperties.get()[i].dynamic)
|
116 kumpf 1.15 {
117 propertyInfo.append(STRING_TRUE);
118 }
119 else
120 {
121 propertyInfo.append(STRING_FALSE);
122 }
|
123 karl 1.48
|
124 kumpf 1.27 if (_configProperties.get()[i].externallyVisible)
|
125 mike 1.2 {
126 propertyInfo.append(STRING_TRUE);
127 }
128 else
129 {
130 propertyInfo.append(STRING_FALSE);
131 }
|
132 karl 1.48
133 propertyInfo.append(getPropertyHelp(name));
134
|
135 mike 1.2 return;
136 }
137 }
138
139 //
140 // specified property name is not found
141 //
142 throw UnrecognizedConfigProperty(name);
143 }
144
|
145 chip 1.20 /**
|
146 kumpf 1.27 Get default value of the specified property
|
147 mike 1.2 */
|
148 vijay.eli 1.23 String DefaultPropertyOwner::getDefaultValue(const String& name) const
|
149 mike 1.2 {
150 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
151 {
|
152 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
153 mike 1.2 {
|
154 kumpf 1.27 return _configProperties.get()[i].defaultValue;
|
155 mike 1.2 }
156 }
157
158 //
159 // Specified property name could not be found
160 //
161 throw UnrecognizedConfigProperty(name);
162 }
163
|
164 chip 1.20 /**
|
165 kumpf 1.27 Get current value of the specified property
|
166 mike 1.2 */
|
167 vijay.eli 1.23 String DefaultPropertyOwner::getCurrentValue(const String& name) const
|
168 mike 1.2 {
169 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
170 {
|
171 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
172 mike 1.2 {
|
173 marek 1.47 if (String::equalNoCase(name, "hostname"))
174 {
175 if (0 == _configProperties.get()[i].currentValue.size())
176 {
177 _configProperties.get()[i].currentValue=
178 System::getHostName();
179 }
180 }
181 if (String::equalNoCase(name, "fullyQualifiedHostName"))
182 {
183 if (0 == _configProperties.get()[i].currentValue.size())
184 {
185 _configProperties.get()[i].currentValue=
186 System::getFullyQualifiedHostName();
187 }
188 }
|
189 venkat.puvvada 1.44 if (String::equalNoCase(name, "maxProviderProcesses") ||
190 String::equalNoCase(name, "maxFailedProviderModuleRestarts"))
|
191 kavita.gupta 1.33 {
|
192 venkat.puvvada 1.44 AutoMutex lock(_dynamicConfigPropertyMutex);
|
193 kavita.gupta 1.33 return _configProperties.get()[i].currentValue;
194 }
195 else
196 {
197 return _configProperties.get()[i].currentValue;
198 }
|
199 mike 1.2 }
200 }
201
202 //
203 // Specified property name could not be found
204 //
205 throw UnrecognizedConfigProperty(name);
206 }
207
|
208 chip 1.20 /**
|
209 kumpf 1.27 Get planned value of the specified property
|
210 mike 1.2 */
|
211 vijay.eli 1.23 String DefaultPropertyOwner::getPlannedValue(const String& name) const
|
212 mike 1.2 {
213 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
214 {
|
215 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
216 mike 1.2 {
|
217 kumpf 1.27 return _configProperties.get()[i].plannedValue;
|
218 mike 1.2 }
219 }
220
221 //
222 // Specified property name could not be found
223 //
224 throw UnrecognizedConfigProperty(name);
225 }
226
|
227 chip 1.20 /**
|
228 kumpf 1.27 Init current value of the specified property to the specified value
|
229 mike 1.2 */
230 void DefaultPropertyOwner::initCurrentValue(
|
231 chip 1.20 const String& name,
|
232 mike 1.2 const String& value)
233 {
|
234 kavita.gupta 1.35 Uint32 index;
235 for (index = 0; index < NUM_PROPERTIES; index++)
|
236 mike 1.2 {
|
237 kavita.gupta 1.41 if (String::equal(
|
238 kavita.gupta 1.35 _configProperties.get()[index].propertyName,
239 name))
|
240 mike 1.2 {
|
241 venkat.puvvada 1.44 if (String::equalNoCase(name, "maxProviderProcesses") ||
242 String::equalNoCase(name, "maxFailedProviderModuleRestarts"))
|
243 kavita.gupta 1.33 {
|
244 venkat.puvvada 1.44 AutoMutex lock(_dynamicConfigPropertyMutex);
|
245 kavita.gupta 1.35 _configProperties.get()[index].currentValue = value;
|
246 kavita.gupta 1.33 }
|
247 marek 1.47 else if (String::equalNoCase(name, "hostname"))
248 {
249 if (0 == value.size())
250 {
251 _configProperties.get()[index].currentValue=
252 System::getHostName();
253 }
254 else
255 {
256 System::setHostName(value);
257 _configProperties.get()[index].currentValue=value;
258 }
259
260 }
261 else if (String::equalNoCase(name, "fullyQualifiedHostName"))
262 {
263 if (0 == value.size())
264 {
265 _configProperties.get()[index].currentValue=
266 System::getFullyQualifiedHostName();
267 }
268 marek 1.47 else
269 {
270 System::setFullyQualifiedHostName(value);
271 _configProperties.get()[index].currentValue=value;
272 }
273 }
|
274 kavita.gupta 1.33 else
275 {
|
276 kavita.gupta 1.35 _configProperties.get()[index].currentValue = value;
|
277 kavita.gupta 1.33 }
|
278 kavita.gupta 1.35 break;
|
279 mike 1.2 }
280 }
281
|
282 kavita.gupta 1.35 if (index >= NUM_PROPERTIES)
283 {
284 //
|
285 kumpf 1.38 // Specified property name could not be found
|
286 kavita.gupta 1.35 //
287 throw UnrecognizedConfigProperty(name);
288 }
289 else if (String::equal(name, "idleConnectionTimeout"))
|
290 kumpf 1.38 {
|
291 kavita.gupta 1.35 Uint64 v;
292 StringConversion::decimalStringToUint64(value.getCString(), v);
293 HTTPConnection::setIdleConnectionTimeout((Uint32)v);
294 }
295 else if (String::equal(name, "socketWriteTimeout"))
296 {
297 Uint64 v;
298 StringConversion::decimalStringToUint64(value.getCString(), v);
299 HTTPAcceptor::setSocketWriteTimeout((Uint32)v);
300 }
301 return;
|
302 mike 1.2 }
303
|
304 chip 1.20 /**
|
305 kumpf 1.27 Init planned value of the specified property to the specified value
|
306 mike 1.2 */
307 void DefaultPropertyOwner::initPlannedValue(
|
308 chip 1.20 const String& name,
|
309 mike 1.2 const String& value)
310 {
311 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
312 {
|
313 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
314 mike 1.2 {
|
315 kumpf 1.27 _configProperties.get()[i].plannedValue = value;
|
316 mike 1.2 return;
317 }
318 }
319
320 //
321 // Specified property name could not be found
322 //
323 throw UnrecognizedConfigProperty(name);
324 }
325
|
326 chip 1.20 /**
|
327 kumpf 1.27 Update current value of the specified property to the specified value
|
328 mike 1.2 */
329 void DefaultPropertyOwner::updateCurrentValue(
|
330 chip 1.20 const String& name,
|
331 venkat.puvvada 1.42 const String& value,
|
332 venkat.puvvada 1.43 const String& userName,
333 Uint32 timeoutSeconds)
|
334 mike 1.2 {
335 //
336 // make sure the property is dynamic before updating the value.
337 //
338 if (!isDynamic(name))
339 {
|
340 chip 1.20 throw NonDynamicConfigProperty(name);
|
341 mike 1.2 }
342
|
343 venkat.puvvada 1.42 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
344 if (String::equal(name, "enableIndicationService"))
345 {
346 ConfigProperty *configProperty = 0;
347 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
348 {
349 if (String::equal(_configProperties.get()[i].propertyName, name))
350 {
351 configProperty = &_configProperties.get()[i];
352 break;
353 }
354 }
355 PEGASUS_ASSERT(configProperty);
356 _requestIndicationServiceStateChange(
357 userName,
|
358 venkat.puvvada 1.43 ConfigManager::parseBooleanValue(value),
359 timeoutSeconds);
|
360 venkat.puvvada 1.42 configProperty->currentValue = value;
361 return;
362 }
363 #endif
364
|
365 mike 1.2 //
|
366 chip 1.20 // Since the validations done in initCurrrentValue are sufficient and
367 // no additional validations required for update, we shall call
|
368 mike 1.2 // initCurrrentValue.
369 //
370 initCurrentValue(name, value);
|
371 yi.zhou 1.26
|
372 kumpf 1.28 #ifdef PEGASUS_ENABLE_AUDIT_LOGGER
|
373 yi.zhou 1.26
374 if (String::equal(name, "enableAuditLog") && isValid(name, value))
375 {
376 Boolean enableAuditLog = ConfigManager::parseBooleanValue(value);
377 AuditLogger::setEnabled(enableAuditLog);
378 }
379
380 #endif
381
|
382 mike 1.2 }
383
384
|
385 chip 1.20 /**
|
386 kumpf 1.27 Update planned value of the specified property to the specified value
|
387 mike 1.2 */
388 void DefaultPropertyOwner::updatePlannedValue(
|
389 chip 1.20 const String& name,
|
390 mike 1.2 const String& value)
391 {
392 //
|
393 chip 1.20 // Since the validations done in initPlannedValue are sufficient and
394 // no additional validations required for update, we shall call
|
395 mike 1.2 // initPlannedValue.
396 //
397 initPlannedValue(name, value);
398 }
399
|
400 dev.meetei 1.46 /**
|
401 karl 1.48 *Parse the list of comma seperated interface addresses
|
402 dev.meetei 1.46 * and return a list of string representation of interfaces
403 * and works in following way
404 *1)It checks for comma in a specified non empty listenAddress value
405 * a)if not found, it is assumed as single interface is specified
406 *2) Otherwise, iterate to find comma and append
407 */
408 Array<String> DefaultPropertyOwner::parseAndGetListenAddress
409 (const String &value_)
410 {
411 PEGASUS_ASSERT(value_.size() != 0 );
412 String value = value_;
413 Array<String> interfaces;
414 try
415 {
416 Uint32 idx = value.find(",");
417 interfaces.clear();
418
419 //it has one ip address only
420 if( idx == PEG_NOT_FOUND)
421 {
422 interfaces.append(value);
423 dev.meetei 1.46 }
424 else // has multiple address
425 {
426 while(idx !=PEG_NOT_FOUND)
427 {
428 interfaces.append(value.subString(0,idx));
|
429 karl 1.48 value.remove(0,idx+1);
|
430 dev.meetei 1.46 idx = value.find(",");
431 }
432 //Last Remaining address
433 PEGASUS_ASSERT (idx == PEG_NOT_FOUND);
434 interfaces.append(value);
435 value.remove(0);
436 }
437 }
438 catch( Exception &e)
439 {
440 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL1,
441 "Exception caught while parsing listenAddresses %s",
442 (const char*)e.getMessage().getCString()));
443 throw;
444 }
445 return interfaces;
446 }
447
448 static Boolean isListenAddressValid(const String value_)
449 {
450 if(value_.size() == 0 )
451 dev.meetei 1.46 {
452 return false;
453 }
454
455 Boolean isIpListTrue = true;
456 Array<String> interfaces = DefaultPropertyOwner::parseAndGetListenAddress(
457 value_);
458
459 HostAddress theAddress;
460 for(Uint32 i = 0, m = interfaces.size(); i < m; ++i)
461 {
462 if(!theAddress.setHostAddress(interfaces[i]))
463 {
464 isIpListTrue = false;
465 throw InvalidListenAddressPropertyValue(
466 "listenAddress", interfaces[i]);
467 break;
468 }
469 }
470
471 return isIpListTrue;
472 dev.meetei 1.46 }
473
|
474 mike 1.2
|
475 chip 1.20 /**
|
476 mike 1.2 Checks to see if the given value is valid or not.
477 */
|
478 kumpf 1.27 Boolean DefaultPropertyOwner::isValid(
479 const String& name,
480 const String& value) const
|
481 mike 1.2 {
482 //
483 // By default, no validation is done. It can optionally be added here
484 // per property.
485 //
|
486 kavita.gupta 1.41 if (String::equal(name, "socketWriteTimeout"))
|
487 marek 1.31 {
488 Uint64 v;
|
489 kumpf 1.38 return
|
490 marek 1.31 StringConversion::decimalStringToUint64(value.getCString(), v) &&
491 StringConversion::checkUintBounds(v, CIMTYPE_UINT32) &&
492 (v != 0);
493 }
|
494 marek 1.50 #ifdef PEGASUS_ENABLE_SLP
495 if (String::equal(name, "slpProviderStartupTimeout"))
496 {
497 Uint64 v;
498 return
499 StringConversion::decimalStringToUint64(value.getCString(), v) &&
500 StringConversion::checkUintBounds(v, CIMTYPE_UINT32) &&
501 (v != 0);
502 }
503 #endif
|
504 kavita.gupta 1.41 if (String::equal(name, "maxProviderProcesses") ||
|
505 venkat.puvvada 1.44 String::equal(name, "idleConnectionTimeout") ||
506 String::equal(name, "maxFailedProviderModuleRestarts"))
|
507 marek 1.25 {
|
508 kavita.gupta 1.30 Uint64 v;
|
509 kumpf 1.38 return
|
510 kavita.gupta 1.30 StringConversion::decimalStringToUint64(value.getCString(), v) &&
511 StringConversion::checkUintBounds(v, CIMTYPE_UINT32);
|
512 marek 1.25 }
|
513 venkat.puvvada 1.45 else if (String::equal(name, "httpsPort") ||
514 String::equal(name, "httpPort"))
515 {
516 Uint64 v;
517 return StringConversion::decimalStringToUint64(value.getCString(), v) &&
518 StringConversion::checkUintBounds(v, CIMTYPE_UINT16) && (v!=0);
519 }
|
520 dev.meetei 1.46 else if (String::equal(name, "listenAddress"))
521 {
|
522 karl 1.48
|
523 dev.meetei 1.46 return isListenAddressValid(value);
524
525 }
|
526 kavita.gupta 1.41 else if (String::equal(name, "enableHttpConnection") ||
527 String::equal(name, "enableHttpsConnection") ||
528 String::equal(name, "daemon") ||
529 String::equal(name, "enableAssociationTraversal") ||
530 String::equal(name, "enableIndicationService") ||
531 String::equal(name, "forceProviderProcesses")
|
532 kavita.gupta 1.40 #ifdef PEGASUS_ENABLE_SLP
|
533 kavita.gupta 1.41 || String::equal(name, "slp")
|
534 kavita.gupta 1.40 #endif
|
535 kumpf 1.28 #ifdef PEGASUS_ENABLE_AUDIT_LOGGER
|
536 kavita.gupta 1.40 || String::equal(name, "enableAuditLog")
537 #endif
538 )
|
539 yi.zhou 1.26 {
|
540 kavita.gupta 1.41 return ConfigManager::isValidBooleanValue(value);
|
541 yi.zhou 1.26 }
|
542 marek 1.47 else if (String::equal(name, "hostname") ||
543 String::equal(name, "fullyQualifiedHostName"))
544 {
545 return HostAddress::isValidHostName(value);
546 }
|
547 kumpf 1.27 return true;
|
548 mike 1.2 }
549
|
550 chip 1.20 /**
|
551 kumpf 1.27 Checks to see if the specified property is dynamic or not.
|
552 mike 1.2 */
|
553 vijay.eli 1.23 Boolean DefaultPropertyOwner::isDynamic(const String& name) const
|
554 mike 1.2 {
555 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
556 {
|
557 kavita.gupta 1.41 if (String::equal(_configProperties.get()[i].propertyName, name))
|
558 mike 1.2 {
|
559 kumpf 1.27 return (_configProperties.get()[i].dynamic == IS_DYNAMIC);
|
560 mike 1.2 }
561 }
562
563 //
564 // Specified property name could not be found
565 //
566 throw UnrecognizedConfigProperty(name);
567 }
568
|
569 venkat.puvvada 1.42 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
570 void DefaultPropertyOwner::_requestIndicationServiceStateChange(
571 const String& userName,
|
572 venkat.puvvada 1.43 Boolean enable,
573 Uint32 timeoutSeconds)
|
574 venkat.puvvada 1.42 {
575 MessageQueue *queue = MessageQueue::lookup(
576 PEGASUS_QUEUENAME_INDICATIONSERVICE);
577 // Return if indication service can not be found
578 if (!queue)
579 {
580 return;
581 }
582
583 Uint32 queueId = queue->getQueueId();
584
585 const String METHOD_NAME = "RequestStateChange";
586 const String PARAMNAME_REQUESTEDSTATE = "RequestedState";
587 const String PARAMNAME_TIMEOUTPERIOD = "TimeoutPeriod";
588 const Uint16 STATE_ENABLED = 2;
589 const Uint16 STATE_DISABLED = 3;
590
591 String referenceStr("//", 2);
592 referenceStr.append(System::getHostName());
593 referenceStr.append("/");
594 referenceStr.append(PEGASUS_NAMESPACENAME_INTEROP.getString());
595 venkat.puvvada 1.42 referenceStr.append(":");
596 referenceStr.append(
597 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE.getString());
598 CIMObjectPath reference(referenceStr);
599
600 Array<CIMParamValue> inParams;
601 Array<CIMParamValue> outParams;
602
603 inParams.append(CIMParamValue(PARAMNAME_REQUESTEDSTATE,
604 CIMValue(enable ? STATE_ENABLED : STATE_DISABLED)));
605
606 inParams.append(CIMParamValue(PARAMNAME_TIMEOUTPERIOD,
|
607 venkat.puvvada 1.43 CIMValue(CIMDateTime(timeoutSeconds * 1000000, true))));
|
608 venkat.puvvada 1.42
609 MessageQueueService *controller = ModuleController::getModuleController();
610
611 try
612 {
613 CIMInvokeMethodRequestMessage* request =
614 new CIMInvokeMethodRequestMessage(
615 XmlWriter::getNextMessageId(),
616 PEGASUS_NAMESPACENAME_INTEROP,
617 referenceStr,
618 CIMNameCast(METHOD_NAME),
619 inParams,
620 QueueIdStack(queueId));
621
622 request->operationContext.insert(
623 IdentityContainer(userName));
624
625 AsyncLegacyOperationStart *asyncRequest =
626 new AsyncLegacyOperationStart(
627 0,
628 queueId,
629 venkat.puvvada 1.42 request);
630
631 AsyncReply * asyncReply = controller->SendWait(asyncRequest);
632
633 CIMInvokeMethodResponseMessage * response =
634 reinterpret_cast<CIMInvokeMethodResponseMessage *>(
635 (static_cast<AsyncLegacyOperationResult *>(
636 asyncReply))->get_result());
637
638 CIMException e = response->cimException;
639
640 delete response;
641 delete asyncRequest;
642 delete asyncReply;
643
644 if (e.getCode() != CIM_ERR_SUCCESS)
645 {
646 throw e;
647 }
648 }
649 catch(const Exception &e)
650 venkat.puvvada 1.42 {
651 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL1,
652 "Exception caught while invoking CIM_IndicationService."
653 "RequestStateChange() method: %s",
654 (const char*)e.getMessage().getCString()));
655 throw;
656 }
657 catch(...)
658 {
659 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL1,
660 "Unknown exception caught while invoking CIM_IndicationService."
661 "RequestStateChange() method");
662 throw;
663 }
664 }
665 #endif
666
|
667 mike 1.2 PEGASUS_NAMESPACE_END
|