1 martin 1.250 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.251 //
|
3 martin 1.250 // 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.251 //
|
10 martin 1.250 // 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.251 //
|
17 martin 1.250 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.251 //
|
20 martin 1.250 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.251 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.250 // 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.251 //
|
28 martin 1.250 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
|
33 kumpf 1.17 #include <Pegasus/Common/Constants.h>
|
34 kumpf 1.204 #include <Pegasus/Common/CIMInstance.h>
|
35 kumpf 1.60 #include <Pegasus/Common/ArrayInternal.h>
|
36 kumpf 1.1 #include <Pegasus/Common/CIMDateTime.h>
37 #include <Pegasus/Common/CIMProperty.h>
38 #include <Pegasus/Common/MessageQueue.h>
39 #include <Pegasus/Common/System.h>
40 #include <Pegasus/Common/Tracer.h>
|
41 kumpf 1.6 #include <Pegasus/Common/XmlWriter.h>
|
42 kumpf 1.36 #include <Pegasus/Common/PegasusVersion.h>
|
43 kumpf 1.195 #include <Pegasus/Common/AcceptLanguageList.h>
44 #include <Pegasus/Common/ContentLanguageList.h>
|
45 kumpf 1.194 #include <Pegasus/Common/LanguageParser.h>
|
46 dj.gorey 1.135 #include <Pegasus/Common/OperationContextInternal.h>
|
47 kumpf 1.114 #include <Pegasus/Common/MessageLoader.h>
48 #include <Pegasus/Common/String.h>
|
49 thilo.boehm 1.257
50 #include <Pegasus/General/IndicationFormatter.h>
|
51 venkat.puvvada 1.260 #include <Pegasus/General/Guid.h>
|
52 thilo.boehm 1.257 #ifdef PEGASUS_INDICATION_PERFINST
53 #include <Pegasus/General/Stopwatch.h>
54 #endif
55
|
56 kumpf 1.243 #include <Pegasus/Server/ProviderRegistrationManager/\
57 ProviderRegistrationManager.h>
|
58 chuck 1.149 #include <Pegasus/Query/QueryExpression/QueryExpression.h>
59 #include <Pegasus/Query/QueryCommon/QueryException.h>
60 #include <Pegasus/Repository/RepositoryQueryContext.h>
|
61 kumpf 1.1
|
62 kumpf 1.114 #include "IndicationConstants.h"
63 #include "SubscriptionRepository.h"
64 #include "SubscriptionTable.h"
|
65 kumpf 1.1 #include "IndicationService.h"
66
|
67 humberto 1.78
|
68 kumpf 1.1 PEGASUS_USING_STD;
69
70 PEGASUS_NAMESPACE_BEGIN
71
|
72 kumpf 1.243 //
73 // Message constants
74 //
75
76 static const char _MSG_PROPERTY_KEY[] =
77 "IndicationService.IndicationService._MSG_PROPERTY";
78 static const char _MSG_PROPERTY[] = "The required property $0 is missing.";
79
80 static const char _MSG_NO_PROVIDERS_KEY[] =
81 "IndicationService.IndicationService._MSG_NO_PROVIDERS";
82 static const char _MSG_NO_PROVIDERS[] =
83 "No providers are capable of servicing the subscription.";
84
85 static const char _MSG_INVALID_TYPE_FOR_PROPERTY_KEY[] =
86 "IndicationService.IndicationService._MSG_INVALID_TYPE_FOR_PROPERTY";
87 static const char _MSG_INVALID_TYPE_FOR_PROPERTY[] =
88 "The value of type $0 is not valid for property $1.";
89
90 static const char _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY_KEY[] =
91 "IndicationService.IndicationService."
92 "_MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY";
93 kumpf 1.243 static const char _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY[] =
94 "The value of an array of type $0 is not valid for property $1.";
95
96 static const char _MSG_INVALID_VALUE_FOR_PROPERTY_KEY[] =
97 "IndicationService.IndicationService._MSG_INVALID_VALUE_FOR_PROPERTY";
98 static const char _MSG_INVALID_VALUE_FOR_PROPERTY[] =
99 "The value $0 is not valid for property $1.";
100
101 static const char _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY_KEY[] =
102 "IndicationService.IndicationService._MSG_UNSUPPORTED_VALUE_FOR_PROPERTY";
103 static const char _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY[] =
104 "The value $0 is not supported for property $1.";
105
106 static const char _MSG_CLASS_NOT_SERVED_KEY[] =
107 "IndicationService.IndicationService._MSG_CLASS_NOT_SERVED";
108 static const char _MSG_CLASS_NOT_SERVED[] =
109 "The specified class is not serviced by the CIM Indication service.";
110
111 static const char _MSG_INVALID_INSTANCES_KEY[] =
112 "IndicationService.IndicationService."
113 "INVALID_SUBSCRIPTION_INSTANCES_IGNORED";
114 kumpf 1.243 static const char _MSG_INVALID_INSTANCES[] =
115 "One or more subscription instances are not valid and are ignored.";
116
117 static const char _MSG_PROVIDER_NO_LONGER_SERVING_KEY[] =
118 "IndicationService.IndicationService._MSG_PROVIDER_NO_LONGER_SERVING";
119 static const char _MSG_PROVIDER_NO_LONGER_SERVING[] =
120 "Provider ($0) is no longer serving subscription ($1) in namespace $2";
121
122 static const char _MSG_PROVIDER_NOW_SERVING_KEY[] =
123 "IndicationService.IndicationService._MSG_PROVIDER_NOW_SERVING";
124 static const char _MSG_PROVIDER_NOW_SERVING[] =
125 "Provider ($0) is now serving subscription ($1) in namespace $2";
126
127 static const char _MSG_NO_PROVIDER_KEY[] =
128 "IndicationService.IndicationService._MSG_NO_PROVIDER";
129 static const char _MSG_NO_PROVIDER[] =
130 "Subscription ($0) in namespace $1 has no provider";
131
|
132 venkat.puvvada 1.258 static const char _MSG_STATE_CHANGE_FAILED_KEY[] =
133 "IndicationService.IndicationService.STATE_CHANGE_FAILED";
134 static const char _MSG_STATE_CHANGE_FAILED[] =
135 "The requested state change failed : $0. Current IndicationService"
136 " EnabledState : $1, HealthState : $2.";
|
137 kumpf 1.243
|
138 kumpf 1.55 // ATTN-RK-20020730: Temporary hack to fix Windows build
139 Boolean ContainsCIMName(const Array<CIMName>& a, const CIMName& x)
140 {
141 Uint32 n = a.size();
142
143 for (Uint32 i = 0; i < n; i++)
144 {
145 if (a[i].equal(x))
146 return true;
147 }
148
149 return false;
150 }
151
|
152 kumpf 1.44 Mutex IndicationService::_mutex;
|
153 venkat.puvvada 1.258
154 /**
155 See CIM_EnabledLogicalElement.RequestStateChange() method for return codes
156 and CIM_EnabledLogicalElement.EnabledState property for service states.
157
158 ATTN: Currently very few states are supported and the following utility
159 functions are hard coded to return service states directly. Write a
160 generic function to get values from ValueMap independent of class.
161 */
162 String _getEnabledStateString(Uint32 code)
163 {
164 // Check for service states
165 switch(code)
166 {
167 case _ENABLEDSTATE_ENABLED:
168 return String("Enabled");
169 case _ENABLEDSTATE_DISABLED:
170 return String("Disabled");
171 case _ENABLEDSTATE_SHUTTINGDOWN:
172 return String("Shutting Down");
173 case _ENABLEDSTATE_STARTING:
174 venkat.puvvada 1.258 return String("Starting");
175 }
176 PEGASUS_ASSERT(false); // Never reach to unknown state at present.
177
178 return String("Unknown");
179 }
180
181 String _getHealthStateString(Uint32 code)
182 {
183 // Service health states
184 switch(code)
185 {
186 case _HEALTHSTATE_OK:
187 return String("OK");
188 case _HEALTHSTATE_DEGRADEDWARNING:
189 return String("Degraded/Warning");
190 }
191 PEGASUS_ASSERT(false); // Never reach to unknown state at present.
192
193 return String("Unknown");
194 }
|
195 kumpf 1.44
|
196 kumpf 1.218 IndicationService::IndicationService(
197 CIMRepository* repository,
198 ProviderRegistrationManager* providerRegManager)
199 : MessageQueueService(
|
200 sahana.prabhakar 1.256 PEGASUS_QUEUENAME_INDICATIONSERVICE),
|
201 kumpf 1.218 _providerRegManager(providerRegManager),
|
202 venkat.puvvada 1.269 _cimRepository(repository),
203 // NOTE: Create ControlProvIndRegTable with only one chain. Only one
204 // indication control provider is available at this time.
205 _controlProvIndRegTable(1)
|
206 kumpf 1.11 {
|
207 venkat.puvvada 1.269 _buildInternalControlProvidersRegistration();
|
208 kumpf 1.94 _enableSubscriptionsForNonprivilegedUsers = false;
|
209 carolann.graves 1.198 _authenticationEnabled = true;
|
210 kumpf 1.94
211 try
212 {
213 // Determine the value for the configuration parameter
214 // enableSubscriptionsForNonprivilegedUsers
215 ConfigManager* configManager = ConfigManager::getInstance();
216
|
217 kumpf 1.202 if (ConfigManager::parseBooleanValue(
218 configManager->getCurrentValue("enableAuthentication")))
|
219 kumpf 1.94 {
|
220 kumpf 1.202 _enableSubscriptionsForNonprivilegedUsers =
221 ConfigManager::parseBooleanValue(
222 configManager->getCurrentValue(
223 "enableSubscriptionsForNonprivilegedUsers"));
|
224 kumpf 1.94 }
225 else
226 {
|
227 carolann.graves 1.198 _authenticationEnabled = false;
|
228 kumpf 1.94 // Authentication needs to be enabled to perform authorization
229 // tests.
230 _enableSubscriptionsForNonprivilegedUsers = true;
231 }
232 }
233 catch (...)
234 {
235 // If there is an error reading the configuration file then
236 // the value of _enableSubscriptionsForNonprivilegedUsers will
237 // default to false (i.e., the more restrictive security
238 // setting.
|
239 marek 1.238 PEG_TRACE_CSTRING(TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
240 kumpf 1.218 "Failure attempting to read configuration parameters during "
241 "initialization.");
|
242 kumpf 1.94 }
243
|
244 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
245 dj.gorey 1.135 "Value of _enableSubscriptionsForNonprivilegedUsers is %d",
|
246 marek 1.215 _enableSubscriptionsForNonprivilegedUsers));
|
247 kumpf 1.94
|
248 kumpf 1.38 try
249 {
|
250 venkat.puvvada 1.258 // Create IndicationsProfileInstance Repository
|
251 venkat.puvvada 1.231 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
|
252 venkat.puvvada 1.258 _indicationServiceConfiguration.reset(
253 new IndicationServiceConfiguration(_cimRepository));
|
254 venkat.puvvada 1.267 #else
255 _enabledState = _ENABLEDSTATE_DISABLED;
|
256 venkat.puvvada 1.231 #endif
|
257 kumpf 1.94 // Initialize the Indication Service
|
258 kumpf 1.218 _initialize();
|
259 kumpf 1.38 }
|
260 kumpf 1.218 catch (Exception& e)
|
261 kumpf 1.38 {
|
262 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
263 thilo.boehm 1.242 "Exception caught in attempting to "
264 "initialize Indication Service: %s",
265 (const char*)e.getMessage().getCString()));
|
266 venkat.puvvada 1.267 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
|
267 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
268 _HEALTHSTATE_DEGRADEDWARNING);
|
269 venkat.puvvada 1.267 #endif
|
270 kumpf 1.38 }
|
271 venkat.puvvada 1.258
|
272 kumpf 1.11 }
|
273 kumpf 1.1
|
274 kumpf 1.218 IndicationService::~IndicationService()
|
275 kumpf 1.11 {
|
276 venkat.puvvada 1.269 _controlProvIndRegTable.clear();
277 }
278
279 void IndicationService::_buildInternalControlProvidersRegistration()
280 {
281 // ProvRegistrationProvider
282 ControlProvIndReg regProvider;
283
284 regProvider.className =
285 PEGASUS_CLASSNAME_PROVIDERMODULE_INSTALERT;
286
287 regProvider.providerModule =
288 CIMInstance(PEGASUS_CLASSNAME_PROVIDERMODULE);
289
290 regProvider.providerModule.addProperty(
291 CIMProperty(
292 PEGASUS_PROPERTYNAME_NAME,
293 String(PEGASUS_MODULENAME_PROVREGPROVIDER)));
294
295 regProvider.providerModule.addProperty(
296 CIMProperty(
297 venkat.puvvada 1.269 PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT,
298 CIMValue()));
299
300 regProvider.provider =
301 CIMInstance(PEGASUS_CLASSNAME_PROVIDER);
302
303 regProvider.provider.addProperty(
304 CIMProperty(
305 PEGASUS_PROPERTYNAME_NAME,
306 String(PEGASUS_MODULENAME_PROVREGPROVIDER)));
307
308 regProvider.provider.addProperty(
309 CIMProperty(
310 _PROPERTY_PROVIDERMODULENAME,
311 String(PEGASUS_MODULENAME_PROVREGPROVIDER)));
312
313 Array<CIMKeyBinding> keys;
314
315 CIMKeyBinding kb1(
316 PEGASUS_PROPERTYNAME_NAME,
317 String(PEGASUS_MODULENAME_PROVREGPROVIDER),
318 venkat.puvvada 1.269 CIMKeyBinding::STRING);
319 keys.append(kb1);
320
321 CIMObjectPath pmPath =
322 CIMObjectPath(
323 String(),
324 CIMNamespaceName(),
325 PEGASUS_CLASSNAME_PROVIDERMODULE,
326 keys);
327 regProvider.providerModule.setPath (pmPath);
328
329 CIMKeyBinding kb2(
330 _PROPERTY_PROVIDERMODULENAME,
331 String(PEGASUS_MODULENAME_PROVREGPROVIDER),
332 CIMKeyBinding::STRING);
333 keys.append(kb2);
334
335 CIMObjectPath providerPath =
336 CIMObjectPath(
337 String(),
338 CIMNamespaceName(),
339 venkat.puvvada 1.269 PEGASUS_CLASSNAME_PROVIDER,
340 keys);
341
342 regProvider.provider.setPath (providerPath);
343
344 String key = PEGASUS_MODULENAME_PROVREGPROVIDER;
345 key.append(PEGASUS_CLASSNAME_PROVIDERMODULE_INSTALERT.getString());
346
347 Boolean ok = _controlProvIndRegTable.insert(
348 key,
349 regProvider);
350
351 PEGASUS_ASSERT(ok);
|
352 kumpf 1.11 }
|
353 kumpf 1.1
|
354 venkat.puvvada 1.267 Uint16 IndicationService::_getEnabledState()
355 {
356 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
357 return _indicationServiceConfiguration->getEnabledState();
358 #else
359 return _enabledState;
360 #endif
361 }
362
363 void IndicationService::_setEnabledState(Uint16 state)
364 {
365 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
366 _indicationServiceConfiguration->setEnabledState(state);
367 #else
368 _enabledState = state;
369 #endif
370 }
|
371 venkat.puvvada 1.259
|
372 kumpf 1.11 void IndicationService::_handle_async_request(AsyncRequest *req)
373 {
|
374 kumpf 1.219 if (req->getType() == ASYNC_CIMSERVICE_STOP)
|
375 kumpf 1.11 {
376 //
377 // Call _terminate
378 //
|
379 kumpf 1.218 _terminate();
|
380 kumpf 1.97
381 handle_CimServiceStop(static_cast<CimServiceStop *>(req));
|
382 kumpf 1.11 }
|
383 kumpf 1.219 else if (req->getType() == ASYNC_CIMSERVICE_START)
|
384 kumpf 1.11 {
|
385 kumpf 1.218 handle_CimServiceStart(static_cast<CimServiceStart *>(req));
|
386 kumpf 1.11 }
|
387 kumpf 1.219 else if (req->getType() == ASYNC_ASYNC_LEGACY_OP_START)
|
388 kumpf 1.11 {
|
389 kumpf 1.218 try
390 {
391 Message* legacy =
392 static_cast<AsyncLegacyOperationStart *>(req)->get_action();
393 legacy->put_async(req);
394
395 handleEnqueue(legacy);
396 }
397 catch(Exception& )
398 {
|
399 marek 1.238 PEG_TRACE_CSTRING(TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
400 kumpf 1.218 "Caught Exception in IndicationService while handling a "
401 "wrapped legacy message ");
402 _make_response(req, async_results::CIM_NAK);
403 }
|
404 dj.gorey 1.135
|
405 kumpf 1.11 return;
406 }
407 else
|
408 kumpf 1.218 MessageQueueService::_handle_async_request(req);
|
409 kumpf 1.11 }
|
410 kumpf 1.1
|
411 kumpf 1.11 void IndicationService::handleEnqueue(Message* message)
412 {
|
413 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
414 Stopwatch stopWatch;
|
415 chip 1.162
416 stopWatch.start();
|
417 kumpf 1.73 #endif
|
418 kumpf 1.235 CIMRequestMessage* cimRequest = dynamic_cast<CIMRequestMessage *>(message);
419 PEGASUS_ASSERT(cimRequest);
|
420 kumpf 1.223
|
421 kumpf 1.137 // Set the client's requested language into this service thread.
422 // This will allow functions in this service to return messages
423 // in the correct language.
|
424 kumpf 1.235 cimRequest->updateThreadLanguages();
|
425 kumpf 1.137
|
426 carolann.graves 1.212 try
|
427 kumpf 1.137 {
|
428 venkat.puvvada 1.267 if (_getEnabledState() != _ENABLEDSTATE_ENABLED)
|
429 carolann.graves 1.212 {
|
430 venkat.puvvada 1.258 _handleCimRequestWithServiceNotEnabled(message);
431 }
432 else
433 {
434 _handleCimRequest(message);
|
435 carolann.graves 1.212 }
436 }
|
437 kumpf 1.235 catch (CIMException& e)
|
438 carolann.graves 1.212 {
|
439 marek 1.238 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
440 kumpf 1.235 "CIMException caught in IndicationService::handleEnqueue: %s",
441 (const char*)e.getMessage().getCString()));
442 CIMResponseMessage* response = cimRequest->buildResponse();
443 response->cimException = e;
444 _enqueueResponse(cimRequest, response);
445 }
446 catch (Exception& e)
447 {
|
448 marek 1.238 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
449 kumpf 1.235 "Exception caught in IndicationService::handleEnqueue: %s",
450 (const char*)e.getMessage().getCString()));
451 CIMResponseMessage* response = cimRequest->buildResponse();
452 response->cimException =
453 PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
454 _enqueueResponse(cimRequest, response);
|
455 carolann.graves 1.212 }
|
456 kumpf 1.235 catch (...)
|
457 carolann.graves 1.212 {
|
458 marek 1.238 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
459 kumpf 1.235 "Unknown exception caught in IndicationService::handleEnqueue."));
460 CIMResponseMessage* response = cimRequest->buildResponse();
461 response->cimException = PEGASUS_CIM_EXCEPTION_L(
462 CIM_ERR_FAILED,
463 MessageLoaderParms(
464 "IndicationService.IndicationService.UNKNOWN_ERROR",
465 "Unknown Error"));
466 _enqueueResponse(cimRequest, response);
|
467 kumpf 1.137 }
|
468 kumpf 1.73
469 #ifdef PEGASUS_INDICATION_PERFINST
|
470 david.dillard 1.163 stopWatch.stop();
|
471 kumpf 1.73
|
472 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
473 kumpf 1.218 "%s: %.3f seconds",
474 MessageTypeToString(message->getType()),
475 stopWatch.getElapsed()));
|
476 kumpf 1.73 #endif
|
477 dj.gorey 1.135
|
478 mday 1.40 delete message;
|
479 kumpf 1.11 }
|
480 kumpf 1.1
|
481 venkat.puvvada 1.258 void IndicationService::_handleCimRequest(Message *message)
482 {
483 switch(message->getType())
484 {
485 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
486 _handleGetInstanceRequest(message);
487 break;
488
489 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
490 _handleEnumerateInstancesRequest(message);
491 break;
492
493 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
494 _handleEnumerateInstanceNamesRequest(message);
495 break;
496
497 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
498 _handleCreateInstanceRequest(message);
499 break;
500
501 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
502 venkat.puvvada 1.258 _handleModifyInstanceRequest(message);
503 break;
504
505 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
506 _handleDeleteInstanceRequest(message);
507 break;
508
509 case CIM_PROCESS_INDICATION_REQUEST_MESSAGE:
510 _handleProcessIndicationRequest(message);
511 break;
512
513 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
514 _handleNotifyProviderRegistrationRequest(message);
515 break;
516
517 case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE:
518 _handleNotifyProviderTerminationRequest(message);
519 break;
520
521 case CIM_NOTIFY_PROVIDER_ENABLE_REQUEST_MESSAGE:
522 _handleNotifyProviderEnableRequest(message);
523 venkat.puvvada 1.258 break;
524
525 case CIM_NOTIFY_PROVIDER_FAIL_REQUEST_MESSAGE:
526 _handleNotifyProviderFailRequest(message);
527 break;
528
529 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
530 case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
531 _handleInvokeMethodRequest(message);
532 break;
533 #endif
534
535 default:
536 CIMRequestMessage* cimRequest =
537 dynamic_cast<CIMRequestMessage *>(message);
538 //
539 // A message type not supported by the Indication Service
540 // Should not reach here
541 //
542 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
543 "IndicationService::_handleCimRequest rcv'd unsupported "
544 venkat.puvvada 1.258 "message of type %s.",
545 MessageTypeToString(message->getType())));
546
547 // Note: not setting Content-Language in the response
548 CIMResponseMessage* response = cimRequest->buildResponse();
549 response->cimException = PEGASUS_CIM_EXCEPTION_L(
550 CIM_ERR_NOT_SUPPORTED,
551 MessageLoaderParms(
552 "IndicationService.IndicationService."
553 "UNSUPPORTED_OPERATION",
554 "The requested operation is not supported or not "
555 "recognized by the indication service."));
556
557 _enqueueResponse(cimRequest, response);
558 }
559 }
560
561 void IndicationService::_handleCimRequestWithServiceNotEnabled(
562 Message *message)
563 {
564 Boolean requestHandled = false;
565 venkat.puvvada 1.258 CIMRequestMessage* cimRequest = dynamic_cast<CIMRequestMessage *>(message);
566
567 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
568 requestHandled = true;
569 switch(message->getType())
570 {
571 case CIM_INVOKE_METHOD_REQUEST_MESSAGE:
572 _handleInvokeMethodRequest(message);
573 break;
574 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
575 case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE:
576 case CIM_NOTIFY_PROVIDER_ENABLE_REQUEST_MESSAGE:
577 case CIM_NOTIFY_PROVIDER_FAIL_REQUEST_MESSAGE:
578 _enqueueResponse(cimRequest, cimRequest->buildResponse());
579 break;
580
581 case CIM_PROCESS_INDICATION_REQUEST_MESSAGE:
582 _handleProcessIndicationRequest(message);
583 break;
584
585 // Handle only CIM_IndicationService class operations.
586 venkat.puvvada 1.258 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
587 {
588 CIMGetInstanceRequestMessage *request =
589 (CIMGetInstanceRequestMessage*)message;
590 if (request->className.equal(
591 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE))
592 {
593 _handleGetInstanceRequest(message);
594 }
595 else
596 {
597 requestHandled = false;
598 }
599 }
600 break;
601 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
602 {
603 CIMEnumerateInstancesRequestMessage *request =
604 (CIMEnumerateInstancesRequestMessage*)message;
605 if (request->className.equal(
606 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE))
607 venkat.puvvada 1.258 {
608 _handleEnumerateInstancesRequest(message);
609 }
610 else
611 {
612 requestHandled = false;
613 }
614 }
615 break;
616
617 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
618 {
619 CIMEnumerateInstanceNamesRequestMessage *request =
620 (CIMEnumerateInstanceNamesRequestMessage*)message;
621 if (request->className.equal(
622 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE))
623 {
624 _handleEnumerateInstanceNamesRequest(message);
625 }
626 else
627 {
628 venkat.puvvada 1.258 requestHandled = false;
629 }
630 }
631 break;
632 default:
633 requestHandled = false;
634 break;
635 }
636 #endif
637
638 if (!requestHandled)
639 {
640 Logger::put_l(
641 Logger::STANDARD_LOG,
642 System::CIMSERVER,
643 Logger::WARNING,
644 MessageLoaderParms(
645 "IndicationService.IndicationService."
646 "CANNOT_EXECUTE_REQUEST",
647 "The requested operation cannot be executed."
648 " IndicationService EnabledState : $0.",
|
649 venkat.puvvada 1.267 _getEnabledStateString(_getEnabledState())));
|
650 venkat.puvvada 1.258
651 CIMResponseMessage* response = cimRequest->buildResponse();
652 response->cimException = PEGASUS_CIM_EXCEPTION_L(
653 CIM_ERR_FAILED,
654 MessageLoaderParms(
655 "IndicationService.IndicationService."
656 "CANNOT_EXECUTE_REQUEST",
657 "The requested operation cannot be executed."
658 " IndicationService EnabledState : $0.",
|
659 venkat.puvvada 1.267 _getEnabledStateString(_getEnabledState())));
|
660 venkat.puvvada 1.258 _enqueueResponse(cimRequest, response);
661 }
662 }
663
664
|
665 kumpf 1.218 void IndicationService::handleEnqueue()
|
666 kumpf 1.11 {
667 Message * message = dequeue();
|
668 kumpf 1.1
|
669 kumpf 1.11 PEGASUS_ASSERT(message != 0);
670 handleEnqueue(message);
671 }
|
672 kumpf 1.1
|
673 marek 1.280 void IndicationService::_setOrAddSystemNameInHandlerFilter(
674 CIMInstance& instance,
675 const String& sysname)
676 {
677 // Key property SystemName should be ignored by server according to
678 // DSP1054 v1.2, setting it to empty string for further processing
679 // host name will replace empty string on returning instances
680 Uint32 sysNamePos = instance.findProperty(_PROPERTY_SYSTEMNAME);
681 CIMValue x = CIMValue(sysname);
682
683 if (PEG_NOT_FOUND == sysNamePos)
684 {
685 instance.addProperty(
686 CIMProperty(_PROPERTY_SYSTEMNAME,x));
687 }
688 else
689 {
690 CIMProperty p=instance.getProperty(sysNamePos);
691 p.setValue(x);
692 }
693 }
694 marek 1.280
695 void IndicationService::_setSystemNameInHandlerFilter(
696 CIMObjectPath& objPath,
697 const String& sysname)
698 {
699 Array<CIMKeyBinding> keys=objPath.getKeyBindings();
700 Array<CIMKeyBinding> updatedKeys;
701
702 updatedKeys.append(keys[0]);
703 updatedKeys.append(keys[1]);
704 updatedKeys.append(keys[2]);
705 updatedKeys.append(CIMKeyBinding(
706 _PROPERTY_SYSTEMNAME,
707 sysname,
708 CIMKeyBinding::STRING));
709 objPath.setKeyBindings(updatedKeys);
|
710 marek 1.283 objPath.setHost(String::EMPTY);
|
711 marek 1.280 }
712
713 void IndicationService::_setSystemNameInHandlerFilterReference(
714 String& reference,
715 const String& sysname)
716 {
717 static const Char16 quote = 0x0022;
718
719 reference.remove(reference.size()-1);
720
721 Uint32 quotePos=reference.reverseFind(quote);
722
723 reference.remove(quotePos+1);
724 reference.append(sysname);
725 reference.append(quote);
|
726 marek 1.283
727 static const Char16 slash = 0x002F;
728 // remove hostname, don't need it
729 if (reference[0] == slash && reference[1] == slash)
730 {
731 // namespace starts after next slash
732 Uint32 ns = reference.find(2, slash);
733 reference.remove(0,ns+1);
734 }
|
735 marek 1.280 }
736
737 void IndicationService::_setSubscriptionSystemName(
738 CIMObjectPath& objPath,
739 const String& sysname)
740 {
741 Array<CIMKeyBinding> keys=objPath.getKeyBindings();
742
743 String filterValue = keys[0].getValue();
744 String handlerValue = keys[1].getValue();
745
746 _setSystemNameInHandlerFilterReference(filterValue,sysname);
747 _setSystemNameInHandlerFilterReference(handlerValue,sysname);
748
749 Array<CIMKeyBinding> newKeys;
750
751 newKeys.append(CIMKeyBinding(
752 PEGASUS_PROPERTYNAME_FILTER,
753 filterValue,
754 CIMKeyBinding::REFERENCE));
755
756 marek 1.280 newKeys.append(CIMKeyBinding(
757 PEGASUS_PROPERTYNAME_HANDLER,
758 handlerValue,
759 CIMKeyBinding::REFERENCE));
760
761 objPath.setKeyBindings(newKeys);
762 }
763
764 void IndicationService::_setSystemName(
765 CIMObjectPath& objPath,
766 const String& sysname)
767 {
768
769 // Need different handling for subscriptions
770 if ((objPath.getClassName().equal(
771 PEGASUS_CLASSNAME_INDSUBSCRIPTION)) ||
772 (objPath.getClassName().equal(
773 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
774 {
775 _setSubscriptionSystemName(objPath,sysname);
776 }
777 marek 1.280 else
778 {
779 // this is a Filter or Handler object path
780 _setSystemNameInHandlerFilter(objPath,sysname);
781 }
782 }
783
784 void IndicationService::_setSystemName(
785 CIMInstance& instance,
786 const String& sysname)
787 {
788
789 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
790 "IndicationService::_setSystemName");
791
792 CIMObjectPath newPath=instance.getPath();
793
794 // Need different handling for subscriptions
795 if ((instance.getClassName().equal(
796 PEGASUS_CLASSNAME_INDSUBSCRIPTION)) ||
797 (instance.getClassName().equal(
798 marek 1.280 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
799 {
800 _setSubscriptionSystemName(newPath,sysname);
801 }
802 else
803 {
804 // this is a Filter or Handler instance
805 _setOrAddSystemNameInHandlerFilter(instance,sysname);
806 _setSystemNameInHandlerFilter(newPath,sysname);
807
808 }
809 instance.setPath(newPath);
810
811 PEG_METHOD_EXIT();
812 }
813
|
814 kumpf 1.218 void IndicationService::_initialize()
|
815 kumpf 1.11 {
|
816 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, "IndicationService::_initialize");
|
817 dj.gorey 1.135
|
818 kumpf 1.11 //
819 // Find required services
|
820 venkat.puvvada 1.245 _providerManager = find_service_qid(PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP);
821 _handlerService = find_service_qid(PEGASUS_QUEUENAME_INDHANDLERMANAGER);
|
822 venkat.puvvada 1.269 _moduleController = find_service_qid(PEGASUS_QUEUENAME_CONTROLSERVICE);
|
823 kumpf 1.37
|
824 kumpf 1.11 //
|
825 marek 1.279 // Set arrays of supported property values
|
826 kumpf 1.115 //
827 // Note: Valid values are defined by the CIM Event Schema MOF
828 // Supported values are a subset of the valid values
|
829 dj.gorey 1.135 // Some valid values, as defined in the MOF, are not currently supported
|
830 kumpf 1.115 // by the Pegasus IndicationService
|
831 kumpf 1.32 //
|
832 venkat.puvvada 1.258 _supportedStates.append(STATE_ENABLED);
833 _supportedStates.append(STATE_DISABLED);
834 _supportedRepeatPolicies.append(_POLICY_UNKNOWN);
835 _supportedRepeatPolicies.append(_POLICY_OTHER);
836 _supportedRepeatPolicies.append(_POLICY_NONE);
837 _supportedRepeatPolicies.append(_POLICY_SUPPRESS);
838 _supportedRepeatPolicies.append(_POLICY_DELAY);
839 _supportedErrorPolicies.append(_ERRORPOLICY_IGNORE);
840 _supportedErrorPolicies.append(_ERRORPOLICY_DISABLE);
841 _supportedErrorPolicies.append(_ERRORPOLICY_REMOVE);
842 _supportedPersistenceTypes.append(PERSISTENCE_PERMANENT);
843 _supportedPersistenceTypes.append(PERSISTENCE_TRANSIENT);
844 _supportedSNMPVersion.append(SNMPV1_TRAP);
845 _supportedSNMPVersion.append(SNMPV2C_TRAP);
|
846 sahana.prabhakar 1.265 _supportedSNMPVersion.append(SNMPV3_TRAP);
|
847 venkat.puvvada 1.258
|
848 anusha.kandepu 1.281
|
849 venkat.puvvada 1.258 ConfigManager* configManager = ConfigManager::getInstance();
850
851 if (ConfigManager::parseBooleanValue(
852 configManager->getCurrentValue("enableIndicationService")))
853 {
|
854 venkat.puvvada 1.267 _setEnabledState(_ENABLEDSTATE_ENABLED);
|
855 ajay.rao 1.266 _initializeActiveSubscriptionsFromRepository(0);
|
856 venkat.puvvada 1.258 }
857
858 PEG_METHOD_EXIT();
859 }
860
861
862
863 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
864
865 String _getReturnCodeString(Uint32 code)
866 {
867 // Method return codes
868 switch(code)
869 {
870 case _RETURNCODE_TIMEOUT:
871 return String("Cannot complete within Timeout Period");
872 case _RETURNCODE_NOTSUPPORTED:
873 return String("Not Supported");
874 case _RETURNCODE_FAILED:
875 return String("Failed");
876 case _RETURNCODE_INVALIDPARAMETER:
877 venkat.puvvada 1.258 return String("Invalid Parameter");
878 }
879
880 PEGASUS_ASSERT(false); // Never reach to unknown return code
881
882 return String("Unknown");
883 }
884
885 void IndicationService::_sendIndicationServiceDisabled()
886 {
887 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
888 "IndicationService::_sendIndicationServiceDisabled");
889
|
890 ajay.rao 1.266 if (_indicationServiceConfiguration->getEnabledState() ==
891 _ENABLEDSTATE_ENABLED)
|
892 venkat.puvvada 1.258 {
893 PEG_METHOD_EXIT();
894 return;
895 }
896
897 CIMIndicationServiceDisabledRequestMessage * request =
898 new CIMIndicationServiceDisabledRequestMessage(
899 XmlWriter::getNextMessageId(),
900 QueueIdStack(_providerManager, getQueueId()));
901
|
902 venkat.puvvada 1.269 CIMIndicationServiceDisabledRequestMessage *requestCopy =
903 new CIMIndicationServiceDisabledRequestMessage(*request);
904
|
905 venkat.puvvada 1.258 AsyncLegacyOperationStart * asyncRequest =
906 new AsyncLegacyOperationStart(
907 0,
908 _providerManager,
|
909 venkat.puvvada 1.269 requestCopy);
|
910 venkat.puvvada 1.258 AutoPtr<AsyncReply> asyncReply(SendWait(asyncRequest));
911
912 delete asyncRequest;
913
|
914 venkat.puvvada 1.269
915 // Now send to all indication internal control providers
916
917 for (ControlProvIndRegTable::Iterator j =
918 _controlProvIndRegTable.start (); j; j++)
919 {
920 ControlProvIndReg reg = j.value();
921 String controlProviderName;
922 reg.provider.getProperty(reg.provider.findProperty(
923 PEGASUS_PROPERTYNAME_NAME)).getValue().get(controlProviderName);
924
925 requestCopy = new CIMIndicationServiceDisabledRequestMessage(*request);
926
927 AsyncModuleOperationStart * asyncRequest =
928 new AsyncModuleOperationStart(
929 0,
930 _moduleController,
931 controlProviderName,
932 requestCopy);
933
934 AutoPtr<AsyncReply> asyncReply(SendWait(asyncRequest));
935 venkat.puvvada 1.269 delete asyncRequest;
936 }
937
938 delete request;
939
|
940 venkat.puvvada 1.258 PEG_METHOD_EXIT();
941 }
942
943 void IndicationService::_handleInvokeMethodRequest(Message *message)
944 {
945 Uint32 timeoutSeconds = 0;
946
947 CIMInvokeMethodRequestMessage *request =
948 dynamic_cast<CIMInvokeMethodRequestMessage*>(message);
949
950 PEGASUS_ASSERT(request);
951
952 CIMInvokeMethodResponseMessage *response =
953 static_cast<CIMInvokeMethodResponseMessage*>(request->buildResponse());
954
955 // Get userName and only privileged user can execute this operation
956 String userName = ((IdentityContainer)request->operationContext.get(
957 IdentityContainer::NAME)).getUserName();
958
959 #ifndef PEGASUS_OS_ZOS
960 if (userName.size() && !System::isPrivilegedUser(userName))
961 venkat.puvvada 1.258 {
962 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,
963 MessageLoaderParms(
964 "IndicationService.IndicationService."
965 "_MSG_NON_PRIVILEGED_ACCESS_DISABLED",
966 "User ($0) is not authorized to perform this operation.",
967 userName));
968 }
969 #endif
970
971 CIMException cimException;
972
973 CIMNamespaceName nameSpace = request->nameSpace;
974 CIMName className = request->instanceName.getClassName().getString();
975
976 Uint32 retCode = _RETURNCODE_COMPLETEDWITHNOERROR;
|
977 venkat.puvvada 1.273 Uint16 requestedState = _ENABLEDSTATE_UNKNOWN;
|
978 venkat.puvvada 1.258
979 if(!nameSpace.equal(PEGASUS_NAMESPACENAME_INTEROP))
980 {
981 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
982 nameSpace.getString());
983 }
984 else if(!className.equal(PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE))
985 {
986 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
987 className.getString());
988 }
989 else if (!request->methodName.equal(_METHOD_REQUESTSTATECHANGE))
990 {
991 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_FOUND,
992 String::EMPTY);
993 }
994 else
995 {
996 CIMValue cimValue;
997
998 for (Uint32 i = 0, n = request->inParameters.size(); i < n ; ++i)
999 venkat.puvvada 1.258 {
1000 CIMName name = request->inParameters[i].getParameterName();
1001 if (name.equal(_PARAM_REQUESTEDSTATE))
1002 {
1003 CIMValue cimValue = request->inParameters[i].getValue();
1004 cimValue.get(requestedState);
1005 }
1006 else if ((name.equal(_PARAM_TIMEOUTPERIOD)))
1007 {
1008 CIMDateTime timeoutInterval;
1009 CIMValue cimValue = request->inParameters[i].getValue();
1010 cimValue.get(timeoutInterval);
1011 if (!timeoutInterval.isInterval())
1012 {
1013 retCode = _RETURNCODE_INVALIDPARAMETER;
1014 break;
1015 }
1016 // Get timeout in seconds
1017 timeoutSeconds =
1018 timeoutInterval.toMicroSeconds() / 1000000;
1019 }
1020 venkat.puvvada 1.258 else
1021 {
1022 retCode = _RETURNCODE_INVALIDPARAMETER;
1023 break;
1024 }
1025 }
|
1026 venkat.puvvada 1.273 if (requestedState == _ENABLEDSTATE_UNKNOWN)
1027 {
1028 cimException = PEGASUS_CIM_EXCEPTION(
1029 CIM_ERR_INVALID_PARAMETER,
1030 _PARAM_REQUESTEDSTATE.getString());
1031 retCode = _RETURNCODE_INVALIDPARAMETER;
1032 }
|
1033 venkat.puvvada 1.258 }
1034
1035 if (cimException.getCode() == CIM_ERR_SUCCESS &&
1036 retCode == _RETURNCODE_COMPLETEDWITHNOERROR)
1037 {
1038 if (requestedState == _ENABLEDSTATE_ENABLED)
1039 {
|
1040 ajay.rao 1.266 retCode = _enableIndicationService(timeoutSeconds);
|
1041 venkat.puvvada 1.258 }
1042 else if (requestedState == _ENABLEDSTATE_DISABLED)
1043 {
1044 retCode = _disableIndicationService(
1045 timeoutSeconds,
1046 cimException);
1047 }
1048 else
1049 {
1050 // We don't support any other state changes now.
1051 retCode = _RETURNCODE_NOTSUPPORTED;
1052 }
1053 }
1054
1055 response->cimException = cimException;
1056 response->retValue = CIMValue(retCode);
1057 _enqueueResponse(request, response);
1058 }
1059
1060
1061 Uint32 IndicationService::_enableIndicationService(Uint32 timeoutSeconds)
1062 venkat.puvvada 1.258 {
1063 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1064 "IndicationService::_enableIndicationService");
1065
1066 Uint32 retCode = _RETURNCODE_COMPLETEDWITHNOERROR;
1067
1068 AutoMutex mtx(_mutex);
1069
1070 // Check if the service is already enabled.
|
1071 ajay.rao 1.266 if (_indicationServiceConfiguration->getEnabledState() ==
1072 _ENABLEDSTATE_ENABLED)
|
1073 venkat.puvvada 1.258 {
1074 // Check if the service is in degraded state.
|
1075 ajay.rao 1.266 if (_indicationServiceConfiguration->getHealthState() ==
1076 _HEALTHSTATE_DEGRADEDWARNING)
|
1077 venkat.puvvada 1.258 {
1078 struct timeval startTime;
1079 Time::gettimeofday(&startTime);
1080
1081 // Wait if there are any pending requests.
1082 if (!_waitForAsyncRequestsComplete(&startTime, timeoutSeconds))
1083 {
1084 Logger::put(
1085 Logger::STANDARD_LOG,
1086 System::CIMSERVER,
1087 Logger::WARNING,
1088 "Failed to recover from degraded state within timeout "
1089 "period of $0 seconds. There are $1 async"
1090 " requests pending.",
1091 timeoutSeconds,
1092 _asyncRequestsPending.get());
1093
1094 retCode = _RETURNCODE_TIMEOUT;
1095 }
1096 else
1097 {
1098 venkat.puvvada 1.258 // No async requests pending.
|
1099 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
1100 _HEALTHSTATE_OK);
|
1101 venkat.puvvada 1.258 }
1102 }
1103 PEG_METHOD_EXIT();
1104 return retCode;
1105 }
1106
|
1107 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(_ENABLEDSTATE_STARTING);
|
1108 venkat.puvvada 1.258
1109 String exceptionMsg;
1110
1111 try
1112 {
1113 if (_initializeActiveSubscriptionsFromRepository(
1114 timeoutSeconds))
1115 {
|
1116 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(_HEALTHSTATE_OK);
|
1117 venkat.puvvada 1.258 }
1118 else
1119 {
|
1120 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
1121 _HEALTHSTATE_DEGRADEDWARNING);
|
1122 venkat.puvvada 1.258 retCode = _RETURNCODE_TIMEOUT;
1123 }
1124 }
1125 catch (const Exception &e)
1126 {
1127 exceptionMsg = e.getMessage();
1128 }
1129 catch (...)
1130 {
1131 exceptionMsg = "Unknown error";
1132 }
1133
|
1134 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(_ENABLEDSTATE_ENABLED);
|
1135 venkat.puvvada 1.258 sendSubscriptionInitComplete();
1136
1137 if (exceptionMsg.size())
1138 {
1139 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
1140 "Exception while enabling the indication Service : %s",
1141 (const char*)exceptionMsg.getCString()));
1142
|
1143 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
1144 _HEALTHSTATE_DEGRADEDWARNING);
|
1145 venkat.puvvada 1.258 }
1146
1147 PEG_METHOD_EXIT();
1148 return retCode;
1149 }
1150
1151 Uint32 IndicationService::_disableIndicationService(Uint32 timeoutSeconds,
1152 CIMException &cimException)
1153 {
1154 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1155 "IndicationService::_disableIndicationService");
1156
1157 Uint32 retCode = _RETURNCODE_COMPLETEDWITHNOERROR;
1158
1159 AutoMutex mtx(_mutex);
1160
1161 // Check if the service is already disabled.
|
1162 ajay.rao 1.266 if (_indicationServiceConfiguration->getEnabledState() ==
1163 _ENABLEDSTATE_DISABLED)
|
1164 venkat.puvvada 1.258 {
1165 PEG_METHOD_EXIT();
1166 return retCode;
1167 }
1168
|
1169 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(
1170 _ENABLEDSTATE_SHUTTINGDOWN);
|
1171 venkat.puvvada 1.258
1172 // Wait for threads running other than indication threads.
1173 while (_threads.get() - _processIndicationThreads.get() > 1)
1174 {
1175 Threads::sleep(100);
1176 }
1177
1178 String exceptionMsg;
1179
1180 try
1181 {
1182 if (_deleteActiveSubscriptions(timeoutSeconds))
1183 {
1184 _sendIndicationServiceDisabled();
|
1185 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(
1186 _ENABLEDSTATE_DISABLED);
1187 _indicationServiceConfiguration->setHealthState(_HEALTHSTATE_OK);
|
1188 venkat.puvvada 1.258 }
1189 else
1190 {
|
1191 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(
1192 _ENABLEDSTATE_ENABLED);
|
1193 venkat.puvvada 1.258 retCode = _RETURNCODE_TIMEOUT;
|
1194 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
1195 _HEALTHSTATE_DEGRADEDWARNING);
|
1196 venkat.puvvada 1.258 cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
1197 MessageLoaderParms(
1198 _MSG_STATE_CHANGE_FAILED_KEY,
1199 _MSG_STATE_CHANGE_FAILED,
1200 _getReturnCodeString(_RETURNCODE_TIMEOUT),
|
1201 ajay.rao 1.266 _getEnabledStateString(
1202 _indicationServiceConfiguration->getEnabledState()),
1203 _getHealthStateString(
1204 _indicationServiceConfiguration->getHealthState())));
|
1205 venkat.puvvada 1.258 }
1206 }
1207 catch (const Exception &e)
1208 {
1209 exceptionMsg = e.getMessage();
1210 }
1211 catch (...)
1212 {
1213 exceptionMsg = "Unknown Error";
1214 }
1215
1216 if (exceptionMsg.size())
1217 {
1218 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
1219 "Exception while disabling the indication Service : %s",
1220 (const char*)exceptionMsg.getCString()));
1221
|
1222 ajay.rao 1.266 _indicationServiceConfiguration->setEnabledState(
1223 _ENABLEDSTATE_ENABLED);
|
1224 venkat.puvvada 1.258 retCode = _RETURNCODE_FAILED;
|
1225 ajay.rao 1.266 _indicationServiceConfiguration->setHealthState(
1226 _HEALTHSTATE_DEGRADEDWARNING);
|
1227 venkat.puvvada 1.258 cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
1228 MessageLoaderParms(
1229 _MSG_STATE_CHANGE_FAILED_KEY,
1230 _MSG_STATE_CHANGE_FAILED,
1231 exceptionMsg,
|
1232 ajay.rao 1.266 _getEnabledStateString(
1233 _indicationServiceConfiguration->getEnabledState()),
1234 _getHealthStateString(
1235 _indicationServiceConfiguration->getHealthState())));
|
1236 venkat.puvvada 1.258 }
1237 PEG_METHOD_EXIT();
1238
1239 return retCode;
1240 }
1241
1242 Boolean IndicationService::_deleteActiveSubscriptions(Uint32 timeoutSeconds)
1243 {
1244 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1245 "IndicationService::_deleteActiveSubscriptions");
1246
1247 struct timeval startTime;
1248 Time::gettimeofday(&startTime);
1249 Boolean completed = true;
1250
1251 // Check if there are existing pending async requests
1252 if (!_waitForAsyncRequestsComplete(&startTime, timeoutSeconds))
1253 {
1254 Logger::put(
1255 Logger::STANDARD_LOG,
1256 System::CIMSERVER,
1257 venkat.puvvada 1.258 Logger::WARNING,
1258 "Failed to disable Indication service within timeout "
1259 "period of $0 seconds. There are $1 existing async "
1260 "requests pending.",
1261 timeoutSeconds,
1262 _asyncRequestsPending.get());
1263
1264 PEG_METHOD_EXIT();
1265 return false;
1266 }
1267
1268 Array <ActiveSubscriptionsTableEntry> subscriptionsEntries;
1269 subscriptionsEntries =
1270 _subscriptionTable->getAllActiveSubscriptionEntries();
1271
1272 CIMPropertyList requiredProperties;
1273 String condition;
1274 String query;
1275 String queryLanguage;
1276
1277 for (Uint32 i=0; i < subscriptionsEntries.size(); i++)
1278 venkat.puvvada 1.258 {
1279 CIMInstance instance = subscriptionsEntries[i].subscription;
1280 String creator = instance.getProperty (instance.findProperty
1281 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue ().toString ();
1282
1283 AcceptLanguageList acceptLangs;
1284 Uint32 propIndex = instance.findProperty(
1285 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
1286 if (propIndex != PEG_NOT_FOUND)
1287 {
1288 String acceptLangsString;
1289 instance.getProperty(propIndex).getValue().get(acceptLangsString);
1290 if (acceptLangsString.size())
1291 {
1292 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
1293 acceptLangsString);
1294 }
1295 }
1296 ContentLanguageList contentLangs;
1297 propIndex = instance.findProperty
1298 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
1299 venkat.puvvada 1.258 if (propIndex != PEG_NOT_FOUND)
1300 {
1301 String contentLangsString;
1302 instance.getProperty(propIndex).getValue().get(
1303 contentLangsString);
1304 if (contentLangsString.size())
1305 {
1306 contentLangs = LanguageParser::parseContentLanguageHeader(
1307 contentLangsString);
1308 }
1309 }
|
1310 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
1311 venkat.puvvada 1.258
|
1312 venkat.puvvada 1.275 _getCreateParams (
1313 instance,
1314 indicationSubclasses,
1315 requiredProperties,
1316 condition,
1317 query,
1318 queryLanguage);
|
1319 venkat.puvvada 1.258
1320 _sendAsyncDeleteRequests(
1321 subscriptionsEntries[i].providers,
1322 instance,
1323 acceptLangs,
1324 contentLangs,
1325 0, // no request
1326 indicationSubclasses,
1327 creator);
1328
1329 }
1330
1331 if (!_waitForAsyncRequestsComplete(&startTime, timeoutSeconds))
1332 {
1333 Logger::put(
1334 Logger::STANDARD_LOG,
1335 System::CIMSERVER,
1336 Logger::WARNING,
1337 "Failed to disable Indication service within timeout "
1338 "period of $0 seconds. There are $1 async requests pending.",
1339 timeoutSeconds,
1340 venkat.puvvada 1.258 _asyncRequestsPending.get());
1341
1342 completed = false;
1343 }
1344 else
1345 {
1346 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
1347 _providerIndicationCountTable.clear();
1348 #endif
1349
1350 _subscriptionTable->clear();
1351 }
1352
1353 PEG_METHOD_EXIT();
1354
1355 return completed;
1356 }
1357
1358
1359 Boolean IndicationService::_waitForAsyncRequestsComplete(
1360 struct timeval* startTime,
1361 venkat.puvvada 1.258 Uint32 timeoutSeconds)
1362 {
1363 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1364 "IndicationService::_waitForAsyncRequestsComplete");
1365
1366 struct timeval timeNow;
1367 Boolean requestsPending = false;
1368 while (_asyncRequestsPending.get() > 0)
1369 {
1370 if (timeoutSeconds)
1371 {
1372 Time::gettimeofday(&timeNow);
1373 if ((Uint32)(timeNow.tv_sec - startTime->tv_sec) > timeoutSeconds)
1374 {
1375 requestsPending = true;
1376 break;
1377 }
1378 }
1379 Threads::sleep(100);
1380 }
1381 PEG_METHOD_EXIT();
1382 venkat.puvvada 1.258
1383 return !requestsPending;
1384 }
|
1385 venkat.puvvada 1.263
1386 void IndicationService::_sendSubscriptionNotActiveMessagetoHandlerService(
1387 const CIMObjectPath &subscriptionName)
1388 {
1389 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1390 "IndicationService::_sendSubscriptionNotActiveMessagetoHandlerService");
1391
1392 CIMRequestMessage * notifyRequest =
1393 new CIMNotifySubscriptionNotActiveRequestMessage (
1394 XmlWriter::getNextMessageId (),
1395 subscriptionName,
1396 QueueIdStack(_handlerService));
1397
1398 AsyncLegacyOperationStart *req =
1399 new AsyncLegacyOperationStart(
1400 0,
1401 _handlerService,
1402 notifyRequest);
1403
1404 AsyncReply *reply = SendWait(req);
1405 delete req;
1406 venkat.puvvada 1.263 delete reply;
1407
1408 PEG_METHOD_EXIT();
1409 }
1410
1411 void IndicationService::_sendListenerNotActiveMessagetoHandlerService(
1412 const CIMObjectPath &handlerName)
1413 {
1414 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1415 "IndicationService::_sendListenerNotActiveMessagetoHandlerService");
1416
1417 // Send notify request only to CIMXML handlers
1418 {
1419 CIMRequestMessage * notifyRequest =
1420 new CIMNotifyListenerNotActiveRequestMessage (
1421 XmlWriter::getNextMessageId (),
1422 handlerName,
1423 QueueIdStack(_handlerService));
1424
1425 AsyncLegacyOperationStart *req =
1426 new AsyncLegacyOperationStart(
1427 venkat.puvvada 1.263 0,
1428 _handlerService,
1429 notifyRequest);
1430
1431 AsyncReply *reply = SendWait(req);
1432 delete req;
1433 delete reply;
1434 }
1435
1436 PEG_METHOD_EXIT();
1437 }
1438
|
1439 venkat.puvvada 1.258 #endif
1440
1441 void IndicationService::_updateAcceptedSubscription(
1442 CIMInstance &subscription,
1443 const Array<ProviderClassList> &acceptedProviders,
|
1444 venkat.puvvada 1.275 const Array<NamespaceClassList> &indicationSubclasses)
|
1445 venkat.puvvada 1.258 {
1446 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1447 "IndicationService::_updateAcceptedSubscription");
1448
1449 if (acceptedProviders.size() == 0)
1450 {
1451 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
1452 "No providers accepted subscription on initialization: %s",
1453 (const char *)
1454 subscription.getPath().toString().getCString()));
1455
1456 //
1457 // No providers accepted the subscription
1458 // Implement the subscription's On Fatal Error Policy
1459 // If subscription is not disabled or removed, send alert and
1460 // Insert entries into the subscription hash tables
1461 //
1462 if (!_subscriptionRepository->reconcileFatalError(
1463 subscription))
1464 {
1465 //
1466 venkat.puvvada 1.258 // Insert entries into the subscription hash tables
1467 //
1468 _subscriptionTable->insertSubscription(
1469 subscription,
1470 acceptedProviders,
|
1471 venkat.puvvada 1.275 indicationSubclasses);
|
1472 venkat.puvvada 1.258
1473 #if 0
1474 //
1475 // Send alert
1476 //
1477 //
1478 // Send NoProviderAlertIndication to handler instances
1479 // ATTN: NoProviderAlertIndication must be defined
1480 //
1481 Array<CIMInstance> subscriptions;
1482 subscriptions.append(activeSubscriptions[i]);
1483 CIMInstance indicationInstance = _createAlertInstance(
1484 _CLASS_NO_PROVIDER_ALERT, subscriptions);
1485
1486 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
1487 "Sending NoProvider Alert for %u subscriptions",
1488 subscriptions.size()));
1489 _sendAlerts(subscriptions, indicationInstance);
1490 #endif
1491
1492 //
1493 venkat.puvvada 1.258 // Get Subscription Filter Name and Handler Name
1494 //
1495 String logString = _getSubscriptionLogString(
1496 subscription);
1497
1498 //
1499 // Log a message for the subscription
1500 //
1501 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
1502 Logger::WARNING,
1503 MessageLoaderParms(
1504 _MSG_NO_PROVIDER_KEY,
1505 _MSG_NO_PROVIDER,
1506 logString,
1507 subscription.getPath().getNameSpace().getString()));
1508 }
1509 }
1510 else
1511 {
1512 //
1513 // At least one provider accepted the subscription
1514 venkat.puvvada 1.258 // Insert entries into the subscription hash tables
1515 //
1516 _subscriptionTable->insertSubscription(
1517 subscription,
1518 acceptedProviders,
|
1519 venkat.puvvada 1.275 indicationSubclasses);
|
1520 venkat.puvvada 1.258 }
|
1521 kumpf 1.32
|
1522 venkat.puvvada 1.258 PEG_METHOD_EXIT();
1523 }
|
1524 carolann.graves 1.188
|
1525 venkat.puvvada 1.258 Boolean IndicationService::_initializeActiveSubscriptionsFromRepository(
1526 Uint32 timeoutSeconds)
1527 {
1528 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
1529 "IndicationService::_initializeActiveSubscriptionsFromRepository");
|
1530 kumpf 1.218
|
1531 venkat.puvvada 1.258 struct timeval startTime;
1532 Time::gettimeofday(&startTime);
1533 Boolean completed = true;
|
1534 kumpf 1.218
|
1535 venkat.puvvada 1.258 #ifdef PEGASUS_INDICATION_PERFINST
1536 Stopwatch stopWatch;
|
1537 carolann.graves 1.188
|
1538 venkat.puvvada 1.258 stopWatch.start();
1539 #endif
|
1540 carolann.graves 1.188
|
1541 venkat.puvvada 1.258 // Create Subscription Repository
1542 _subscriptionRepository.reset(new SubscriptionRepository(_cimRepository));
|
1543 carolann.graves 1.188
|
1544 venkat.puvvada 1.258 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
1545 _asyncRequestsPending = 0;
1546 _processIndicationThreads = 0;
1547 #endif
|
1548 carolann.graves 1.188
|
1549 venkat.puvvada 1.258 // Create Subscription Table
1550 _subscriptionTable.reset(
1551 new SubscriptionTable(_subscriptionRepository.get()));
|
1552 carolann.graves 1.188
|
1553 venkat.puvvada 1.258 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
1554 _providerIndicationCountTable.clear();
1555 #endif
|
1556 carolann.graves 1.188
|
1557 venkat.puvvada 1.258 Array<CIMInstance> activeSubscriptions;
1558 Array<CIMInstance> noProviderSubscriptions;
1559 Boolean invalidInstance = false;
|
1560 carolann.graves 1.188 //
|
1561 kumpf 1.11 // Get existing active subscriptions from each namespace in the repository
1562 //
|
1563 kumpf 1.218 invalidInstance = _subscriptionRepository->getActiveSubscriptions(
1564 activeSubscriptions);
1565 noProviderSubscriptions.clear();
|
1566 kumpf 1.1
|
1567 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1568 carolann.graves 1.192 "%u active subscription(s) found on initialization",
|
1569 kumpf 1.218 activeSubscriptions.size()));
|
1570 carolann.graves 1.192
|
1571 kumpf 1.11 String condition;
|
1572 kumpf 1.124 String query;
|
1573 kumpf 1.11 String queryLanguage;
1574 CIMPropertyList propertyList;
|
1575 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
1576 kumpf 1.1
|
1577 kumpf 1.218 for (Uint32 i = 0; i < activeSubscriptions.size(); i++)
|
1578 kumpf 1.11 {
1579 //
1580 // Check for expired subscription
1581 //
|
1582 carolann.graves 1.192 try
1583 {
|
1584 kumpf 1.218 if (_isExpired(activeSubscriptions[i]))
|
1585 dj.gorey 1.135 {
|
1586 kumpf 1.218 CIMObjectPath path = activeSubscriptions[i].getPath();
|
1587 carolann.graves 1.192
|
1588 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1589 carolann.graves 1.192 "Deleting expired subscription on initialization: %s",
|
1590 kumpf 1.218 (const char *) path.toString().getCString()));
|
1591 carolann.graves 1.192
|
1592 kumpf 1.218 _deleteExpiredSubscription(path);
|
1593 venkat.puvvada 1.263
1594 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
1595 _sendSubscriptionNotActiveMessagetoHandlerService(path);
1596 #endif
|
1597 carolann.graves 1.192 // If subscription is expired delete the subscription
1598 // and continue on to the next one.
1599 continue;
|
1600 dj.gorey 1.135 }
|
1601 carolann.graves 1.192 }
1602 catch (DateTimeOutOfRangeException& e)
|
1603 kumpf 1.11 {
|
1604 dj.gorey 1.135 //
1605 // This instance from the repository is invalid
1606 // Log a message and skip it
1607 //
|
1608 kumpf 1.218 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
|
1609 dj.gorey 1.135 Logger::WARNING,
|
1610 kumpf 1.241 MessageLoaderParms(
|
1611 kumpf 1.243 "IndicationService.IndicationService."
1612 "INVALID_SUBSCRIPTION_INSTANCE_IGNORED",
1613 "An invalid Subscription instance was ignored: $0.",
|
1614 kumpf 1.241 e.getMessage()));
|
1615 kumpf 1.11 continue;
1616 }
|
1617 kumpf 1.1
|
1618 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
1619 _getCreateParams(
1620 activeSubscriptions[i],
1621 indicationSubclasses,
1622 indicationProviders,
1623 propertyList,
1624 condition,
1625 query,
1626 queryLanguage);
|
1627 kumpf 1.1
|
1628 kumpf 1.218 if (indicationProviders.size() == 0)
|
1629 kumpf 1.11 {
|
1630 marek 1.238 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
1631 carolann.graves 1.192 "No providers found for subscription on initialization: %s",
1632 (const char *)
|
1633 kumpf 1.218 activeSubscriptions[i].getPath().toString().getCString()));
|
1634 carolann.graves 1.192
|
1635 kumpf 1.11 //
1636 // There are no providers that can support this subscription
|
1637 kumpf 1.19 // Implement the subscription's On Fatal Error Policy
1638 // If subscription is not disabled or removed,
|
1639 kumpf 1.105 // Append this subscription to no provider list and
1640 // Insert entries into the subscription hash tables
|
1641 kumpf 1.11 //
|
1642 kumpf 1.218 if (!_subscriptionRepository->reconcileFatalError(
1643 activeSubscriptions[i]))
|
1644 kumpf 1.19 {
|
1645 kumpf 1.218 noProviderSubscriptions.append(activeSubscriptions[i]);
|
1646 kumpf 1.105
|
1647 venkat.puvvada 1.275 _subscriptionTable->insertSubscription(
1648 activeSubscriptions[i],
1649 indicationProviders,
1650 indicationSubclasses);
|
1651 kumpf 1.19 }
|
1652 kumpf 1.11 continue;
1653 }
|
1654 dj.gorey 1.135
|
1655 kumpf 1.11 //
|
1656 kumpf 1.38 // Send Create request message to each provider
|
1657 kumpf 1.39 // NOTE: These Create requests are not associated with a user request,
1658 // so there is no associated authType or userName
|
1659 kumpf 1.15 // The Creator from the subscription instance is used for userName,
1660 // and authType is not set
|
1661 kumpf 1.11 //
|
1662 kumpf 1.218 CIMInstance instance = activeSubscriptions[i];
|
1663 kumpf 1.80 String creator;
|
1664 kumpf 1.218 if (!_getCreator(instance, creator))
|
1665 kumpf 1.80 {
1666 //
1667 // This instance from the repository is corrupted
|
1668 kumpf 1.114 // Skip it
|
1669 kumpf 1.80 //
|
1670 kumpf 1.114 invalidInstance = true;
|
1671 carolann.graves 1.144 continue;
|
1672 kumpf 1.80 }
|
1673 chuck 1.77
|
1674 kumpf 1.137 // Get the language tags that were saved with the subscription instance
|
1675 kumpf 1.195 AcceptLanguageList acceptLangs;
|
1676 kumpf 1.218 Uint32 propIndex = instance.findProperty(
1677 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
|
1678 kumpf 1.137 if (propIndex != PEG_NOT_FOUND)
|
1679 chip 1.162 {
|
1680 kumpf 1.194 String acceptLangsString;
1681 instance.getProperty(propIndex).getValue().get(acceptLangsString);
1682 if (acceptLangsString.size())
1683 {
1684 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
1685 acceptLangsString);
1686 }
|
1687 chip 1.162 }
|
1688 kumpf 1.195 ContentLanguageList contentLangs;
|
1689 kumpf 1.218 propIndex = instance.findProperty(
1690 PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
|
1691 kumpf 1.137 if (propIndex != PEG_NOT_FOUND)
|
1692 chip 1.162 {
|
1693 kumpf 1.194 String contentLangsString;
1694 instance.getProperty(propIndex).getValue().get(contentLangsString);
1695 if (contentLangsString.size())
1696 {
1697 contentLangs = LanguageParser::parseContentLanguageHeader(
1698 contentLangsString);
1699 }
|
1700 chuck 1.77 }
|
1701 chuck 1.75
|
1702 venkat.puvvada 1.258 // If Indication profile support is enabled indication service can be
1703 // enabled dynamically. Send create subscription requests using
1704 // SendAsync() to honor the timeout.
1705 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
1706 if (timeoutSeconds > 0) // if timeout is specified
1707 {
1708 _sendAsyncCreateRequests(
1709 indicationProviders,
1710 propertyList,
1711 condition,
1712 query,
1713 queryLanguage,
1714 activeSubscriptions[i],
1715 acceptLangs,
1716 contentLangs,
1717 0, // original request is 0
1718 indicationSubclasses,
1719 creator);
1720 }
1721 else
1722 #endif
|
1723 carolann.graves 1.172 //
|
1724 venkat.puvvada 1.258 // Send Create request message to each provider using SendWait() if
1725 // timeout is not specified.
|
1726 carolann.graves 1.172 // Note: SendWait is used instead of SendAsync. Initialization must
1727 // deal with multiple subscriptions, each with multiple providers.
1728 // Using SendWait eliminates the need for a callback and the necessity
1729 // to handle multiple levels of aggregation, which would add
1730 // significant complexity. Since initialization cannot complete
1731 // anyway until responses have been received for all subscriptions,
1732 // from all the providers, use of SendWait should not cause a
1733 // significant performance issue.
1734 //
1735 {
|
1736 venkat.puvvada 1.258 Array<ProviderClassList> acceptedProviders;
1737 acceptedProviders = _sendWaitCreateRequests(
1738 indicationProviders,
1739 propertyList,
1740 condition,
1741 query,
1742 queryLanguage,
1743 activeSubscriptions[i],
1744 acceptLangs,
1745 contentLangs,
1746 creator);
|
1747 carolann.graves 1.172
|
1748 venkat.puvvada 1.258 _updateAcceptedSubscription(
|
1749 kumpf 1.218 activeSubscriptions[i],
|
1750 carolann.graves 1.172 acceptedProviders,
|
1751 venkat.puvvada 1.275 indicationSubclasses);
|
1752 carolann.graves 1.172 }
|
1753 kumpf 1.11 } // for each active subscription
|
1754 kumpf 1.1
|
1755 venkat.puvvada 1.258
1756 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
1757 if (timeoutSeconds > 0)
1758 {
1759 if (!_waitForAsyncRequestsComplete(&startTime, timeoutSeconds))
1760 {
1761 Logger::put(
1762 Logger::STANDARD_LOG,
1763 System::CIMSERVER,
1764 Logger::WARNING,
1765 "Failed to enable Indication service within timeout "
1766 "period of $0 seconds. There are $1 async"
1767 " requests pending.",
1768 timeoutSeconds,
1769 _asyncRequestsPending.get());
1770 completed = false;
1771 }
1772 }
1773 #endif
1774
|
1775 kumpf 1.11 //
|
1776 kumpf 1.114 // Log a message if any invalid instances were found
1777 //
1778 if (invalidInstance)
1779 {
|
1780 kumpf 1.218 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
|
1781 kumpf 1.241 MessageLoaderParms(
1782 _MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES));
|
1783 kumpf 1.114 }
1784 //
|
1785 kumpf 1.87 // Log a message for any subscription for which there is no longer any
|
1786 kumpf 1.11 // provider
1787 //
|
1788 kumpf 1.218 if (noProviderSubscriptions.size() > 0)
|
1789 kumpf 1.11 {
|
1790 kumpf 1.87 #if 0
|
1791 kumpf 1.11 //
1792 // Send NoProviderAlertIndication to handler instances
1793 // ATTN: NoProviderAlertIndication must be defined
1794 //
|
1795 kumpf 1.218 CIMInstance indicationInstance = _createAlertInstance(
1796 _CLASS_NO_PROVIDER_ALERT, noProviderSubscriptions);
|
1797 kumpf 1.1
|
1798 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1799 carolann.graves 1.192 "Sending NoProvider Alert for %u subscriptions",
|
1800 kumpf 1.218 noProviderSubscriptions.size()));
1801 _sendAlerts(noProviderSubscriptions, indicationInstance);
|
1802 kumpf 1.87 #endif
1803 //
1804 // Log a message for each subscription
1805 //
|
1806 kumpf 1.218 for (Uint32 i = 0; i < noProviderSubscriptions.size(); i++)
|
1807 kumpf 1.87 {
|
1808 kumpf 1.98 //
1809 // Get Subscription Filter Name and Handler Name
1810 //
|
1811 kumpf 1.218 String logString =
1812 _getSubscriptionLogString(noProviderSubscriptions[i]);
|
1813 kumpf 1.98
|
1814 kumpf 1.218 Logger::put_l(
1815 Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
|
1816 kumpf 1.241 MessageLoaderParms(
1817 _MSG_NO_PROVIDER_KEY,
1818 _MSG_NO_PROVIDER,
1819 logString,
1820 noProviderSubscriptions[i].getPath().getNameSpace().
1821 getString()));
|
1822 kumpf 1.87 }
|
1823 kumpf 1.11 }
|
1824 kumpf 1.1
|
1825 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
|
1826 chip 1.162 stopWatch.stop();
|
1827 kumpf 1.73
|
1828 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1829 marek 1.215 "%s: %.3f seconds", "Initialize", stopWatch.getElapsed()));
|
1830 kumpf 1.73 #endif
1831
|
1832 kumpf 1.218 PEG_METHOD_EXIT();
|
1833 venkat.puvvada 1.258
1834 return completed;
|
1835 kumpf 1.11 }
|
1836 kumpf 1.1
|
1837 kumpf 1.218 void IndicationService::_terminate()
|
1838 kumpf 1.11 {
|
1839 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, "IndicationService::_terminate");
|
1840 kumpf 1.114
|
1841 kumpf 1.218 Array<CIMInstance> activeSubscriptions;
|
1842 kumpf 1.11 CIMInstance indicationInstance;
|
1843 kumpf 1.1
|
1844 kumpf 1.11 //
|
1845 kumpf 1.87 // A message is already logged that CIM Server is shutting down --
1846 // no need to log a message
1847 //
1848 #if 0
1849 //
|
1850 kumpf 1.73 // Get existing active subscriptions from hash table
|
1851 kumpf 1.11 //
|
1852 kumpf 1.218 activeSubscriptions = _getActiveSubscriptions();
|
1853 kumpf 1.1
|
1854 kumpf 1.218 if (activeSubscriptions.size() > 0)
|
1855 kumpf 1.73 {
1856 //
1857 // Create CimomShutdownAlertIndication instance
1858 // ATTN: CimomShutdownAlertIndication must be defined
1859 //
|
1860 kumpf 1.218 indicationInstance = _createAlertInstance(
1861 _CLASS_CIMOM_SHUTDOWN_ALERT, activeSubscriptions);
|
1862 dj.gorey 1.135
|
1863 kumpf 1.73 //
1864 // Send CimomShutdownAlertIndication to each unique handler instance
1865 //
|
1866 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1867 carolann.graves 1.192 "Sending CIMServerShutdown Alert for %u subscriptions",
|
1868 kumpf 1.218 activeSubscriptions.size()));
1869 _sendAlerts(activeSubscriptions, indicationInstance);
|
1870 kumpf 1.73 }
|
1871 kumpf 1.87 #endif
|
1872 kumpf 1.120
1873 //
|
1874 dj.gorey 1.135 // Remove entries from the SubscriptionTable's Active Subscriptions and
|
1875 kumpf 1.120 // Subscription Classes tables
1876 //
|
1877 dj.gorey 1.135 // NOTE: The table entries are removed when the SubscriptionTable
1878 // destructor is called by the IndicationService destructor. However,
|
1879 kumpf 1.120 // currently the IndicationService destructor is never called, so the
|
1880 dj.gorey 1.135 // IndicationService must call the SubscriptionTable clear() function to
|
1881 kumpf 1.120 // remove the table entries.
|
1882 kumpf 1.218 _subscriptionTable->clear();
|
1883 kumpf 1.1
|
1884 kumpf 1.218 PEG_METHOD_EXIT();
|
1885 kumpf 1.11 }
|
1886 kumpf 1.6
|
1887 kumpf 1.94 void IndicationService::_checkNonprivilegedAuthorization(
|
1888 kumpf 1.218 const String& userName)
|
1889 kumpf 1.94 {
|
1890 r.kieninger 1.222 #ifndef PEGASUS_OS_ZOS
|
1891 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
1892 kumpf 1.114 "IndicationService::_checkNonprivilegedAuthorization");
|
1893 kumpf 1.94
|
1894 kumpf 1.235 if (!_enableSubscriptionsForNonprivilegedUsers)
|
1895 kumpf 1.94 {
|
1896 kumpf 1.235 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
1897 "_checkNonprivilegedAuthorization - checking whether user %s is "
1898 "privileged",
1899 (const char*) userName.getCString()));
1900 if (!System::isPrivilegedUser(userName))
|
1901 kumpf 1.94 {
|
1902 kumpf 1.243 MessageLoaderParms parms(
1903 "IndicationService.IndicationService."
1904 "_MSG_NON_PRIVILEGED_ACCESS_DISABLED",
1905 "User ($0) is not authorized to perform this operation.",
1906 userName);
|
1907 kumpf 1.235 PEG_METHOD_EXIT();
1908 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, parms);
|
1909 kumpf 1.94 }
1910 }
|
1911 kumpf 1.235
1912 PEG_METHOD_EXIT();
|
1913 r.kieninger 1.222 #endif
|
1914 dj.gorey 1.135 }
|
1915 kumpf 1.94
|
1916 venkat.puvvada 1.264 void IndicationService::_deliverWaitingIndications()
1917 {
1918 // Deliver indications if any waiting for pending Create Subscription
1919 // requests.
1920 Message *message;
1921 while(!_subscriptionRepository->
1922 getUncommittedCreateSubscriptionRequests() &&
1923 (message = _deliveryWaitIndications.remove_front()))
1924 {
1925 handleEnqueue(message);
1926 }
1927 }
1928
1929 void IndicationService::_beginCreateSubscription(const CIMObjectPath &objPath)
1930 {
1931 _subscriptionRepository->beginCreateSubscription(objPath);
1932 }
1933
1934 void IndicationService::_cancelCreateSubscription(const CIMObjectPath &objPath)
1935 {
1936 _subscriptionRepository->cancelCreateSubscription(objPath);
1937 venkat.puvvada 1.264 _deliverWaitingIndications();
1938 }
1939
1940 void IndicationService::_commitCreateSubscription(const CIMObjectPath &objPath)
1941 {
1942 _subscriptionRepository->commitCreateSubscription(objPath);
1943 _deliverWaitingIndications();
1944 }
1945
|
1946 kumpf 1.218 void IndicationService::_handleCreateInstanceRequest(const Message * message)
|
1947 kumpf 1.11 {
|
1948 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
1949 kumpf 1.114 "IndicationService::_handleCreateInstanceRequest");
|
1950 kumpf 1.6
|
1951 dj.gorey 1.135 CIMCreateInstanceRequestMessage* request =
|
1952 kumpf 1.11 (CIMCreateInstanceRequestMessage*) message;
|
1953 kumpf 1.6
|
1954 kumpf 1.88 Boolean responseSent = false;
|
1955 kumpf 1.6
|
1956 kumpf 1.45 CIMObjectPath instanceRef;
|
1957 venkat.puvvada 1.221 CIMObjectPath subscriptionPath;
|
1958 kumpf 1.1
|
1959 kumpf 1.218 CIMInstance instance = request->newInstance.clone();
|
1960 kumpf 1.1
|
1961 kumpf 1.235 String userName = ((IdentityContainer)request->operationContext.get(
1962 IdentityContainer::NAME)).getUserName();
1963 _checkNonprivilegedAuthorization(userName);
|
1964 se.gupta 1.123
|
1965 kumpf 1.235 AcceptLanguageList acceptLangs =
1966 ((AcceptLanguageListContainer)request->operationContext.get(
1967 AcceptLanguageListContainer::NAME)).getLanguages();
1968 ContentLanguageList contentLangs =
1969 ((ContentLanguageListContainer)request->operationContext.get(
1970 ContentLanguageListContainer::NAME)).getLanguages();
1971
1972 if (_canCreate(instance, request->nameSpace))
1973 {
1974 //
1975 // If the instance is of the PEGASUS_CLASSNAME_INDSUBSCRIPTION
1976 // class or the PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION
1977 // class and subscription state is enabled, determine if any
1978 // providers can serve the subscription
1979 //
1980 Uint16 subscriptionState;
1981 String condition;
1982 String query;
1983 String queryLanguage;
1984 CIMPropertyList requiredProperties;
|
1985 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
1986 kumpf 1.235 Array<ProviderClassList> indicationProviders;
|
1987 kumpf 1.105
|
1988 kumpf 1.235 if ((instance.getClassName().equal(
1989 PEGASUS_CLASSNAME_INDSUBSCRIPTION)) ||
1990 (instance.getClassName().equal(
1991 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
|
1992 kumpf 1.105 {
|
1993 venkat.puvvada 1.264 _beginCreateSubscription(instance.getPath());
|
1994 kumpf 1.105
|
1995 kumpf 1.235 try
|
1996 kumpf 1.105 {
|
1997 venkat.puvvada 1.221 subscriptionPath = instance.getPath();
|
1998 kumpf 1.105 //
1999 // Get subscription state
2000 //
|
2001 dj.gorey 1.135 // NOTE: _canCreate has already validated the
2002 // SubscriptionState property in the instance; if missing, it
2003 // was added with the default value; if null, it was set to
|
2004 kumpf 1.105 // the default value; if invalid, an exception was thrown
2005 //
2006 CIMValue subscriptionStateValue;
|
2007 kumpf 1.218 subscriptionStateValue = instance.getProperty(
2008 instance.findProperty(
2009 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE)).getValue();
2010 subscriptionStateValue.get(subscriptionState);
|
2011 kumpf 1.105
|
2012 w.otsuka 1.207 if ((subscriptionState == STATE_ENABLED) ||
2013 (subscriptionState == STATE_ENABLEDDEGRADED))
|
2014 kumpf 1.105 {
|
2015 venkat.puvvada 1.275 _getCreateParams(
2016 instance,
2017 indicationSubclasses,
2018 indicationProviders,
2019 requiredProperties,
2020 condition,
2021 query,
2022 queryLanguage);
|
2023 kumpf 1.105
|
2024 kumpf 1.218 if (indicationProviders.size() == 0)
|
2025 kumpf 1.105 {
2026 //
|
2027 dj.gorey 1.135 // There are no providers that can support this
|
2028 kumpf 1.105 // subscription
2029 //
2030
|
2031 kumpf 1.218 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
|
2032 dj.gorey 1.135 MessageLoaderParms(_MSG_NO_PROVIDERS_KEY,
|
2033 kumpf 1.105 _MSG_NO_PROVIDERS));
2034 }
2035
2036 //
2037 // Send Create request message to each provider
2038 //
|
2039 venkat.puvvada 1.275 _sendAsyncCreateRequests(
2040 indicationProviders,
2041 requiredProperties,
2042 condition,
2043 query,
2044 queryLanguage,
2045 instance,
|
2046 dj.gorey 1.135 acceptLangs,
|
2047 kumpf 1.124 contentLangs,
2048 request,
|
2049 kumpf 1.105 indicationSubclasses,
|
2050 venkat.puvvada 1.275 userName,
2051 request->authType);
|
2052 kumpf 1.105
2053 //
|
2054 kumpf 1.137 // Response is sent from _handleCreateResponseAggregation
|
2055 kumpf 1.105 //
2056 responseSent = true;
2057 }
2058 else
2059 {
2060 //
2061 // Create instance for disabled subscription
2062 //
|
2063 kumpf 1.218 instanceRef = _subscriptionRepository->createInstance(
2064 instance, request->nameSpace, userName,
2065 acceptLangs, contentLangs, false);
|
2066 venkat.puvvada 1.264 _commitCreateSubscription(subscriptionPath);
|
2067 marek 1.280
2068 // put correct SystemName in place
2069 _setSubscriptionSystemName(
2070 instanceRef,
2071 System::getFullyQualifiedHostName());
|
2072 kumpf 1.105 }
2073 }
|
2074 kumpf 1.235 catch (...)
|
2075 kumpf 1.105 {
|
2076 venkat.puvvada 1.264 _cancelCreateSubscription(subscriptionPath);
|
2077 kumpf 1.235 throw;
|
2078 kumpf 1.105 }
2079 }
|
2080 kumpf 1.235 else
2081 {
2082 //
2083 // Create instance for filter or handler
2084 //
2085 instanceRef = _subscriptionRepository->createInstance(
2086 instance, request->nameSpace, userName,
2087 acceptLangs, contentLangs, false);
|
2088 marek 1.280
2089 // put correct SystemName in place
2090 _setSystemNameInHandlerFilter(
2091 instanceRef,
2092 System::getFullyQualifiedHostName());
2093
|
2094 kumpf 1.235 }
|
2095 kumpf 1.11 }
|
2096 kumpf 1.1
|
2097 kumpf 1.38 //
|
2098 kumpf 1.137 // Send response, if not sent from callback
2099 // (for example, if there are no indication providers that can support a
2100 // subscription)
|
2101 kumpf 1.38 //
|
2102 kumpf 1.88 if (!responseSent)
2103 {
|
2104 dj.gorey 1.135 // l10n - no Content-Language in response
|
2105 kumpf 1.213 CIMCreateInstanceResponseMessage* response =
2106 dynamic_cast<CIMCreateInstanceResponseMessage*>(
2107 request->buildResponse());
2108 PEGASUS_ASSERT(response != 0);
|
2109 carolann.graves 1.145 response->instanceName = instanceRef;
|
2110 kumpf 1.218 _enqueueResponse(request, response);
|
2111 kumpf 1.88 }
|
2112 kumpf 1.6
|
2113 kumpf 1.218 PEG_METHOD_EXIT();
|
2114 kumpf 1.11 }
|
2115 kumpf 1.6
|
2116 kumpf 1.218 void IndicationService::_handleGetInstanceRequest(const Message* message)
|
2117 kumpf 1.11 {
|
2118 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
2119 kumpf 1.114 "IndicationService::_handleGetInstanceRequest");
|
2120 kumpf 1.6
|
2121 dj.gorey 1.135 CIMGetInstanceRequestMessage* request =
|
2122 kumpf 1.11 (CIMGetInstanceRequestMessage*) message;
|
2123 kumpf 1.6
|
2124 kumpf 1.11 CIMInstance instance;
|
2125 kumpf 1.194 String contentLangsString;
|
2126 kumpf 1.6
|
2127 venkat.puvvada 1.234 String userName = ((IdentityContainer)request->operationContext.
2128 get(IdentityContainer::NAME)).getUserName();
2129
|
2130 kumpf 1.235 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
2131 if (request->className.equal(PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE)||
2132 request->className.equal(
2133 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICECAPABILITIES))
|
2134 kumpf 1.11 {
|
2135 kumpf 1.235 instance = _indicationServiceConfiguration->getInstance(
2136 request->nameSpace,
2137 request->instanceName,
2138 request->includeQualifiers,
2139 request->includeClassOrigin,
2140 request->propertyList);
2141 }
2142 else
|
2143 venkat.puvvada 1.231 #endif
|
2144 yi.zhou 1.232
2145 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
|
2146 kumpf 1.235 if (request->className.equal(PEGASUS_CLASSNAME_PROVIDERINDDATA))
2147 {
2148 instance = _providerIndicationCountTable.
2149 getProviderIndicationDataInstance(request->instanceName);
2150 }
2151 else if (request->className.equal(
2152 PEGASUS_CLASSNAME_SUBSCRIPTIONINDDATA))
2153 {
2154 instance = _subscriptionTable->
2155 getSubscriptionIndicationDataInstance(request->instanceName);
2156 }
2157 else
|
2158 yi.zhou 1.232 #endif
|
2159 kumpf 1.235 {
2160 _checkNonprivilegedAuthorization(userName);
2161
2162 //
2163 // Add Creator to property list, if not null
2164 // Also, if a Subscription and Time Remaining is requested,
2165 // Ensure Subscription Duration and Start Time are in property list
2166 //
2167 Boolean setTimeRemaining;
2168 Boolean startTimeAdded;
2169 Boolean durationAdded;
2170 CIMPropertyList propertyList = request->propertyList;
2171 CIMName className = request->instanceName.getClassName();
|
2172 marek 1.280
|
2173 kumpf 1.235 _updatePropertyList(
2174 className,
2175 propertyList,
2176 setTimeRemaining,
2177 startTimeAdded,
2178 durationAdded);
|
2179 yi.zhou 1.232
|
2180 marek 1.280 // Set SystemName to empty String for internal processing
2181 // the SystemName will be fixed with correct fully qualified hostname
2182 // on return.
2183 _setSystemName(request->instanceName,String::EMPTY);
2184
|
2185 kumpf 1.235 //
2186 // Get instance from repository
2187 //
2188 instance = _subscriptionRepository->getInstance(
2189 request->nameSpace,
2190 request->instanceName,
2191 request->includeQualifiers,
2192 request->includeClassOrigin,
2193 propertyList);
|
2194 kumpf 1.1
|
2195 kumpf 1.235 //
2196 // Remove Creator property from instance before returning
2197 //
2198 String creator;
2199 if (!_getCreator(instance, creator))
2200 {
|
2201 venkat.puvvada 1.231 //
|
2202 kumpf 1.235 // This instance from the repository is corrupted
|
2203 venkat.puvvada 1.231 //
|
2204 kumpf 1.235 MessageLoaderParms parms(
2205 _MSG_INVALID_INSTANCES_KEY,
2206 _MSG_INVALID_INSTANCES);
2207 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
2208 }
|
2209 sahana.prabhakar 1.265
2210 // check if this is SNMP Handler
2211 if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_SNMP))
2212 {
2213 if(String::compare(creator,userName) != 0)
2214 {
2215 // only the creator of the handler has access to
2216 // the handler deata.
2217 MessageLoaderParms parms(
2218 "IndicationService.IndicationService."
2219 "_MSG_NON_PRIVILEGED_ACCESS_DISABLED",
2220 "User ($0) is not authorized to perform this operation.",
2221 userName);
2222 PEG_METHOD_EXIT();
2223 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, parms);
2224 }
2225 }
2226
|
2227 kumpf 1.235 instance.removeProperty(
2228 instance.findProperty(
2229 PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
|
2230 chuck 1.77
|
2231 sahana.prabhakar 1.265 // Remove Creation Time property from CIMXML handlers
|
2232 venkat.puvvada 1.263
|
2233 marek 1.280 if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
2234 className.equal(PEGASUS_CLASSNAME_LSTNRDST_CIMXML))
|
2235 venkat.puvvada 1.263 {
2236 Uint32 idx = instance.findProperty(
2237 PEGASUS_PROPERTYNAME_LSTNRDST_CREATIONTIME);
2238
2239 if (idx != PEG_NOT_FOUND)
2240 {
2241 instance.removeProperty(idx);
2242 }
2243 }
2244
|
2245 marek 1.280 // Put host name back into SystemName property if not Subscription
2246 if ((!className.equal(PEGASUS_CLASSNAME_INDSUBSCRIPTION)) &&
2247 (!className.equal(PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
2248 {
2249 // this is a Filter or Handler instance
2250 _setOrAddSystemNameInHandlerFilter(
2251 instance,
2252 System::getFullyQualifiedHostName());
2253 }
|
2254 venkat.puvvada 1.263
|
2255 kumpf 1.235 //
2256 // Remove the language properties from instance before returning
2257 //
2258 Uint32 propIndex = instance.findProperty(
2259 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
2260 if (propIndex != PEG_NOT_FOUND)
2261 {
2262 instance.removeProperty(propIndex);
2263 }
|
2264 venkat.puvvada 1.231
|
2265 kumpf 1.235 propIndex = instance.findProperty(
2266 PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
2267 if (propIndex != PEG_NOT_FOUND)
2268 {
2269 // Get the content languages to be sent in the Content-Language
2270 // header
2271 instance.getProperty(propIndex).getValue().
2272 get(contentLangsString);
2273 instance.removeProperty(propIndex);
2274 }
|
2275 venkat.puvvada 1.231
|
2276 kumpf 1.235 //
2277 // If a subscription with a duration, calculate subscription time
2278 // remaining, and add property to the instance
2279 //
2280 if (setTimeRemaining)
2281 {
2282 _setTimeRemaining(instance);
2283 if (startTimeAdded)
|
2284 kumpf 1.99 {
|
2285 kumpf 1.235 instance.removeProperty(
2286 instance.findProperty(
2287 _PROPERTY_STARTTIME));
|
2288 kumpf 1.99 }
|
2289 kumpf 1.235 if (durationAdded)
|
2290 kumpf 1.99 {
|
2291 kumpf 1.235 instance.removeProperty(
2292 instance.findProperty(
2293 _PROPERTY_DURATION));
|
2294 kumpf 1.99 }
|
2295 kumpf 1.11 }
2296 }
|
2297 kumpf 1.235
|
2298 kumpf 1.218 CIMGetInstanceResponseMessage * response =
2299 dynamic_cast<CIMGetInstanceResponseMessage *>(request->buildResponse());
|
2300 kumpf 1.194 if (contentLangsString.size())
2301 {
2302 // Note: setting Content-Language in the response to the
2303 // contentLanguage in the repository.
2304 response->operationContext.set(ContentLanguageListContainer(
2305 LanguageParser::parseContentLanguageHeader(contentLangsString)));
2306 }
|
2307 thilo.boehm 1.262 response->getResponseData().setInstance(instance);
|
2308 kumpf 1.218 _enqueueResponse(request, response);
|
2309 kumpf 1.1
|
2310 kumpf 1.218 PEG_METHOD_EXIT();
|
2311 kumpf 1.1 }
2312
|
2313 kumpf 1.11 void IndicationService::_handleEnumerateInstancesRequest(const Message* message)
|
2314 kumpf 1.1 {
|
2315 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
2316 kumpf 1.114 "IndicationService::_handleEnumerateInstancesRequest");
|
2317 kumpf 1.1
|
2318 dj.gorey 1.135 CIMEnumerateInstancesRequestMessage* request =
|
2319 kumpf 1.11 (CIMEnumerateInstancesRequestMessage*) message;
|
2320 kumpf 1.1
|
2321 kumpf 1.218 Array<CIMInstance> returnedInstances;
|
2322 kumpf 1.216 String aggregatedLangs;
|
2323 chuck 1.75
|
2324 venkat.puvvada 1.234 String userName = ((IdentityContainer)request->operationContext.
2325 get(IdentityContainer::NAME)).getUserName();
2326
|
2327 kumpf 1.235 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
2328 if (request->className.equal(PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE) ||
2329 request->className.equal(
2330 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICECAPABILITIES))
|
2331 kumpf 1.11 {
|
2332 kumpf 1.235 returnedInstances = _indicationServiceConfiguration->
2333 enumerateInstancesForClass(
2334 request->nameSpace,
2335 request->className,
2336 request->includeQualifiers,
2337 request->includeClassOrigin,
2338 request->propertyList);
2339 }
2340 else
|
2341 venkat.puvvada 1.231 #endif
2342
|
2343 yi.zhou 1.229 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
|
2344 kumpf 1.235 if (request->className.equal(PEGASUS_CLASSNAME_PROVIDERINDDATA))
2345 {
2346 returnedInstances = _providerIndicationCountTable.
2347 enumerateProviderIndicationDataInstances();
2348 }
2349 else if (request->className.equal(
2350 PEGASUS_CLASSNAME_SUBSCRIPTIONINDDATA))
2351 {
2352 returnedInstances = _subscriptionTable->
2353 enumerateSubscriptionIndicationDataInstances();
2354 }
2355 else
|
2356 yi.zhou 1.229 #endif
|
2357 kumpf 1.235 {
2358 _checkNonprivilegedAuthorization(userName);
2359 Array<CIMInstance> enumInstances;
2360
2361 //
2362 // Add Creator to property list, if not null
2363 // Also, if a Subscription and Time Remaining is requested,
2364 // Ensure Subscription Duration and Start Time are in property
2365 // list
2366 //
2367 Boolean setTimeRemaining;
2368 Boolean startTimeAdded;
2369 Boolean durationAdded;
2370 CIMPropertyList propertyList = request->propertyList;
2371 _updatePropertyList(request->className,
2372 propertyList, setTimeRemaining, startTimeAdded, durationAdded);
2373
2374 enumInstances =
2375 _subscriptionRepository->enumerateInstancesForClass(
|
2376 kumpf 1.254 request->nameSpace, request->className,
|
2377 kumpf 1.235 request->includeQualifiers, request->includeClassOrigin,
2378 propertyList);
2379
2380 // Vars used to aggregate the content languages of the subscription
2381 // instances.
2382 Boolean langMismatch = false;
2383 Uint32 propIndex;
2384
|
2385 marek 1.280 // In a loop do the following to all instances to be returned:
2386 // ============================================================
|
2387 kumpf 1.235 // Remove Creator and language properties from instances before
2388 // returning
|
2389 marek 1.280 // Remove CreationTime property from CIMXML handlers
2390 // Fix-up Content-Language header if necessary
2391 //
2392 // If a subscription with a duration, calculate subscription
2393 // time remaining, and add property to the instance
2394 //
2395 // put the host name into SystemName properties and key bindings
|
2396 kumpf 1.235 //
2397 for (Uint32 i = 0; i < enumInstances.size(); i++)
|
2398 kumpf 1.11 {
|
2399 marek 1.280 CIMInstance adjustedInstance=enumInstances[i];
|
2400 kumpf 1.235 String creator;
|
2401 marek 1.280 if (!_getCreator(adjustedInstance, creator))
|
2402 kumpf 1.235 {
2403 //
2404 // This instance from the repository is corrupted
2405 // Skip it
2406 //
2407 continue;
2408 }
|
2409 venkat.puvvada 1.263
|
2410 marek 1.280 CIMName clsName = adjustedInstance.getClassName();
|
2411 sahana.prabhakar 1.265
2412 // check if this is SNMP Handler
2413 if (clsName.equal(PEGASUS_CLASSNAME_INDHANDLER_SNMP))
2414 {
2415 if(String::compare(creator,userName) != 0)
2416 {
2417 // only the creator of the handler has access to
2418 // the handler deata.
2419 continue;
2420 }
2421 }
2422
|
2423 marek 1.280 adjustedInstance.removeProperty(
2424 adjustedInstance.findProperty(
|
2425 kumpf 1.235 PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
|
2426 kumpf 1.11
|
2427 sahana.prabhakar 1.265 // Remove CreationTime property from CIMXML handlers
|
2428 venkat.puvvada 1.263
2429 if (clsName.equal(PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
2430 clsName.equal(PEGASUS_CLASSNAME_LSTNRDST_CIMXML))
2431 {
|
2432 marek 1.280 Uint32 idx = adjustedInstance.findProperty(
|
2433 venkat.puvvada 1.263 PEGASUS_PROPERTYNAME_LSTNRDST_CREATIONTIME);
2434
2435 if (idx != PEG_NOT_FOUND)
2436 {
|
2437 marek 1.280 adjustedInstance.removeProperty(idx);
|
2438 venkat.puvvada 1.263 }
2439 }
2440
|
2441 marek 1.280 propIndex = adjustedInstance.findProperty(
|
2442 kumpf 1.235 PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
2443 String contentLangs;
2444 if (propIndex != PEG_NOT_FOUND)
2445 {
|
2446 marek 1.280 adjustedInstance.getProperty(propIndex).getValue().get(
|
2447 kumpf 1.235 contentLangs);
|
2448 marek 1.280 adjustedInstance.removeProperty(propIndex);
|
2449 kumpf 1.235 }
|
2450 chuck 1.75
|
2451 marek 1.280 propIndex = adjustedInstance.findProperty(
|
2452 kumpf 1.235 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
2453 if (propIndex != PEG_NOT_FOUND)
2454 {
|
2455 marek 1.280 adjustedInstance.removeProperty(propIndex);
|
2456 kumpf 1.235 }
|
2457 chuck 1.77
|
2458 kumpf 1.235 // Determine what to set into the Content-Language header back
2459 // to the client
2460 if (!langMismatch)
2461 {
2462 if (contentLangs == String::EMPTY)
2463 {
2464 langMismatch = true;
2465 aggregatedLangs = String::EMPTY;
2466 }
2467 else
2468 {
2469 if (aggregatedLangs == String::EMPTY)
2470 {
2471 aggregatedLangs = contentLangs;
2472 }
2473 else if (aggregatedLangs != contentLangs)
2474 {
2475 langMismatch = true;
2476 aggregatedLangs = String::EMPTY;
2477 }
2478 }
2479 kumpf 1.235 }
|
2480 chuck 1.75
|
2481 kumpf 1.11 //
|
2482 kumpf 1.235 // If a subscription with a duration, calculate subscription
2483 // time remaining, and add property to the instance
|
2484 kumpf 1.11 //
|
2485 kumpf 1.235 if (setTimeRemaining)
|
2486 kumpf 1.11 {
|
2487 kumpf 1.235 try
2488 {
|
2489 marek 1.280 _setTimeRemaining(adjustedInstance);
|
2490 kumpf 1.235 }
2491 catch (DateTimeOutOfRangeException&)
|
2492 dj.gorey 1.135 {
2493 //
|
2494 kumpf 1.235 // This instance from the repository is invalid
|
2495 dj.gorey 1.135 // Skip it
2496 //
2497 continue;
2498 }
|
2499 kumpf 1.235 if (startTimeAdded)
|
2500 kumpf 1.99 {
|
2501 marek 1.280 adjustedInstance.removeProperty(adjustedInstance.
|
2502 kumpf 1.235 findProperty(_PROPERTY_STARTTIME));
|
2503 kumpf 1.99 }
|
2504 kumpf 1.235 if (durationAdded)
|
2505 kumpf 1.99 {
|
2506 marek 1.280 adjustedInstance.removeProperty(
2507 adjustedInstance.findProperty(_PROPERTY_DURATION));
|
2508 yi.zhou 1.229 }
|
2509 kumpf 1.235 }
|
2510 marek 1.280 // put the host name into SystemName properties and key bindings
2511 _setSystemName(
2512 adjustedInstance,
2513 System::getFullyQualifiedHostName());
|
2514 yi.zhou 1.229
|
2515 marek 1.280 returnedInstances.append(adjustedInstance);
|
2516 kumpf 1.11 }
|
2517 kumpf 1.1 }
2518
|
2519 kumpf 1.213 CIMEnumerateInstancesResponseMessage* response =
2520 dynamic_cast<CIMEnumerateInstancesResponseMessage*>(
2521 request->buildResponse());
2522 PEGASUS_ASSERT(response != 0);
|
2523 kumpf 1.194 if (aggregatedLangs.size())
2524 {
2525 // Note: setting Content-Language in the response to the aggregated
2526 // contentLanguage from the instances in the repository.
2527 response->operationContext.set(ContentLanguageListContainer(
2528 LanguageParser::parseContentLanguageHeader(aggregatedLangs)));
2529 }
|
2530 thilo.boehm 1.262 response->getResponseData().setInstances(returnedInstances);
|
2531 kumpf 1.218 _enqueueResponse(request, response);
|
2532 kumpf 1.1
|
2533 kumpf 1.218 PEG_METHOD_EXIT();
|
2534 kumpf 1.11 }
|
2535 kumpf 1.1
|
2536 kumpf 1.218 void IndicationService::_handleEnumerateInstanceNamesRequest(
2537 const Message* message)
|
2538 kumpf 1.11 {
|
2539 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
2540 carolann.graves 1.198 "IndicationService::_handleEnumerateInstanceNamesRequest");
|
2541 dj.gorey 1.135
|
2542 kumpf 1.11 CIMEnumerateInstanceNamesRequestMessage* request =
2543 (CIMEnumerateInstanceNamesRequestMessage*) message;
|
2544 kumpf 1.1
|
2545 kumpf 1.45 Array<CIMObjectPath> enumInstanceNames;
|
2546 kumpf 1.1
|
2547 venkat.puvvada 1.234 String userName = ((IdentityContainer)request->operationContext.get(
2548 IdentityContainer::NAME)).getUserName();
2549
|
2550 kumpf 1.235 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
2551 if (request->className.equal(
2552 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE) ||
2553 request->className.equal(
2554 PEGASUS_CLASSNAME_CIM_INDICATIONSERVICECAPABILITIES))
|
2555 yi.zhou 1.232 {
|
2556 kumpf 1.235 enumInstanceNames = _indicationServiceConfiguration->
2557 enumerateInstanceNamesForClass(
2558 request->nameSpace,
2559 request->className);
2560 }
2561 else
|
2562 yi.zhou 1.232 #endif
2563
2564 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
|
2565 kumpf 1.235 if (request->className.equal(PEGASUS_CLASSNAME_PROVIDERINDDATA))
2566 {
2567 enumInstanceNames = _providerIndicationCountTable.
2568 enumerateProviderIndicationDataInstanceNames();
|
2569 yi.zhou 1.232 }
|
2570 kumpf 1.235 else if (request->className.equal(
2571 PEGASUS_CLASSNAME_SUBSCRIPTIONINDDATA))
|
2572 yi.zhou 1.232 {
|
2573 kumpf 1.235 enumInstanceNames = _subscriptionTable->
2574 enumerateSubscriptionIndicationDataInstanceNames();
|
2575 yi.zhou 1.232 }
|
2576 kumpf 1.235 else
2577 #endif
|
2578 yi.zhou 1.232 {
|
2579 kumpf 1.235 _checkNonprivilegedAuthorization(userName);
2580 enumInstanceNames =
2581 _subscriptionRepository->enumerateInstanceNamesForClass(
2582 request->nameSpace,
2583 request->className);
|
2584 marek 1.280
2585 // put the hostname back into SystemName key binding
2586 for (Uint32 i=0;i<enumInstanceNames.size();i++)
2587 {
2588 _setSystemName(
2589 enumInstanceNames[i],
2590 System::getFullyQualifiedHostName());
2591 }
|
2592 kumpf 1.11 }
|
2593 kumpf 1.1
|
2594 chuck 1.75 // Note: not setting Content-Language in the response
|
2595 kumpf 1.213 CIMEnumerateInstanceNamesResponseMessage* response =
2596 dynamic_cast<CIMEnumerateInstanceNamesResponseMessage *>(
2597 request->buildResponse());
2598 PEGASUS_ASSERT(response != 0);
|
2599 thilo.boehm 1.262 response->getResponseData().setInstanceNames(enumInstanceNames);
|
2600 kumpf 1.218 _enqueueResponse(request, response);
|
2601 kumpf 1.1
|
2602 kumpf 1.218 PEG_METHOD_EXIT();
|
2603 kumpf 1.1 }
2604
|
2605 kumpf 1.218 void IndicationService::_handleModifyInstanceRequest(const Message* message)
|
2606 kumpf 1.1 {
|
2607 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
2608 kumpf 1.114 "IndicationService::_handleModifyInstanceRequest");
|
2609 kumpf 1.1
|
2610 dj.gorey 1.135 CIMModifyInstanceRequestMessage* request =
|
2611 kumpf 1.11 (CIMModifyInstanceRequestMessage*) message;
|
2612 kumpf 1.6
|
2613 kumpf 1.88 Boolean responseSent = false;
|
2614 dj.gorey 1.135
|
2615 kumpf 1.235 String userName = ((IdentityContainer)request->operationContext.get(
2616 IdentityContainer::NAME)).getUserName();
2617 _checkNonprivilegedAuthorization(userName);
2618
2619 //
|
2620 marek 1.280 // Get modified instance and instance name from request
|
2621 kumpf 1.235 //
|
2622 marek 1.280 CIMInstance modifiedInstance = request->modifiedInstance;
2623 CIMObjectPath instanceReference = modifiedInstance.getPath();
2624
2625 // set SystemName keybinding to empty in request's reference and instance
2626 _setSystemName(instanceReference,String::EMPTY);
2627 modifiedInstance.setPath(instanceReference);
|
2628 kumpf 1.235
2629 //
2630 // Get instance from repository
2631 //
2632 CIMInstance instance;
2633
2634 instance = _subscriptionRepository->getInstance(
2635 request->nameSpace, instanceReference);
2636
2637 if (_canModify(request, instanceReference, instance, modifiedInstance))
|
2638 kumpf 1.6 {
2639 //
|
2640 kumpf 1.235 // Set path in instance
|
2641 kumpf 1.6 //
|
2642 kumpf 1.235 instanceReference.setNameSpace(request->nameSpace);
2643 instance.setPath(instanceReference);
|
2644 dj.gorey 1.135
|
2645 kumpf 1.6 //
|
2646 kumpf 1.235 // Check for expired subscription
|
2647 kumpf 1.6 //
|
2648 kumpf 1.235 try
2649 {
2650 if (_isExpired(instance))
2651 {
2652 //
2653 // Delete the subscription instance
2654 //
2655 _deleteExpiredSubscription(instanceReference);
|
2656 venkat.puvvada 1.263 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
2657 _sendSubscriptionNotActiveMessagetoHandlerService(
2658 instanceReference);
2659 #endif
|
2660 kumpf 1.235 PEG_METHOD_EXIT();
|
2661 kumpf 1.19
|
2662 kumpf 1.243 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
2663 MessageLoaderParms(
2664 "IndicationService.IndicationService._MSG_EXPIRED",
2665 "An expired subscription cannot be modified: the "
2666 "subscription is deleted."));
|
2667 kumpf 1.235 }
2668 }
2669 catch (DateTimeOutOfRangeException&)
|
2670 kumpf 1.1 {
|
2671 kumpf 1.11 //
|
2672 kumpf 1.235 // This instance from the repository is invalid
|
2673 carolann.graves 1.186 //
|
2674 kumpf 1.235 PEG_METHOD_EXIT();
2675 throw;
2676 }
|
2677 carolann.graves 1.186
|
2678 kumpf 1.235 //
2679 // _canModify, above, already checked that propertyList is not
2680 // null, and that numProperties is 0 or 1
2681 //
2682 CIMPropertyList propertyList = request->propertyList;
2683 if (request->propertyList.size() > 0)
2684 {
|
2685 carolann.graves 1.186 //
|
2686 kumpf 1.235 // Get current state from instance
|
2687 kumpf 1.11 //
|
2688 kumpf 1.235 Uint16 currentState;
|
2689 marek 1.279 _subscriptionRepository->getState(instance, currentState);
|
2690 kumpf 1.15 //
|
2691 kumpf 1.235 // Get new state
2692 //
2693 // NOTE: _canModify has already validated the
2694 // SubscriptionState property in the instance; if missing, it
2695 // was added with the default value; if null, it was set to
2696 // the default value; if invalid, an exception was thrown
2697 //
2698 Uint16 newState;
2699 modifiedInstance.getProperty(modifiedInstance.findProperty(
2700 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE)).getValue().get(
2701 newState);
2702
2703 //
2704 // If Subscription State has changed,
2705 // Set Time of Last State Change to current date time
|
2706 kumpf 1.15 //
|
2707 kumpf 1.235 CIMDateTime currentDateTime =
2708 CIMDateTime::getCurrentDateTime();
2709 if (newState != currentState)
|
2710 kumpf 1.1 {
|
2711 kumpf 1.235 if (modifiedInstance.findProperty(_PROPERTY_LASTCHANGE) !=
2712 PEG_NOT_FOUND)
|
2713 kumpf 1.114 {
|
2714 kumpf 1.235 CIMProperty lastChange = modifiedInstance.getProperty(
2715 modifiedInstance.findProperty(
2716 _PROPERTY_LASTCHANGE));
2717 lastChange.setValue(CIMValue(currentDateTime));
|
2718 kumpf 1.114 }
|
2719 kumpf 1.235 else
|
2720 kumpf 1.80 {
|
2721 kumpf 1.235 modifiedInstance.addProperty(CIMProperty(
2722 _PROPERTY_LASTCHANGE, CIMValue(currentDateTime)));
|
2723 kumpf 1.80 }
|
2724 kumpf 1.235 Array<CIMName> properties =
2725 propertyList.getPropertyNameArray();
2726 properties.append(_PROPERTY_LASTCHANGE);
2727 propertyList.set(properties);
2728 }
|
2729 dj.gorey 1.135
|
2730 kumpf 1.235 //
2731 // If Subscription is to be enabled, and this is the first
2732 // time, set Subscription Start Time
2733 //
2734 if ((newState == STATE_ENABLED) ||
2735 (newState == STATE_ENABLEDDEGRADED))
2736 {
|
2737 kumpf 1.11 //
|
2738 kumpf 1.235 // If Subscription Start Time is null, set value
2739 // to the current date time
|
2740 kumpf 1.11 //
|
2741 kumpf 1.235 CIMDateTime startTime;
2742 CIMProperty startTimeProperty = instance.getProperty(
2743 instance.findProperty(_PROPERTY_STARTTIME));
|
2744 kumpf 1.237 CIMValue startTimeValue = startTimeProperty.getValue();
|
2745 kumpf 1.235 Boolean setStart = false;
2746 if (startTimeValue.isNull())
2747 {
2748 setStart = true;
2749 }
2750 else
2751 {
2752 startTimeValue.get(startTime);
|
2753 dj.gorey 1.135
|
2754 kumpf 1.235 if (startTime.isInterval())
|
2755 kumpf 1.35 {
|
2756 kumpf 1.235 if (startTime.equal(
2757 CIMDateTime(_ZERO_INTERVAL_STRING)))
2758 {
2759 setStart = true;
2760 }
|
2761 kumpf 1.35 }
|
2762 kumpf 1.11 }
|
2763 kumpf 1.13
|
2764 kumpf 1.235 if (setStart)
|
2765 kumpf 1.13 {
|
2766 kumpf 1.235 if (modifiedInstance.findProperty(_PROPERTY_STARTTIME)
2767 != PEG_NOT_FOUND)
|
2768 kumpf 1.13 {
|
2769 kumpf 1.239 CIMProperty startTimeProperty =
|
2770 kumpf 1.235 modifiedInstance.getProperty(
2771 modifiedInstance.findProperty(
2772 _PROPERTY_STARTTIME));
|
2773 kumpf 1.239 startTimeProperty.setValue(CIMValue(currentDateTime));
|
2774 kumpf 1.13 }
2775 else
2776 {
|
2777 kumpf 1.235 modifiedInstance.addProperty(CIMProperty(
2778 _PROPERTY_STARTTIME,
2779 CIMValue(currentDateTime)));
|
2780 kumpf 1.13 }
|
2781 kumpf 1.35
|
2782 kumpf 1.235 Array<CIMName> properties =
2783 propertyList.getPropertyNameArray();
2784 properties.append(_PROPERTY_STARTTIME);
2785 propertyList.set(properties);
|
2786 kumpf 1.13 }
|
2787 kumpf 1.235 }
|
2788 kumpf 1.19
|
2789 kumpf 1.235 // Add the language properties to the modified instance.
2790 // Note: These came from the Accept-Language and
2791 // Content-Language headers in the HTTP messages, and may be
2792 // empty.
2793 AcceptLanguageList acceptLangs =
2794 ((AcceptLanguageListContainer)request->operationContext.get(
2795 AcceptLanguageListContainer::NAME)).getLanguages();
2796 modifiedInstance.addProperty(CIMProperty(
2797 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS,
2798 LanguageParser::buildAcceptLanguageHeader(acceptLangs)));
2799
2800 ContentLanguageList contentLangs =
2801 ((ContentLanguageListContainer)request->operationContext.get
2802 (ContentLanguageListContainer::NAME)).getLanguages();
2803 modifiedInstance.addProperty (CIMProperty
2804 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS,
2805 LanguageParser::buildContentLanguageHeader(contentLangs)));
2806
2807 Array<CIMName> properties = propertyList.getPropertyNameArray();
2808 properties.append (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
2809 properties.append (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
2810 kumpf 1.235 propertyList.set (properties);
|
2811 chuck 1.75
|
2812 kumpf 1.235 //
2813 // If subscription is to be enabled, determine if there are
2814 // any indication providers that can serve the subscription
2815 //
2816 Array<ProviderClassList> indicationProviders;
2817 CIMPropertyList requiredProperties;
2818 String condition;
2819 String query;
2820 String queryLanguage;
|
2821 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
2822 chuck 1.75
|
2823 kumpf 1.235 if (((newState == STATE_ENABLED) ||
2824 (newState == STATE_ENABLEDDEGRADED))
2825 && ((currentState != STATE_ENABLED) &&
2826 (currentState != STATE_ENABLEDDEGRADED)))
2827 {
|
2828 kumpf 1.11 //
|
2829 kumpf 1.235 // Subscription was previously not enabled but is now to
2830 // be enabled
|
2831 kumpf 1.11 //
|
2832 venkat.puvvada 1.275 _getCreateParams(
2833 instance,
2834 indicationSubclasses,
2835 indicationProviders,
2836 requiredProperties,
2837 condition,
2838 query,
2839 queryLanguage);
|
2840 dj.gorey 1.135
|
2841 kumpf 1.235 if (indicationProviders.size() == 0)
|
2842 kumpf 1.11 {
2843 //
|
2844 kumpf 1.235 // There are no providers that can support this
2845 // subscription
|
2846 kumpf 1.11 //
|
2847 kumpf 1.235 instance.setPath(instanceReference);
2848 _subscriptionRepository->reconcileFatalError(instance);
2849 PEG_METHOD_EXIT();
|
2850 humberto 1.78
|
2851 kumpf 1.235 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
2852 MessageLoaderParms(_MSG_NO_PROVIDERS_KEY,
2853 _MSG_NO_PROVIDERS));
|
2854 kumpf 1.11 }
|
2855 kumpf 1.235 }
|
2856 kumpf 1.19
|
2857 kumpf 1.235 //
2858 // Modify the instance in the repository
2859 //
2860 modifiedInstance.setPath(instanceReference);
2861 _subscriptionRepository->modifyInstance(
2862 request->nameSpace, modifiedInstance,
2863 request->includeQualifiers, propertyList);
|
2864 david 1.71
|
2865 kumpf 1.235 PEG_TRACE((
2866 TRC_INDICATION_SERVICE,
|
2867 marek 1.238 Tracer::LEVEL3,
|
2868 kumpf 1.235 "IndicationService::_handleModifyInstanceRequest - "
2869 "Name Space: %s Instance name: %s",
2870 (const char*)
2871 request->nameSpace.getString().getCString(),
2872 (const char*)
2873 modifiedInstance.getClassName().getString().getCString()
2874 ));
|
2875 kumpf 1.23
|
2876 kumpf 1.235 //
2877 // If subscription is newly enabled, send Create requests
2878 // and enable providers
2879 //
2880 if (((newState == STATE_ENABLED) ||
2881 (newState == STATE_ENABLEDDEGRADED))
2882 && ((currentState != STATE_ENABLED) &&
2883 (currentState != STATE_ENABLEDDEGRADED)))
2884 {
2885 instanceReference.setNameSpace(request->nameSpace);
2886 instance.setPath(instanceReference);
2887
2888 _sendAsyncCreateRequests(
2889 indicationProviders,
2890 requiredProperties,
2891 condition,
2892 query,
2893 queryLanguage,
2894 instance,
2895 acceptLangs,
2896 contentLangs,
2897 kumpf 1.235 request,
2898 indicationSubclasses,
2899 userName,
2900 request->authType);
|
2901 dj.gorey 1.135
|
2902 kumpf 1.235 //
2903 // Response is sent from _handleCreateResponseAggregation
2904 //
2905 responseSent = true;
2906 }
2907 else if ((newState == STATE_DISABLED) &&
2908 ((currentState == STATE_ENABLED) ||
2909 (currentState == STATE_ENABLEDDEGRADED)))
2910 {
2911 //
2912 // Subscription was previously enabled but is now to be
2913 // disabled
2914 //
2915 instanceReference.setNameSpace(request->nameSpace);
2916 instance.setPath(instanceReference);
|
2917 venkat.puvvada 1.275 indicationProviders =
2918 _getDeleteParams(instance, indicationSubclasses);
|
2919 dj.gorey 1.135
|
2920 kumpf 1.11 //
|
2921 kumpf 1.235 // Send Delete requests
|
2922 kumpf 1.11 //
|
2923 kumpf 1.235 if (indicationProviders.size() > 0)
|
2924 kumpf 1.1 {
|
2925 kumpf 1.235 _sendAsyncDeleteRequests(
|
2926 kumpf 1.218 indicationProviders,
|
2927 kumpf 1.46 instance,
|
2928 dj.gorey 1.135 acceptLangs,
2929 contentLangs,
|
2930 kumpf 1.88 request,
2931 indicationSubclasses,
|
2932 kumpf 1.218 userName,
2933 request->authType);
|
2934 humberto 1.78
|
2935 kumpf 1.73 //
|
2936 kumpf 1.235 // Response is sent from
2937 // _handleDeleteResponseAggregation
|
2938 kumpf 1.73 //
|
2939 kumpf 1.88 responseSent = true;
|
2940 venkat.puvvada 1.263 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
2941 _sendSubscriptionNotActiveMessagetoHandlerService(
2942 instanceReference);
2943 #endif
|
2944 kumpf 1.1 }
2945 }
2946 }
|
2947 kumpf 1.11 }
|
2948 kumpf 1.1
|
2949 kumpf 1.38 //
|
2950 kumpf 1.137 // Send response, if not sent from callback
2951 // (for example, if there are no indication providers that can support a
2952 // subscription)
|
2953 kumpf 1.38 //
|
2954 kumpf 1.88 if (!responseSent)
2955 {
2956 // Note: don't need to set content-language in the response.
|
2957 kumpf 1.218 CIMResponseMessage * response = request->buildResponse();
2958 _enqueueResponse(request, response);
|
2959 kumpf 1.88 }
|
2960 kumpf 1.1
|
2961 kumpf 1.218 PEG_METHOD_EXIT();
|
2962 kumpf 1.1 }
2963
|
2964 kumpf 1.218 void IndicationService::_handleDeleteInstanceRequest(const Message* message)
|
2965 kumpf 1.1 {
|
2966 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
2967 kumpf 1.114 "IndicationService::_handleDeleteInstanceRequest");
|
2968 kumpf 1.1
|
2969 dj.gorey 1.135 CIMDeleteInstanceRequestMessage* request =
|
2970 kumpf 1.11 (CIMDeleteInstanceRequestMessage*) message;
|
2971 kumpf 1.1
|
2972 kumpf 1.88 Boolean responseSent = false;
|
2973 kumpf 1.1
|
2974 kumpf 1.235 String userName = ((IdentityContainer)request->operationContext.get(
2975 IdentityContainer::NAME)).getUserName();
2976 _checkNonprivilegedAuthorization(userName);
2977
|
2978 marek 1.280 // set eventual SystemName keybinding to empty string
2979 _setSystemName(request->instanceName,String::EMPTY);
2980
|
2981 kumpf 1.235 //
2982 // Check if instance may be deleted -- a filter or handler instance
2983 // referenced by a subscription instance may not be deleted
2984 //
2985 if (_canDelete(request->instanceName, request->nameSpace, userName))
|
2986 kumpf 1.1 {
|
2987 kumpf 1.235 //
2988 // If a subscription, get the instance from the repository
2989 //
2990 CIMInstance subscriptionInstance;
2991 if (request->instanceName.getClassName().equal(
2992 PEGASUS_CLASSNAME_INDSUBSCRIPTION) ||
2993 request->instanceName.getClassName ().equal(
2994 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))
2995 {
2996 subscriptionInstance =
2997 _subscriptionRepository->getInstance(
2998 request->nameSpace, request->instanceName);
2999 }
|
3000 kumpf 1.94
|
3001 kumpf 1.11 //
|
3002 kumpf 1.235 // Delete instance from repository
|
3003 kumpf 1.11 //
|
3004 kumpf 1.235 _subscriptionRepository->deleteInstance(
3005 request->nameSpace, request->instanceName);
3006
|
3007 venkat.puvvada 1.263 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
3008 if (request->instanceName.getClassName().equal(
3009 PEGASUS_CLASSNAME_LSTNRDST_CIMXML) ||
3010 request->instanceName.getClassName().equal(
|
3011 anusha.kandepu 1.281 PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
3012 request->instanceName.getClassName().equal(
3013 PEGASUS_CLASSNAME_INDHANDLER_WSMAN))
|
3014 venkat.puvvada 1.263 {
3015 CIMObjectPath handlerName = request->instanceName;
3016 handlerName.setNameSpace(request->nameSpace);
3017 _sendListenerNotActiveMessagetoHandlerService(handlerName);
3018 }
3019 #endif
3020
|
3021 kumpf 1.235 PEG_TRACE((
3022 TRC_INDICATION_SERVICE,
|
3023 marek 1.238 Tracer::LEVEL3,
|
3024 kumpf 1.235 "IndicationService::_handleDeleteInstanceRequest - "
3025 "Name Space: %s Instance name: %s",
3026 (const char*) request->nameSpace.getString().getCString(),
3027 (const char*)
3028 request->instanceName.getClassName().getString().getCString()
3029 ));
3030
3031 if (request->instanceName.getClassName().equal(
3032 PEGASUS_CLASSNAME_INDSUBSCRIPTION) ||
3033 request->instanceName.getClassName ().equal(
3034 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))
|
3035 kumpf 1.11 {
|
3036 kumpf 1.88 //
|
3037 kumpf 1.235 // If subscription is active, send delete requests to providers
3038 // and update hash tables
|
3039 kumpf 1.88 //
|
3040 kumpf 1.235 Uint16 subscriptionState;
3041 CIMValue subscriptionStateValue;
3042 subscriptionStateValue = subscriptionInstance.getProperty(
3043 subscriptionInstance.findProperty(
3044 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE)).getValue();
3045 subscriptionStateValue.get(subscriptionState);
|
3046 kumpf 1.1
|
3047 kumpf 1.235 if ((subscriptionState == STATE_ENABLED) ||
3048 (subscriptionState == STATE_ENABLEDDEGRADED))
|
3049 kumpf 1.1 {
|
3050 kumpf 1.235 Array<ProviderClassList> indicationProviders;
|
3051 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
3052 kumpf 1.235 CIMObjectPath instanceReference = request->instanceName;
3053 instanceReference.setNameSpace(request->nameSpace);
3054 subscriptionInstance.setPath(instanceReference);
|
3055 dj.gorey 1.135
|
3056 kumpf 1.235 indicationProviders = _getDeleteParams(
3057 subscriptionInstance,
|
3058 venkat.puvvada 1.275 indicationSubclasses);
|
3059 kumpf 1.11
|
3060 kumpf 1.235 if (indicationProviders.size() > 0)
3061 {
3062 //
3063 // Send Delete requests
3064 //
3065 _sendAsyncDeleteRequests(
3066 indicationProviders,
3067 subscriptionInstance,
3068 ((AcceptLanguageListContainer)
3069 request->operationContext.get(
3070 AcceptLanguageListContainer::NAME)).
3071 getLanguages(),
3072 ((ContentLanguageListContainer)
3073 request->operationContext.get(
3074 ContentLanguageListContainer::NAME)).
3075 getLanguages(),
3076 request,
3077 indicationSubclasses,
3078 userName,
3079 request->authType);
|
3080 kumpf 1.1
|
3081 kumpf 1.235 //
3082 // Response is sent from
3083 // _handleDeleteResponseAggregation
3084 //
3085 responseSent = true;
|
3086 venkat.puvvada 1.263 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
3087 _sendSubscriptionNotActiveMessagetoHandlerService(
3088 instanceReference);
3089 #endif
|
3090 kumpf 1.235 }
3091 else
|
3092 kumpf 1.88 {
|
3093 kumpf 1.235 //
3094 // Subscription was enabled, but had no providers
3095 // Remove entries from the subscription hash tables
3096 //
3097 _subscriptionTable->removeSubscription(
|
3098 kumpf 1.218 subscriptionInstance,
3099 indicationSubclasses,
|
3100 kumpf 1.235 indicationProviders);
|
3101 kumpf 1.88 }
3102 }
|
3103 kumpf 1.11 }
3104 }
3105
|
3106 kumpf 1.38 //
|
3107 kumpf 1.137 // Send response, if not sent from callback
3108 // (for example, if a subscription had no indication providers)
|
3109 kumpf 1.38 //
|
3110 kumpf 1.88 if (!responseSent)
3111 {
|
3112 kumpf 1.218 CIMResponseMessage * response = request->buildResponse();
3113 _enqueueResponse(request, response);
|
3114 kumpf 1.88 }
|
3115 kumpf 1.11
|
3116 kumpf 1.218 PEG_METHOD_EXIT();
|
3117 kumpf 1.11 }
3118
|
3119 kumpf 1.218 // l10n TODO - might need to globalize another flow and another consumer
3120 // interface (ie. mdd's) if we can't agree on one export flow and consumer
3121 // interface (see PEP67)
|
3122 chuck 1.75
|
3123 yi.zhou 1.225 void IndicationService::_handleProcessIndicationRequest(Message* message)
|
3124 kumpf 1.11 {
|
3125 venkat.puvvada 1.258
3126 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
3127 _processIndicationThreads++;
3128 AutoPtr<AtomicInt, DecAtomicInt> counter(&_processIndicationThreads);
3129 #endif
3130
|
3131 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
3132 Stopwatch stopWatch;
3133 #endif
3134
|
3135 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
3136 kumpf 1.114 "IndicationService::_handleProcessIndicationRequest");
|
3137 kumpf 1.11
|
3138 yi.zhou 1.229 #ifdef PEGASUS_INDICATION_PERFINST
3139 stopWatch.reset();
3140 stopWatch.start();
3141 #endif
3142
|
3143 yi.zhou 1.225 CIMProcessIndicationRequestMessage* request = dynamic_cast<
3144 CIMProcessIndicationRequestMessage*> (message);
3145 PEGASUS_ASSERT(request != 0);
|
3146 kumpf 1.11
|
3147 kumpf 1.218 Array<CIMInstance> matchedSubscriptions;
|
3148 marek 1.277 Array<SubscriptionKey> matchedSubscriptionsKeys;
|
3149 venkat.puvvada 1.272 Uint32 timeout = request->timeoutMilliSec;
|
3150 kumpf 1.11
3151 CIMInstance indication = request->indicationInstance;
|
3152 venkat.puvvada 1.270
3153 QueueIdStack qids = request->queueIds.copyAndPop();
3154
3155 AutoPtr<DeliveryStatusAggregator, ExpectedResponseCountSetDone>
|
3156 venkat.puvvada 1.271 deliveryStatusAggregator;
3157
3158 if (qids.size())
3159 {
|
3160 venkat.puvvada 1.270 #ifdef PEGASUS_ENABLE_INDICATION_ORDERING
|
3161 venkat.puvvada 1.271 deliveryStatusAggregator.reset(
|
3162 venkat.puvvada 1.270 new DeliveryStatusAggregator(
3163 request->messageId,
3164 qids.top(),
|
3165 venkat.puvvada 1.272 request->oopAgentName,
3166 request->timeoutMilliSec));
|
3167 venkat.puvvada 1.270 #endif
|
3168 venkat.puvvada 1.271 }
|
3169 kumpf 1.218
|
3170 kumpf 1.11 try
3171 {
|
3172 marek 1.238 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
3173 w.otsuka 1.217 "Received %s Indication %s from namespace %s from provider %s",
3174 (const char*)(indication.getClassName().getString().getCString()),
3175 (const char*)(request->messageId.getCString()),
3176 (const char*)(request->nameSpace.getString().getCString()),
3177 (const char*)(request->provider.getProperty(request->provider.
|
3178 yi.zhou 1.225 findProperty(PEGASUS_PROPERTYNAME_NAME)).getValue().toString().
3179 getCString())));
3180
|
3181 venkat.puvvada 1.264 // If there are subscription requests pending with the providers,
3182 // deliver the indication later when all create subscription
3183 // requests are completed.
3184 // It is possible that indication arrives after provider's
3185 // enableIndication() method is called and before create
3186 // subscription request is completed by IndicationService.
3187 // This casuses the indications to be lost because of no matching
3188 // subscriptions exists.
3189 if (_subscriptionRepository->getUncommittedCreateSubscriptionRequests())
3190 {
3191 PEG_TRACE_CSTRING(TRC_INDICATION_GENERATION, Tracer::LEVEL3,
3192 "Pending Create subscription requets exists, indication"
3193 " will be delivered after all pending create"
3194 " subscription requets are completed");
3195 CIMProcessIndicationRequestMessage * requestCopy =
3196 new CIMProcessIndicationRequestMessage(*request);
|
3197 venkat.puvvada 1.271 // Delivery enqueue status is not required for this request.
3198 requestCopy->queueIds = QueueIdStack(requestCopy->queueIds.top());
|
3199 venkat.puvvada 1.264 _deliveryWaitIndications.insert_back(requestCopy);
3200 PEG_METHOD_EXIT();
3201 return;
3202 }
3203
|
3204 kumpf 1.37 //
|
3205 kumpf 1.253 // Get supported properties by the indication provider
|
3206 yi.zhou 1.225 // Get Indication class properties
|
3207 kumpf 1.253 // Check if the provider supports all properties of the indication
3208 // class, if so, set to null
|
3209 kumpf 1.37 //
|
3210 yi.zhou 1.225 Array<CIMName> providerSupportedProperties;
|
3211 kumpf 1.218 Array<CIMName> indicationClassProperties;
|
3212 yi.zhou 1.225 CIMPropertyList supportedPropertyList;
3213
|
3214 kumpf 1.83 for (Uint32 i = 0; i < indication.getPropertyCount(); i++)
|
3215 carolann.graves 1.142 {
|
3216 yi.zhou 1.225 providerSupportedProperties.append(
3217 indication.getProperty(i).getName());
|
3218 carolann.graves 1.142 }
|
3219 carolann.graves 1.147
|
3220 yi.zhou 1.225 supportedPropertyList = _checkPropertyList(providerSupportedProperties,
|
3221 kumpf 1.253 request->nameSpace,
3222 indication.getClassName(),
|
3223 yi.zhou 1.225 indicationClassProperties);
|
3224 carolann.graves 1.147
3225 //
|
3226 yi.zhou 1.225 // Get initial subscriptions based on the class name, namespace
|
3227 kumpf 1.253 // of the generated indication, and subscriptions specified by the
3228 // indication provider if the provider included subscriptions
3229 // in the subscriptionInstanceNamesContainer
|
3230 carolann.graves 1.147 //
|
3231 yi.zhou 1.229 Array<CIMInstance> subscriptions;
|
3232 marek 1.277 Array<SubscriptionKey> subscriptionKeys;
|
3233 venkat.puvvada 1.264
|
3234 yi.zhou 1.229 _getRelevantSubscriptions(
3235 request->subscriptionInstanceNames,
3236 indication.getClassName(),
3237 request->nameSpace,
3238 request->provider,
3239 subscriptions,
3240 subscriptionKeys);
3241
|
3242 yi.zhou 1.225 for (Uint32 i = 0; i < subscriptions.size(); i++)
|
3243 kumpf 1.68 {
|
3244 yi.zhou 1.225 try
3245 {
3246 QueryExpression queryExpr;
3247 String filterQuery;
3248 String queryLanguage;
3249 String filterName;
|
3250 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNameSpaces;
|
3251 carolann.graves 1.147
|
3252 kumpf 1.73 //
|
3253 yi.zhou 1.225 // Get filter query expression of the subscription
|
3254 kumpf 1.73 //
|
3255 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
3256 subscriptions[i],
3257 filterQuery,
3258 sourceNameSpaces,
3259 queryLanguage,
3260 filterName);
|
3261 kumpf 1.73
|
3262 yi.zhou 1.225 queryExpr = _getQueryExpression(
|
3263 venkat.puvvada 1.275 filterQuery, queryLanguage, request->nameSpace);
|
3264 kumpf 1.73
|
3265 yi.zhou 1.225 //
|
3266 kumpf 1.253 // Evaluate if the subscription matches the indication by
|
3267 yi.zhou 1.225 // checking:
|
3268 kumpf 1.253 // 1) Whether the properties (in WHERE clause) from filter
|
3269 yi.zhou 1.225 // query are supported by the indication provider;
3270 // 2) Whether the subscripton is expired;
|
3271 kumpf 1.253 // 3) Whether the filter criteria are met by the generated
3272 // indication
|
3273 yi.zhou 1.225 //
|
3274 kumpf 1.253 if (_subscriptionMatch (subscriptions[i], indication,
|
3275 venkat.puvvada 1.275 supportedPropertyList, queryExpr, request->nameSpace))
|
3276 kumpf 1.253 {
|
3277 marek 1.238 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
3278 yi.zhou 1.225 "%s Indication %s satisfies filter %s:%s query "
3279 "expression \"%s\"",
3280 (const char*)(indication.getClassName().
3281 getString().getCString()),
3282 (const char*)(request->messageId.getCString()),
|
3283 venkat.puvvada 1.275 (const char*)(request->nameSpace.getString().
|
3284 yi.zhou 1.225 getCString()),
3285 (const char*)(filterName.getCString()),
3286 (const char*)(filterQuery.getCString())));
|
3287 kumpf 1.15
|
3288 kumpf 1.218 //
|
3289 yi.zhou 1.225 // Format the indication
3290 // This includes two parts:
|
3291 kumpf 1.253 // 1) Use QueryExpression::applyProjection to remove
|
3292 yi.zhou 1.225 // properties not listed in the SELECT clause;
|
3293 kumpf 1.253 // 2) Remove any properties that may be left on the
3294 // indication that are not in the indication class.
3295 // These are properties added by the provider
|
3296 yi.zhou 1.225 // incorrectly.
3297 //
3298 CIMInstance formattedIndication = indication.clone();
|
3299 chip 1.162
|
3300 kumpf 1.253 if (_formatIndication(formattedIndication,
|
3301 yi.zhou 1.225 queryExpr,
|
3302 kumpf 1.253 providerSupportedProperties,
|
3303 yi.zhou 1.225 indicationClassProperties))
|
3304 kumpf 1.218 {
|
3305 yi.zhou 1.225 //
3306 // get the handler instance and forward the formatted
3307 // indication to the handler
3308 //
|
3309 kumpf 1.253 CIMInstance handlerInstance =
|
3310 yi.zhou 1.225 _subscriptionRepository->getHandler(
3311 subscriptions[i]);
3312
|
3313 marek 1.238 PEG_TRACE((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
3314 yi.zhou 1.225 "Handler %s:%s.%s found for %s Indication %s",
3315 (const char*)(request->nameSpace.getString().
3316 getCString()),
3317 (const char*)(handlerInstance.getClassName().
3318 getString().getCString()),
3319 (const char*)(handlerInstance.getProperty(
3320 handlerInstance.findProperty(
3321 PEGASUS_PROPERTYNAME_NAME)).getValue().
3322 toString().getCString()),
3323 (const char*)(indication.getClassName().
3324 getString().getCString()),
3325 (const char*)(request->messageId.getCString())));
3326
|
3327 kumpf 1.253 _forwardIndToHandler(subscriptions[i],
3328 handlerInstance,
3329 formattedIndication,
|
3330 yi.zhou 1.225 request->nameSpace,
|
3331 venkat.puvvada 1.270 request->operationContext,
3332 deliveryStatusAggregator.get());
|
3333 yi.zhou 1.225 matchedSubscriptions.append(subscriptions[i]);
|
3334 yi.zhou 1.229 matchedSubscriptionsKeys.append(subscriptionKeys[i]);
|
3335 kumpf 1.218 }
|
3336 kumpf 1.137 }
|
3337 yi.zhou 1.225 }
3338 catch (Exception& e)
3339 {
|
3340 marek 1.238 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
3341 yi.zhou 1.225 "Exception caught in attempting to process indication "
3342 "for the subscription %s: %s",
3343 (const char *) subscriptions[i].getPath ().toString().
3344 getCString(),
|
3345 kumpf 1.253 (const char *) e.getMessage ().getCString()));
|
3346 yi.zhou 1.225 }
3347 catch (exception& e)
3348 {
|
3349 marek 1.238 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
3350 yi.zhou 1.225 "Exception caught in attempting to process indication "
3351 "for the subscription %s: %s",
3352 (const char *) subscriptions[i].getPath ().toString().
3353 getCString(), e.what()));
3354 }
3355 catch (...)
3356 {
|
3357 marek 1.238 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
3358 yi.zhou 1.225 "Unknown exception caught in attempting to process "
3359 "indication for the subscription %s",
3360 (const char *) subscriptions[i].getPath ().toString ().
3361 getCString()));
3362 }
|
3363 dj.gorey 1.135
|
3364 kumpf 1.1 }
|
3365 carolann.graves 1.167
|
3366 yi.zhou 1.229 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
3367 _providerIndicationCountTable.incrementEntry(
3368 request->provider, matchedSubscriptions.size() == 0);
3369 _subscriptionTable->updateMatchedIndicationCounts(
3370 request->provider, matchedSubscriptionsKeys);
3371 #endif
3372
|
3373 carolann.graves 1.167 //
|
3374 yi.zhou 1.225 // Log subscriptions info to a trace message
|
3375 carolann.graves 1.167 //
3376 if (matchedSubscriptions.size() == 0)
3377 {
|
3378 marek 1.238 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL1,
|
3379 w.otsuka 1.217 "No matching subscriptions found for %s Indication %s",
3380 (const char*)(indication.getClassName().getString().
|
3381 yi.zhou 1.225 getCString()),
|
3382 w.otsuka 1.217 (const char*)(request->messageId.getCString())));
|
3383 carolann.graves 1.167 }
|
3384 yi.zhou 1.225 else
3385 {
|
3386 marek 1.238 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
3387 yi.zhou 1.225 "%d subscriptions found for %s Indication %s in namespace %s",
3388 matchedSubscriptions.size(),
3389 (const char*)(indication.getClassName().getString().
3390 getCString()),
3391 (const char*)(request->messageId.getCString()),
3392 (const char*)(request->nameSpace.getString().getCString())));
3393 }
|
3394 kumpf 1.11 }
|
3395 kumpf 1.236 catch (Exception& e)
3396 {
|
3397 marek 1.238 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
3398 kumpf 1.236 "Exception caught while processing indication: %s. "
3399 "Indication may be lost.",
3400 (const char*)e.getMessage().getCString()));
3401 PEG_METHOD_EXIT();
3402 throw;
3403 }
|
3404 kumpf 1.173 catch (...)
3405 {
|
3406 marek 1.238 PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
3407 kumpf 1.235 "Exception caught while processing indication. Indication may be "
3408 "lost.");
3409 PEG_METHOD_EXIT();
3410 throw;
|
3411 kumpf 1.173 }
|
3412 kumpf 1.11
|
3413 kumpf 1.236 _enqueueResponse(request, request->buildResponse());
|
3414 kumpf 1.11
|
3415 yi.zhou 1.229 #ifdef PEGASUS_INDICATION_PERFINST
3416 stopWatch.stop();
3417
|
3418 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
3419 yi.zhou 1.229 "%s: %.3f seconds", "Process Indication", stopWatch.getElapsed()));
3420 #endif
3421
|
3422 kumpf 1.48 PEG_METHOD_EXIT ();
|
3423 kumpf 1.119 return;
3424 }
3425
3426 void IndicationService::_handleIndicationCallBack (
3427 AsyncOpNode * operation,
3428 MessageQueue * destination,
3429 void * userParameter)
3430 {
3431 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
3432 "IndicationService::_handleIndicationCallBack");
3433
|
3434 dj.gorey 1.135 IndicationService * service =
|
3435 kumpf 1.218 static_cast<IndicationService *> (destination);
|
3436 dj.gorey 1.135 CIMInstance * subscription =
|
3437 kumpf 1.218 reinterpret_cast<CIMInstance *> (userParameter);
|
3438 dj.gorey 1.135 AsyncReply * asyncReply =
|
3439 kumpf 1.201 static_cast<AsyncReply *>(operation->removeResponse());
|
3440 kumpf 1.218 CIMHandleIndicationResponseMessage* handlerResponse =
3441 reinterpret_cast<CIMHandleIndicationResponseMessage *>(
3442 (static_cast<AsyncLegacyOperationResult *>(
3443 asyncReply))->get_result());
|
3444 kumpf 1.119 PEGASUS_ASSERT (handlerResponse != 0);
|
3445 kumpf 1.11
|
3446 kumpf 1.119 if (handlerResponse->cimException.getCode () != CIM_ERR_SUCCESS)
3447 {
|
3448 thilo.boehm 1.242 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
3449 "Sending Indication and HandlerService returns CIMException: %s",
3450 (const char*)
3451 handlerResponse->cimException.getMessage().getCString()));
|
3452 kumpf 1.119
3453 //
3454 // ATTN-CAKG-P1-20020326: Implement subscription's OnFatalErrorPolicy
3455 //
3456 //service->_subscriptionRepository->reconcileFatalError (*subscription);
3457 }
3458
3459 delete handlerResponse;
3460 delete asyncReply;
3461 service->return_op (operation);
3462
3463 PEG_METHOD_EXIT ();
|
3464 kumpf 1.11 }
3465
3466 void IndicationService::_handleNotifyProviderRegistrationRequest
3467 (const Message* message)
3468 {
|
3469 kumpf 1.114 PEG_METHOD_ENTER ( TRC_INDICATION_SERVICE,
|
3470 kumpf 1.48 "IndicationService::_handleNotifyProviderRegistrationRequest");
|
3471 kumpf 1.11
|
3472 dj.gorey 1.135 CIMNotifyProviderRegistrationRequestMessage* request =
|
3473 kumpf 1.11 (CIMNotifyProviderRegistrationRequestMessage*) message;
3474
|
3475 kumpf 1.137 ProviderIdContainer pidc = request->operationContext.get
|
3476 chip 1.162 (ProviderIdContainer::NAME);
3477 CIMInstance provider = pidc.getProvider();
|
3478 se.gupta 1.129 CIMInstance providerModule = pidc.getModule();
|
3479 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
3480 Boolean isRemoteNameSpace = pidc.isRemoteNameSpace();
3481 String remoteInfo = pidc.getRemoteInfo();
3482 #endif
3483
|
3484 kumpf 1.63 CIMName className = request->className;
|
3485 kumpf 1.218 Array<CIMNamespaceName> newNameSpaces = request->newNamespaces;
3486 Array<CIMNamespaceName> oldNameSpaces = request->oldNamespaces;
|
3487 kumpf 1.11 CIMPropertyList newPropertyNames = request->newPropertyNames;
3488 CIMPropertyList oldPropertyNames = request->oldPropertyNames;
|
3489 kumpf 1.6
|
3490 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace> newSubscriptions;
3491 Array<SubscriptionWithSrcNamespace> formerSubscriptions;
|
3492 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
3493 kumpf 1.16 ProviderClassList indicationProvider;
|
3494 kumpf 1.6
|
3495 kumpf 1.11 newSubscriptions.clear ();
3496 formerSubscriptions.clear ();
|
3497 kumpf 1.1
|
3498 kumpf 1.11 switch (request->operation)
3499 {
3500 case OP_CREATE:
3501 {
|
3502 kumpf 1.10 //
|
3503 kumpf 1.11 // Get matching subscriptions
|
3504 kumpf 1.10 //
|
3505 dj.gorey 1.135 newSubscriptions = _getMatchingSubscriptions (className,
|
3506 kumpf 1.15 newNameSpaces, newPropertyNames);
|
3507 kumpf 1.11
3508 break;
3509 }
|
3510 kumpf 1.10
|
3511 kumpf 1.11 case OP_DELETE:
3512 {
|
3513 kumpf 1.10 //
|
3514 kumpf 1.11 // Get matching subscriptions
|
3515 kumpf 1.10 //
|
3516 dj.gorey 1.135 formerSubscriptions = _getMatchingSubscriptions (className,
|
3517 kumpf 1.15 oldNameSpaces, oldPropertyNames);
|
3518 kumpf 1.11
|
3519 yi.zhou 1.229 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
3520 _providerIndicationCountTable.removeEntry(provider);
3521 #endif
3522
|
3523 kumpf 1.11 break;
|
3524 kumpf 1.10 }
3525
|
3526 kumpf 1.11 case OP_MODIFY:
|
3527 kumpf 1.10 {
|
3528 kumpf 1.11 //
3529 // Get lists of affected subscriptions
3530 //
|
3531 kumpf 1.15 _getModifiedSubscriptions (className, newNameSpaces, oldNameSpaces,
|
3532 dj.gorey 1.135 newPropertyNames, oldPropertyNames,
|
3533 kumpf 1.15 newSubscriptions, formerSubscriptions);
|
3534 kumpf 1.11
3535 break;
|
3536 kumpf 1.10 }
|
3537 kumpf 1.11 default:
3538 //
3539 // Error condition: operation not supported
3540 //
|
3541 kumpf 1.48 PEG_METHOD_EXIT ();
|
3542 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3543 kumpf 1.11 break;
3544 } // switch
3545
3546 //
3547 // Construct provider class list from input provider and class name
3548 //
|
3549 kumpf 1.12 indicationProvider.provider = provider;
|
3550 kumpf 1.15 indicationProvider.providerModule = providerModule;
|
3551 venkat.puvvada 1.275 NamespaceClassList nscl;
3552 nscl.classList.append(className);
3553 indicationProvider.classList.append (nscl);
|
3554 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
3555 indicationProvider.isRemoteNameSpace = isRemoteNameSpace;
3556 indicationProvider.remoteInfo = remoteInfo;
3557 #endif
|
3558 kumpf 1.11 indicationProviders.append (indicationProvider);
|
3559 kumpf 1.10
|
3560 kumpf 1.11 if (newSubscriptions.size () > 0)
3561 {
3562 CIMPropertyList requiredProperties;
3563 String condition;
|
3564 kumpf 1.124 String query;
|
3565 kumpf 1.11 String queryLanguage;
|
3566 kumpf 1.10
|
3567 dj.gorey 1.135 // Send Create or Modify request for each subscription that can newly
|
3568 kumpf 1.16 // be supported
|
3569 kumpf 1.10 //
|
3570 kumpf 1.83 for (Uint32 i = 0; i < newSubscriptions.size (); i++)
|
3571 kumpf 1.10 {
|
3572 venkat.puvvada 1.275 indicationProviders[0].classList[0].nameSpace =
3573 newSubscriptions[i].nameSpace;
3574
3575 Array<NamespaceClassList> indicationSubclasses;
3576 _getCreateParams (
3577 newSubscriptions[i].subscription,
3578 indicationSubclasses,
3579 requiredProperties,
3580 condition,
3581 query,
3582 queryLanguage);
3583
|
3584 kumpf 1.11
3585 //
|
3586 kumpf 1.39 // NOTE: These Create or Modify requests are not associated with a
3587 // user request, so there is no associated authType or userName
|
3588 dj.gorey 1.135 // The Creator from the subscription instance is used for
|
3589 kumpf 1.16 // userName, and authType is not set
|
3590 kumpf 1.15 //
|
3591 dj.gorey 1.135 // NOTE: the subscriptions in the newSubscriptions list came from
3592 // the IndicationService's internal hash tables, and thus
|
3593 kumpf 1.80 // each instance is known to have a valid Creator property
3594 //
|
3595 venkat.puvvada 1.275 CIMInstance instance = newSubscriptions[i].subscription;
|
3596 kumpf 1.15 String creator = instance.getProperty (instance.findProperty
|
3597 kumpf 1.38 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue ().toString ();
|
3598 kumpf 1.11
|
3599 chuck 1.77 // l10n start
|
3600 kumpf 1.195 AcceptLanguageList acceptLangs;
|
3601 kumpf 1.114 Uint32 propIndex = instance.findProperty
|
3602 dj.gorey 1.135 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
|
3603 chuck 1.77 if (propIndex != PEG_NOT_FOUND)
3604 {
|
3605 kumpf 1.194 String acceptLangsString;
3606 instance.getProperty(propIndex).getValue().get(
3607 acceptLangsString);
3608 if (acceptLangsString.size())
3609 {
3610 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
3611 acceptLangsString);
3612 }
|
3613 chuck 1.77 }
|
3614 kumpf 1.195 ContentLanguageList contentLangs;
|
3615 kumpf 1.114 propIndex = instance.findProperty
|
3616 dj.gorey 1.135 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
|
3617 chuck 1.77 if (propIndex != PEG_NOT_FOUND)
3618 {
|
3619 kumpf 1.194 String contentLangsString;
3620 instance.getProperty(propIndex).getValue().get(
3621 contentLangsString);
3622 if (contentLangsString.size())
3623 {
3624 contentLangs = LanguageParser::parseContentLanguageHeader(
3625 contentLangsString);
3626 }
|
3627 chuck 1.77 }
3628 // l10n end
|
3629 chuck 1.75
|
3630 kumpf 1.11 //
|
3631 kumpf 1.73 // Look up the subscription in the active subscriptions table
|
3632 kumpf 1.16 //
|
3633 kumpf 1.73 ActiveSubscriptionsTableEntry tableValue;
|
3634 dj.gorey 1.135 if (_subscriptionTable->getSubscriptionEntry
|
3635 venkat.puvvada 1.275 (newSubscriptions[i].subscription.getPath (), tableValue))
|
3636 kumpf 1.16 {
|
3637 kumpf 1.70 //
|
3638 dj.gorey 1.135 // If the provider is already in the subscription's list,
|
3639 kumpf 1.73 // send a Modify request, otherwise send a Create request
|
3640 kumpf 1.70 //
|
3641 dj.gorey 1.135 Uint32 providerIndex = _subscriptionTable->providerInList
|
3642 kumpf 1.114 (provider, tableValue);
|
3643 kumpf 1.73 if (providerIndex != PEG_NOT_FOUND)
3644 {
3645 //
3646 // Send Modify requests
3647 //
|
3648 venkat.puvvada 1.275 _sendWaitModifyRequests (
3649 indicationProviders,
3650 requiredProperties,
3651 condition,
3652 query,
3653 queryLanguage,
3654 newSubscriptions[i].subscription,
|
3655 kumpf 1.194 acceptLangs,
3656 contentLangs,
|
3657 chuck 1.75 creator);
|
3658 kumpf 1.73 }
3659 else
3660 {
3661 //
3662 // Send Create requests
3663 //
|
3664 kumpf 1.218 Array<ProviderClassList> acceptedProviders;
|
3665 venkat.puvvada 1.275 acceptedProviders = _sendWaitCreateRequests(
3666 indicationProviders,
3667 requiredProperties,
3668 condition,
3669 query,
3670 queryLanguage,
3671 newSubscriptions[i].subscription,
|
3672 kumpf 1.194 acceptLangs,
3673 contentLangs,
|
3674 kumpf 1.88 creator);
|
3675 kumpf 1.137
|
3676 carolann.graves 1.172 if (acceptedProviders.size () > 0)
|
3677 carolann.graves 1.164 {
3678 //
3679 // Provider is not yet in the list for this
3680 // subscription; add provider to the list
3681 //
3682 _subscriptionTable->updateProviders
|
3683 venkat.puvvada 1.275 (instance.getPath (), indicationProviders[0], true);
|
3684 carolann.graves 1.164 }
|
3685 kumpf 1.73 }
|
3686 kumpf 1.114 }
|
3687 kumpf 1.16 else
|
3688 kumpf 1.10 {
|
3689 kumpf 1.16 //
|
3690 kumpf 1.73 // Subscription not found in Active Subscriptions table
|
3691 kumpf 1.16 //
|
3692 kumpf 1.1 }
3693 }
|
3694 kumpf 1.87
3695 //
3696 // NOTE: When a provider that was previously not serving a subscription
|
3697 kumpf 1.88 // now serves the subscription due to a provider registration change,
|
3698 kumpf 1.87 // a log message is sent, even if there were previously other providers
3699 // serving the subscription
3700 //
3701
3702 //
3703 // Log a message for each subscription
3704 //
|
3705 kumpf 1.114 CIMClass providerClass = _subscriptionRepository->getClass
|
3706 kumpf 1.105 (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER,
3707 true, true, false, CIMPropertyList ());
|
3708 kumpf 1.87 CIMInstance providerCopy = provider.clone ();
3709 CIMObjectPath path = providerCopy.buildPath (providerClass);
3710 providerCopy.setPath (path);
|
3711 carolann.graves 1.164 String logString1 = getProviderLogString (providerCopy);
3712
|
3713 kumpf 1.87 for (Uint32 j = 0; j < newSubscriptions.size (); j++)
3714 {
|
3715 kumpf 1.98 //
3716 // Get Provider Name, Subscription Filter Name and Handler Name
3717 //
|
3718 dj.gorey 1.135 String logString2 = _getSubscriptionLogString
|
3719 venkat.puvvada 1.275 (newSubscriptions[j].subscription);
|
3720 kumpf 1.98
|
3721 kumpf 1.241 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
3722 Logger::WARNING,
3723 MessageLoaderParms(
3724 _MSG_PROVIDER_NOW_SERVING_KEY,
3725 _MSG_PROVIDER_NOW_SERVING, logString1, logString2,
|
3726 venkat.puvvada 1.275 newSubscriptions[j].subscription.getPath().
3727 getNameSpace().getString()));
|
3728 kumpf 1.87 }
|
3729 kumpf 1.1 }
|
3730 kumpf 1.11
3731 if (formerSubscriptions.size () > 0)
|
3732 kumpf 1.1 {
|
3733 kumpf 1.16 CIMPropertyList requiredProperties;
3734 String condition;
|
3735 kumpf 1.124 String query;
|
3736 kumpf 1.16 String queryLanguage;
|
3737 kumpf 1.11
3738 //
|
3739 dj.gorey 1.135 // Send Delete or Modify request for each subscription that can no
|
3740 kumpf 1.16 // longer be supported
|
3741 kumpf 1.11 //
|
3742 kumpf 1.83 for (Uint32 i = 0; i < formerSubscriptions.size (); i++)
|
3743 kumpf 1.11 {
|
3744 venkat.puvvada 1.275 indicationProviders[0].classList[0].nameSpace =
3745 formerSubscriptions[i].nameSpace;
|
3746 kumpf 1.80 //
|
3747 kumpf 1.39 // NOTE: These Delete or Modify requests are not associated with a
3748 // user request, so there is no associated authType or userName
|
3749 kumpf 1.16 // The Creator from the subscription instance is used for userName,
3750 // and authType is not set
|
3751 kumpf 1.80 //
|
3752 dj.gorey 1.135 // NOTE: the subscriptions in the formerSubscriptions list came
3753 // from the IndicationService's internal hash tables, and thus
|
3754 kumpf 1.80 // each instance is known to have a valid Creator property
3755 //
|
3756 venkat.puvvada 1.275 CIMInstance instance = formerSubscriptions[i].subscription;
|
3757 kumpf 1.15 String creator = instance.getProperty (instance.findProperty
|
3758 kumpf 1.38 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue ().toString ();
|
3759 kumpf 1.195 AcceptLanguageList acceptLangs;
|
3760 carolann.graves 1.164 Uint32 propIndex = instance.findProperty
3761 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
|
3762 chuck 1.77 if (propIndex != PEG_NOT_FOUND)
3763 {
|
3764 kumpf 1.194 String acceptLangsString;
3765 instance.getProperty(propIndex).getValue().get(
3766 acceptLangsString);
3767 if (acceptLangsString.size())
3768 {
3769 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
3770 acceptLangsString);
3771 }
|
3772 chuck 1.77 }
|
3773 kumpf 1.195 ContentLanguageList contentLangs;
|
3774 carolann.graves 1.164 propIndex = instance.findProperty
3775 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
|
3776 chuck 1.77 if (propIndex != PEG_NOT_FOUND)
3777 {
|
3778 kumpf 1.194 String contentLangsString;
3779 instance.getProperty(propIndex).getValue().get(
3780 contentLangsString);
3781 if (contentLangsString.size())
3782 {
3783 contentLangs = LanguageParser::parseContentLanguageHeader(
3784 contentLangsString);
3785 }
|
3786 chuck 1.77 }
|
3787 chuck 1.75
|
3788 kumpf 1.16 //
|
3789 kumpf 1.73 // Look up the subscription in the active subscriptions table
|
3790 kumpf 1.37 // If class list contains only the class name from the current
|
3791 kumpf 1.38 // operation, send a Delete request
3792 // Otherwise, send a Modify request
|
3793 kumpf 1.16 //
|
3794 kumpf 1.73 ActiveSubscriptionsTableEntry tableValue;
|
3795 dj.gorey 1.135 if (_subscriptionTable->getSubscriptionEntry
|
3796 venkat.puvvada 1.275 (formerSubscriptions[i].subscription.getPath (), tableValue))
|
3797 kumpf 1.16 {
|
3798 dj.gorey 1.135 Uint32 providerIndex = _subscriptionTable->providerInList
|
3799 kumpf 1.114 (provider, tableValue);
|
3800 kumpf 1.73 if (providerIndex != PEG_NOT_FOUND)
|
3801 kumpf 1.37 {
|
3802 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
3803 _getCreateParams (
3804 formerSubscriptions[i].subscription,
3805 indicationSubclasses,
3806 requiredProperties,
3807 condition,
3808 query,
3809 queryLanguage);
|
3810 kumpf 1.88
|
3811 kumpf 1.73 //
|
3812 dj.gorey 1.135 // If class list contains only the class name from the
|
3813 kumpf 1.73 // current delete, send a Delete request
3814 //
|
3815 kumpf 1.218 if ((tableValue.providers[providerIndex].classList.size()
|
3816 kumpf 1.73 == 1) &&
|
3817 venkat.puvvada 1.275 (tableValue.providers[providerIndex].classList[0].
3818 classList[0].equal(className)))
|
3819 kumpf 1.73 {
|
3820 venkat.puvvada 1.275
3821 if (tableValue.providers[providerIndex].
3822 classList[0].nameSpace ==
3823 formerSubscriptions[i].nameSpace)
3824 {
3825 _sendWaitDeleteRequests (
3826 indicationProviders,
3827 formerSubscriptions[i].subscription,
3828 acceptLangs,
3829 contentLangs,
3830 creator);
|
3831 kumpf 1.137
|
3832 venkat.puvvada 1.275 //
3833 //
3834 //
3835 _subscriptionTable->updateProviders(
3836 instance.getPath(),
3837 indicationProviders[0],
3838 false);
3839 }
|
3840 kumpf 1.73 }
|
3841 dj.gorey 1.135
|
3842 kumpf 1.70 //
|
3843 kumpf 1.73 // Otherwise, send a Modify request
|
3844 kumpf 1.70 //
|
3845 kumpf 1.73 else
3846 {
|
3847 venkat.puvvada 1.275 Uint32 classIndex = _subscriptionTable->classInList(
3848 className,
3849 formerSubscriptions[i].nameSpace,
3850 tableValue.providers[providerIndex]);
3851
|
3852 kumpf 1.73 if (classIndex != PEG_NOT_FOUND)
3853 {
|
3854 kumpf 1.137 //
|
3855 carolann.graves 1.164 // Send Modify requests
|
3856 kumpf 1.137 //
|
3857 venkat.puvvada 1.275 _sendWaitModifyRequests (
3858 indicationProviders,
3859 requiredProperties,
3860 condition,
3861 query,
3862 queryLanguage,
3863 formerSubscriptions[i].subscription,
|
3864 kumpf 1.194 acceptLangs,
3865 contentLangs,
|
3866 carolann.graves 1.164 creator);
|
3867 kumpf 1.73 }
3868 else
3869 {
|
3870 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
3871 thilo.boehm 1.242 "Class %s not found in tableValue.providers",
3872 (const char*)className.getString().getCString()
3873 ));
|
3874 kumpf 1.73 }
3875 }
3876 }
3877 else
3878 {
|
3879 kumpf 1.37 //
|
3880 dj.gorey 1.135 // The subscription was not served by the provider
|
3881 kumpf 1.37 //
3882 }
|
3883 kumpf 1.16 }
3884 else
3885 {
|
3886 kumpf 1.37 //
|
3887 kumpf 1.88 // Subscription not found in Active Subscriptions table
|
3888 kumpf 1.37 //
|
3889 kumpf 1.16 }
|
3890 kumpf 1.11 }
|
3891 kumpf 1.1
|
3892 kumpf 1.87 #if 0
|
3893 kumpf 1.11 //
3894 // Create NoProviderAlertIndication instance
3895 // ATTN: NoProviderAlertIndication must be defined
3896 //
|
3897 dj.gorey 1.135 CIMInstance indicationInstance = _createAlertInstance
|
3898 kumpf 1.11 (_CLASS_NO_PROVIDER_ALERT, formerSubscriptions);
|
3899 dj.gorey 1.135
|
3900 kumpf 1.11 //
3901 // Send NoProviderAlertIndication to each unique handler instance
3902 //
|
3903 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
3904 carolann.graves 1.192 "Sending NoProvider Alert for %u subscriptions",
|
3905 marek 1.215 formerSubscriptions.size ()));
|
3906 kumpf 1.11 _sendAlerts (formerSubscriptions, indicationInstance);
|
3907 kumpf 1.87 #endif
3908 //
|
3909 kumpf 1.88 // NOTE: When a provider that was previously serving a subscription
3910 // no longer serves the subscription due to a provider registration
3911 // change, a log message is sent, even if there are still other
|
3912 kumpf 1.87 // providers serving the subscription
3913 //
3914
3915 //
3916 // Log a message for each subscription
3917 //
|
3918 kumpf 1.114 CIMClass providerClass = _subscriptionRepository->getClass
|
3919 kumpf 1.105 (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER,
3920 true, true, false, CIMPropertyList ());
|
3921 kumpf 1.87 CIMInstance providerCopy = provider.clone ();
3922 CIMObjectPath path = providerCopy.buildPath (providerClass);
3923 providerCopy.setPath (path);
|
3924 carolann.graves 1.164 String logString1 = getProviderLogString (providerCopy);
3925
|
3926 kumpf 1.87 for (Uint32 j = 0; j < formerSubscriptions.size (); j++)
3927 {
|
3928 kumpf 1.98 //
3929 // Get Provider Name, Subscription Filter Name and Handler Name
3930 //
|
3931 dj.gorey 1.135 String logString2 = _getSubscriptionLogString
|
3932 venkat.puvvada 1.275 (formerSubscriptions[j].subscription);
|
3933 kumpf 1.98
|
3934 kumpf 1.241 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
3935 Logger::WARNING,
3936 MessageLoaderParms(
3937 _MSG_PROVIDER_NO_LONGER_SERVING_KEY,
3938 _MSG_PROVIDER_NO_LONGER_SERVING, logString1, logString2,
|
3939 venkat.puvvada 1.275 formerSubscriptions[j].subscription.getPath().
3940 getNameSpace().getString()));
|
3941 kumpf 1.87 }
|
3942 kumpf 1.11 }
|
3943 kumpf 1.1
|
3944 kumpf 1.137 //
|
3945 carolann.graves 1.164 // Send response
|
3946 kumpf 1.137 //
|
3947 carolann.graves 1.164 CIMResponseMessage * response = request->buildResponse ();
3948 _enqueueResponse (request, response);
|
3949 kumpf 1.137
|
3950 kumpf 1.48 PEG_METHOD_EXIT ();
|
3951 kumpf 1.1 }
3952
|
3953 kumpf 1.114 void IndicationService::_handleNotifyProviderTerminationRequest
3954 (const Message * message)
|
3955 kumpf 1.73 {
3956 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
3957 kumpf 1.114 "IndicationService::_handleNotifyProviderTermination");
|
3958 kumpf 1.73
|
3959 kumpf 1.218 Array<CIMInstance> providerSubscriptions;
|
3960 kumpf 1.11 CIMInstance indicationInstance;
3961
|
3962 chip 1.162 CIMNotifyProviderTerminationRequestMessage* request =
|
3963 kumpf 1.137 (CIMNotifyProviderTerminationRequestMessage*) message;
|
3964 kumpf 1.11
|
3965 kumpf 1.218 Array<CIMInstance> providers = request->providers;
|
3966 kumpf 1.11
|
3967 kumpf 1.83 for (Uint32 i = 0; i < providers.size (); i++)
|
3968 kumpf 1.38 {
|
3969 yi.zhou 1.229 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
3970 _providerIndicationCountTable.removeEntry(providers[i]);
3971 #endif
3972
|
3973 kumpf 1.38 //
3974 // Get list of affected subscriptions
3975 //
|
3976 carolann.graves 1.198 // _subscriptionTable->reflectProviderDisable also updates the
|
3977 kumpf 1.114 // Active Subscriptions hash table, and implements each subscription's
3978 // On Fatal Error policy, if necessary
|
3979 kumpf 1.73 //
|
3980 kumpf 1.218 providerSubscriptions.clear();
3981 providerSubscriptions = _subscriptionTable->reflectProviderDisable(
3982 providers[i]);
|
3983 dj.gorey 1.135
|
3984 kumpf 1.218 if (providerSubscriptions.size() > 0)
|
3985 kumpf 1.73 {
3986 //
3987 // NOTE: When a provider that was previously serving a subscription
3988 // no longer serves the subscription due to a provider termination,
3989 // an alert is always sent, even if there are still other providers
3990 // serving the subscription
3991 //
|
3992 dj.gorey 1.135
|
3993 kumpf 1.87 #if 0
|
3994 kumpf 1.73 //
3995 // Create ProviderTerminatedAlertIndication instance
3996 // ATTN: ProviderTerminatedAlertIndication must be defined
3997 //
|
3998 dj.gorey 1.135 indicationInstance = _createAlertInstance
|
3999 kumpf 1.73 (_CLASS_PROVIDER_TERMINATED_ALERT, providerSubscriptions);
|
4000 dj.gorey 1.135
|
4001 kumpf 1.73 //
|
4002 dj.gorey 1.135 // Send ProviderTerminatedAlertIndication to each unique handler
|
4003 kumpf 1.73 // instance
4004 //
|
4005 marek 1.215 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
4006 carolann.graves 1.192 "Sending ProviderDisabled Alert for %u subscriptions",
|
4007 marek 1.215 providerSubscriptions.size ()));
|
4008 kumpf 1.73 _sendAlerts (providerSubscriptions, indicationInstance);
|
4009 kumpf 1.87 #endif
4010 //
4011 // Log a message for each subscription
4012 //
|
4013 kumpf 1.218 CIMClass providerClass = _subscriptionRepository->getClass(
4014 PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER,
4015 true, true, false, CIMPropertyList());
4016 CIMInstance providerCopy = providers[i].clone();
|
4017 kumpf 1.87 CIMObjectPath path = providerCopy.buildPath (providerClass);
4018 providerCopy.setPath (path);
4019 for (Uint32 j = 0; j < providerSubscriptions.size (); j++)
4020 {
|
4021 kumpf 1.98 //
4022 // Get Provider Name, Subscription Filter Name and Handler Name
4023 //
|
4024 kumpf 1.114 String logString1 = getProviderLogString (providerCopy);
|
4025 dj.gorey 1.135 String logString2 = _getSubscriptionLogString
|
4026 kumpf 1.218 (providerSubscriptions[j]);
|
4027 kumpf 1.98
|
4028 kumpf 1.241 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
4029 Logger::WARNING,
4030 MessageLoaderParms(
4031 _MSG_PROVIDER_NO_LONGER_SERVING_KEY,
4032 _MSG_PROVIDER_NO_LONGER_SERVING, logString1, logString2,
4033 providerSubscriptions[j].getPath().getNameSpace().
4034 getString()));
|
4035 kumpf 1.87 }
|
4036 kumpf 1.73 }
|
4037 kumpf 1.38 }
|
4038 kumpf 1.11
|
4039 carolann.graves 1.145 CIMResponseMessage * response = request->buildResponse ();
|
4040 kumpf 1.137 _enqueueResponse (request, response);
4041
|
4042 kumpf 1.48 PEG_METHOD_EXIT ();
|
4043 kumpf 1.11 }
|
4044 kumpf 1.1
|
4045 kumpf 1.105 void IndicationService::_handleNotifyProviderEnableRequest
4046 (const Message * message)
4047 {
4048 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
4049 kumpf 1.114 "IndicationService::_handleNotifyProviderEnableRequest");
|
4050 kumpf 1.105
4051 CIMNotifyProviderEnableRequestMessage * request =
4052 (CIMNotifyProviderEnableRequestMessage *) message;
|
4053 carolann.graves 1.198 ProviderIdContainer pidc = request->operationContext.get
4054 (ProviderIdContainer::NAME);
|
4055 se.gupta 1.129 CIMInstance providerModule = pidc.getModule();
4056 CIMInstance provider = pidc.getProvider();
|
4057 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
4058 Boolean isRemoteNameSpace = pidc.isRemoteNameSpace();
4059 String remoteInfo = pidc.getRemoteInfo();
4060 #endif
|
4061 kumpf 1.218 Array<CIMInstance> capabilities = request->capInstances;
|
4062 kumpf 1.105
|
4063 kumpf 1.118 CIMException cimException;
|
4064 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace> subscriptions;
|
4065 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
4066 kumpf 1.118
|
4067 kumpf 1.105 //
|
4068 dj.gorey 1.135 // Get class name, namespace names, and property list
|
4069 kumpf 1.105 // from each capability instance
4070 //
4071 Uint32 numCapabilities = capabilities.size ();
4072 for (Uint32 i = 0; i < numCapabilities; i++)
4073 {
4074 CIMName className;
|
4075 kumpf 1.218 Array<CIMNamespaceName> namespaceNames;
|
4076 kumpf 1.105 CIMPropertyList propertyList;
|
4077 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace> currentSubscriptions;
|
4078 kumpf 1.105
4079 try
4080 {
4081 String cName;
|
4082 kumpf 1.218 capabilities[i].getProperty (capabilities[i].findProperty
|
4083 kumpf 1.105 (_PROPERTY_CLASSNAME)).getValue ().get (cName);
4084 className = CIMName (cName);
4085
|
4086 kumpf 1.218 Array<String> nsNames;
4087 capabilities[i].getProperty (capabilities[i].findProperty
|
4088 kumpf 1.105 (_PROPERTY_NAMESPACES)).getValue ().get (nsNames);
4089 for (Uint32 j = 0; j < nsNames.size (); j++)
4090 {
|
4091 kumpf 1.218 namespaceNames.append (CIMNamespaceName (nsNames[j]));
|
4092 kumpf 1.105 }
4093
|
4094 kumpf 1.218 Array<String> pNames;
4095 Array<CIMName> propertyNames;
4096 Uint32 propertiesIndex = capabilities[i].findProperty
|
4097 kumpf 1.105 (_PROPERTY_SUPPORTEDPROPERTIES);
4098 if (propertiesIndex != PEG_NOT_FOUND)
4099 {
|
4100 kumpf 1.218 CIMValue propertiesValue = capabilities[i].getProperty
|
4101 kumpf 1.105 (propertiesIndex).getValue ();
4102 //
4103 // If the property list is not null, set the property names
4104 //
4105 if (!propertiesValue.isNull ())
4106 {
4107 propertiesValue.get (pNames);
4108 for (Uint32 k = 0; k < pNames.size (); k++)
4109 {
|
4110 kumpf 1.218 propertyNames.append (CIMName (pNames[k]));
|
4111 kumpf 1.105 }
4112 propertyList.set (propertyNames);
4113 }
4114 }
4115 }
|
4116 kumpf 1.218 catch (Exception& exception)
|
4117 kumpf 1.105 {
4118 //
4119 // Error getting information from Capabilities instance
4120 //
|
4121 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
4122 thilo.boehm 1.242 "Exception caught in handling provider enable notification: %s",
4123 (const char*)exception.getMessage().getCString()));
|
4124 kumpf 1.118
|
4125 kumpf 1.137 cimException = CIMException(CIM_ERR_FAILED, exception.getMessage());
|
4126 kumpf 1.105 break;
4127 }
4128 catch (...)
4129 {
|
4130 thilo.boehm 1.248 PEG_TRACE_CSTRING (TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
4131 kumpf 1.105 "Error in handling provider enable notification");
|
4132 kumpf 1.118
|
4133 kumpf 1.137 cimException = PEGASUS_CIM_EXCEPTION_L(
4134 CIM_ERR_FAILED,
4135 MessageLoaderParms(
4136 "IndicationService.IndicationService.UNKNOWN_ERROR",
4137 "Unknown Error"));
|
4138 kumpf 1.105 break;
4139 }
4140
4141 //
4142 // Get matching subscriptions
4143 //
|
4144 carolann.graves 1.164 currentSubscriptions = _getMatchingSubscriptions
4145 (className, namespaceNames, propertyList);
|
4146 kumpf 1.105
|
4147 carolann.graves 1.164 for (Uint32 c = 0; c < currentSubscriptions.size (); c++)
|
4148 kumpf 1.105 {
|
4149 carolann.graves 1.164 Boolean inList = false;
|
4150 kumpf 1.105
|
4151 carolann.graves 1.164 for (Uint32 m = 0; m < subscriptions.size (); m++)
|
4152 kumpf 1.105 {
4153 //
|
4154 carolann.graves 1.164 // If the current subscription is already in the list of
4155 // matching subscriptions, add the current class to the
4156 // indication provider class list for the subscription
|
4157 kumpf 1.105 //
|
4158 venkat.puvvada 1.275 if (currentSubscriptions[c].subscription.identical(
4159 subscriptions[m].subscription))
|
4160 kumpf 1.105 {
|
4161 venkat.puvvada 1.275 for (Uint32 i = 0,
4162 n = indicationProviders[m].classList.size();
4163 i < n; ++i)
4164 {
4165 if (indicationProviders[m].classList[i].nameSpace
4166 == currentSubscriptions[c].nameSpace)
4167 {
4168 indicationProviders[m].classList[i].
4169 classList.append(className);
4170 inList = true;
4171 break;
4172 }
4173 }
4174 if (!inList)
4175 {
4176 NamespaceClassList nscl;
4177 nscl.nameSpace = currentSubscriptions[c].nameSpace;
4178 nscl.classList.append(className);
4179 indicationProviders[m].classList.append(nscl);
4180 inList = true;
4181 }
|
4182 carolann.graves 1.164 break;
|
4183 kumpf 1.105 }
|
4184 carolann.graves 1.164 }
|
4185 dj.gorey 1.135
|
4186 carolann.graves 1.164 if (!inList)
4187 {
|
4188 kumpf 1.105 //
|
4189 carolann.graves 1.164 // If the current subscription is not already in the list of
4190 // matching subscriptions, add it to the list and add the
4191 // indication provider class list for the subscription
|
4192 kumpf 1.105 //
|
4193 kumpf 1.218 subscriptions.append (currentSubscriptions[c]);
|
4194 carolann.graves 1.164 ProviderClassList indicationProvider;
4195 indicationProvider.provider = provider;
4196 indicationProvider.providerModule = providerModule;
|
4197 venkat.puvvada 1.275 NamespaceClassList nscl;
4198 nscl.classList.append(className);
4199 nscl.nameSpace = currentSubscriptions[c].nameSpace;
4200 indicationProvider.classList.append (nscl);
|
4201 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
4202 indicationProvider.isRemoteNameSpace = isRemoteNameSpace;
4203 indicationProvider.remoteInfo = remoteInfo;
4204 #endif
|
4205 carolann.graves 1.164 indicationProviders.append (indicationProvider);
4206 }
4207 }
4208 } // for each capability instance
4209
4210 if (subscriptions.size () > 0)
4211 {
4212 CIMPropertyList requiredProperties;
4213 String condition;
4214 String query;
4215 String queryLanguage;
4216
4217 //
4218 // Get Provider Name
4219 //
4220 String logString1 = getProviderLogString (provider);
4221
4222 for (Uint32 s = 0; s < subscriptions.size (); s++)
4223 {
|
4224 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
4225 Array<NamespaceClassList> indicationSubclasses;
4226 CIMInstance instance = subscriptions[s].subscription;
4227 _getCreateParams (
4228 instance,
4229 indicationSubclasses,
4230 requiredProperties,
4231 condition,
4232 query,
|
4233 carolann.graves 1.186 queryLanguage);
|
4234 kumpf 1.105
|
4235 carolann.graves 1.164 //
4236 // NOTE: These Create requests are not associated with a
4237 // user request, so there is no associated authType or userName
4238 // The Creator from the subscription instance is used for
4239 // userName, and authType is not set
4240 //
4241 // NOTE: the subscriptions in the subscriptions list came from
4242 // the IndicationService's internal hash tables, and thus
4243 // each instance is known to have a valid Creator property
4244 //
4245 String creator = instance.getProperty (instance.findProperty
4246 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue
4247 ().toString ();
4248
|
4249 kumpf 1.195 AcceptLanguageList acceptLangs;
|
4250 carolann.graves 1.164 Uint32 propIndex = instance.findProperty
4251 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
4252 if (propIndex != PEG_NOT_FOUND)
4253 {
|
4254 kumpf 1.194 String acceptLangsString;
4255 instance.getProperty(propIndex).getValue().get(
4256 acceptLangsString);
4257 if (acceptLangsString.size())
4258 {
4259 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
4260 acceptLangsString);
4261 }
|
4262 carolann.graves 1.164 }
|
4263 kumpf 1.195 ContentLanguageList contentLangs;
|
4264 carolann.graves 1.164 propIndex = instance.findProperty
4265 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
4266 if (propIndex != PEG_NOT_FOUND)
4267 {
|
4268 kumpf 1.194 String contentLangsString;
4269 instance.getProperty(propIndex).getValue().get(
4270 contentLangsString);
4271 if (contentLangsString.size())
4272 {
4273 contentLangs = LanguageParser::parseContentLanguageHeader(
4274 contentLangsString);
4275 }
|
4276 carolann.graves 1.164 }
4277
4278 //
4279 // Send Create requests
4280 //
|
4281 kumpf 1.218 Array<ProviderClassList> currentIndicationProviders;
4282 currentIndicationProviders.append (indicationProviders[s]);
4283 Array<ProviderClassList> acceptedProviders;
|
4284 venkat.puvvada 1.275 acceptedProviders = _sendWaitCreateRequests(
4285 currentIndicationProviders,
4286 requiredProperties,
4287 condition,
4288 query,
4289 queryLanguage,
4290 instance,
|
4291 kumpf 1.194 acceptLangs,
4292 contentLangs,
|
4293 carolann.graves 1.164 creator);
4294
|
4295 carolann.graves 1.172 if (acceptedProviders.size () > 0)
|
4296 carolann.graves 1.164 {
|
4297 kumpf 1.105 //
|
4298 carolann.graves 1.164 // Get Subscription entry from Active Subscriptions table
|
4299 kumpf 1.137 //
|
4300 carolann.graves 1.164 ActiveSubscriptionsTableEntry tableValue;
4301 if (_subscriptionTable->getSubscriptionEntry
4302 (instance.getPath (), tableValue))
4303 {
4304 //
4305 // Look for the provider in the subscription's list
4306 //
4307 Uint32 providerIndex =
4308 _subscriptionTable->providerInList
|
4309 kumpf 1.218 (indicationProviders[s].provider, tableValue);
|
4310 carolann.graves 1.164 if (providerIndex != PEG_NOT_FOUND)
4311 {
4312 //
4313 // Provider is already in the list for this
4314 // subscription; add class to provider class list
4315 //
4316 for (Uint32 cn = 0;
|
4317 kumpf 1.218 cn < indicationProviders[s].classList.size ();
|
4318 carolann.graves 1.164 cn++)
4319 {
|
4320 venkat.puvvada 1.275 for(Uint32 sn = 0;
4321 sn < indicationProviders[s].classList[cn].
4322 classList.size();
4323 ++sn)
4324 {
4325 _subscriptionTable->updateClasses(
4326 instance.getPath (),
4327 indicationProviders[s].provider,
4328 indicationProviders[s].classList[cn].
4329 nameSpace,
4330 indicationProviders[s].classList[cn].
4331 classList[sn]);
4332 }
|
4333 carolann.graves 1.164 }
4334 }
4335 else
4336 {
4337 //
4338 // Provider is not yet in the list for this
4339 // subscription; add provider to the list
4340 //
4341 _subscriptionTable->updateProviders
|
4342 kumpf 1.218 (instance.getPath (), indicationProviders[s],
|
4343 carolann.graves 1.164 true);
|
4344 kumpf 1.137
|
4345 carolann.graves 1.164 //
4346 // NOTE: When a provider that was previously not
4347 // serving a subscription now serves the
4348 // subscription due to a provider being enabled, a
4349 // log message is sent, even if there were
4350 // previously other providers serving the
4351 // subscription
4352 //
|
4353 dj.gorey 1.135
|
4354 carolann.graves 1.164 //
4355 // Get Subscription Filter Name and Handler Name
4356 //
4357 String logString2 = _getSubscriptionLogString
|
4358 venkat.puvvada 1.275 (subscriptions[s].subscription);
|
4359 dj.gorey 1.135
|
4360 carolann.graves 1.164 //
4361 // Log a message for each subscription
4362 //
|
4363 kumpf 1.241 Logger::put_l(Logger::STANDARD_LOG,
|
4364 carolann.graves 1.164 System::CIMSERVER, Logger::WARNING,
|
4365 kumpf 1.241 MessageLoaderParms(
4366 _MSG_PROVIDER_NOW_SERVING_KEY,
4367 _MSG_PROVIDER_NOW_SERVING,
4368 logString1, logString2,
|
4369 venkat.puvvada 1.275 subscriptions[s].subscription.getPath().
4370 getNameSpace().getString()));
|
4371 carolann.graves 1.164 }
4372 }
4373 } // if any provider accepted the create subscription request
4374 } // for each matching subscription
4375 } // if any matching subscriptions
|
4376 kumpf 1.118
|
4377 kumpf 1.137 //
|
4378 carolann.graves 1.164 // Send response
|
4379 kumpf 1.137 //
|
4380 carolann.graves 1.164 CIMResponseMessage * response = request->buildResponse ();
4381 response->cimException = cimException;
4382 _enqueueResponse (request, response);
|
4383 kumpf 1.105
4384 PEG_METHOD_EXIT ();
4385 }
4386
|
4387 carolann.graves 1.198 void IndicationService::_handleNotifyProviderFailRequest
4388 (Message * message)
4389 {
4390 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4391 "IndicationService::_handleNotifyProviderFailRequest");
4392
|
4393 kumpf 1.213 CIMNotifyProviderFailRequestMessage* request =
4394 dynamic_cast<CIMNotifyProviderFailRequestMessage*>(message);
4395 PEGASUS_ASSERT(request != 0);
|
4396 carolann.graves 1.198
4397 String moduleName = request->moduleName;
4398 String userName = request->userName;
4399
4400 //
4401 // Determine providers in module that were serving active subscriptions
4402 // and update the Active Subscriptions Table
4403 //
|
4404 kumpf 1.218 Array<ActiveSubscriptionsTableEntry> providerModuleSubscriptions =
|
4405 carolann.graves 1.198 _subscriptionTable->reflectProviderModuleFailure
4406 (moduleName, userName, _authenticationEnabled);
4407
|
4408 yi.zhou 1.229 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
4409 _providerIndicationCountTable.removeModuleEntries(moduleName);
4410 #endif
4411
|
4412 carolann.graves 1.198 //
4413 // FUTURE: Attempt to recreate the subscription state
4414 //
4415
4416 //
4417 // Send response
4418 //
4419 CIMResponseMessage * response = request->buildResponse ();
4420 CIMNotifyProviderFailResponseMessage * failResponse =
4421 (CIMNotifyProviderFailResponseMessage *) response;
4422 failResponse->numSubscriptionsAffected =
4423 providerModuleSubscriptions.size ();
4424 _enqueueResponse (request, response);
4425 }
4426
|
4427 kumpf 1.11 Boolean IndicationService::_canCreate (
|
4428 kumpf 1.218 CIMInstance& instance,
4429 const CIMNamespaceName& nameSpace)
|
4430 kumpf 1.11 {
|
4431 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canCreate");
|
4432 kumpf 1.4
|
4433 kumpf 1.11 // REVIEW: Derived classes of CIM_IndicationSubscription not
4434 // handled. It is reasonable for a user to derive from this
4435 // class and add extra properties.
|
4436 kumpf 1.4
|
4437 kumpf 1.11 // REVIEW: how does the provider manager know to forward
4438 // requests to this service? Is it by class name? If so,
4439 // shouldn't the provider use an is-a operator on the new
4440 // class?
|
4441 kumpf 1.4
|
4442 kumpf 1.11 //
4443 // Check all required properties exist
|
4444 dj.gorey 1.135 // For a property that has a default value, if it does not exist or is
|
4445 kumpf 1.34 // null, add or set property with default value
4446 // For a property that has a specified set of valid values, validate
|
4447 kumpf 1.11 //
|
4448 yi.zhou 1.157 if ((instance.getClassName ().equal (PEGASUS_CLASSNAME_INDSUBSCRIPTION)) ||
|
4449 carolann.graves 1.179 (instance.getClassName ().equal
4450 (PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
|
4451 kumpf 1.11 {
4452 //
4453 // Filter and Handler are key properties for Subscription
4454 // No other properties are required
4455 //
|
4456 kumpf 1.218 _checkRequiredProperty(
4457 instance,
4458 PEGASUS_PROPERTYNAME_FILTER,
4459 CIMTYPE_REFERENCE,
|
4460 kumpf 1.240 true);
|
4461 kumpf 1.218 _checkRequiredProperty(
4462 instance,
4463 PEGASUS_PROPERTYNAME_HANDLER,
4464 CIMTYPE_REFERENCE,
|
4465 kumpf 1.240 true);
|
4466 kumpf 1.1
|
4467 kumpf 1.34 //
|
4468 carolann.graves 1.205 // Get filter and handler property values
|
4469 kumpf 1.108 //
4470 CIMProperty filterProperty = instance.getProperty
|
4471 w.otsuka 1.207 (instance.findProperty (PEGASUS_PROPERTYNAME_FILTER));
|
4472 kumpf 1.108 CIMValue filterValue = filterProperty.getValue ();
4473 CIMObjectPath filterPath;
4474 filterValue.get (filterPath);
|
4475 carolann.graves 1.186
|
4476 kumpf 1.108 CIMProperty handlerProperty = instance.getProperty
|
4477 w.otsuka 1.207 (instance.findProperty (PEGASUS_PROPERTYNAME_HANDLER));
|
4478 kumpf 1.108 CIMValue handlerValue = handlerProperty.getValue ();
4479 CIMObjectPath handlerPath;
4480 handlerValue.get (handlerPath);
|
4481 carolann.graves 1.186
4482 //
|
4483 carolann.graves 1.179 // Currently, the Indication Service requires that a Subscription
4484 // instance and the Filter and Handler instances to which it refers
|
4485 carolann.graves 1.186 // all be created on the same Host.
4486 // Developers are recommended NOT to include Host in the
|
4487 carolann.graves 1.179 // Filter or Handler reference property values.
4488 //
4489
4490 //
4491 // If Host is included in a Filter or Handler reference property
|
4492 carolann.graves 1.189 // value, attempt to validate that it is correct.
|
4493 carolann.graves 1.179 // If Host cannot be validated, reject the create operation.
4494 //
4495 CIMObjectPath origFilterPath = filterPath;
4496 if (filterPath.getHost () != String::EMPTY)
4497 {
|
4498 marek 1.209 if (!System::isLocalHost (filterPath.getHost()))
|
4499 carolann.graves 1.179 {
4500 //
4501 // Reject subscription creation
4502 //
|
4503 kumpf 1.240 PEG_METHOD_EXIT();
|
4504 kumpf 1.218 throw PEGASUS_CIM_EXCEPTION_L(
4505 CIM_ERR_INVALID_PARAMETER,
4506 MessageLoaderParms(
4507 _MSG_INVALID_VALUE_FOR_PROPERTY_KEY,
|
4508 kumpf 1.240 _MSG_INVALID_VALUE_FOR_PROPERTY,
|
4509 kumpf 1.218 origFilterPath.toString(),
4510 PEGASUS_PROPERTYNAME_FILTER.getString()));
|
4511 carolann.graves 1.179 }
4512 }
|
4513 marek 1.280 // Set SystemName key property to empty
4514 try
4515 {
4516 IndicationService::_setSystemNameInHandlerFilter(
4517 filterPath,
4518 String::EMPTY);
4519 filterValue.set(filterPath);
4520 filterProperty.setValue(filterValue);
4521 }
4522 catch(Exception &)
4523 {
4524 PEG_METHOD_EXIT();
4525 throw PEGASUS_CIM_EXCEPTION_L(
4526 CIM_ERR_INVALID_PARAMETER,
4527 MessageLoaderParms(
4528 _MSG_INVALID_VALUE_FOR_PROPERTY_KEY,
4529 _MSG_INVALID_VALUE_FOR_PROPERTY,
4530 origFilterPath.toString(),
4531 PEGASUS_PROPERTYNAME_FILTER.getString()));
4532 }
|
4533 carolann.graves 1.179
4534 CIMObjectPath origHandlerPath = handlerPath;
4535 if (handlerPath.getHost () != String::EMPTY)
4536 {
|
4537 marek 1.209 if (!System::isLocalHost (handlerPath.getHost()))
|
4538 carolann.graves 1.179 {
4539 //
4540 // Reject subscription creation
4541 //
|
4542 kumpf 1.240 PEG_METHOD_EXIT();
|
4543 kumpf 1.218 throw PEGASUS_CIM_EXCEPTION_L(
4544 CIM_ERR_INVALID_PARAMETER,
4545 MessageLoaderParms(
4546 _MSG_INVALID_VALUE_FOR_PROPERTY_KEY,
|
4547 kumpf 1.240 _MSG_INVALID_VALUE_FOR_PROPERTY,
|
4548 kumpf 1.218 origHandlerPath.toString(),
4549 PEGASUS_PROPERTYNAME_HANDLER.getString()));
|
4550 carolann.graves 1.179 }
4551 }
|
4552 marek 1.280 // Set SystemName key property to empty
4553 try
4554 {
4555 IndicationService::_setSystemNameInHandlerFilter(
4556 handlerPath,
4557 String::EMPTY);
4558 handlerValue.set(handlerPath);
4559 handlerProperty.setValue(handlerValue);
4560 }
4561 catch(Exception &)
4562 {
4563 PEG_METHOD_EXIT();
4564 throw PEGASUS_CIM_EXCEPTION_L(
4565 CIM_ERR_INVALID_PARAMETER,
4566 MessageLoaderParms(
4567 _MSG_INVALID_VALUE_FOR_PROPERTY_KEY,
4568 _MSG_INVALID_VALUE_FOR_PROPERTY,
4569 origHandlerPath.toString(),
4570 PEGASUS_PROPERTYNAME_HANDLER.getString()));
4571 }
|
4572 carolann.graves 1.179
4573 //
|
4574 carolann.graves 1.205 // Get Filter namespace - if not set in Filter reference property
4575 // value, namespace is the namespace of the subscription
4576 //
4577 CIMNamespaceName filterNS = filterPath.getNameSpace ();
4578 if (filterNS.isNull ())
4579 {
4580 filterNS = nameSpace;
4581 }
4582
4583 //
4584 // Get Handler namespace - if not set in Handler reference property
4585 // value, namespace is the namespace of the subscription
4586 //
|
4587 kumpf 1.218 CIMNamespaceName handlerNS = handlerPath.getNameSpace();
4588 if (handlerNS.isNull())
|
4589 carolann.graves 1.205 {
4590 handlerNS = nameSpace;
4591 }
4592
4593 //
4594 // Validate the Filter and Handler reference properties
4595 // Ensure Filter and Handler instances can be retrieved from the
4596 // repository
4597 //
4598 CIMInstance filterInstance =
|
4599 kumpf 1.218 _subscriptionRepository->getInstance(filterNS, filterPath,
|
4600 kumpf 1.254 false, false, CIMPropertyList());
|
4601 carolann.graves 1.205
4602 CIMInstance handlerInstance =
|
4603 kumpf 1.218 _subscriptionRepository->getInstance(handlerNS, handlerPath,
|
4604 kumpf 1.254 false, false, CIMPropertyList());
|
4605 carolann.graves 1.205
4606 //
|
4607 kumpf 1.108 // Set the key bindings in the subscription instance
4608 //
|
4609 kumpf 1.218 Array<CIMKeyBinding> kb;
4610 kb.append(CIMKeyBinding(PEGASUS_PROPERTYNAME_FILTER, filterValue));
4611 kb.append(CIMKeyBinding(PEGASUS_PROPERTYNAME_HANDLER, handlerValue));
|
4612 kumpf 1.108
4613 CIMObjectPath instanceRef = instance.getPath ();
|
4614 kumpf 1.218 instanceRef.setKeyBindings(kb);
4615 instanceRef.setNameSpace(nameSpace);
4616 instance.setPath(instanceRef);
|
4617 kumpf 1.108
4618 //
4619 // Subscription State, Repeat Notification Policy, and On Fatal Error
|
4620 dj.gorey 1.135 // Policy properties each has a default value, a corresponding
|
4621 kumpf 1.34 // Other___ property, and a set of valid values
4622 //
|
4623 kumpf 1.218 _checkPropertyWithOther(
4624 instance,
4625 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE,
4626 _PROPERTY_OTHERSTATE,
4627 (Uint16) STATE_ENABLED,
4628 (Uint16) STATE_OTHER,
4629 _supportedStates);
4630
4631 _checkPropertyWithOther(
4632 instance,
4633 _PROPERTY_REPEATNOTIFICATIONPOLICY,
4634 _PROPERTY_OTHERREPEATNOTIFICATIONPOLICY,
4635 (Uint16) _POLICY_NONE,
4636 (Uint16) _POLICY_OTHER,
|
4637 kumpf 1.115 _supportedRepeatPolicies);
|
4638 kumpf 1.22
|
4639 kumpf 1.218 _checkPropertyWithOther(
4640 instance,
4641 _PROPERTY_ONFATALERRORPOLICY,
4642 _PROPERTY_OTHERONFATALERRORPOLICY,
4643 (Uint16) _ERRORPOLICY_IGNORE,
4644 (Uint16) _ERRORPOLICY_OTHER,
|
4645 kumpf 1.115 _supportedErrorPolicies);
|
4646 kumpf 1.116
|
4647 kumpf 1.218 if (instance.getClassName().equal(
|
4648 carolann.graves 1.186 PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))
4649 {
4650 Array<String> textFormatParams;
4651 CIMValue textFormatParamsValue;
4652 CIMClass indicationClass;
4653
4654 // get TextFormatParameters from instance
4655 Uint32 textFormatParamsPos =
4656 instance.findProperty(_PROPERTY_TEXTFORMATPARAMETERS);
|
4657 yi.zhou 1.157
4658 if (textFormatParamsPos != PEG_NOT_FOUND)
|
4659 carolann.graves 1.186 {
4660 textFormatParamsValue = instance.getProperty(
4661 textFormatParamsPos).getValue();
|
4662 yi.zhou 1.157
4663 if (!textFormatParamsValue.isNull())
|
4664 carolann.graves 1.186 {
4665 textFormatParamsValue.get(textFormatParams);
4666 }
4667 }
|
4668 yi.zhou 1.157
|
4669 carolann.graves 1.186 // get indication class
4670 indicationClass = _getIndicationClass (instance);
|
4671 yi.zhou 1.157
4672 String textFormatStr;
4673 CIMValue textFormatValue;
4674
4675 // get TextFormatStr from instance
4676 Uint32 textFormatPos =
|
4677 chip 1.162 instance.findProperty(_PROPERTY_TEXTFORMAT);
|
4678 yi.zhou 1.157
4679 if (textFormatPos != PEG_NOT_FOUND)
4680 {
4681 textFormatValue = instance.getProperty(
|
4682 carolann.graves 1.186 textFormatPos).getValue();
|
4683 yi.zhou 1.157
|
4684 yi.zhou 1.161 #if defined(PEGASUS_ENABLE_SYSTEM_LOG_HANDLER) || \
4685 defined(PEGASUS_ENABLE_EMAIL_HANDLER)
|
4686 carolann.graves 1.186 // if the value of textFormat is not null
|
4687 yi.zhou 1.157 if (!(textFormatValue.isNull()) &&
|
4688 carolann.graves 1.186 (textFormatValue.getType() == CIMTYPE_STRING) &&
4689 !(textFormatValue.isArray()))
4690 {
4691 textFormatValue.get(textFormatStr);
|
4692 yi.zhou 1.157
|
4693 carolann.graves 1.186 // Validates the syntax and the provided type for the
4694 // property TextFormat
4695 IndicationFormatter::validateTextFormat (
4696 textFormatStr, indicationClass,
4697 textFormatParams);
|
4698 chip 1.162
|
4699 carolann.graves 1.186 // Validates the property names in TextFormatParameters
|
4700 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
4701 yi.zhou 1.157 String query;
|
4702 carolann.graves 1.186 String queryLanguage;
|
4703 w.otsuka 1.217 String filterName;
|
4704 carolann.graves 1.186 CIMPropertyList propertyList;
|
4705 yi.zhou 1.157
|
4706 carolann.graves 1.186 // Get filter properties
4707 _subscriptionRepository->getFilterProperties (instance,
|
4708 venkat.puvvada 1.275 query, sourceNamespaces, queryLanguage, filterName);
|
4709 yi.zhou 1.157
4710 // Build the query expression from the filter query
|
4711 carolann.graves 1.186 QueryExpression queryExpression = _getQueryExpression(query,
|
4712 venkat.puvvada 1.275 queryLanguage, sourceNamespaces[0]);
|
4713 chip 1.162
|
4714 carolann.graves 1.186 // the select clause projection
4715 propertyList = queryExpression.getPropertyList();
|
4716 chip 1.162
|
4717 carolann.graves 1.186 IndicationFormatter::validateTextFormatParameters(
4718 propertyList, indicationClass, textFormatParams);
4719 }
|
4720 yi.zhou 1.159 #endif
|
4721 yi.zhou 1.157 }
|
4722 carolann.graves 1.186 }
|
4723 dj.gorey 1.135 }
|
4724 kumpf 1.11 else // Filter or Handler
4725 {
|
4726 kumpf 1.1 //
|
4727 kumpf 1.11 // Name, CreationClassName, SystemName, and SystemCreationClassName
|
4728 dj.gorey 1.135 // are key properties for Filter and Handler
|
4729 carolann.graves 1.146 // Name must exist
|
4730 kumpf 1.11 // If others do not exist, add and set to default
|
4731 carolann.graves 1.146 // If they exist but are NULL, set value to the default
4732 // If they exist and are not NULL, validate the value
|
4733 kumpf 1.1 //
|
4734 venkat.puvvada 1.260
4735 if (instance.getClassName ().equal (PEGASUS_CLASSNAME_INDFILTER))
4736 {
4737 _checkRequiredProperty(
4738 instance,
4739 PEGASUS_PROPERTYNAME_NAME,
4740 CIMTYPE_STRING,
4741 true);
4742 }
4743 else
4744 {
4745 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
4746 // Name is an optional property for Handler. If Name key property
4747 // not found then set the Name value using GUID.
4748 _checkPropertyWithGuid(
4749 instance,
4750 PEGASUS_PROPERTYNAME_NAME);
4751 #else
4752 _checkRequiredProperty(
4753 instance,
4754 PEGASUS_PROPERTYNAME_NAME,
4755 venkat.puvvada 1.260 CIMTYPE_STRING,
4756 true);
4757 #endif
4758 }
|
4759 kumpf 1.1
|
4760 kumpf 1.218 _initOrValidateStringProperty(
4761 instance,
4762 PEGASUS_PROPERTYNAME_CREATIONCLASSNAME,
4763 instance.getClassName().getString());
|
4764 marek 1.280
4765 _setOrAddSystemNameInHandlerFilter(instance,String::EMPTY);
4766
|
4767 kumpf 1.218 _initOrValidateStringProperty(
4768 instance,
|
4769 carolann.graves 1.146 _PROPERTY_SYSTEMCREATIONCLASSNAME,
|
4770 kumpf 1.218 System::getSystemCreationClassName());
|
4771 kumpf 1.1
|
4772 kumpf 1.64 if (instance.getClassName ().equal (PEGASUS_CLASSNAME_INDFILTER))
|
4773 kumpf 1.10 {
4774 //
|
4775 kumpf 1.11 // Query and QueryLanguage properties are required for Filter
|
4776 kumpf 1.10 //
|
4777 kumpf 1.218 _checkRequiredProperty(
4778 instance,
4779 PEGASUS_PROPERTYNAME_QUERY,
4780 CIMTYPE_STRING,
|
4781 kumpf 1.240 false);
|
4782 kumpf 1.218 _checkRequiredProperty(
4783 instance,
4784 PEGASUS_PROPERTYNAME_QUERYLANGUAGE,
4785 CIMTYPE_STRING,
|
4786 kumpf 1.240 false);
|
4787 kumpf 1.1
|
4788 kumpf 1.10 //
|
4789 kumpf 1.102 // Validate the query language is supported
4790 //
4791 String queryLanguage;
|
4792 kumpf 1.218 instance.getProperty(
4793 instance.findProperty(PEGASUS_PROPERTYNAME_QUERYLANGUAGE)).
4794 getValue().get(queryLanguage);
|
4795 chuck 1.149
|
4796 karl 1.228 #ifndef PEGASUS_ENABLE_CQL
|
4797 chuck 1.149 // Special code to block CQL, if CQL is disabled
|
4798 kumpf 1.252 if ((queryLanguage == "CIM:CQL") || (queryLanguage == "DMTF:CQL"))
|
4799 chuck 1.149 {
|
4800 kumpf 1.218 // CQL is not allowed in this case
4801 PEG_METHOD_EXIT();
4802 throw PEGASUS_CIM_EXCEPTION(
4803 CIM_ERR_NOT_SUPPORTED, queryLanguage);
|
4804 kumpf 1.102 }
|
4805 chuck 1.149 #endif
|
4806 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
4807
4808 _checkProperty(
4809 instance,
4810 _PROPERTY_SOURCENAMESPACE,
4811 CIMTYPE_STRING);
|
4812 kumpf 1.102
|
4813 venkat.puvvada 1.275 _checkProperty(
4814 instance,
4815 _PROPERTY_SOURCENAMESPACES,
4816 CIMTYPE_STRING,
4817 true);
4818
4819 _subscriptionRepository->getSourceNamespaces(
4820 instance,
4821 nameSpace,
4822 sourceNamespaces);
4823
4824 if (sourceNamespaces.size() == 1 &&
4825 nameSpace == sourceNamespaces[0])
4826 {
|
4827 kumpf 1.218 _checkPropertyWithDefault(
4828 instance,
4829 _PROPERTY_SOURCENAMESPACE,
|
4830 venkat.puvvada 1.275 nameSpace.getString());
4831 }
|
4832 kumpf 1.15
4833 //
4834 // Validate the query and indication class name
4835 // An exception is thrown if the query is invalid or the class
4836 // is not an indication class
4837 //
4838 String filterQuery = instance.getProperty (instance.findProperty
|
4839 w.otsuka 1.207 (PEGASUS_PROPERTYNAME_QUERY)).getValue ().toString ();
|
4840 chuck 1.149
|
4841 venkat.puvvada 1.275 for (Uint32 i = 0, n = sourceNamespaces.size(); i < n; ++i)
|
4842 chuck 1.149 {
|
4843 venkat.puvvada 1.275 QueryExpression queryExpression;
4844 try
4845 {
4846 queryExpression = _getQueryExpression(
4847 filterQuery,
4848 queryLanguage,
4849 sourceNamespaces[i]);
4850 }
4851 catch (QueryLanguageInvalidException&)
4852 {
4853 // The filter query had an invalid language name.
4854 PEG_METHOD_EXIT();
4855 throw PEGASUS_CIM_EXCEPTION(
4856 CIM_ERR_NOT_SUPPORTED, queryLanguage);
4857 }
|
4858 chuck 1.149
|
4859 venkat.puvvada 1.275 CIMName indicationClassName = _getIndicationClassName(
4860 queryExpression,
4861 sourceNamespaces[i]);
|
4862 kumpf 1.117
|
4863 venkat.puvvada 1.275 //
4864 // Make sure that the FROM class exists in the repository.
4865 //
4866 CIMClass indicationClass = _subscriptionRepository->getClass(
4867 sourceNamespaces[i],
4868 indicationClassName,
4869 false,
4870 false,
4871 false,
4872 CIMPropertyList ());
|
4873 kumpf 1.117
|
4874 venkat.puvvada 1.275 //
4875 // Validate all the properties in the SELECT statement exist
4876 // on their class context.
4877 //
4878 try
4879 {
4880 queryExpression.validate();
4881 }
4882 catch (QueryMissingPropertyException& qmp)
4883 {
4884 // A property does not exist on the class it is scoped to.
4885 PEG_METHOD_EXIT();
4886 throw PEGASUS_CIM_EXCEPTION(
4887 CIM_ERR_INVALID_PARAMETER,
4888 qmp.getMessage());
4889 }
4890 catch (QueryValidationException& qv)
4891 {
4892 // Received some other validation error.
4893 // This includes detecting an array property
4894 // is in the WHERE list for WQL.
4895 venkat.puvvada 1.275 PEG_METHOD_EXIT();
4896 throw PEGASUS_CIM_EXCEPTION(
4897 CIM_ERR_NOT_SUPPORTED,
4898 qv.getMessage());
4899 }
|
4900 kumpf 1.117 }
|
4901 kumpf 1.11 }
|
4902 kumpf 1.10
|
4903 kumpf 1.11 //
|
4904 anusha.kandepu 1.281 // Currently only six subclasses of the Listener Destination
|
4905 dj.gorey 1.135 // class are supported -- further subclassing is not currently
|
4906 kumpf 1.11 // supported
4907 //
|
4908 dj.gorey 1.135 else if ((instance.getClassName ().equal
|
4909 kumpf 1.64 (PEGASUS_CLASSNAME_INDHANDLER_CIMXML)) ||
|
4910 dj.gorey 1.135 (instance.getClassName ().equal
|
4911 tony 1.103 (PEGASUS_CLASSNAME_LSTNRDST_CIMXML)) ||
|
4912 chip 1.162 (instance.getClassName ().equal
4913 (PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG)) ||
4914 (instance.getClassName ().equal
4915 (PEGASUS_CLASSNAME_LSTNRDST_EMAIL)) ||
|
4916 kumpf 1.64 (instance.getClassName ().equal
|
4917 anusha.kandepu 1.281 (PEGASUS_CLASSNAME_INDHANDLER_SNMP)) ||
4918 (instance.getClassName ().equal
4919 (PEGASUS_CLASSNAME_INDHANDLER_WSMAN)))
|
4920 kumpf 1.11 {
|
4921 yi.zhou 1.161 #ifndef PEGASUS_ENABLE_SYSTEM_LOG_HANDLER
4922 if (instance.getClassName ().equal
|
4923 chip 1.162 (PEGASUS_CLASSNAME_LSTNRDST_SYSTEM_LOG))
|
4924 yi.zhou 1.161 {
4925 //
|
4926 carolann.graves 1.170 // The System Log Handler is not enabled currently,
|
4927 yi.zhou 1.161 // this class is not currently served by the Indication Service
4928 //
4929 PEG_METHOD_EXIT ();
4930
4931 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
|
4932 chip 1.162 MessageLoaderParms(_MSG_CLASS_NOT_SERVED_KEY,
4933 _MSG_CLASS_NOT_SERVED));
4934 }
|
4935 yi.zhou 1.161 #endif
4936
4937 #if !defined(PEGASUS_ENABLE_EMAIL_HANDLER)
4938
4939 if (instance.getClassName ().equal
|
4940 chip 1.162 (PEGASUS_CLASSNAME_LSTNRDST_EMAIL))
|
4941 yi.zhou 1.161 {
4942 //
|
4943 carolann.graves 1.170 // The Email Handler is not enabled currently,
|
4944 yi.zhou 1.161 // this class is not currently served by the Indication Service
4945 //
4946 PEG_METHOD_EXIT ();
4947
4948 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
|
4949 chip 1.162 MessageLoaderParms(_MSG_CLASS_NOT_SERVED_KEY,
4950 _MSG_CLASS_NOT_SERVED));
4951 }
|
4952 yi.zhou 1.161 #endif
|
4953 anusha.kandepu 1.281
4954 #ifndef PEGASUS_ENABLE_PROTOCOL_WSMAN
4955 if (instance.getClassName ().equal
4956 (PEGASUS_CLASSNAME_INDHANDLER_WSMAN))
4957 {
4958 //
4959 // The WSMAN Handler is not enabled currently,
4960 // this class is not currently served by the Indication Service
4961 //
4962 PEG_METHOD_EXIT ();
4963
4964 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
4965 MessageLoaderParms(_MSG_CLASS_NOT_SERVED_KEY,
4966 _MSG_CLASS_NOT_SERVED));
4967 }
4968 #endif
|
4969 kumpf 1.218 _checkPropertyWithOther(
4970 instance,
4971 PEGASUS_PROPERTYNAME_PERSISTENCETYPE,
4972 _PROPERTY_OTHERPERSISTENCETYPE,
4973 (Uint16) PERSISTENCE_PERMANENT,
4974 (Uint16) PERSISTENCE_OTHER,
|
4975 kumpf 1.115 _supportedPersistenceTypes);
|
4976 kumpf 1.11
|
4977 kumpf 1.218 if (instance.getClassName().equal(
4978 PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
4979 instance.getClassName().equal(
|
4980 anusha.kandepu 1.281 PEGASUS_CLASSNAME_LSTNRDST_CIMXML) ||
4981 instance.getClassName ().equal(
4982 PEGASUS_CLASSNAME_INDHANDLER_WSMAN))
|
4983 kumpf 1.11 {
|
4984 kumpf 1.13 //
|
4985 dj.gorey 1.135 // Destination property is required for CIMXML
|
4986 kumpf 1.13 // Handler subclass
4987 //
|
4988 kumpf 1.218 _checkRequiredProperty(
4989 instance,
4990 PEGASUS_PROPERTYNAME_LSTNRDST_DESTINATION,
4991 CIMTYPE_STRING,
|
4992 kumpf 1.240 false);
|
4993 kumpf 1.11 }
|
4994 anusha.kandepu 1.281
4995 // WSMAN Indication Handler properties are checked below
4996 if (instance.getClassName().equal
4997 (PEGASUS_CLASSNAME_INDHANDLER_WSMAN))
4998 {
4999 // Delivery Mode property is required for WSMAN Handler
5000 _checkRequiredProperty(
5001 instance,
5002 PEGASUS_PROPERTYNAME_WSM_DELIVERY_MODE,
5003 CIMTYPE_UINT16,
5004 false);
5005 }
|
5006 kumpf 1.11
|
5007 kumpf 1.218 if (instance.getClassName().equal
|
5008 kumpf 1.64 (PEGASUS_CLASSNAME_INDHANDLER_SNMP))
|
5009 kumpf 1.11 {
|
5010 kumpf 1.137 //
|
5011 kumpf 1.74 // TargetHost property is required for SNMP
5012 // Handler subclass
5013 //
|
5014 kumpf 1.218 _checkRequiredProperty(
5015 instance,
5016 PEGASUS_PROPERTYNAME_LSTNRDST_TARGETHOST,
5017 CIMTYPE_STRING,
|
5018 kumpf 1.240 false);
|
5019 kumpf 1.74
|
5020 kumpf 1.11 //
|
5021 kumpf 1.74 // TargetHostFormat property is required for SNMP
|
5022 kumpf 1.13 // Handler subclass
5023 //
|
5024 kumpf 1.218 _checkRequiredProperty(
5025 instance,
5026 _PROPERTY_TARGETHOSTFORMAT,
5027 CIMTYPE_UINT16,
|
5028 kumpf 1.240 false);
|
5029 kumpf 1.13
5030 //
|
5031 kumpf 1.74 // SNMPVersion property is required for SNMP Handler
|
5032 kumpf 1.11 //
|
5033 kumpf 1.218 _checkRequiredProperty(
5034 instance,
5035 PEGASUS_PROPERTYNAME_SNMPVERSION,
5036 CIMTYPE_UINT16,
|
5037 kumpf 1.240 false);
|
5038 kumpf 1.218
|
5039 yi.zhou 1.193 // Currently, only SNMPv1 trap and SNMPv2C trap are supported,
5040 // verify if the value of SNMPVersion is one of them
5041
|
5042 kumpf 1.218 _checkValue(
5043 instance,
5044 PEGASUS_PROPERTYNAME_SNMPVERSION,
5045 _supportedSNMPVersion);
|
5046 kumpf 1.11 }
|
5047 yi.zhou 1.160
|
5048 kumpf 1.218 if (instance.getClassName().equal
|
5049 yi.zhou 1.160 (PEGASUS_CLASSNAME_LSTNRDST_EMAIL))
5050 {
5051 //
5052 // MailTo property is required for Email
5053 // Handler subclass
5054 //
|
5055 kumpf 1.218 _checkRequiredProperty(
5056 instance,
5057 PEGASUS_PROPERTYNAME_LSTNRDST_MAILTO,
5058 CIMTYPE_STRING,
|
5059 kumpf 1.240 false,
|
5060 kumpf 1.218 true);
|
5061 yi.zhou 1.160
|
5062 kumpf 1.218 // get MailTo from handler instance
|
5063 yi.zhou 1.161 Array<String> mailTo;
|
5064 kumpf 1.218 instance.getProperty(instance.findProperty(
5065 PEGASUS_PROPERTYNAME_LSTNRDST_MAILTO)).getValue().get(
5066 mailTo);
|
5067 yi.zhou 1.160
|
5068 kumpf 1.218 // Build mail address string
5069 String mailAddrStr;
5070 Uint32 mailAddrSize = mailTo.size();
|
5071 chip 1.162
|
5072 kumpf 1.218 for (Uint32 i=0; i < mailAddrSize; i++)
5073 {
5074 mailAddrStr.append(mailTo[i]);
|
5075 chip 1.162
|
5076 kumpf 1.218 if (i < (mailAddrSize - 1))
5077 {
5078 mailAddrStr.append(",");
5079 }
5080 }
|
5081 chip 1.162
5082
|
5083 kumpf 1.218 //
5084 // Email address can not be an empty string
5085 //
5086 if (mailAddrStr == String::EMPTY)
5087 {
5088 PEG_METHOD_EXIT();
5089 throw PEGASUS_CIM_EXCEPTION_L(
5090 CIM_ERR_FAILED,
5091 MessageLoaderParms(
5092 "IndicationService.IndicationService."
5093 "_MSG_DO_NOT_HAVE_EMAIL_ADDRESS",
5094 "Do not have an e-mail address."));
5095 }
|
5096 yi.zhou 1.160
5097 //
5098 // MailSubject property is required for Email
5099 // Handler subclass
5100 //
|
5101 kumpf 1.218 _checkRequiredProperty(
5102 instance,
5103 PEGASUS_PROPERTYNAME_LSTNRDST_MAILSUBJECT,
5104 CIMTYPE_STRING,
|
5105 kumpf 1.240 false);
|
5106 yi.zhou 1.160 }
|
5107 kumpf 1.11 }
5108 else
5109 {
5110 //
5111 // A class not currently served by the Indication Service
5112 //
|
5113 kumpf 1.218 PEG_METHOD_EXIT();
|
5114 humberto 1.78
|
5115 kumpf 1.218 throw PEGASUS_CIM_EXCEPTION_L(
5116 CIM_ERR_NOT_SUPPORTED,
5117 MessageLoaderParms(
5118 _MSG_CLASS_NOT_SERVED_KEY,
5119 _MSG_CLASS_NOT_SERVED));
|
5120 kumpf 1.11 }
|
5121 kumpf 1.1 }
5122
|
5123 kumpf 1.218 PEG_METHOD_EXIT();
|
5124 kumpf 1.11 return true;
|
5125 kumpf 1.22 }
5126
|
5127 kumpf 1.218 void IndicationService::_checkRequiredProperty(
5128 CIMInstance& instance,
5129 const CIMName& propertyName,
|
5130 kumpf 1.116 const CIMType expectedType,
|
5131 kumpf 1.240 Boolean isKeyProperty,
5132 Boolean isArray)
|
5133 kumpf 1.34 {
|
5134 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
5135 kumpf 1.114 "IndicationService::_checkRequiredProperty");
|
5136 kumpf 1.34
5137 Boolean missingProperty = false;
5138
5139 //
5140 // Required property must exist in instance
5141 //
|
5142 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
5143 kumpf 1.34 {
5144 missingProperty = true;
5145 }
5146 else
5147 {
5148 //
5149 // Get the property
5150 //
5151 CIMProperty theProperty = instance.getProperty
5152 (instance.findProperty (propertyName));
5153 CIMValue theValue = theProperty.getValue ();
5154
5155 //
5156 // Required property must have a non-null value
5157 //
5158 if (theValue.isNull ())
5159 {
5160 missingProperty = true;
5161 }
|
5162 kumpf 1.116 else
5163 {
5164 //
5165 // Check that the property value is of the correct type
5166 //
|
5167 david.dillard 1.174 if ((theValue.getType () != expectedType) ||
|
5168 carolann.graves 1.179 (theValue.isArray () != isArray))
|
5169 kumpf 1.116 {
5170 if (theValue.isArray ())
5171 {
|
5172 kumpf 1.240 PEG_METHOD_EXIT();
5173 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER,
5174 MessageLoaderParms(
5175 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY_KEY,
5176 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY,
5177 cimTypeToString(theValue.getType()),
5178 propertyName.getString()));
|
5179 kumpf 1.116 }
5180 else
5181 {
|
5182 kumpf 1.240 PEG_METHOD_EXIT();
5183 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_INVALID_PARAMETER,
5184 MessageLoaderParms(
5185 _MSG_INVALID_TYPE_FOR_PROPERTY_KEY,
5186 _MSG_INVALID_TYPE_FOR_PROPERTY,
5187 cimTypeToString(theValue.getType()),
5188 propertyName.getString()));
|
5189 kumpf 1.116 }
5190 }
5191 }
|
5192 kumpf 1.34 }
5193
5194 if (missingProperty)
5195 {
|
5196 kumpf 1.240 if (isKeyProperty)
|
5197 kumpf 1.116 {
|
5198 kumpf 1.240 PEG_METHOD_EXIT();
5199 throw PEGASUS_CIM_EXCEPTION_L(
5200 CIM_ERR_INVALID_PARAMETER,
5201 MessageLoaderParms(
|
5202 kumpf 1.243 "IndicationService.IndicationService._MSG_KEY_PROPERTY",
5203 "The key property $0 is missing.",
|
5204 kumpf 1.240 propertyName.getString()));
|
5205 dj.gorey 1.135 }
5206 else
|
5207 kumpf 1.116 {
|
5208 kumpf 1.240 PEG_METHOD_EXIT();
5209 throw PEGASUS_CIM_EXCEPTION_L(
5210 CIM_ERR_INVALID_PARAMETER,
5211 MessageLoaderParms(
5212 _MSG_PROPERTY_KEY,
5213 _MSG_PROPERTY,
5214 propertyName.getString()));
|
5215 kumpf 1.116 }
|
5216 kumpf 1.240 }
|
5217 kumpf 1.116
|
5218 kumpf 1.48 PEG_METHOD_EXIT ();
|
5219 kumpf 1.34 }
5220
5221 void IndicationService::_checkPropertyWithOther (
|
5222 kumpf 1.218 CIMInstance& instance,
5223 const CIMName& propertyName,
5224 const CIMName& otherPropertyName,
|
5225 kumpf 1.22 const Uint16 defaultValue,
|
5226 kumpf 1.32 const Uint16 otherValue,
|
5227 kumpf 1.218 const Array<Uint16>& supportedValues)
|
5228 kumpf 1.22 {
|
5229 kumpf 1.114 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5230 "IndicationService::_checkPropertyWithOther");
5231
|
5232 kumpf 1.22 Uint16 result = defaultValue;
5233
5234 //
5235 // If the property doesn't exist, add it with the default value
5236 //
|
5237 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
5238 kumpf 1.22 {
5239 instance.addProperty (CIMProperty (propertyName,
5240 CIMValue (defaultValue)));
5241 }
5242 else
5243 {
5244 //
5245 // Get the property
5246 //
5247 CIMProperty theProperty = instance.getProperty
5248 (instance.findProperty (propertyName));
5249 CIMValue theValue = theProperty.getValue ();
5250
5251 //
|
5252 dj.gorey 1.135 // Check that the value is of the correct type
|
5253 kumpf 1.80 //
5254 if ((theValue.getType () != CIMTYPE_UINT16) || (theValue.isArray ()))
5255 {
|
5256 kumpf 1.137 String exceptionStr;
|
5257 kumpf 1.80 if (theValue.isArray ())
5258 {
|
5259 kumpf 1.115 MessageLoaderParms parms(
|
5260 kumpf 1.218 "IndicationService.IndicationService."
5261 "_MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY",
5262 "Invalid type array of $0 for property $1",
5263 cimTypeToString(theValue.getType()),
5264 propertyName.getString());
|
5265 dj.gorey 1.135
|
5266 kumpf 1.115 exceptionStr.append(MessageLoader::getMessage(parms));
|
5267 humberto 1.82 }
|
5268 kumpf 1.115 else
5269 {
|
5270 kumpf 1.137 MessageLoaderParms parms(
|
5271 kumpf 1.218 "IndicationService.IndicationService."
5272 "_MSG_INVALID_TYPE_FOR_PROPERTY",
5273 "Invalid type $0 for property $1",
5274 cimTypeToString(theValue.getType()),
5275 propertyName.getString());
|
5276 dj.gorey 1.135
|
5277 kumpf 1.115 exceptionStr.append(MessageLoader::getMessage(parms));
|
5278 kumpf 1.80 }
5279 PEG_METHOD_EXIT ();
5280 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
5281 exceptionStr);
5282 }
5283
5284 //
|
5285 kumpf 1.22 // If the value is null, set to the default value
5286 //
5287 if (theValue.isNull ())
5288 {
5289 theProperty.setValue (CIMValue (defaultValue));
5290 }
5291 else
5292 {
5293 theValue.get (result);
|
5294 kumpf 1.115 //
5295 // Check for valid values that are not supported
5296 //
5297 // Note: Supported values are a subset of the valid values
|
5298 dj.gorey 1.135 // Some valid values, as defined in the MOF, are not currently
|
5299 kumpf 1.115 // supported by the Pegasus IndicationService
5300 //
|
5301 kumpf 1.218 if (!Contains(supportedValues, result))
|
5302 kumpf 1.115 {
|
5303 kumpf 1.218 PEG_METHOD_EXIT();
5304 throw PEGASUS_CIM_EXCEPTION_L(
5305 CIM_ERR_NOT_SUPPORTED,
5306 MessageLoaderParms(
5307 _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY_KEY,
|
5308 kumpf 1.240 _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY,
|
5309 kumpf 1.218 theValue.toString(),
5310 propertyName.getString()));
|
5311 kumpf 1.32 }
|
5312 kumpf 1.22 }
5313
5314 //
5315 // If the value is Other, the Other
|
5316 kumpf 1.116 // property must exist, value must not be NULL and type must be String
|
5317 kumpf 1.22 //
5318 if (result == otherValue)
5319 {
|
5320 kumpf 1.218 if (instance.findProperty(otherPropertyName) == PEG_NOT_FOUND)
|
5321 kumpf 1.22 {
|
5322 kumpf 1.218 PEG_METHOD_EXIT();
5323 throw PEGASUS_CIM_EXCEPTION_L(
5324 CIM_ERR_INVALID_PARAMETER,
5325 MessageLoaderParms(
5326 _MSG_PROPERTY_KEY,
|
5327 kumpf 1.240 _MSG_PROPERTY,
|
5328 kumpf 1.218 otherPropertyName.getString()));
|
5329 kumpf 1.22 }
5330 else
5331 {
5332 CIMProperty otherProperty = instance.getProperty
|
5333 kumpf 1.218 (instance.findProperty(otherPropertyName));
5334 CIMValue theOtherValue = otherProperty.getValue();
5335 if (theOtherValue.isNull())
|
5336 kumpf 1.22 {
|
5337 kumpf 1.218 PEG_METHOD_EXIT();
5338 throw PEGASUS_CIM_EXCEPTION_L(
5339 CIM_ERR_INVALID_PARAMETER,
5340 MessageLoaderParms(
5341 _MSG_PROPERTY_KEY,
|
5342 kumpf 1.240 _MSG_PROPERTY,
|
5343 kumpf 1.218 otherPropertyName.getString()));
|
5344 kumpf 1.22 }
|
5345 kumpf 1.218 else if (theOtherValue.getType() != CIMTYPE_STRING)
|
5346 kumpf 1.116 {
5347 //
|
5348 dj.gorey 1.135 // Property exists and is not null,
|
5349 kumpf 1.116 // but is not of correct type
5350 //
|
5351 kumpf 1.240 PEG_METHOD_EXIT();
|
5352 kumpf 1.218 throw PEGASUS_CIM_EXCEPTION_L(
5353 CIM_ERR_INVALID_PARAMETER,
5354 MessageLoaderParms(
5355 _MSG_INVALID_TYPE_FOR_PROPERTY_KEY,
|
5356 kumpf 1.240 _MSG_INVALID_TYPE_FOR_PROPERTY,
|
5357 kumpf 1.218 cimTypeToString(theOtherValue.getType()),
5358 otherPropertyName.getString()));
|
5359 kumpf 1.116 }
|
5360 kumpf 1.22 }
5361 }
5362
5363 //
5364 // If value is not Other, Other property must not exist
5365 // or must be NULL
5366 //
|
5367 kumpf 1.52 else if (instance.findProperty (otherPropertyName) != PEG_NOT_FOUND)
|
5368 kumpf 1.22 {
|
5369 kumpf 1.218 CIMProperty otherProperty = instance.getProperty(
5370 instance.findProperty(otherPropertyName));
5371 CIMValue theOtherValue = otherProperty.getValue();
5372 if (!theOtherValue.isNull())
5373 {
5374 PEG_METHOD_EXIT();
5375 throw PEGASUS_CIM_EXCEPTION_L(
5376 CIM_ERR_INVALID_PARAMETER,
5377 MessageLoaderParms(
|
5378 kumpf 1.243 "IndicationService.IndicationService."
5379 "_MSG_PROPERTY_PRESENT_BUT_VALUE_NOT",
5380 "The $0 property is present, but the $1 value is "
5381 "not $2.",
|
5382 kumpf 1.218 otherPropertyName.getString(),
5383 propertyName.getString(),
5384 CIMValue(otherValue).toString()));
|
5385 kumpf 1.22 }
5386 }
5387 }
5388
|
5389 kumpf 1.218 PEG_METHOD_EXIT();
|
5390 kumpf 1.1 }
5391
|
5392 venkat.puvvada 1.260 String IndicationService::_checkPropertyWithGuid(
5393 CIMInstance& instance,
5394 const CIMName& propertyName)
5395 {
5396 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
5397 "IndicationService::_checkPropertyWithGuid");
5398
5399 String value = _checkPropertyWithDefault(
5400 instance,
5401 propertyName,
5402 Guid::getGuid(PEGASUS_INSTANCEID_GLOBAL_PREFIX));
5403
5404 PEG_METHOD_EXIT();
5405
5406 return value;
5407 }
5408
|
5409 kumpf 1.218 String IndicationService::_checkPropertyWithDefault(
5410 CIMInstance& instance,
5411 const CIMName& propertyName,
5412 const String& defaultValue)
|
5413 kumpf 1.34 {
|
5414 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
5415 kumpf 1.114 "IndicationService::_checkPropertyWithDefault");
5416
|
5417 kumpf 1.34 String result = defaultValue;
5418
5419 //
5420 // If the property doesn't exist, add it with the default value
5421 //
|
5422 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
5423 kumpf 1.34 {
5424 instance.addProperty (CIMProperty (propertyName,
5425 CIMValue (defaultValue)));
5426 }
5427 else
5428 {
5429 //
5430 // Get the property
5431 //
5432 CIMProperty theProperty = instance.getProperty
5433 (instance.findProperty (propertyName));
5434 CIMValue theValue = theProperty.getValue ();
5435
5436 //
5437 // If the value is null, set to the default value
5438 //
5439 if (theValue.isNull ())
5440 {
5441 theProperty.setValue (CIMValue (defaultValue));
5442 }
|
5443 david.dillard 1.174 else if ((theValue.getType () != CIMTYPE_STRING) ||
|
5444 carolann.graves 1.165 (theValue.isArray ()))
|
5445 kumpf 1.116 {
5446 //
5447 // Property exists and is not null,
5448 // but is not of correct type
5449 //
|
5450 carolann.graves 1.165 if (theValue.isArray ())
5451 {
|
5452 kumpf 1.240 PEG_METHOD_EXIT();
5453 throw PEGASUS_CIM_EXCEPTION_L(
5454 CIM_ERR_INVALID_PARAMETER,
5455 MessageLoaderParms(
5456 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY_KEY,
5457 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY,
5458 cimTypeToString(theValue.getType()),
5459 propertyName.getString()));
|
5460 carolann.graves 1.165 }
5461 else
5462 {
|
5463 kumpf 1.240 PEG_METHOD_EXIT();
5464 throw PEGASUS_CIM_EXCEPTION_L(
5465 CIM_ERR_INVALID_PARAMETER,
5466 MessageLoaderParms(
5467 _MSG_INVALID_TYPE_FOR_PROPERTY_KEY,
5468 _MSG_INVALID_TYPE_FOR_PROPERTY,
5469 cimTypeToString(theValue.getType()),
5470 propertyName.getString()));
|
5471 carolann.graves 1.165 }
|
5472 kumpf 1.116 }
|
5473 kumpf 1.34 else
5474 {
5475 theValue.get (result);
5476 }
5477 }
5478
|
5479 gs.keenan 1.155 PEG_METHOD_EXIT ();
|
5480 kumpf 1.34 return result;
|
5481 kumpf 1.116 }
5482
|
5483 carolann.graves 1.146 String IndicationService::_initOrValidateStringProperty (
|
5484 kumpf 1.218 CIMInstance& instance,
5485 const CIMName& propertyName,
5486 const String& defaultValue)
|
5487 carolann.graves 1.146 {
5488 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5489 "IndicationService::_initOrValidateStringProperty");
5490
5491 String result = defaultValue;
5492
5493 String propertyValue = _checkPropertyWithDefault (instance, propertyName,
5494 defaultValue);
|
5495 kumpf 1.226
|
5496 carolann.graves 1.146 if (propertyValue != defaultValue)
5497 {
|
5498 marek 1.280 // SNIA requires SystemCreationClassName to be
|
5499 kumpf 1.226 // overridden with the correct values.
|
5500 marek 1.280 if (propertyName == _PROPERTY_SYSTEMCREATIONCLASSNAME)
|
5501 kumpf 1.226 {
5502 // The property must exist after _checkPropertyWithDefault is called
5503 CIMProperty p =
5504 instance.getProperty(instance.findProperty(propertyName));
5505 p.setValue(CIMValue(defaultValue));
5506 PEG_METHOD_EXIT();
5507 return result;
5508 }
5509
|
5510 carolann.graves 1.146 //
5511 // Property value specified is invalid
5512 //
|
5513 kumpf 1.240 PEG_METHOD_EXIT();
5514 throw PEGASUS_CIM_EXCEPTION_L(
5515 CIM_ERR_INVALID_PARAMETER,
5516 MessageLoaderParms(
5517 _MSG_INVALID_VALUE_FOR_PROPERTY_KEY,
5518 _MSG_INVALID_VALUE_FOR_PROPERTY,
5519 propertyValue,
5520 propertyName.getString()));
|
5521 carolann.graves 1.146 }
5522
|
5523 gs.keenan 1.155 PEG_METHOD_EXIT ();
|
5524 carolann.graves 1.146 return result;
|
5525 gs.keenan 1.155 }
|
5526 carolann.graves 1.146
|
5527 kumpf 1.116 void IndicationService::_checkProperty (
|
5528 kumpf 1.218 CIMInstance& instance,
5529 const CIMName& propertyName,
|
5530 yi.zhou 1.187 const CIMType expectedType,
5531 const Boolean isArray)
|
5532 kumpf 1.116 {
5533 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5534 "IndicationService::_checkProperty");
5535
5536 //
5537 // If the property exists, get it
5538 //
5539 Uint32 propPos = instance.findProperty (propertyName);
5540 if (propPos != PEG_NOT_FOUND)
5541 {
5542 CIMProperty theProperty = instance.getProperty (propPos);
5543 CIMValue theValue = theProperty.getValue ();
5544
5545 //
5546 // If the value is not null, check the type
5547 //
5548 if (!theValue.isNull ())
5549 {
|
5550 kumpf 1.218 if ((theValue.getType () != expectedType) ||
|
5551 yi.zhou 1.187 (theValue.isArray () != isArray))
|
5552 kumpf 1.116 {
5553 //
5554 // Property exists and is not null, but is not of correct type
5555 //
5556 if (theValue.isArray ())
5557 {
|
5558 kumpf 1.240 PEG_METHOD_EXIT();
5559 throw PEGASUS_CIM_EXCEPTION_L(
5560 CIM_ERR_INVALID_PARAMETER,
5561 MessageLoaderParms(
5562 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY_KEY,
5563 _MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY,
5564 cimTypeToString(theValue.getType()),
5565 propertyName.getString()));
|
5566 kumpf 1.116 }
5567 else
5568 {
|
5569 kumpf 1.240 PEG_METHOD_EXIT();
5570 throw PEGASUS_CIM_EXCEPTION_L(
5571 CIM_ERR_INVALID_PARAMETER,
5572 MessageLoaderParms(
5573 _MSG_INVALID_TYPE_FOR_PROPERTY_KEY,
5574 _MSG_INVALID_TYPE_FOR_PROPERTY,
5575 cimTypeToString(theValue.getType()),
5576 propertyName.getString()));
|
5577 kumpf 1.116 }
5578 }
5579 }
5580 }
|
5581 kumpf 1.48 PEG_METHOD_EXIT ();
|
5582 kumpf 1.34 }
5583
|
5584 yi.zhou 1.193 void IndicationService::_checkValue (
|
5585 kumpf 1.218 const CIMInstance& instance,
5586 const CIMName& propertyName,
5587 const Array<Uint16>& supportedValues)
|
5588 yi.zhou 1.193 {
5589 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5590 "IndicationService::_checkValue");
5591
5592 Uint16 theValue;
5593
5594 // get the property value
5595 Uint32 propPos = instance.findProperty (propertyName);
5596 if (propPos != PEG_NOT_FOUND)
5597 {
|
5598 carolann.graves 1.198 CIMValue propertyValue = (instance.getProperty(propPos)).getValue();
|
5599 yi.zhou 1.193
5600 if (!(propertyValue.isNull()))
5601 {
5602 propertyValue.get(theValue);
5603
|
5604 kumpf 1.218 // Check for valid values that are not supported
5605 // Note: Supported values are a subset of the valid values
5606 // Some valid values, as defined in the MOF, are not currently
5607 // supported
|
5608 yi.zhou 1.193 if (!Contains(supportedValues, theValue))
5609 {
|
5610 kumpf 1.240 PEG_METHOD_EXIT();
5611 throw PEGASUS_CIM_EXCEPTION_L(
5612 CIM_ERR_NOT_SUPPORTED,
5613 MessageLoaderParms(
5614 _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY_KEY,
5615 _MSG_UNSUPPORTED_VALUE_FOR_PROPERTY,
5616 theValue,
5617 propertyName.getString()));
|
5618 yi.zhou 1.193 }
5619 }
5620 }
5621
5622 PEG_METHOD_EXIT ();
5623 }
5624
|
5625 kumpf 1.11 Boolean IndicationService::_canModify (
5626 const CIMModifyInstanceRequestMessage * request,
|
5627 kumpf 1.218 const CIMObjectPath& instanceReference,
5628 const CIMInstance& instance,
5629 CIMInstance& modifiedInstance)
|
5630 kumpf 1.1 {
|
5631 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify");
|
5632 kumpf 1.1
|
5633 kumpf 1.11 //
|
5634 dj.gorey 1.135 // Currently, only modification allowed is of Subscription State
|
5635 kumpf 1.11 // property in Subscription class
5636 //
|
5637 yi.zhou 1.157 if (!(instanceReference.getClassName ().equal
5638 (PEGASUS_CLASSNAME_INDSUBSCRIPTION)) &&
|
5639 chip 1.162 !(instanceReference.getClassName ().equal
5640 (PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION)))
|
5641 kumpf 1.11 {
|
5642 kumpf 1.48 PEG_METHOD_EXIT ();
|
5643 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
5644 kumpf 1.11 }
|
5645 kumpf 1.1
|
5646 kumpf 1.11 if (request->includeQualifiers)
|
5647 kumpf 1.1 {
|
5648 kumpf 1.48 PEG_METHOD_EXIT ();
|
5649 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
5650 kumpf 1.11 }
|
5651 kumpf 1.1
|
5652 kumpf 1.11 //
5653 // Request is invalid if property list is null, meaning all properties
5654 // are to be updated
5655 //
5656 if (request->propertyList.isNull ())
5657 {
|
5658 kumpf 1.48 PEG_METHOD_EXIT ();
|
5659 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
5660 kumpf 1.11 }
|
5661 kumpf 1.1
|
5662 kumpf 1.11 //
5663 // Request is invalid if more than one property is specified
5664 //
|
5665 kumpf 1.218 else if (request->propertyList.size() > 1)
|
5666 kumpf 1.1 {
|
5667 kumpf 1.218 PEG_METHOD_EXIT();
|
5668 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
5669 kumpf 1.1 }
|
5670 kumpf 1.11
5671 //
5672 // For request to be valid, zero or one property must be specified
5673 // If one property specified, it must be Subscription State property
5674 //
|
5675 kumpf 1.218 else if ((request->propertyList.size() == 1) &&
5676 (!request->propertyList[0].equal(
5677 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE)))
|
5678 kumpf 1.1 {
|
5679 kumpf 1.218 PEG_METHOD_EXIT();
|
5680 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
5681 kumpf 1.1 }
5682
|
5683 kumpf 1.80 //
5684 // Check the SubscriptionState property in the modified instance
5685 //
|
5686 kumpf 1.218 _checkPropertyWithOther(
5687 modifiedInstance,
5688 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE,
5689 _PROPERTY_OTHERSTATE,
5690 (Uint16) STATE_ENABLED,
5691 (Uint16) STATE_OTHER,
5692 _supportedStates);
|
5693 kumpf 1.32
|
5694 kumpf 1.11 //
5695 // Get creator from instance
5696 //
|
5697 kumpf 1.80 String creator;
5698 if (!_getCreator (instance, creator))
5699 {
5700 //
5701 // This instance from the repository is corrupted
5702 //
5703 PEG_METHOD_EXIT ();
|
5704 chip 1.162 MessageLoaderParms parms(_MSG_INVALID_INSTANCES_KEY,
|
5705 kumpf 1.137 _MSG_INVALID_INSTANCES);
5706 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
|
5707 kumpf 1.80 }
|
5708 kumpf 1.1
|
5709 kumpf 1.11 //
5710 // Current user must be privileged user or instance Creator to modify
|
5711 kumpf 1.13 // NOTE: if authentication was not turned on when instance was created,
5712 // instance creator will be String::EMPTY
|
5713 dj.gorey 1.135 // If creator is String::EMPTY, anyone may modify or delete the
|
5714 kumpf 1.13 // instance
5715 //
|
5716 kumpf 1.137 String currentUser = ((IdentityContainer)request->operationContext.get
5717 (IdentityContainer :: NAME)).getUserName();
|
5718 kumpf 1.13 if ((creator != String::EMPTY) &&
|
5719 r.kieninger 1.222 #ifndef PEGASUS_OS_ZOS
|
5720 dj.gorey 1.135 (!System::isPrivilegedUser (currentUser)) &&
|
5721 r.kieninger 1.222 #endif
|
5722 kumpf 1.11 (currentUser != creator))
5723 {
|
5724 kumpf 1.48 PEG_METHOD_EXIT ();
|
5725 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, String::EMPTY);
|
5726 kumpf 1.11 }
|
5727 kumpf 1.1
|
5728 gs.keenan 1.155 PEG_METHOD_EXIT ();
|
5729 kumpf 1.11 return true;
|
5730 kumpf 1.1 }
5731
|
5732 kumpf 1.11 Boolean IndicationService::_canDelete (
|
5733 kumpf 1.218 const CIMObjectPath& instanceReference,
5734 const CIMNamespaceName& nameSpace,
5735 const String& currentUser)
|
5736 kumpf 1.1 {
|
5737 kumpf 1.114 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canDelete");
5738
|
5739 kumpf 1.63 CIMName superClass;
5740 CIMName propName;
|
5741 kumpf 1.11
5742 //
|
5743 carolann.graves 1.179 // Get the instance to be deleted from the repository
|
5744 kumpf 1.16 //
|
5745 kumpf 1.19 CIMInstance instance;
5746
|
5747 dj.gorey 1.135 instance = _subscriptionRepository->getInstance
|
5748 kumpf 1.114 (nameSpace, instanceReference);
|
5749 kumpf 1.19
|
5750 kumpf 1.16 //
5751 // Get creator from instance
5752 //
|
5753 kumpf 1.80 String creator;
5754 if (!_getCreator (instance, creator))
5755 {
5756 //
5757 // This instance from the repository is corrupted
|
5758 dj.gorey 1.135 // Allow the delete if a Privileged User
5759 // (or authentication turned off),
|
5760 kumpf 1.80 // Otherwise disallow as access denied
5761 //
|
5762 r.kieninger 1.222 #ifndef PEGASUS_OS_ZOS
|
5763 kumpf 1.80 if ((!System::isPrivilegedUser (currentUser)) &&
5764 (currentUser != String::EMPTY))
5765 {
5766 PEG_METHOD_EXIT ();
5767 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_ACCESS_DENIED, String::EMPTY);
5768 }
|
5769 r.kieninger 1.222 #endif
|
5770 kumpf 1.80 }
|
5771 kumpf 1.16
5772 //
5773 // Current user must be privileged user or instance Creator to delete
5774 // NOTE: if authentication was not turned on when instance was created,
5775 // instance creator will be String::EMPTY
|
5776 dj.gorey 1.135 // If creator is String::EMPTY, anyone may modify or delete the
|
5777 kumpf 1.16 // instance
5778 //
5779 if ((creator != String::EMPTY) &&
|
5780 r.kieninger 1.222 #ifndef PEGASUS_OS_ZOS
|
5781 kumpf 1.16 (!System::isPrivilegedUser (currentUser)) &&
|
5782 r.kieninger 1.222 #endif
|
5783 kumpf 1.16 (currentUser != creator))
5784 {
|
5785 kumpf 1.48 PEG_METHOD_EXIT ();
|
5786 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, String::EMPTY);
|
5787 kumpf 1.16 }
5788
5789 //
|
5790 kumpf 1.11 // Get the class and superclass of the instance to be deleted
5791 //
|
5792 kumpf 1.19 CIMClass refClass;
5793
|
5794 kumpf 1.114 refClass = _subscriptionRepository->getClass (nameSpace,
|
5795 dj.gorey 1.135 instanceReference.getClassName (), true, true, false,
|
5796 kumpf 1.114 CIMPropertyList ());
|
5797 kumpf 1.11 superClass = refClass.getSuperClassName();
|
5798 kumpf 1.1
|
5799 kumpf 1.11 //
|
5800 carolann.graves 1.169 // If the class is Filter or superclass is Handler or Listener Destination,
5801 // check for subscription instances referring to the instance to be deleted
|
5802 kumpf 1.11 //
|
5803 carolann.graves 1.169 if ((superClass.equal (PEGASUS_CLASSNAME_INDHANDLER)) ||
5804 (superClass.equal (PEGASUS_CLASSNAME_LSTNRDST)) ||
5805 (instanceReference.getClassName().equal (PEGASUS_CLASSNAME_INDFILTER)))
5806 {
|
5807 david.dillard 1.174 if (instanceReference.getClassName ().equal
|
5808 carolann.graves 1.169 (PEGASUS_CLASSNAME_INDFILTER))
|
5809 kumpf 1.11 {
|
5810 w.otsuka 1.207 propName = PEGASUS_PROPERTYNAME_FILTER;
|
5811 kumpf 1.11 }
|
5812 yi.zhou 1.157 else if ((superClass.equal (PEGASUS_CLASSNAME_INDHANDLER)) ||
|
5813 carolann.graves 1.169 (superClass.equal (PEGASUS_CLASSNAME_LSTNRDST)))
|
5814 kumpf 1.1 {
|
5815 w.otsuka 1.207 propName = PEGASUS_PROPERTYNAME_HANDLER;
|
5816 kumpf 1.1
|
5817 kumpf 1.11 //
|
5818 dj.gorey 1.135 // If deleting transient handler, first delete any referencing
|
5819 kumpf 1.11 // subscriptions
5820 //
|
5821 dj.gorey 1.135 if (_subscriptionRepository->isTransient (nameSpace,
|
5822 kumpf 1.114 instanceReference))
|
5823 kumpf 1.1 {
|
5824 kumpf 1.11 _deleteReferencingSubscriptions (nameSpace, propName,
5825 instanceReference);
|
5826 kumpf 1.48 PEG_METHOD_EXIT ();
|
5827 kumpf 1.11 return true;
|
5828 kumpf 1.1 }
|
5829 kumpf 1.11 }
|
5830 kumpf 1.1
|
5831 kumpf 1.11 //
|
5832 carolann.graves 1.186 // Get all the subscriptions from the repository
|
5833 kumpf 1.11 //
|
5834 kumpf 1.218 Array<CIMInstance> subscriptions =
|
5835 carolann.graves 1.186 _subscriptionRepository->getAllSubscriptions ();
|
5836 kumpf 1.1
|
5837 kumpf 1.11 CIMValue propValue;
|
5838 kumpf 1.1
|
5839 kumpf 1.11 //
|
5840 dj.gorey 1.135 // Check each subscription for a reference to the instance to be
|
5841 kumpf 1.11 // deleted
5842 //
|
5843 kumpf 1.83 for (Uint32 i = 0; i < subscriptions.size(); i++)
|
5844 kumpf 1.11 {
5845 //
5846 // Get the subscription Filter or Handler property value
5847 //
|
5848 kumpf 1.46 propValue = subscriptions[i].getProperty
5849 (subscriptions[i].findProperty
|
5850 kumpf 1.11 (propName)).getValue();
|
5851 dj.gorey 1.135
|
5852 kumpf 1.45 CIMObjectPath ref;
|
5853 kumpf 1.11 propValue.get (ref);
|
5854 kumpf 1.4
|
5855 kumpf 1.11 //
|
5856 carolann.graves 1.186 // If the Filter or Handler reference property value includes
5857 // namespace, check if it is the namespace of the Filter or Handler
5858 // being deleted.
5859 // If the Filter or Handler reference property value does not
5860 // include namespace, check if the current subscription namespace
5861 // is the namespace of the Filter or Handler being deleted.
|
5862 carolann.graves 1.179 //
|
5863 carolann.graves 1.186 CIMNamespaceName instanceNS = ref.getNameSpace ();
|
5864 kumpf 1.218 if (((instanceNS.isNull ()) &&
5865 (subscriptions[i].getPath ().getNameSpace () == nameSpace))
|
5866 carolann.graves 1.186 || (instanceNS == nameSpace))
5867 {
5868
5869 //
5870 // Remove Host and Namespace from reference property value, if
5871 // present, before comparing
5872 //
5873 CIMObjectPath path ("", CIMNamespaceName (),
5874 ref.getClassName (), ref.getKeyBindings ());
|
5875 carolann.graves 1.179
|
5876 carolann.graves 1.186 //
5877 // Remove Host and Namespace from reference of instance to be
5878 // deleted, if present, before comparing
5879 //
5880 CIMObjectPath iref ("", CIMNamespaceName (),
5881 instanceReference.getClassName (),
5882 instanceReference.getKeyBindings ());
5883
5884 //
5885 // If the current subscription Filter or Handler is the
5886 // instance to be deleted, it may not be deleted
5887 //
5888 if (iref == path)
5889 {
5890 PEG_METHOD_EXIT ();
|
5891 kumpf 1.243 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
5892 MessageLoaderParms(
5893 "IndicationService.IndicationService."
5894 "_MSG_REFERENCED",
5895 "A filter or handler referenced by a subscription "
5896 "cannot be deleted."));
|
5897 carolann.graves 1.186 }
|
5898 kumpf 1.1 }
5899 }
5900 }
5901
|
5902 kumpf 1.48 PEG_METHOD_EXIT ();
|
5903 kumpf 1.11 return true;
5904 }
|
5905 kumpf 1.4
|
5906 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace>
5907 IndicationService::_getMatchingSubscriptions (
5908 const CIMName& supportedClass,
5909 const Array<CIMNamespaceName> nameSpaces,
5910 const CIMPropertyList& supportedProperties,
5911 const Boolean checkProvider,
5912 const CIMInstance& provider)
|
5913 kumpf 1.1 {
|
5914 kumpf 1.114 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5915 "IndicationService::_getMatchingSubscriptions");
5916
|
5917 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace> matchingSubscriptions;
5918 Array<SubscriptionWithSrcNamespace> subscriptions;
|
5919 kumpf 1.1
|
5920 venkat.puvvada 1.275 subscriptions = _subscriptionTable->getMatchingSubscriptions(
5921 supportedClass,
5922 nameSpaces,
5923 checkProvider,
5924 provider);
|
5925 kumpf 1.1
|
5926 kumpf 1.114 for (Uint32 i = 0; i < subscriptions.size (); i++)
|
5927 kumpf 1.11 {
|
5928 kumpf 1.114 Boolean match = true;
5929
|
5930 kumpf 1.11 //
|
5931 kumpf 1.114 // If supported properties is null (all properties)
5932 // the subscription can be supported
|
5933 kumpf 1.11 //
|
5934 kumpf 1.114 if (!supportedProperties.isNull ())
|
5935 kumpf 1.73 {
|
5936 kumpf 1.114 String filterQuery;
|
5937 chuck 1.149 String queryLanguage;
|
5938 kumpf 1.114 CIMName indicationClassName;
|
5939 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
5940 kumpf 1.114 CIMPropertyList propertyList;
|
5941 w.otsuka 1.217 String filterName;
|
5942 kumpf 1.73
|
5943 yi.zhou 1.224 try
5944 {
5945 //
5946 // Get filter properties
5947 //
|
5948 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
5949 subscriptions[i].subscription,
5950 filterQuery,
5951 sourceNamespaces,
5952 queryLanguage,
5953 filterName);
|
5954 yi.zhou 1.224
5955 QueryExpression queryExpr = _getQueryExpression(
|
5956 venkat.puvvada 1.275 filterQuery, queryLanguage, subscriptions[i].nameSpace);
|
5957 yi.zhou 1.224
5958 // Get the class paths in the FROM list
5959 // Since neither WQL nor CQL support joins, so we can
5960 // assume one class path.
|
5961 kumpf 1.253 indicationClassName =
|
5962 yi.zhou 1.224 queryExpr.getClassPathList()[0].getClassName();
|
5963 chuck 1.149
|
5964 yi.zhou 1.224 if (!_subscriptionRepository->validateIndicationClassName(
|
5965 venkat.puvvada 1.275 indicationClassName, subscriptions[i].nameSpace))
|
5966 yi.zhou 1.224 {
5967 // Invalid FROM class, skip the subscription
5968 continue;
5969 }
|
5970 chip 1.162
|
5971 yi.zhou 1.224 //
5972 // Get required property list from filter query (WHERE clause)
5973 //
5974 // Note that the supportedClass is passed in,
5975 // not the indicationClassName.
5976 // The supportedClass is the class of the indication
5977 // instance, while the indicationClassName is the FROM class.
5978 // This is needed because CQL can have class scoping operators
5979 // on properties that may not be the same class
5980 // as the FROM class. The required properties
5981 // for an indication are based on its class,
5982 // not the FROM class.
5983 //
5984 // Also note that for CQL, this does not return
5985 // required embedded object properties.
5986 propertyList = _getPropertyList (queryExpr,
|
5987 venkat.puvvada 1.275 subscriptions[i].nameSpace,
|
5988 chuck 1.149 supportedClass);
|
5989 dj.gorey 1.135
|
5990 carolann.graves 1.166 //
|
5991 yi.zhou 1.224 // If the subscription requires all properties,
5992 // but supported property list does not include all
5993 // properties, the subscription cannot be supported
|
5994 carolann.graves 1.166 //
|
5995 yi.zhou 1.224 if (propertyList.isNull ())
5996 {
5997 //
5998 // Current subscription does not match
5999 // Continue to next subscription in list
6000 //
6001 continue;
6002 }
6003 else
|
6004 kumpf 1.114 {
|
6005 yi.zhou 1.224 //
6006 // Compare subscription required property list
6007 // with supported property list
6008 //
6009 for (Uint32 j = 0;
6010 j < propertyList.size () && match;
6011 j++)
|
6012 kumpf 1.73 {
|
6013 yi.zhou 1.224 if (!ContainsCIMName
6014 (supportedProperties.getPropertyNameArray(),
6015 propertyList[j]))
6016 {
6017 match = false;
6018 break;
6019 }
|
6020 kumpf 1.73 }
6021 }
|
6022 kumpf 1.114 }
|
6023 yi.zhou 1.224 catch(const Exception & e)
6024 {
6025 // This subscription is invalid
6026 // skip it
6027 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL2,
6028 "Exception caught trying to verify required properties"
6029 " in a subscription are all contained in the list of"
6030 " supported indication properties: %s",
|
6031 kumpf 1.253 (const char *) e.getMessage ().getCString()));
|
6032 yi.zhou 1.224 continue;
6033 }
6034 catch(const exception & e)
6035 {
6036 // This subscription is invalid
6037 // skip it
6038 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL2,
6039 "Exception caught trying to verify required properties"
6040 " in a subscription are all contained in the list of"
|
6041 kumpf 1.253 " supported indication properties: %s", e.what ()));
|
6042 yi.zhou 1.224 continue;
6043 }
6044 catch(...)
6045 {
6046 // This subscription is invalid
6047 // skip it
6048 PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL2,
6049 "Unknown exception caught trying to verify "
6050 "required properties in a subscription are all contained "
|
6051 kumpf 1.253 "in the list of supported indication properties.");
|
6052 yi.zhou 1.224 continue;
6053 }
|
6054 kumpf 1.114 }
|
6055 kumpf 1.11
|
6056 kumpf 1.114 if (match)
6057 {
6058 //
6059 // Add current subscription to list
6060 //
|
6061 kumpf 1.218 matchingSubscriptions.append (subscriptions[i]);
|
6062 kumpf 1.73 }
6063 }
|
6064 kumpf 1.1
|
6065 kumpf 1.48 PEG_METHOD_EXIT ();
|
6066 kumpf 1.19 return matchingSubscriptions;
|
6067 kumpf 1.1 }
6068
|
6069 kumpf 1.11 void IndicationService::_getModifiedSubscriptions (
|
6070 kumpf 1.218 const CIMName& supportedClass,
6071 const Array<CIMNamespaceName>& newNameSpaces,
6072 const Array<CIMNamespaceName>& oldNameSpaces,
6073 const CIMPropertyList& newProperties,
6074 const CIMPropertyList& oldProperties,
|
6075 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace>& newSubscriptions,
6076 Array<SubscriptionWithSrcNamespace>& formerSubscriptions)
|
6077 kumpf 1.1 {
|
6078 kumpf 1.114 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6079 "IndicationService::_getModifiedSubscriptions");
6080
|
6081 venkat.puvvada 1.275 Array<SubscriptionWithSrcNamespace> newList;
6082 Array<SubscriptionWithSrcNamespace> formerList;
6083 Array<SubscriptionWithSrcNamespace> bothList;
|
6084 kumpf 1.1
|
6085 kumpf 1.11 newSubscriptions.clear ();
6086 formerSubscriptions.clear ();
6087
|
6088 kumpf 1.1 //
|
6089 dj.gorey 1.135 // For each newly supported namespace, lookup to retrieve list of
|
6090 kumpf 1.73 // subscriptions for the indication class-source namespace pair
6091 //
|
6092 dj.gorey 1.135 newList = _subscriptionTable->getMatchingSubscriptions
|
6093 kumpf 1.114 (supportedClass, newNameSpaces);
|
6094 kumpf 1.73
6095 //
|
6096 dj.gorey 1.135 // For each formerly supported namespace, lookup to retrieve list of
|
6097 kumpf 1.73 // subscriptions for the indication class-source namespace pair
6098 //
|
6099 dj.gorey 1.135 formerList = _subscriptionTable->getMatchingSubscriptions
|
6100 kumpf 1.114 (supportedClass, oldNameSpaces);
|
6101 kumpf 1.73
6102 //
|
6103 dj.gorey 1.135 // Find subscriptions that appear in both lists, and move them to a third
|
6104 kumpf 1.73 // list
|
6105 kumpf 1.1 //
|
6106 kumpf 1.73 Sint8 found;
|
6107 kumpf 1.83 for (Uint32 p = 0; p < newList.size (); p++)
|
6108 kumpf 1.73 {
6109 found = -1;
|
6110 kumpf 1.83 for (Uint32 q = 0; q < formerList.size (); q++)
|
6111 kumpf 1.73 {
|
6112 venkat.puvvada 1.275 if (newList[p].subscription.identical (formerList[q].subscription))
|
6113 kumpf 1.73 {
6114 found = q;
|
6115 kumpf 1.218 bothList.append (newList[p]);
|
6116 kumpf 1.73 break;
6117 }
6118 }
6119 if (found >= 0)
6120 {
6121 newList.remove (p);
6122 p--;
6123 formerList.remove (found);
6124 }
6125 }
|
6126 kumpf 1.1
6127 //
|
6128 dj.gorey 1.135 // For indicationClassName-sourceNamespace pair that is now supported, but
6129 // previously was not, add to list of newly supported subscriptions if
|
6130 kumpf 1.73 // required properties are now supported
|
6131 kumpf 1.1 //
|
6132 kumpf 1.83 for (Uint32 n = 0; n < newList.size (); n++)
|
6133 kumpf 1.1 {
|
6134 kumpf 1.73 String filterQuery;
|
6135 chuck 1.149 String queryLanguage;
|
6136 kumpf 1.73 CIMName indicationClassName;
|
6137 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
6138 kumpf 1.73 CIMPropertyList requiredProperties;
|
6139 w.otsuka 1.217 String filterName;
|
6140 kumpf 1.11
6141 //
|
6142 kumpf 1.73 // Get filter properties
6143 //
|
6144 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties (
6145 newList[n].subscription,
6146 filterQuery,
6147 sourceNamespaces,
6148 queryLanguage,
6149 filterName);
6150
|
6151 kumpf 1.218 QueryExpression queryExpression = _getQueryExpression(
|
6152 venkat.puvvada 1.275 filterQuery, queryLanguage, newList[n].nameSpace);
|
6153 dj.gorey 1.135
|
6154 kumpf 1.73 //
6155 // Get indication class name from filter query (FROM clause)
6156 //
|
6157 chuck 1.149 indicationClassName = _getIndicationClassName (queryExpression,
|
6158 venkat.puvvada 1.275 newList[n].nameSpace);
|
6159 dj.gorey 1.135
|
6160 kumpf 1.73 //
|
6161 carolann.graves 1.175 // Get required property list from filter query (WHERE clause)
|
6162 kumpf 1.11 //
|
6163 chuck 1.149 // Note: the supportedClass is passed to _getPropertyList
6164 // rather than the FROM class because CQL could have
6165 // class scoping operators that scope properties to
6166 // specific subclasses of the FROM.
6167 //
6168 requiredProperties = _getPropertyList (queryExpression,
|
6169 venkat.puvvada 1.275 newList[n].nameSpace, supportedClass);
|
6170 kumpf 1.19
|
6171 kumpf 1.1 //
|
6172 kumpf 1.73 // Check if required properties are now supported
|
6173 kumpf 1.1 //
|
6174 kumpf 1.73 if (_inPropertyList (requiredProperties, newProperties))
|
6175 kumpf 1.1 {
|
6176 kumpf 1.218 newSubscriptions.append (newList[n]);
|
6177 kumpf 1.73 }
6178 }
|
6179 kumpf 1.13
|
6180 kumpf 1.73 //
|
6181 dj.gorey 1.135 // For indicationClassName-sourceNamespace pair that was previously
6182 // supported, but now is not, add to list of formerly supported
|
6183 kumpf 1.73 // subscriptions
6184 //
|
6185 kumpf 1.83 for (Uint32 f = 0; f < formerList.size (); f++)
|
6186 kumpf 1.73 {
|
6187 kumpf 1.218 formerSubscriptions.append (formerList[f]);
|
6188 kumpf 1.73 }
|
6189 kumpf 1.1
|
6190 kumpf 1.73 //
|
6191 dj.gorey 1.135 // For indicationClassName-sourceNamespace pair that is now supported,
|
6192 kumpf 1.73 // and was also previously supported, add to appropriate list, based on
|
6193 dj.gorey 1.135 // required properties
|
6194 kumpf 1.73 //
|
6195 kumpf 1.83 for (Uint32 b = 0; b < bothList.size (); b++)
|
6196 kumpf 1.73 {
6197 String filterQuery;
|
6198 chuck 1.149 String queryLanguage;
|
6199 kumpf 1.73 CIMName indicationClassName;
|
6200 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
6201 kumpf 1.73 CIMPropertyList requiredProperties;
6202 Boolean newMatch = false;
6203 Boolean formerMatch = false;
|
6204 w.otsuka 1.217 String filterName;
|
6205 kumpf 1.1
|
6206 kumpf 1.73 //
6207 // Get filter properties
6208 //
|
6209 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
6210 bothList[b].subscription,
6211 filterQuery,
6212 sourceNamespaces,
6213 queryLanguage,
6214 filterName);
6215
|
6216 kumpf 1.218 QueryExpression queryExpression = _getQueryExpression(
|
6217 venkat.puvvada 1.275 filterQuery, queryLanguage, bothList[b].nameSpace);
|
6218 dj.gorey 1.135
|
6219 kumpf 1.73 //
6220 // Get indication class name from filter query (FROM clause)
6221 //
|
6222 venkat.puvvada 1.275 indicationClassName = _getIndicationClassName(
6223 queryExpression,
6224 bothList[b].nameSpace);
|
6225 dj.gorey 1.135
|
6226 kumpf 1.73 //
|
6227 carolann.graves 1.175 // Get required property list from filter query (WHERE clause)
|
6228 kumpf 1.73 //
|
6229 chuck 1.149 // Note: the supportedClass is passed to _getPropertyList
6230 // rather than the FROM class because CQL could have
6231 // class scoping operators that scope properties to
6232 // specific subclasses of the FROM.
6233 //
|
6234 venkat.puvvada 1.275 requiredProperties = _getPropertyList (
6235 queryExpression,
6236 bothList[b].nameSpace,
6237 supportedClass);
|
6238 kumpf 1.1
|
6239 kumpf 1.73 //
|
6240 dj.gorey 1.135 // Check required properties
|
6241 kumpf 1.73 //
|
6242 dj.gorey 1.135 newMatch = _inPropertyList (requiredProperties,
|
6243 kumpf 1.73 newProperties);
|
6244 dj.gorey 1.135 formerMatch = _inPropertyList (requiredProperties,
|
6245 kumpf 1.73 oldProperties);
|
6246 kumpf 1.15
|
6247 kumpf 1.73 //
6248 // Add current subscription to appropriate list
6249 //
6250 if (newMatch && !formerMatch)
6251 {
|
6252 kumpf 1.218 newSubscriptions.append (bothList[b]);
|
6253 kumpf 1.73 }
6254 else if (!newMatch && formerMatch)
6255 {
|
6256 kumpf 1.218 formerSubscriptions.append (bothList[b]);
|
6257 kumpf 1.73 }
6258 }
|
6259 kumpf 1.11
|
6260 kumpf 1.48 PEG_METHOD_EXIT ();
|
6261 kumpf 1.11 }
6262
|
6263 kumpf 1.15 Boolean IndicationService::_inPropertyList (
|
6264 kumpf 1.218 const CIMPropertyList& requiredProperties,
6265 const CIMPropertyList& supportedProperties)
|
6266 kumpf 1.15 {
|
6267 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6268 kumpf 1.114 "IndicationService::_inPropertyList");
|
6269 kumpf 1.22
|
6270 kumpf 1.15 //
6271 // If property list is null (all properties)
6272 // all the required properties are supported
6273 //
6274 if (supportedProperties.isNull ())
6275 {
|
6276 carolann.graves 1.170 PEG_METHOD_EXIT();
|
6277 kumpf 1.15 return true;
6278 }
6279 else
6280 {
6281 //
6282 // If the subscription requires all properties,
|
6283 dj.gorey 1.135 // but property list does not include all
|
6284 kumpf 1.15 // properties, the required properties cannot be supported
6285 //
6286 if (requiredProperties.isNull ())
6287 {
|
6288 carolann.graves 1.170 PEG_METHOD_EXIT();
|
6289 kumpf 1.15 return false;
6290 }
6291 else
6292 {
6293 //
6294 // Compare required property list
6295 // with property list
6296 //
|
6297 kumpf 1.83 for (Uint32 i = 0; i < requiredProperties.size (); i++)
|
6298 kumpf 1.15 {
|
6299 dj.gorey 1.135 if (!ContainsCIMName
6300 (supportedProperties.getPropertyNameArray (),
|
6301 kumpf 1.51 requiredProperties[i]))
|
6302 kumpf 1.15 {
|
6303 carolann.graves 1.170 PEG_METHOD_EXIT();
|
6304 kumpf 1.15 return false;
6305 }
6306 }
6307 }
6308 }
6309
|
6310 kumpf 1.48 PEG_METHOD_EXIT ();
|
6311 kumpf 1.15 return true;
6312 }
6313
|
6314 kumpf 1.218 QueryExpression IndicationService::_getQueryExpression(
6315 const String& filterQuery,
6316 const String& queryLanguage,
6317 const CIMNamespaceName& ns) const
6318 {
6319 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
6320 "IndicationService::_getQueryExpression");
6321
6322 try
6323 {
6324 RepositoryQueryContext ctx(ns, _cimRepository);
6325 QueryExpression queryExpression(queryLanguage, filterQuery, ctx);
6326 PEG_METHOD_EXIT();
6327 return queryExpression;
6328 }
6329 catch (QueryParseException& qpe)
6330 {
6331 String exceptionStr = qpe.getMessage();
|
6332 chip 1.162
|
6333 kumpf 1.218 PEG_METHOD_EXIT();
6334 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, exceptionStr);
6335 }
6336 catch (ParseError& pe)
6337 {
6338 String exceptionStr = pe.getMessage();
|
6339 chip 1.162
|
6340 kumpf 1.218 PEG_METHOD_EXIT();
6341 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, exceptionStr);
6342 }
6343 catch (MissingNullTerminator& mnt)
6344 {
6345 String exceptionStr = mnt.getMessage();
|
6346 chip 1.162
|
6347 kumpf 1.218 PEG_METHOD_EXIT();
6348 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, exceptionStr);
6349 }
|
6350 kumpf 1.1 }
6351
|
6352 kumpf 1.63 CIMName IndicationService::_getIndicationClassName (
|
6353 kumpf 1.218 const QueryExpression& queryExpression,
6354 const CIMNamespaceName& nameSpaceName) const
|
6355 kumpf 1.1 {
|
6356 kumpf 1.114 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6357 "IndicationService::_getIndicationClassName");
6358
|
6359 kumpf 1.63 CIMName indicationClassName;
|
6360 kumpf 1.218 Array<CIMName> indicationSubclasses;
|
6361 kumpf 1.1
|
6362 chuck 1.149 // Get the class paths in the FROM list.
6363 // Note: neither WQL nor CQL support joins, so we can
6364 // assume one class path.
6365 // Note: neither WQL not CQL support wbem-uri for class paths,
6366 // so we can ignore the parts of the path before the class name.
6367 Array<CIMObjectPath> fromPaths = queryExpression.getClassPathList();
6368 indicationClassName = fromPaths[0].getClassName();
|
6369 kumpf 1.11
|
6370 kumpf 1.114 //
6371 // Validate that class is an Indication class
6372 // The Indication Qualifier should exist and have the value True
6373 //
|
6374 dj.gorey 1.135 Boolean validClass = _subscriptionRepository->validateIndicationClassName
|
6375 kumpf 1.114 (indicationClassName, nameSpaceName);
|
6376 kumpf 1.1
|
6377 kumpf 1.15 if (!validClass)
|
6378 kumpf 1.1 {
|
6379 kumpf 1.240 PEG_METHOD_EXIT();
6380 throw PEGASUS_CIM_EXCEPTION_L(
6381 CIM_ERR_INVALID_PARAMETER,
6382 MessageLoaderParms(
|
6383 kumpf 1.243 "IndicationService.IndicationService."
6384 "_MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY",
6385 "The Indication class name $0 is not valid in the FROM clause "
6386 "of $1 $2 property.",
|
6387 kumpf 1.240 indicationClassName.getString(),
6388 PEGASUS_CLASSNAME_INDFILTER.getString(),
6389 PEGASUS_PROPERTYNAME_QUERY.getString()));
|
6390 kumpf 1.11 }
|
6391 kumpf 1.1
|
6392 kumpf 1.48 PEG_METHOD_EXIT ();
|
6393 kumpf 1.19 return indicationClassName;
|
6394 kumpf 1.1 }
6395
|
6396 kumpf 1.218 Array<ProviderClassList> IndicationService::_getIndicationProviders (
|
6397 venkat.puvvada 1.275 const String &query,
6398 const String &queryLang,
|
6399 kumpf 1.218 const CIMName& indicationClassName,
|
6400 venkat.puvvada 1.275 const Array<NamespaceClassList>& indicationSubclasses) const
|
6401 kumpf 1.22 {
|
6402 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6403 kumpf 1.114 "IndicationService::_getIndicationProviders");
|
6404 kumpf 1.22
|
6405 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders;
|
6406 kumpf 1.16 ProviderClassList provider;
|
6407 kumpf 1.218 Array<CIMInstance> providerInstances;
6408 Array<CIMInstance> providerModuleInstances;
|
6409 kumpf 1.1
|
6410 chuck 1.149 CIMPropertyList requiredPropertyList;
6411
|
6412 venkat.puvvada 1.275
|
6413 kumpf 1.11 //
|
6414 kumpf 1.12 // For each indication subclass, get providers
|
6415 kumpf 1.1 //
|
6416 carolann.graves 1.192 for (Uint32 i = 0, n = indicationSubclasses.size (); i < n; i++)
|
6417 kumpf 1.1 {
|
6418 venkat.puvvada 1.275 for (Uint32 c = 0, nc = indicationSubclasses[i].classList.size();
6419 c < nc; ++c)
|
6420 kumpf 1.1 {
|
6421 venkat.puvvada 1.275 QueryExpression queryExpression = _getQueryExpression(
6422 query,
6423 queryLang,
6424 indicationSubclasses[i].nameSpace);
|
6425 dj.gorey 1.135
|
6426 venkat.puvvada 1.275 // Get required property list from filter query (WHERE clause)
6427 // from this indication subclass
6428 //
6429 requiredPropertyList = _getPropertyList (
6430 queryExpression,
6431 indicationSubclasses[i].nameSpace,
6432 indicationSubclasses[i].classList[c]);
|
6433 chip 1.162
|
6434 kumpf 1.1 //
|
6435 venkat.puvvada 1.275 // Get providers that can serve the subscription
|
6436 kumpf 1.1 //
|
6437 venkat.puvvada 1.275 providerInstances.clear ();
6438 providerModuleInstances.clear ();
6439 if (_providerRegManager->getIndicationProviders(
6440 indicationSubclasses[i].nameSpace,
6441 indicationSubclasses[i].classList[c],
6442 requiredPropertyList,
6443 providerInstances,
6444 providerModuleInstances))
|
6445 kumpf 1.1 {
|
6446 venkat.puvvada 1.275 PEGASUS_ASSERT (providerInstances.size () ==
6447 providerModuleInstances.size ());
6448
6449 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
6450 "%u indication provider(s) found for class %s",
6451 providerInstances.size (),
6452 (const char *)indicationSubclasses[i].classList[c].
6453 getString ().getCString ()));
|
6454 kumpf 1.1
6455 //
|
6456 venkat.puvvada 1.275 // Merge into list of ProviderClassList structs
|
6457 kumpf 1.1 //
|
6458 venkat.puvvada 1.275 for (Uint32 j = 0, numI = providerInstances.size ();
6459 j < numI; j++)
|
6460 kumpf 1.1 {
|
6461 venkat.puvvada 1.275 provider.classList.clear ();
6462 Boolean duplicate = false;
6463
6464 //
6465 // See if indication provider is already in list
6466 //
6467 for (Uint32 k = 0, numP = indicationProviders.size ();
6468 k < numP && !duplicate; k++)
6469 {
6470 if ((providerInstances[j].getPath ().identical
6471 (indicationProviders[k].provider.getPath ())) &&
6472 (providerModuleInstances[j].getPath ().identical
6473 (indicationProviders[k].providerModule.getPath ())))
6474 {
6475 //
6476 // Indication provider is already in list
6477 // Add subclass to provider's class list
6478 //
6479 for(Uint32 s = 0, ns = indicationProviders[k].
6480 classList.size();
6481 s < ns; ++s)
6482 venkat.puvvada 1.275 {
6483 if (indicationProviders[k].classList[s].
6484 nameSpace == indicationSubclasses[i].
6485 nameSpace)
6486 {
6487 indicationProviders[k].classList[s].
6488 classList.append(
6489 indicationSubclasses[i].
6490 classList[c]);
6491 duplicate = true;
6492 break;
6493 }
6494 }
6495 if (!duplicate)
6496 {
6497 NamespaceClassList nscl;
6498 nscl.nameSpace =
6499 indicationSubclasses[i].nameSpace;
6500 nscl.classList.append(
6501 indicationSubclasses[i].classList[c]);
6502 indicationProviders[k].classList.append(nscl);
6503 venkat.puvvada 1.275 duplicate = true;
6504 }
6505 }
6506 }
6507
6508 if (!duplicate)
|
6509 kumpf 1.1 {
|
6510 kumpf 1.12 //
|
6511 venkat.puvvada 1.275 // Current provider is not yet in list
6512 // Create new list entry
|
6513 kumpf 1.12 //
|
6514 venkat.puvvada 1.275 provider.provider = providerInstances[j];
6515 provider.providerModule = providerModuleInstances[j];
6516 NamespaceClassList nscl;
6517 nscl.classList.append(
6518 indicationSubclasses[i].classList[c]);
6519 nscl.nameSpace =
6520 indicationSubclasses[i].nameSpace;
6521 provider.classList.append (nscl);
6522 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
6523 String remoteInformation;
6524 Boolean isRemote = _cimRepository->isRemoteNameSpace(
|
6525 thilo.boehm 1.278 nscl.nameSpace, remoteInformation);
|
6526 venkat.puvvada 1.275 provider.isRemoteNameSpace = isRemote;
6527 provider.remoteInfo = remoteInformation;
6528 #endif
6529 indicationProviders.append(provider);
|
6530 kumpf 1.1 }
|
6531 venkat.puvvada 1.275 } // for each indication provider instance
6532 } // if any providers
6533 } // for each indication subclass
6534 } // for each source namespace
|
6535 dj.gorey 1.135
|
6536 venkat.puvvada 1.269 // Verify if any control providers exists for this class
6537 if (!indicationProviders.size())
6538 {
|
6539 venkat.puvvada 1.275 indicationProviders =
6540 _getInternalIndProviders(indicationSubclasses);
|
6541 venkat.puvvada 1.269 }
6542
|
6543 kumpf 1.218 PEG_METHOD_EXIT();
|
6544 kumpf 1.19 return indicationProviders;
|
6545 kumpf 1.1 }
6546
|
6547 kumpf 1.218 CIMPropertyList IndicationService::_getPropertyList(
6548 const QueryExpression& queryExpression,
6549 const CIMNamespaceName& nameSpaceName,
6550 const CIMName& indicationClassName) const
|
6551 kumpf 1.1 {
|
6552 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6553 kumpf 1.114 "IndicationService::_getPropertyList");
6554
|
6555 kumpf 1.67 CIMPropertyList propertyList;
|
6556 kumpf 1.1
|
6557 carolann.graves 1.175 // Get all the properties referenced in the condition (WHERE clause)
|
6558 chuck 1.149 // Note: for CQL, this only returns the properties directly on the
6559 // class name passed in, not any properties on embedded objects.
|
6560 kumpf 1.1 //
|
6561 chuck 1.149 try
6562 {
|
6563 kumpf 1.218 CIMObjectPath classPath(String::EMPTY,
|
6564 chuck 1.149 nameSpaceName,
6565 indicationClassName);
|
6566 kumpf 1.218 propertyList = queryExpression.getWherePropertyList(classPath);
|
6567 chuck 1.149 }
|
6568 kumpf 1.218 catch (QueryException& qe)
|
6569 chuck 1.149 {
6570 // The class path was not the FROM class, or a subclass
6571 // of the FROM class.
|
6572 kumpf 1.218 String exceptionStr = qe.getMessage();
|
6573 chip 1.162
|
6574 kumpf 1.218 PEG_METHOD_EXIT();
6575 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exceptionStr);
|
6576 chuck 1.149 }
6577
|
6578 kumpf 1.218 if (propertyList.isNull())
|
6579 kumpf 1.11 {
|
6580 kumpf 1.67 //
|
6581 dj.gorey 1.135 // Return null property list for all properties
|
6582 kumpf 1.67 //
|
6583 carolann.graves 1.170 PEG_METHOD_EXIT();
|
6584 kumpf 1.67 return propertyList;
6585 }
6586 else
6587 {
|
6588 kumpf 1.218 Array<CIMName> propertyArray;
|
6589 kumpf 1.67
|
6590 chuck 1.149 // Get the property names
|
6591 kumpf 1.67 //
|
6592 kumpf 1.218 propertyArray = propertyList.getPropertyNameArray();
|
6593 kumpf 1.67
|
6594 kumpf 1.218 Array<CIMName> indicationClassProperties;
|
6595 carolann.graves 1.170 PEG_METHOD_EXIT();
|
6596 kumpf 1.218 return _checkPropertyList(propertyArray, nameSpaceName,
|
6597 carolann.graves 1.142 indicationClassName, indicationClassProperties);
|
6598 kumpf 1.11 }
|
6599 kumpf 1.37 }
6600
|
6601 kumpf 1.218 CIMPropertyList IndicationService::_checkPropertyList(
6602 const Array<CIMName>& propertyList,
6603 const CIMNamespaceName& nameSpaceName,
6604 const CIMName& indicationClassName,
6605 Array<CIMName>& indicationClassProperties) const
|
6606 kumpf 1.37 {
|
6607 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6608 kumpf 1.114 "IndicationService::_checkPropertyList");
|
6609 kumpf 1.37
|
6610 kumpf 1.14 //
|
6611 kumpf 1.17 // Check if list includes all properties in class
6612 // If so, must be set to NULL
|
6613 kumpf 1.14 //
|
6614 kumpf 1.19 CIMClass indicationClass;
6615
|
6616 kumpf 1.114 //
6617 // Get the indication class object from the repository
6618 // Specify localOnly=false because superclass properties are needed
6619 // Specify includeQualifiers=false because qualifiers are not needed
6620 //
|
6621 kumpf 1.218 indicationClass = _subscriptionRepository->getClass(
6622 nameSpaceName, indicationClassName, false, false, false,
6623 CIMPropertyList());
|
6624 kumpf 1.19
|
6625 kumpf 1.17 Boolean allProperties = true;
|
6626 kumpf 1.218 for (Uint32 i = 0; i < indicationClass.getPropertyCount(); i++)
|
6627 kumpf 1.17 {
|
6628 kumpf 1.218 indicationClassProperties.append(
6629 indicationClass.getProperty(i).getName());
6630 if (!ContainsCIMName(propertyList,
6631 indicationClass.getProperty(i).getName()))
|
6632 kumpf 1.17 {
6633 allProperties = false;
6634 }
6635 }
|
6636 kumpf 1.14
|
6637 kumpf 1.17 if (allProperties)
6638 {
6639 //
6640 // Return NULL CIMPropertyList
6641 //
|
6642 kumpf 1.218 PEG_METHOD_EXIT();
6643 return CIMPropertyList();
|
6644 kumpf 1.17 }
6645 else
6646 {
|
6647 kumpf 1.218 PEG_METHOD_EXIT();
6648 return CIMPropertyList(propertyList);
|
6649 kumpf 1.17 }
|
6650 kumpf 1.11 }
6651
|
6652 kumpf 1.218 String IndicationService::_getCondition(
6653 const String& filterQuery) const
|
6654 kumpf 1.11 {
|
6655 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6656 kumpf 1.114 "IndicationService::_getCondition");
6657
|
6658 kumpf 1.216 String condition;
|
6659 kumpf 1.11
6660 //
6661 // Get condition substring from filter query
6662 //
|
6663 kumpf 1.218 if (filterQuery.find(_QUERY_WHERE) != PEG_NOT_FOUND)
|
6664 kumpf 1.11 {
|
6665 kumpf 1.218 condition = filterQuery.subString(filterQuery.find(_QUERY_WHERE) + 6);
|
6666 kumpf 1.11 }
6667
|
6668 kumpf 1.218 PEG_METHOD_EXIT();
|
6669 kumpf 1.19 return condition;
|
6670 kumpf 1.11 }
6671
|
6672 kumpf 1.218 void IndicationService::_deleteReferencingSubscriptions(
6673 const CIMNamespaceName& nameSpace,
6674 const CIMName& referenceProperty,
6675 const CIMObjectPath& handler)
|
6676 kumpf 1.11 {
|
6677 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6678 kumpf 1.114 "IndicationService::_deleteReferencingSubscriptions");
|
6679 kumpf 1.19
|
6680 kumpf 1.218 Array<CIMInstance> deletedSubscriptions;
|
6681 kumpf 1.19
|
6682 kumpf 1.11 //
|
6683 kumpf 1.114 // Delete referencing subscriptions from the repository
|
6684 kumpf 1.11 //
|
6685 dj.gorey 1.135 deletedSubscriptions =
|
6686 kumpf 1.218 _subscriptionRepository->deleteReferencingSubscriptions(
6687 nameSpace, referenceProperty, handler);
|
6688 kumpf 1.11
6689 //
|
6690 kumpf 1.114 // Send delete request to each provider for each deleted subscription
|
6691 kumpf 1.11 //
|
6692 kumpf 1.218 for (Uint32 i = 0; i < deletedSubscriptions.size(); i++)
|
6693 kumpf 1.11 {
|
6694 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
6695 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
6696 kumpf 1.11
|
6697 kumpf 1.218 indicationProviders = _getDeleteParams(deletedSubscriptions[i],
|
6698 venkat.puvvada 1.275 indicationSubclasses);
|
6699 kumpf 1.11
|
6700 kumpf 1.1 //
|
6701 kumpf 1.114 // Send Delete requests
|
6702 kumpf 1.1 //
|
6703 dj.gorey 1.135 // NOTE: These Delete requests are not associated with a user
|
6704 kumpf 1.114 // request, so there is no associated authType or userName
6705 // The Creator from the subscription instance is used for userName,
6706 // and authType is not set
|
6707 kumpf 1.1 //
|
6708 kumpf 1.218 CIMInstance instance = deletedSubscriptions[i];
|
6709 kumpf 1.216 String creator;
|
6710 kumpf 1.218 _getCreator(instance, creator);
|
6711 chuck 1.75
|
6712 dj.gorey 1.135 // l10n start
|
6713 kumpf 1.195 AcceptLanguageList acceptLangs;
|
6714 kumpf 1.218 Uint32 propIndex = instance.findProperty(
6715 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
|
6716 kumpf 1.114 if (propIndex != PEG_NOT_FOUND)
6717 {
|
6718 kumpf 1.194 String acceptLangsString;
6719 instance.getProperty(propIndex).getValue().get(
6720 acceptLangsString);
6721 if (acceptLangsString.size())
6722 {
6723 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
6724 acceptLangsString);
6725 }
|
6726 kumpf 1.114 }
|
6727 kumpf 1.195 ContentLanguageList contentLangs;
|
6728 kumpf 1.218 propIndex = instance.findProperty(
6729 PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
|
6730 kumpf 1.114 if (propIndex != PEG_NOT_FOUND)
6731 {
|
6732 kumpf 1.194 String contentLangsString;
6733 instance.getProperty(propIndex).getValue().get(
6734 contentLangsString);
6735 if (contentLangsString.size())
6736 {
6737 contentLangs = LanguageParser::parseContentLanguageHeader(
6738 contentLangsString);
6739 }
|
6740 kumpf 1.114 }
|
6741 chuck 1.77 // l10n end
|
6742 chuck 1.75
|
6743 kumpf 1.218 _sendAsyncDeleteRequests(
6744 indicationProviders,
6745 deletedSubscriptions[i],
|
6746 kumpf 1.194 acceptLangs,
6747 contentLangs,
|
6748 kumpf 1.114 0, // no request
6749 indicationSubclasses,
6750 creator);
|
6751 kumpf 1.11 }
6752
|
6753 kumpf 1.218 PEG_METHOD_EXIT();
|
6754 kumpf 1.11 }
6755
|
6756 kumpf 1.218 Boolean IndicationService::_isExpired(
6757 const CIMInstance& instance) const
|
6758 kumpf 1.11 {
|
6759 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, "IndicationService::_isExpired");
|
6760 kumpf 1.11
|
6761 kumpf 1.35 Boolean isExpired = true;
6762 Uint64 timeRemaining = 0;
|
6763 kumpf 1.1
|
6764 kumpf 1.11 //
|
6765 kumpf 1.35 // Get time remaining, if subscription has a duration
|
6766 kumpf 1.11 //
|
6767 kumpf 1.218 if (_getTimeRemaining(instance, timeRemaining))
|
6768 kumpf 1.13 {
|
6769 kumpf 1.35 if (timeRemaining > 0)
6770 {
6771 isExpired = false;
6772 }
|
6773 kumpf 1.13 }
6774 else
6775 {
|
6776 kumpf 1.35 //
6777 // If there is no duration, the subscription has no expiration date
6778 //
6779 isExpired = false;
|
6780 kumpf 1.13 }
|
6781 kumpf 1.1
|
6782 kumpf 1.218 PEG_METHOD_EXIT();
|
6783 kumpf 1.35 return isExpired;
|
6784 kumpf 1.1 }
6785
|
6786 kumpf 1.218 void IndicationService::_deleteExpiredSubscription(
6787 CIMObjectPath& subscription)
|
6788 kumpf 1.1 {
|
6789 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6790 kumpf 1.114 "IndicationService::_deleteExpiredSubscription");
|
6791 kumpf 1.1
|
6792 kumpf 1.88 CIMInstance subscriptionInstance;
|
6793 kumpf 1.11 //
|
6794 kumpf 1.114 // Delete instance from repository
|
6795 kumpf 1.88 //
|
6796 kumpf 1.218 subscriptionInstance =
6797 _subscriptionRepository->deleteSubscription(subscription);
|
6798 kumpf 1.88
6799 //
|
6800 dj.gorey 1.135 // If a valid instance object was returned, the subscription was
|
6801 kumpf 1.114 // successfully deleted
|
6802 kumpf 1.11 //
|
6803 kumpf 1.218 if (!subscriptionInstance.isUninitialized())
|
6804 kumpf 1.11 {
|
6805 kumpf 1.114 //
6806 // If subscription was active, send delete requests to providers
6807 // and update hash tables
6808 //
6809 Uint16 subscriptionState;
6810 CIMValue subscriptionStateValue;
|
6811 kumpf 1.218 subscriptionStateValue = subscriptionInstance.getProperty(
6812 subscriptionInstance.findProperty(
6813 PEGASUS_PROPERTYNAME_SUBSCRIPTION_STATE)).getValue();
6814 subscriptionStateValue.get(subscriptionState);
|
6815 kumpf 1.1
|
6816 w.otsuka 1.207 if ((subscriptionState == STATE_ENABLED) ||
6817 (subscriptionState == STATE_ENABLEDDEGRADED))
|
6818 kumpf 1.114 {
|
6819 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
6820 venkat.puvvada 1.275 Array<NamespaceClassList> indicationSubclasses;
|
6821 kumpf 1.114 CIMNamespaceName sourceNamespaceName;
|
6822 kumpf 1.88
|
6823 kumpf 1.218 subscriptionInstance.setPath(subscription);
|
6824 kumpf 1.88
|
6825 kumpf 1.218 indicationProviders = _getDeleteParams(subscriptionInstance,
|
6826 venkat.puvvada 1.275 indicationSubclasses);
|
6827 kumpf 1.88
|
6828 kumpf 1.114 //
6829 // Send Delete requests
6830 //
|
6831 dj.gorey 1.135 // NOTE: These Delete requests are not associated with a user
|
6832 kumpf 1.114 // request, so there is no associated authType or userName
6833 // The Creator from the subscription instance is used for userName,
6834 // and authType is not set
6835 //
6836 String creator;
|
6837 kumpf 1.218 _getCreator(subscriptionInstance, creator);
|
6838 kumpf 1.88
|
6839 kumpf 1.114 //
|
6840 dj.gorey 1.135 // Get the language tags that were saved with the subscription
6841 // instance
|
6842 kumpf 1.114 //
|
6843 kumpf 1.195 AcceptLanguageList acceptLangs;
|
6844 kumpf 1.218 Uint32 propIndex = subscriptionInstance.findProperty(
6845 PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
|
6846 kumpf 1.114 if (propIndex != PEG_NOT_FOUND)
|
6847 dj.gorey 1.135 {
|
6848 kumpf 1.194 String acceptLangsString;
6849 subscriptionInstance.getProperty(propIndex).getValue().get(
6850 acceptLangsString);
6851 if (acceptLangsString.size())
6852 {
6853 acceptLangs = LanguageParser::parseAcceptLanguageHeader(
6854 acceptLangsString);
6855 }
|
6856 dj.gorey 1.135 }
|
6857 kumpf 1.195 ContentLanguageList contentLangs;
|
6858 kumpf 1.218 propIndex = subscriptionInstance.findProperty(
6859 PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
|
6860 kumpf 1.114 if (propIndex != PEG_NOT_FOUND)
|
6861 dj.gorey 1.135 {
|
6862 kumpf 1.194 String contentLangsString;
6863 subscriptionInstance.getProperty(propIndex).getValue().get(
6864 contentLangsString);
6865 if (contentLangsString.size())
6866 {
6867 contentLangs = LanguageParser::parseContentLanguageHeader(
6868 contentLangsString);
6869 }
|
6870 kumpf 1.114 }
|
6871 kumpf 1.88
|
6872 kumpf 1.218 subscriptionInstance.setPath(subscription);
6873 _sendAsyncDeleteRequests(indicationProviders,
|
6874 venkat.puvvada 1.275 subscriptionInstance,
|
6875 kumpf 1.194 acceptLangs,
6876 contentLangs,
|
6877 kumpf 1.114 0, // no request
6878 indicationSubclasses,
6879 creator);
6880 }
|
6881 rohini.deshpande 1.282 #ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
6882 _deleteFilterHandler(subscriptionInstance);
6883 #endif
|
6884 kumpf 1.114 }
6885 else
6886 {
|
6887 kumpf 1.88 //
|
6888 kumpf 1.114 // The subscription may have already been deleted by another thread
|
6889 kumpf 1.88 //
6890 }
6891
|
6892 kumpf 1.218 PEG_METHOD_EXIT();
|
6893 kumpf 1.88 }
|
6894 kumpf 1.1
|
6895 rohini.deshpande 1.282
6896 #ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN
6897 //If the subscription is wsman then Delete the filter and handler
6898 //also from the repository.
6899 void IndicationService::_deleteFilterHandler(
6900 CIMInstance& subscriptionInstance)
6901 {
6902 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
6903 "IndicationService::_deleteFilterHandler");
6904 Uint32 handlerPropIndex = subscriptionInstance.findProperty(
6905 PEGASUS_PROPERTYNAME_HANDLER);
6906 if(handlerPropIndex != PEG_NOT_FOUND)
6907 {
6908 CIMProperty handlerProperty = subscriptionInstance.getProperty(
6909 handlerPropIndex);
6910 CIMObjectPath handlerObjPath;
6911 handlerProperty.getValue().get(handlerObjPath);
6912 if(handlerObjPath.getClassName() ==
6913 PEGASUS_CLASSNAME_INDHANDLER_WSMAN)
6914 {
6915 Array<CIMKeyBinding> keyBindings = handlerObjPath.
6916 rohini.deshpande 1.282 getKeyBindings();
6917 // Get the Handler name
6918 String handlerName;
6919 for(Uint32 i = 0 ; i < keyBindings.size(); i++)
6920 {
6921 if(keyBindings[i].getName().getString() ==
6922 PEGASUS_PROPERTYNAME_NAME.getString())
6923 {
6924 handlerName = keyBindings[i].getValue();
6925 break;
6926 }
6927 }
6928 _subscriptionRepository->deleteInstance(
6929 handlerObjPath.getNameSpace(), handlerObjPath);
6930 }
6931 }
6932
6933 Uint32 filterPropIndex = subscriptionInstance.findProperty(
6934 PEGASUS_PROPERTYNAME_FILTER);
6935 if(filterPropIndex != PEG_NOT_FOUND)
6936 {
6937 rohini.deshpande 1.282 CIMProperty filterProperty = subscriptionInstance.
6938 getProperty(filterPropIndex);
6939 CIMObjectPath filterObjPath;
6940 filterProperty.getValue().get(filterObjPath);
6941 Array<CIMKeyBinding> keyBindings = filterObjPath.
6942 getKeyBindings();
6943 // Get Filter name
6944 String filterName;
6945 for(Uint32 i = 0 ; i < keyBindings.size(); i++)
6946 {
6947 if(keyBindings[i].getName().getString() ==
6948 PEGASUS_PROPERTYNAME_NAME.getString())
6949 {
6950 filterName = keyBindings[i].getValue();
6951 break;
6952 }
6953 }
6954 // If filter was created by the wsman subscribe request,
6955 // then delete it. If filter is created by wsman subscribe
6956 // request, subscriptionInfo and filter name will match.
6957 Uint32 subInfoIndex = subscriptionInstance.findProperty(
6958 rohini.deshpande 1.282 _PROPERTY_SUBSCRIPTION_INFO);
6959 CIMProperty subInfoProperty = subscriptionInstance.
6960 getProperty(subInfoIndex);
6961 String subscriptionInfo;
6962 subInfoProperty.getValue().get(subscriptionInfo);
6963 if (subscriptionInfo == filterName)
6964 {
6965 _subscriptionRepository->deleteInstance(
6966 filterObjPath.getNameSpace(),filterObjPath);
6967 }
6968 }
6969 PEG_METHOD_EXIT();
6970 }
6971 #endif
6972
|
6973 kumpf 1.218 Boolean IndicationService::_getTimeRemaining(
6974 const CIMInstance& instance,
6975 Uint64& timeRemaining) const
|
6976 kumpf 1.1 {
|
6977 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
6978 kumpf 1.114 "IndicationService::_getTimeRemaining");
|
6979 kumpf 1.1
|
6980 kumpf 1.35 Boolean hasDuration = true;
6981 timeRemaining = 0;
6982
|
6983 kumpf 1.11 //
6984 // Calculate time remaining from subscription
6985 // start time, subscription duration, and current date time
6986 //
|
6987 kumpf 1.1
|
6988 kumpf 1.11 //
|
6989 dj.gorey 1.135 // NOTE: It is assumed that the instance passed to this method is a
|
6990 kumpf 1.35 // subscription instance, and that the Start Time property exists
6991 // and has a value
|
6992 kumpf 1.11 //
|
6993 kumpf 1.1
|
6994 kumpf 1.11 //
6995 // Get Subscription Start Time
6996 //
6997 CIMValue startTimeValue;
6998 CIMDateTime startTime;
|
6999 kumpf 1.218 Uint32 startTimeIndex = instance.findProperty(_PROPERTY_STARTTIME);
7000 PEGASUS_ASSERT(startTimeIndex != PEG_NOT_FOUND);
7001 startTimeValue = instance.getProperty(startTimeIndex).getValue();
7002 PEGASUS_ASSERT(!(startTimeValue.isNull()));
7003 startTimeValue.get(startTime);
|
7004 kumpf 1.1
|
7005 kumpf 1.11 //
7006 // Get Subscription Duration
7007 //
|
7008 kumpf 1.218 Uint32 durationIndex = instance.findProperty(_PROPERTY_DURATION);
|
7009 carolann.graves 1.171 if (durationIndex != PEG_NOT_FOUND)
|
7010 kumpf 1.35 {
7011 CIMValue durationValue;
|
7012 kumpf 1.218 durationValue = instance.getProperty(durationIndex).getValue();
7013 if (durationValue.isNull())
|
7014 kumpf 1.35 {
7015 hasDuration = false;
7016 }
7017 else
7018 {
7019 Uint64 duration;
|
7020 kumpf 1.218 durationValue.get(duration);
|
7021 kumpf 1.1
|
7022 kumpf 1.35 //
|
7023 david.dillard 1.174 // A Start Time set to the _ZERO_INTERVAL_STRING indicates that
|
7024 carolann.graves 1.171 // the subscription has not yet been enabled for the first time
7025 // In this case, the time remaining is equal to the Duration
|
7026 kumpf 1.35 //
|
7027 kumpf 1.218 if (startTime.isInterval())
|
7028 carolann.graves 1.171 {
|
7029 kumpf 1.218 if (startTime.equal(CIMDateTime(_ZERO_INTERVAL_STRING)))
|
7030 carolann.graves 1.171 {
7031 timeRemaining = (Sint64) duration;
7032 }
|
7033 dj.gorey 1.135
|
7034 carolann.graves 1.171 //
7035 // Any interval value other than _ZERO_INTERVAL_STRING
7036 // indicates an invalid Start Time value in the instance
7037 //
7038 else
7039 {
|
7040 kumpf 1.218 PEGASUS_ASSERT(false);
|
7041 carolann.graves 1.171 }
|
7042 kumpf 1.65 }
|
7043 carolann.graves 1.171
7044 else
|
7045 kumpf 1.65 {
|
7046 carolann.graves 1.171 //
|
7047 david.dillard 1.174 // Get current date time, and calculate Subscription Time
|
7048 carolann.graves 1.171 // Remaining
7049 //
7050 CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime();
7051
|
7052 kumpf 1.235 Sint64 difference = CIMDateTime::getDifference(
7053 startTime, currentDateTime);
|
7054 kumpf 1.218 PEGASUS_ASSERT(difference >= 0);
|
7055 carolann.graves 1.171 if (((Sint64) duration - difference) >= 0)
7056 {
7057 timeRemaining = (Sint64) duration - difference;
7058 }
|
7059 kumpf 1.35 }
7060 }
7061 }
7062 else
|
7063 kumpf 1.1 {
|
7064 kumpf 1.35 hasDuration = false;
|
7065 kumpf 1.1 }
|
7066 kumpf 1.35
|
7067 kumpf 1.218 PEG_METHOD_EXIT();
|
7068 kumpf 1.35 return hasDuration;
7069 }
7070
|
7071 kumpf 1.218 void IndicationService::_setTimeRemaining(
7072 CIMInstance& instance)
|
7073 kumpf 1.35 {
|
7074 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7075 kumpf 1.114 "IndicationService::_setTimeRemaining");
|
7076 kumpf 1.35
7077 Uint64 timeRemaining = 0;
|
7078 kumpf 1.218 if (_getTimeRemaining(instance, timeRemaining))
|
7079 kumpf 1.1 {
|
7080 kumpf 1.35 //
7081 // Add or set the value of the property with the calculated value
7082 //
|
7083 kumpf 1.218 if (instance.findProperty(_PROPERTY_TIMEREMAINING) == PEG_NOT_FOUND)
|
7084 kumpf 1.35 {
|
7085 kumpf 1.218 instance.addProperty(
7086 CIMProperty(_PROPERTY_TIMEREMAINING, timeRemaining));
|
7087 kumpf 1.35 }
|
7088 dj.gorey 1.135 else
|
7089 kumpf 1.35 {
|
7090 kumpf 1.218 CIMProperty remaining = instance.getProperty(
7091 instance.findProperty(_PROPERTY_TIMEREMAINING));
7092 remaining.setValue(CIMValue(timeRemaining));
|
7093 kumpf 1.35 }
|
7094 kumpf 1.1 }
7095
|
7096 kumpf 1.218 PEG_METHOD_EXIT();
|
7097 kumpf 1.1 }
7098
|
7099 kumpf 1.218 void IndicationService::_getCreateParams(
7100 const CIMInstance& subscriptionInstance,
|
7101 venkat.puvvada 1.275 Array<NamespaceClassList>& indicationSubclasses,
|
7102 kumpf 1.218 Array<ProviderClassList>& indicationProviders,
7103 CIMPropertyList& propertyList,
7104 String& condition,
7105 String& query,
7106 String& queryLanguage)
|
7107 kumpf 1.1 {
|
7108 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7109 kumpf 1.114 "IndicationService::_getCreateParams");
7110
|
7111 kumpf 1.63 CIMName indicationClassName;
|
7112 kumpf 1.11 condition = String::EMPTY;
|
7113 kumpf 1.124 query = String::EMPTY;
|
7114 kumpf 1.11 queryLanguage = String::EMPTY;
|
7115 w.otsuka 1.217 String filterName;
|
7116 kumpf 1.1
|
7117 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNameSpaces;
|
7118 kumpf 1.11 //
|
7119 kumpf 1.16 // Get filter properties
|
7120 kumpf 1.11 //
|
7121 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
7122 subscriptionInstance,
7123 query,
7124 sourceNameSpaces,
7125 queryLanguage,
7126 filterName);
|
7127 chuck 1.149
|
7128 venkat.puvvada 1.275 for (Uint32 i = 0, n = sourceNameSpaces.size(); i < n; ++i)
7129 {
|
7130 dj.gorey 1.135
|
7131 venkat.puvvada 1.275 //
7132 // Build the query expression from the filter query
7133 //
7134 QueryExpression queryExpression = _getQueryExpression(
7135 query,
7136 queryLanguage,
7137 sourceNameSpaces[i]);
|
7138 kumpf 1.19
|
7139 venkat.puvvada 1.275 //
7140 // Get indication class name from filter query (FROM clause)
7141 //
7142 indicationClassName = _getIndicationClassName(
7143 queryExpression,
7144 sourceNameSpaces[i]);
7145
7146 //
7147 // Get list of subclass names for indication class
7148 //
7149 Array<CIMName> indSubclasses =
7150 _subscriptionRepository->getIndicationSubclasses(
7151 sourceNameSpaces[i],
7152 indicationClassName);
7153
7154 NamespaceClassList namespaceClassList;
7155 namespaceClassList.nameSpace = sourceNameSpaces[i];
7156 namespaceClassList.classList = indSubclasses;
7157 indicationSubclasses.append(namespaceClassList);
7158 }
|
7159 kumpf 1.1
7160 //
|
7161 kumpf 1.11 // Get indication provider class lists
|
7162 kumpf 1.1 //
|
7163 chuck 1.149 indicationProviders = _getIndicationProviders(
|
7164 venkat.puvvada 1.275 query,
7165 queryLanguage,
7166 indicationClassName,
7167 indicationSubclasses);
|
7168 kumpf 1.11
|
7169 kumpf 1.218 if (indicationProviders.size() > 0)
|
7170 kumpf 1.1 {
|
7171 kumpf 1.218 condition = _getCondition(query);
|
7172 kumpf 1.16 }
7173
|
7174 kumpf 1.218 PEG_METHOD_EXIT();
|
7175 kumpf 1.16 }
|
7176 dj.gorey 1.135
|
7177 venkat.puvvada 1.269 Array<ProviderClassList> IndicationService::_getInternalIndProviders(
|
7178 venkat.puvvada 1.275 const Array<NamespaceClassList>& indicationSubclasses) const
|
7179 venkat.puvvada 1.269 {
7180 Array<ProviderClassList> providers;
7181 for (Uint32 i = 0, n = indicationSubclasses.size(); i < n; ++i)
7182 {
|
7183 venkat.puvvada 1.275 for (Uint32 k = 0, m = indicationSubclasses[i].classList.size();
7184 k < m; ++k)
|
7185 venkat.puvvada 1.269 {
|
7186 venkat.puvvada 1.275 for (ControlProvIndRegTable::Iterator j =
7187 _controlProvIndRegTable.start (); j; j++)
7188 {
7189 ControlProvIndReg reg = j.value();
7190 if (indicationSubclasses[i].classList[k] == reg.className &&
7191 (reg.nameSpace.isNull() ||
7192 reg.nameSpace == indicationSubclasses[i].nameSpace))
7193 {
7194 String controlProviderName;
7195 reg.provider.getProperty(
7196 reg.provider.findProperty(
7197 PEGASUS_PROPERTYNAME_NAME)).getValue().get(
7198 controlProviderName);
7199 ProviderClassList provider;
7200 provider.controlProviderName = controlProviderName;
7201 provider.provider = reg.provider;
7202 provider.providerModule = reg.providerModule;
7203 NamespaceClassList nscl;
7204 nscl.nameSpace =
7205 indicationSubclasses[i].nameSpace;
7206 nscl.classList.append(reg.className);
7207 venkat.puvvada 1.275 provider.classList.append(nscl);
7208 providers.append(provider);
7209 }
|
7210 venkat.puvvada 1.269 }
7211 }
7212 }
7213
7214 return providers;
7215 }
7216
|
7217 kumpf 1.218 void IndicationService::_getCreateParams(
7218 const CIMInstance& subscriptionInstance,
|
7219 venkat.puvvada 1.275 Array<NamespaceClassList>& indicationSubclasses,
|
7220 kumpf 1.218 CIMPropertyList& propertyList,
7221 String& condition,
7222 String& query,
7223 String& queryLanguage)
|
7224 kumpf 1.16 {
|
7225 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7226 kumpf 1.114 "IndicationService::_getCreateParams");
7227
|
7228 kumpf 1.16 condition = String::EMPTY;
|
7229 kumpf 1.124 query = String::EMPTY;
|
7230 kumpf 1.16 queryLanguage = String::EMPTY;
|
7231 w.otsuka 1.217 String filterName;
|
7232 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
7233 kumpf 1.16
7234 //
7235 // Get filter properties
7236 //
|
7237 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
7238 subscriptionInstance,
|
7239 kumpf 1.218 query,
|
7240 venkat.puvvada 1.275 sourceNamespaces,
|
7241 kumpf 1.218 queryLanguage,
|
7242 venkat.puvvada 1.275 filterName);
|
7243 dj.gorey 1.135
|
7244 venkat.puvvada 1.275 for (Uint32 i = 0, n = sourceNamespaces.size(); i < n; ++i)
7245 {
7246 QueryExpression queryExpression = _getQueryExpression(
7247 query,
7248 queryLanguage,
7249 sourceNamespaces[i]);
7250
7251 //
7252 // Get indication class name from filter query (FROM clause)
7253 //
7254 CIMName indicationClassName =
7255 _getIndicationClassName(queryExpression, sourceNamespaces[i]);
|
7256 kumpf 1.218
|
7257 venkat.puvvada 1.275 //
7258 // Get required property list from filter query (WHERE clause)
7259 //
7260 propertyList = _getPropertyList(
7261 queryExpression,
7262 sourceNamespaces[i],
7263 indicationClassName);
|
7264 kumpf 1.11
|
7265 venkat.puvvada 1.275 //
7266 // Get condition from filter query (WHERE clause)
7267 //
7268 condition = _getCondition(query);
|
7269 dj.gorey 1.135
|
7270 venkat.puvvada 1.275 //
7271 // Get list of subclass names for indication class
7272 //
7273 Array<CIMName> indSubclasses =
7274 _subscriptionRepository->getIndicationSubclasses(
7275 sourceNamespaces[i],
7276 indicationClassName);
7277
7278 NamespaceClassList namespaceClassList;
7279 namespaceClassList.nameSpace = sourceNamespaces[i];
7280 namespaceClassList.classList = indSubclasses;
7281 indicationSubclasses.append(namespaceClassList);
7282 }
|
7283 kumpf 1.73
|
7284 kumpf 1.218 PEG_METHOD_EXIT();
|
7285 kumpf 1.1 }
|
7286 dj.gorey 1.135
|
7287 kumpf 1.218 Array<ProviderClassList> IndicationService::_getDeleteParams(
7288 const CIMInstance& subscriptionInstance,
|
7289 venkat.puvvada 1.275 Array<NamespaceClassList>& indicationSubclasses)
|
7290 kumpf 1.1 {
|
7291 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7292 kumpf 1.114 "IndicationService::_getDeleteParams");
7293
|
7294 kumpf 1.11 String filterQuery;
|
7295 chuck 1.149 String queryLanguage;
|
7296 w.otsuka 1.217 String filterName;
|
7297 kumpf 1.63 CIMName indicationClassName;
|
7298 kumpf 1.218 Array<ProviderClassList> indicationProviders;
|
7299 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
7300 kumpf 1.6
|
7301 kumpf 1.1 //
|
7302 kumpf 1.16 // Get filter properties
|
7303 kumpf 1.11 //
|
7304 venkat.puvvada 1.275 _subscriptionRepository->getFilterProperties(
7305 subscriptionInstance,
7306 filterQuery,
7307 sourceNamespaces,
7308 queryLanguage,
7309 filterName);
|
7310 dj.gorey 1.135
|
7311 venkat.puvvada 1.275 for(Uint32 i = 0, n = sourceNamespaces.size(); i < n; ++i)
7312 {
7313 QueryExpression queryExpression =
7314 _getQueryExpression(
7315 filterQuery,
7316 queryLanguage,
7317 sourceNamespaces[i]);
7318
7319 //
7320 // Get indication class name from filter query (FROM clause)
7321 //
7322 indicationClassName =
7323 _getIndicationClassName(queryExpression, sourceNamespaces[i]);
7324
7325 //
7326 // Get list of subclass names for indication class
7327 //
7328 Array<CIMName> indSubclasses =
7329 _subscriptionRepository->getIndicationSubclasses(
7330 sourceNamespaces[i],
7331 indicationClassName);
|
7332 dj.gorey 1.135
|
7333 venkat.puvvada 1.275 NamespaceClassList namespaceClassList;
7334 namespaceClassList.nameSpace = sourceNamespaces[i];
7335 namespaceClassList.classList = indSubclasses;
7336 indicationSubclasses.append(namespaceClassList);
7337 }
|
7338 kumpf 1.19
|
7339 kumpf 1.11 //
|
7340 kumpf 1.73 // Get indication provider class lists from Active Subscriptions table
|
7341 kumpf 1.11 //
|
7342 kumpf 1.73 ActiveSubscriptionsTableEntry tableValue;
|
7343 kumpf 1.218 if (_subscriptionTable->getSubscriptionEntry(
7344 subscriptionInstance.getPath(), tableValue))
|
7345 kumpf 1.73 {
7346 indicationProviders = tableValue.providers;
7347 }
7348 else
7349 {
7350 //
|
7351 kumpf 1.88 // Subscription not found in Active Subscriptions table
|
7352 kumpf 1.73 //
7353 }
|
7354 kumpf 1.11
|
7355 kumpf 1.218 PEG_METHOD_EXIT();
|
7356 kumpf 1.11 return indicationProviders;
7357 }
|
7358 dj.gorey 1.135
|
7359 venkat.puvvada 1.275 Array<ProviderClassList> IndicationService::
7360 _getIndicationProvidersWithNamespaceClassList(
7361 const Array<ProviderClassList> &providers)
7362 {
7363 Array<ProviderClassList> indProviders;
7364 for (Uint32 i = 0, n = providers.size(); i < n; ++i)
7365 {
7366 for (Uint32 j = 0, m = providers[i].classList.size(); j < m; ++j)
7367 {
7368 PEGASUS_ASSERT(
7369 providers[i].classList[j].nameSpace != CIMNamespaceName());
7370 ProviderClassList prcl = providers[i];
7371 NamespaceClassList nscl;
7372 nscl.nameSpace = providers[i].classList[j].nameSpace;
7373 nscl.classList = providers[i].classList[j].classList;
7374 prcl.classList.clear();
7375 prcl.classList.append(nscl);
7376 indProviders.append(prcl);
7377
7378 }
7379 }
7380 venkat.puvvada 1.275 return indProviders;
7381 }
7382
7383 void IndicationService::_addProviderToAcceptedProviderList(
7384 Array<ProviderClassList> &acceptedProviders,
7385 ProviderClassList &provider)
7386 {
7387 PEGASUS_ASSERT(provider.classList.size() == 1);
7388
7389 for (Uint32 i = 0, n = acceptedProviders.size(); i < n; ++i)
7390 {
7391 if (acceptedProviders[i].provider.getPath().identical(
7392 provider.provider.getPath()) &&
7393 acceptedProviders[i].providerModule.getPath().identical(
7394 provider.providerModule.getPath()))
7395 {
7396 acceptedProviders[i].classList.append(provider.classList[0]);
7397 return;
7398 }
7399 }
7400 acceptedProviders.append(provider);
7401 venkat.puvvada 1.275 #ifdef PEGASUS_ENABLE_INDICATION_COUNT
7402 _providerIndicationCountTable.insertEntry(provider.provider);
7403 #endif
7404 }
7405
|
7406 kumpf 1.218 void IndicationService::_sendAsyncCreateRequests(
|
7407 venkat.puvvada 1.275 const Array<ProviderClassList>& providers,
|
7408 kumpf 1.218 const CIMPropertyList& propertyList,
7409 const String& condition,
7410 const String& query,
7411 const String& queryLanguage,
7412 const CIMInstance& subscription,
7413 const AcceptLanguageList& acceptLangs,
7414 const ContentLanguageList& contentLangs,
7415 const CIMRequestMessage * origRequest,
|
7416 venkat.puvvada 1.275 const Array<NamespaceClassList>& indicationSubclasses,
|
7417 kumpf 1.218 const String& userName,
7418 const String& authType)
|
7419 kumpf 1.88 {
|
7420 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7421 carolann.graves 1.164 "IndicationService::_sendAsyncCreateRequests");
|
7422 kumpf 1.114
|
7423 kumpf 1.88 CIMValue propValue;
7424 Uint16 repeatNotificationPolicy;
|
7425 mday 1.20
|
7426 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders =
7427 _getIndicationProvidersWithNamespaceClassList(providers);
7428
|
7429 kumpf 1.107 // If there are no providers to accept the subscription, just return
7430 if (indicationProviders.size() == 0)
7431 {
|
7432 carolann.graves 1.170 PEG_METHOD_EXIT();
|
7433 kumpf 1.107 return;
7434 }
7435
|
7436 venkat.puvvada 1.258 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
7437 _asyncRequestsPending++;
7438 AutoPtr<AtomicInt, DecAtomicInt> counter(&_asyncRequestsPending);
7439 #endif
7440
|
7441 kumpf 1.88 //
7442 // Get repeat notification policy value from subscription instance
7443 //
|
7444 kumpf 1.218 propValue = subscription.getProperty(
7445 subscription.findProperty(
7446 _PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue();
7447 propValue.get(repeatNotificationPolicy);
|
7448 kumpf 1.88
|
7449 w.otsuka 1.154 CIMRequestMessage * aggRequest=0;
|
7450 dj.gorey 1.135
|
7451 kumpf 1.88 if (origRequest == 0)
7452 {
7453 //
7454 // Initialize -- no request associated with this create
7455 //
7456 aggRequest = 0;
7457 }
7458 else
7459 {
7460 //
|
7461 carolann.graves 1.164 // Create Instance or Modify Instance
|
7462 kumpf 1.88 //
|
7463 kumpf 1.218 switch (origRequest->getType())
|
7464 kumpf 1.88 {
7465 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
7466 {
7467 CIMCreateInstanceRequestMessage * request =
7468 (CIMCreateInstanceRequestMessage *) origRequest;
7469 CIMCreateInstanceRequestMessage * requestCopy =
|
7470 kumpf 1.218 new CIMCreateInstanceRequestMessage(*request);
|
7471 kumpf 1.88 aggRequest = requestCopy;
7472 break;
7473 }
7474
7475 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
7476 {
7477 CIMModifyInstanceRequestMessage * request =
7478 (CIMModifyInstanceRequestMessage *) origRequest;
7479 CIMModifyInstanceRequestMessage * requestCopy =
|
7480 kumpf 1.218 new CIMModifyInstanceRequestMessage(*request);
|
7481 kumpf 1.88 aggRequest = requestCopy;
7482 break;
7483 }
7484
7485 default:
7486 {
|
7487 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
7488 thilo.boehm 1.242 "Unexpected origRequest type %s "
7489 "in _sendAsyncCreateRequests",
7490 MessageTypeToString(origRequest->getType())));
|
7491 kumpf 1.218 PEGASUS_ASSERT(false);
|
7492 kumpf 1.88 break;
7493 }
7494 }
7495 }
7496
7497 //
7498 // Create an aggregate object for the create subscription requests
7499 //
|
7500 marek 1.268 AutoPtr<IndicationOperationAggregate> operationAggregate(
|
7501 venkat.puvvada 1.269 new IndicationOperationAggregate(
7502 aggRequest,
7503 indicationProviders[0].controlProviderName,
7504 indicationSubclasses));
7505
|
7506 marek 1.268 operationAggregate.get()->setNumberIssued(indicationProviders.size());
|
7507 kumpf 1.88
7508 //
7509 // Send Create request to each provider
7510 //
|
7511 kumpf 1.218 for (Uint32 i = 0; i < indicationProviders.size(); i++)
|
7512 kumpf 1.88 {
7513 //
7514 // Create the create subscription request
7515 //
|
7516 marek 1.268 AutoPtr<CIMCreateSubscriptionRequestMessage> request(
|
7517 kumpf 1.218 new CIMCreateSubscriptionRequestMessage(
7518 XmlWriter::getNextMessageId(),
|
7519 venkat.puvvada 1.275 indicationProviders[i].classList[0].nameSpace,
|
7520 kumpf 1.88 subscription,
|
7521 venkat.puvvada 1.275 indicationProviders[i].classList[0].classList,
|
7522 kumpf 1.88 propertyList,
7523 repeatNotificationPolicy,
|
7524 kumpf 1.124 query,
|
7525 kumpf 1.218 QueueIdStack(_providerManager, getQueueId()),
|
7526 kumpf 1.88 authType,
|
7527 marek 1.268 userName));
|
7528 kumpf 1.88
7529 //
7530 // Store a copy of the request in the operation aggregate instance
7531 //
|
7532 marek 1.268 AutoPtr<CIMCreateSubscriptionRequestMessage> requestCopy(
7533 new CIMCreateSubscriptionRequestMessage(* (request.get())));
7534
7535 requestCopy.get()->operationContext.insert(ProviderIdContainer(
|
7536 kumpf 1.218 indicationProviders[i].providerModule
7537 ,indicationProviders[i].provider
|
7538 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
7539 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
7540 ,indicationProviders[i].remoteInfo
|
7541 dave.sudlik 1.208 #endif
7542 ));
|
7543 marek 1.268 operationAggregate.get()->appendRequest(requestCopy.get());
7544 request.get()->operationContext.insert(ProviderIdContainer(
|
7545 kumpf 1.218 indicationProviders[i].providerModule
7546 ,indicationProviders[i].provider
|
7547 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
7548 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
7549 ,indicationProviders[i].remoteInfo
|
7550 dave.sudlik 1.208 #endif
7551 ));
|
7552 marek 1.268 request.get()->operationContext.insert(
|
7553 kumpf 1.218 SubscriptionInstanceContainer(subscription));
|
7554 marek 1.268 request.get()->operationContext.insert(
|
7555 kumpf 1.218 SubscriptionFilterConditionContainer(condition,queryLanguage));
|
7556 marek 1.268 request.get()->operationContext.insert(
|
7557 venkat.puvvada 1.275 SubscriptionFilterQueryContainer(
7558 query,
7559 queryLanguage,
7560 indicationProviders[i].classList[0].nameSpace));
|
7561 marek 1.268 request.get()->operationContext.insert(IdentityContainer(userName));
7562 request.get()->operationContext.set(
|
7563 kumpf 1.218 ContentLanguageListContainer(contentLangs));
|
7564 marek 1.268 request.get()->operationContext.set(
7565 AcceptLanguageListContainer(acceptLangs));
|
7566 se.gupta 1.126
|
7567 kumpf 1.218 AsyncOpNode * op = this->get_op();
|
7568 kumpf 1.88
|
7569 venkat.puvvada 1.269 AutoPtr<AsyncRequest> asyncRequest;
7570 Uint32 serviceId;
7571 if (!indicationProviders[i].controlProviderName.size())
7572 {
7573 serviceId = _providerManager;
7574 asyncRequest.reset(
7575 new AsyncLegacyOperationStart(
7576 op,
7577 serviceId,
7578 request.get()));
7579 }
7580 else
7581 {
7582 serviceId = _moduleController;
7583 asyncRequest.reset(
7584 new AsyncModuleOperationStart(
7585 op,
7586 serviceId,
7587 indicationProviders[i].controlProviderName,
7588 request.get()));
7589 }
|
7590 kumpf 1.88
|
7591 kumpf 1.218 SendAsync(
7592 op,
|
7593 venkat.puvvada 1.269 serviceId,
|
7594 kumpf 1.88 IndicationService::_aggregationCallBack,
|
7595 dj.gorey 1.135 this,
|
7596 marek 1.268 operationAggregate.get());
7597
7598 // Release objects from their AutoPtr to prevent double deletes.
|
7599 venkat.puvvada 1.269 asyncRequest.release();
|
7600 marek 1.268 requestCopy.release();
7601 request.release();
|
7602 venkat.puvvada 1.258
7603 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
7604 // Release AutomicInt if atleast one request is sent for aggregation.
7605 counter.release();
7606 #endif
|
7607 kumpf 1.88 }
|
7608 marek 1.268 operationAggregate.release();
|
7609 kumpf 1.31
|
7610 kumpf 1.218 PEG_METHOD_EXIT();
|
7611 mday 1.20 }
7612
|
7613 kumpf 1.218 Array<ProviderClassList> IndicationService::_sendWaitCreateRequests(
|
7614 venkat.puvvada 1.275 const Array<ProviderClassList>& providers,
|
7615 kumpf 1.218 const CIMPropertyList& propertyList,
7616 const String& condition,
7617 const String& query,
7618 const String& queryLanguage,
7619 const CIMInstance& subscription,
7620 const AcceptLanguageList& acceptLangs,
7621 const ContentLanguageList& contentLangs,
7622 const String& userName,
7623 const String& authType)
|
7624 kumpf 1.11 {
|
7625 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7626 carolann.graves 1.164 "IndicationService::_sendWaitCreateRequests");
|
7627 kumpf 1.114
|
7628 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders =
7629 _getIndicationProvidersWithNamespaceClassList(providers);
7630
|
7631 kumpf 1.11 CIMValue propValue;
7632 Uint16 repeatNotificationPolicy;
|
7633 kumpf 1.218 Array<ProviderClassList> acceptedProviders;
7634 acceptedProviders.clear();
|
7635 kumpf 1.11
|
7636 carolann.graves 1.164 // If there are no providers to accept the subscription, just return
|
7637 kumpf 1.107 if (indicationProviders.size() == 0)
7638 {
|
7639 carolann.graves 1.170 PEG_METHOD_EXIT();
|
7640 carolann.graves 1.172 return acceptedProviders;
|
7641 kumpf 1.107 }
7642
|
7643 kumpf 1.1 //
|
7644 kumpf 1.14 // Get repeat notification policy value from subscription instance
|
7645 kumpf 1.1 //
|
7646 kumpf 1.218 propValue = subscription.getProperty(
7647 subscription.findProperty(
7648 _PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue();
7649 propValue.get(repeatNotificationPolicy);
|
7650 kumpf 1.11
|
7651 kumpf 1.88 //
|
7652 carolann.graves 1.164 // Send Create request to each provider
|
7653 kumpf 1.88 //
|
7654 kumpf 1.218 for (Uint32 i = 0; i < indicationProviders.size(); i++)
|
7655 kumpf 1.88 {
7656 //
|
7657 carolann.graves 1.164 // Create the create subscription request
|
7658 kumpf 1.88 //
|
7659 carolann.graves 1.164 CIMCreateSubscriptionRequestMessage * request =
|
7660 kumpf 1.218 new CIMCreateSubscriptionRequestMessage(
7661 XmlWriter::getNextMessageId(),
|
7662 venkat.puvvada 1.275 indicationProviders[i].classList[0].nameSpace,
|
7663 carolann.graves 1.164 subscription,
|
7664 venkat.puvvada 1.275 indicationProviders[i].classList[0].classList,
|
7665 carolann.graves 1.164 propertyList,
7666 repeatNotificationPolicy,
7667 query,
|
7668 kumpf 1.218 QueueIdStack(_providerManager, getQueueId()),
|
7669 carolann.graves 1.164 authType,
7670 userName);
7671
7672 //
7673 // Set operation context
7674 //
|
7675 kumpf 1.218 request->operationContext.insert(ProviderIdContainer(
7676 indicationProviders[i].providerModule
7677 ,indicationProviders[i].provider
|
7678 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
7679 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
7680 ,indicationProviders[i].remoteInfo
|
7681 dave.sudlik 1.208 #endif
7682 ));
|
7683 kumpf 1.218 request->operationContext.insert(
7684 SubscriptionInstanceContainer(subscription));
7685 request->operationContext.insert(
7686 SubscriptionFilterConditionContainer(condition,queryLanguage));
7687 request->operationContext.insert(
|
7688 venkat.puvvada 1.275 SubscriptionFilterQueryContainer(
7689 query,
7690 queryLanguage,
7691 indicationProviders[i].classList[0].nameSpace));
|
7692 carolann.graves 1.164 request->operationContext.insert(IdentityContainer(userName));
|
7693 kumpf 1.218 request->operationContext.set(
7694 ContentLanguageListContainer(contentLangs));
|
7695 carolann.graves 1.164 request->operationContext.set(AcceptLanguageListContainer(acceptLangs));
7696
|
7697 venkat.puvvada 1.269 AsyncRequest *asyncRequest;
7698 if (!indicationProviders[i].controlProviderName.size())
7699 {
7700 asyncRequest = new AsyncLegacyOperationStart(
|
7701 marek 1.211 0,
|
7702 carolann.graves 1.164 _providerManager,
|
7703 venkat.puvvada 1.244 request);
|
7704 venkat.puvvada 1.269 }
7705 else
7706 {
7707 asyncRequest = new AsyncModuleOperationStart(
7708 0,
7709 _moduleController,
7710 indicationProviders[i]. controlProviderName,
7711 request);
7712 }
|
7713 carolann.graves 1.164
|
7714 kumpf 1.218 AsyncReply * asyncReply = SendWait(asyncRequest);
|
7715 carolann.graves 1.164
|
7716 venkat.puvvada 1.269 MessageType msgType = asyncReply->getType();
7717 PEGASUS_ASSERT((msgType == ASYNC_ASYNC_LEGACY_OP_RESULT) ||
7718 (msgType == ASYNC_ASYNC_MODULE_OP_RESULT));
7719
7720 CIMCreateSubscriptionResponseMessage *response;
7721
7722 if (msgType == ASYNC_ASYNC_LEGACY_OP_RESULT)
7723 {
7724 response = reinterpret_cast<CIMCreateSubscriptionResponseMessage *>(
|
7725 kumpf 1.218 (static_cast<AsyncLegacyOperationResult *>(
7726 asyncReply))->get_result());
|
7727 venkat.puvvada 1.269 }
7728 else
7729 {
7730 response = reinterpret_cast<CIMCreateSubscriptionResponseMessage *>(
7731 (static_cast<AsyncModuleOperationResult *>(
7732 asyncReply))->get_result());
7733 }
7734
|
7735 carolann.graves 1.164
|
7736 kumpf 1.218 if (response->cimException.getCode() == CIM_ERR_SUCCESS)
|
7737 kumpf 1.88 {
|
7738 venkat.puvvada 1.275 _addProviderToAcceptedProviderList(
7739 acceptedProviders,
7740 indicationProviders[i]);
|
7741 kumpf 1.88 }
7742 else
7743 {
|
7744 carolann.graves 1.164 //
7745 // Provider rejected the subscription
7746 //
|
7747 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
7748 thilo.boehm 1.242 "Provider (%s) rejected create subscription: %s",
7749 (const char*)indicationProviders[i].provider.getPath()
7750 .toString().getCString(),
7751 (const char*)response->cimException.getMessage().getCString()));
|
7752 kumpf 1.88 }
|
7753 carolann.graves 1.164
|
7754 carolann.graves 1.185 delete response;
|
7755 carolann.graves 1.164 delete asyncRequest;
7756 delete asyncReply;
7757 } // for each indication provider
|
7758 kumpf 1.218 PEG_METHOD_EXIT();
|
7759 carolann.graves 1.172 return acceptedProviders;
|
7760 carolann.graves 1.164 }
7761
|
7762 kumpf 1.218 void IndicationService::_sendWaitModifyRequests(
|
7763 venkat.puvvada 1.275 const Array<ProviderClassList>& providers,
|
7764 kumpf 1.218 const CIMPropertyList& propertyList,
7765 const String& condition,
7766 const String& query,
7767 const String& queryLanguage,
7768 const CIMInstance& subscription,
7769 const AcceptLanguageList& acceptLangs,
7770 const ContentLanguageList& contentLangs,
7771 const String& userName,
7772 const String& authType)
|
7773 carolann.graves 1.164 {
|
7774 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7775 carolann.graves 1.164 "IndicationService::_sendWaitModifyRequests");
7776
|
7777 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders =
7778 _getIndicationProvidersWithNamespaceClassList(providers);
7779
|
7780 carolann.graves 1.164 CIMValue propValue;
7781 Uint16 repeatNotificationPolicy;
7782
7783 // If there are no providers to accept the subscription update, just return
7784 if (indicationProviders.size() == 0)
|
7785 kumpf 1.88 {
|
7786 carolann.graves 1.170 PEG_METHOD_EXIT();
|
7787 carolann.graves 1.164 return;
|
7788 kumpf 1.88 }
7789
|
7790 carolann.graves 1.164 //
7791 // Get repeat notification policy value from subscription instance
7792 //
|
7793 kumpf 1.218 propValue = subscription.getProperty(
7794 subscription.findProperty(
7795 _PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue();
7796 propValue.get(repeatNotificationPolicy);
|
7797 kumpf 1.88
7798 //
7799 // Send Modify request to each provider
7800 //
|
7801 kumpf 1.218 for (Uint32 i = 0; i < indicationProviders.size(); i++)
|
7802 kumpf 1.88 {
7803 CIMModifySubscriptionRequestMessage * request =
|
7804 kumpf 1.218 new CIMModifySubscriptionRequestMessage(
7805 XmlWriter::getNextMessageId(),
|
7806 venkat.puvvada 1.275 indicationProviders[i].classList[0].nameSpace,
|
7807 kumpf 1.88 subscription,
|
7808 venkat.puvvada 1.275 indicationProviders[i].classList[0].classList,
|
7809 kumpf 1.88 propertyList,
7810 repeatNotificationPolicy,
|
7811 kumpf 1.124 query,
|
7812 kumpf 1.218 QueueIdStack(_providerManager, getQueueId()),
|
7813 kumpf 1.88 authType,
|
7814 se.gupta 1.132 userName);
|
7815 kumpf 1.88
7816 //
|
7817 carolann.graves 1.164 // Set operation context
|
7818 kumpf 1.88 //
|
7819 kumpf 1.218 request->operationContext.insert(ProviderIdContainer(
7820 indicationProviders[i].providerModule
7821 ,indicationProviders[i].provider
|
7822 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
7823 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
7824 ,indicationProviders[i].remoteInfo
|
7825 dave.sudlik 1.208 #endif
7826 ));
|
7827 kumpf 1.218 request->operationContext.insert(
7828 SubscriptionInstanceContainer(subscription));
7829 request->operationContext.insert(
7830 SubscriptionFilterConditionContainer(condition,queryLanguage));
7831 request->operationContext.insert(
|
7832 venkat.puvvada 1.275 SubscriptionFilterQueryContainer(
7833 query,
7834 queryLanguage,
7835 indicationProviders[i].classList[0].nameSpace));
|
7836 kumpf 1.137 request->operationContext.insert(IdentityContainer(userName));
|
7837 kumpf 1.218 request->operationContext.set(
7838 ContentLanguageListContainer(contentLangs));
|
7839 kumpf 1.137 request->operationContext.set(AcceptLanguageListContainer(acceptLangs));
|
7840 se.gupta 1.126
|
7841 venkat.puvvada 1.269
7842 AsyncRequest *asyncRequest;
7843 if (!indicationProviders[i].controlProviderName.size())
7844 {
7845 asyncRequest = new AsyncLegacyOperationStart(
|
7846 marek 1.211 0,
|
7847 kumpf 1.88 _providerManager,
|
7848 venkat.puvvada 1.244 request);
|
7849 venkat.puvvada 1.269 }
7850 else
7851 {
7852 asyncRequest = new AsyncModuleOperationStart(
7853 0,
7854 _moduleController,
7855 indicationProviders[i].controlProviderName,
7856 request);
7857 }
|
7858 kumpf 1.88
|
7859 kumpf 1.218 AsyncReply * asyncReply = SendWait(asyncRequest);
|
7860 carolann.graves 1.164
|
7861 venkat.puvvada 1.269 MessageType msgType = asyncReply->getType();
7862 PEGASUS_ASSERT((msgType == ASYNC_ASYNC_LEGACY_OP_RESULT) ||
7863 (msgType == ASYNC_ASYNC_MODULE_OP_RESULT));
7864
7865 CIMModifySubscriptionResponseMessage *response;
7866
7867 if (msgType == ASYNC_ASYNC_LEGACY_OP_RESULT)
7868 {
7869 response = reinterpret_cast<CIMModifySubscriptionResponseMessage *>(
|
7870 kumpf 1.218 (static_cast<AsyncLegacyOperationResult *>(
7871 asyncReply))->get_result());
|
7872 venkat.puvvada 1.269 }
7873 else
7874 {
7875 response = reinterpret_cast<CIMModifySubscriptionResponseMessage *>(
7876 (static_cast<AsyncModuleOperationResult *>(
7877 asyncReply))->get_result());
7878 }
|
7879 carolann.graves 1.164
|
7880 kumpf 1.218 if (!(response->cimException.getCode() == CIM_ERR_SUCCESS))
|
7881 carolann.graves 1.164 {
7882 //
7883 // Provider rejected the subscription
7884 //
|
7885 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
7886 thilo.boehm 1.242 "Provider (%s) rejected modify subscription: %s",
7887 (const char*)indicationProviders[i].provider.getPath()
7888 .toString().getCString(),
7889 (const char*)response->cimException.getMessage().getCString()));
|
7890 carolann.graves 1.164 }
7891
|
7892 kumpf 1.210 delete response;
|
7893 carolann.graves 1.164 delete asyncRequest;
7894 delete asyncReply;
7895 } // for each indication provider
|
7896 kumpf 1.88
|
7897 kumpf 1.218 PEG_METHOD_EXIT();
|
7898 kumpf 1.88 }
7899
|
7900 kumpf 1.218 void IndicationService::_sendAsyncDeleteRequests(
|
7901 venkat.puvvada 1.275 const Array<ProviderClassList>& providers,
|
7902 kumpf 1.218 const CIMInstance& subscription,
7903 const AcceptLanguageList& acceptLangs,
7904 const ContentLanguageList& contentLangs,
7905 const CIMRequestMessage * origRequest,
|
7906 venkat.puvvada 1.275 const Array<NamespaceClassList>& indicationSubclasses,
|
7907 kumpf 1.218 const String& userName,
7908 const String& authType)
|
7909 kumpf 1.88 {
|
7910 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
7911 carolann.graves 1.164 "IndicationService::_sendAsyncDeleteRequests");
|
7912 kumpf 1.88
|
7913 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders =
7914 _getIndicationProvidersWithNamespaceClassList(providers);
7915
|
7916 kumpf 1.107 // If there are no providers to delete the subscription, just return
7917 if (indicationProviders.size() == 0)
7918 {
|
7919 carolann.graves 1.170 PEG_METHOD_EXIT();
|
7920 kumpf 1.107 return;
7921 }
7922
|
7923 venkat.puvvada 1.258 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
7924 _asyncRequestsPending++;
7925 AutoPtr<AtomicInt, DecAtomicInt> counter(&_asyncRequestsPending);
7926 #endif
7927
|
7928 carolann.graves 1.198 //
7929 // Update subscription hash tables
7930 //
|
7931 kumpf 1.218 _subscriptionTable->removeSubscription(
7932 subscription,
|
7933 carolann.graves 1.198 indicationSubclasses,
7934 indicationProviders);
7935
|
7936 w.otsuka 1.154 CIMRequestMessage * aggRequest = 0;
|
7937 kumpf 1.88
7938 if (origRequest == 0)
7939 {
7940 //
|
7941 dj.gorey 1.135 // Delete a referencing or expired subscription -- no request
|
7942 kumpf 1.88 // associated with this delete
7943 //
7944 aggRequest = 0;
7945 }
7946 else
7947 {
7948 //
|
7949 carolann.graves 1.164 // Delete Instance or Modify Instance
|
7950 kumpf 1.88 //
|
7951 kumpf 1.218 switch (origRequest->getType())
|
7952 kumpf 1.88 {
7953 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
7954 {
7955 CIMDeleteInstanceRequestMessage * request =
7956 (CIMDeleteInstanceRequestMessage *) origRequest;
7957 CIMDeleteInstanceRequestMessage * requestCopy =
|
7958 kumpf 1.218 new CIMDeleteInstanceRequestMessage(*request);
|
7959 kumpf 1.88 aggRequest = requestCopy;
7960 break;
7961 }
7962
7963 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
7964 {
7965 CIMModifyInstanceRequestMessage * request =
7966 (CIMModifyInstanceRequestMessage *) origRequest;
7967 CIMModifyInstanceRequestMessage * requestCopy =
|
7968 kumpf 1.218 new CIMModifyInstanceRequestMessage(*request);
|
7969 kumpf 1.88 aggRequest = requestCopy;
7970 break;
7971 }
7972
7973 default:
7974 {
|
7975 kumpf 1.253 PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
7976 thilo.boehm 1.242 "Unexpected origRequest type %s "
7977 "in _sendAsyncDeleteRequests",
7978 MessageTypeToString(origRequest->getType())));
|
7979 kumpf 1.218 PEGASUS_ASSERT(false);
|
7980 kumpf 1.88 break;
7981 }
7982 }
7983 }
7984
|
7985 kumpf 1.11 //
|
7986 kumpf 1.88 // Create an aggregate object for the delete subscription requests
|
7987 kumpf 1.11 //
|
7988 kumpf 1.88 IndicationOperationAggregate * operationAggregate =
|
7989 venkat.puvvada 1.269 new IndicationOperationAggregate(
7990 aggRequest,
7991 indicationProviders[0].controlProviderName,
7992 indicationSubclasses);
7993
|
7994 kumpf 1.218 operationAggregate->setNumberIssued(indicationProviders.size());
|
7995 mday 1.20
|
7996 kumpf 1.88 //
7997 // Send Delete request to each provider
7998 //
|
7999 kumpf 1.218 for (Uint32 i = 0; i < indicationProviders.size(); i++)
|
8000 kumpf 1.11 {
|
8001 kumpf 1.88 CIMDeleteSubscriptionRequestMessage * request =
|
8002 kumpf 1.218 new CIMDeleteSubscriptionRequestMessage(
8003 XmlWriter::getNextMessageId(),
|
8004 venkat.puvvada 1.275 indicationProviders[i].classList[0].nameSpace,
|
8005 kumpf 1.46 subscription,
|
8006 venkat.puvvada 1.275 indicationProviders[i].classList[0].classList,
|
8007 kumpf 1.218 QueueIdStack(_providerManager, getQueueId()),
|
8008 kumpf 1.88 authType,
|
8009 se.gupta 1.132 userName);
|
8010 kumpf 1.88
8011 //
8012 // Store a copy of the request in the operation aggregate instance
8013 //
8014 CIMDeleteSubscriptionRequestMessage * requestCopy =
|
8015 kumpf 1.218 new CIMDeleteSubscriptionRequestMessage(*request);
8016 requestCopy->operationContext.insert(ProviderIdContainer(
8017 indicationProviders[i].providerModule
8018 ,indicationProviders[i].provider
|
8019 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
8020 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
8021 ,indicationProviders[i].remoteInfo
|
8022 dave.sudlik 1.208 #endif
8023 ));
|
8024 kumpf 1.218 operationAggregate->appendRequest(requestCopy);
8025 request->operationContext.insert(ProviderIdContainer(
8026 indicationProviders[i].providerModule
8027 ,indicationProviders[i].provider
|
8028 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
8029 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
8030 ,indicationProviders[i].remoteInfo
|
8031 dave.sudlik 1.208 #endif
8032 ));
|
8033 kumpf 1.88
|
8034 kumpf 1.218 request->operationContext.insert(
8035 SubscriptionInstanceContainer(subscription));
|
8036 kumpf 1.137 request->operationContext.insert(IdentityContainer(userName));
|
8037 kumpf 1.218 request->operationContext.set(
8038 ContentLanguageListContainer(contentLangs));
|
8039 kumpf 1.137 request->operationContext.set(AcceptLanguageListContainer(acceptLangs));
|
8040 se.gupta 1.121
|
8041 kumpf 1.218 AsyncOpNode * op = this->get_op();
|
8042 kumpf 1.1
|
8043 venkat.puvvada 1.269 Uint32 serviceId;
8044 if (!indicationProviders[i].controlProviderName.size())
8045 {
8046 AsyncLegacyOperationStart * async_req =
8047 new AsyncLegacyOperationStart(
8048 op,
8049 _providerManager,
8050 request);
8051 serviceId = _providerManager;
8052 }
8053 else
8054 {
8055 AsyncModuleOperationStart* moduleControllerRequest =
8056 new AsyncModuleOperationStart(
8057 op,
8058 _moduleController,
8059 indicationProviders[i].controlProviderName,
8060 request);
8061 serviceId = _moduleController;
8062 }
|
8063 kumpf 1.1
|
8064 kumpf 1.218 SendAsync(
8065 op,
|
8066 venkat.puvvada 1.269 serviceId,
|
8067 kumpf 1.88 IndicationService::_aggregationCallBack,
8068 this,
8069 operationAggregate);
|
8070 venkat.puvvada 1.258
8071 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
8072 // Release AutomicInt if atleast one request is sent for aggregation.
8073 counter.release();
8074 #endif
|
8075 kumpf 1.88 }
8076
|
8077 kumpf 1.218 PEG_METHOD_EXIT();
|
8078 kumpf 1.88 }
8079
|
8080 kumpf 1.218 void IndicationService::_sendWaitDeleteRequests(
|
8081 venkat.puvvada 1.275 const Array<ProviderClassList>& providers,
|
8082 kumpf 1.218 const CIMInstance& subscription,
8083 const AcceptLanguageList& acceptLangs,
8084 const ContentLanguageList& contentLangs,
8085 const String& userName,
8086 const String& authType)
|
8087 carolann.graves 1.164 {
|
8088 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8089 carolann.graves 1.164 "IndicationService::_sendWaitDeleteRequests");
8090
|
8091 venkat.puvvada 1.275 Array<ProviderClassList> indicationProviders =
8092 _getIndicationProvidersWithNamespaceClassList(providers);
8093
|
8094 carolann.graves 1.164 // If there are no providers to delete the subscription, just return
8095 if (indicationProviders.size() == 0)
8096 {
|
8097 carolann.graves 1.170 PEG_METHOD_EXIT();
|
8098 carolann.graves 1.164 return;
8099 }
8100
8101 //
8102 // Send Delete request to each provider
8103 //
|
8104 kumpf 1.218 for (Uint32 i = 0; i < indicationProviders.size(); i++)
|
8105 carolann.graves 1.164 {
8106 CIMDeleteSubscriptionRequestMessage * request =
|
8107 kumpf 1.218 new CIMDeleteSubscriptionRequestMessage(
8108 XmlWriter::getNextMessageId(),
|
8109 venkat.puvvada 1.275 indicationProviders[i].classList[0].nameSpace,
|
8110 carolann.graves 1.164 subscription,
|
8111 venkat.puvvada 1.275 indicationProviders[i].classList[0].classList,
|
8112 kumpf 1.218 QueueIdStack(_providerManager, getQueueId()),
|
8113 carolann.graves 1.164 authType,
8114 userName);
8115
8116 //
8117 // Set operation context
8118 //
|
8119 kumpf 1.218 request->operationContext.insert(ProviderIdContainer(
8120 indicationProviders[i].providerModule
8121 ,indicationProviders[i].provider
|
8122 dave.sudlik 1.208 #ifdef PEGASUS_ENABLE_REMOTE_CMPI
|
8123 kumpf 1.218 ,indicationProviders[i].isRemoteNameSpace
8124 ,indicationProviders[i].remoteInfo
|
8125 dave.sudlik 1.208 #endif
8126 ));
|
8127 kumpf 1.218 request->operationContext.insert(
8128 SubscriptionInstanceContainer(subscription));
|
8129 carolann.graves 1.164 request->operationContext.insert(IdentityContainer(userName));
|
8130 kumpf 1.218 request->operationContext.set(
8131 ContentLanguageListContainer(contentLangs));
|
8132 carolann.graves 1.164 request->operationContext.set(AcceptLanguageListContainer(acceptLangs));
8133
|
8134 venkat.puvvada 1.269 AsyncRequest *asyncRequest;
8135 if (!indicationProviders[i].controlProviderName.size())
8136 {
8137 asyncRequest =
8138 new AsyncLegacyOperationStart(
8139 0,
8140 _providerManager,
8141 request);
8142 }
8143 else
8144 {
8145 asyncRequest =
8146 new AsyncModuleOperationStart(
8147 0,
8148 _moduleController,
8149 indicationProviders[i].controlProviderName,
8150 request);
8151 }
|
8152 carolann.graves 1.164
|
8153 kumpf 1.218 AsyncReply * asyncReply = SendWait(asyncRequest);
|
8154 carolann.graves 1.164
|
8155 venkat.puvvada 1.269 MessageType msgType = asyncReply->getType();
8156 PEGASUS_ASSERT((msgType == ASYNC_ASYNC_LEGACY_OP_RESULT) ||
8157 (msgType == ASYNC_ASYNC_MODULE_OP_RESULT));
8158
8159 CIMDeleteSubscriptionResponseMessage *response;
8160
8161 if (msgType == ASYNC_ASYNC_LEGACY_OP_RESULT)
8162 {
8163 response = reinterpret_cast<CIMDeleteSubscriptionResponseMessage *>(
|
8164 kumpf 1.218 (static_cast<AsyncLegacyOperationResult *>(
8165 asyncReply))->get_result());
|
8166 venkat.puvvada 1.269 }
8167 else
8168 {
8169 response = reinterpret_cast<CIMDeleteSubscriptionResponseMessage *>(
8170 (static_cast<AsyncModuleOperationResult *>(
8171 asyncReply))->get_result());
8172 }
|
8173 carolann.graves 1.164
|
8174 kumpf 1.218 if (!(response->cimException.getCode() == CIM_ERR_SUCCESS))
|
8175 carolann.graves 1.164 {
8176 //
8177 // Provider rejected the subscription
8178 //
|
8179 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
8180 thilo.boehm 1.242 "Provider (%s) rejected delete subscription: %s",
8181 (const char*)indicationProviders[i].provider.getPath()
8182 .toString().getCString(),
8183 (const char*)response->cimException.getMessage().getCString()));
|
8184 carolann.graves 1.164 }
8185
|
8186 kumpf 1.210 delete response;
|
8187 carolann.graves 1.164 delete asyncRequest;
8188 delete asyncReply;
8189 } // for each indication provider
8190
|
8191 kumpf 1.218 PEG_METHOD_EXIT();
|
8192 carolann.graves 1.164 }
8193
|
8194 kumpf 1.218 void IndicationService::_aggregationCallBack(
|
8195 kumpf 1.88 AsyncOpNode * op,
8196 MessageQueue * q,
8197 void * userParameter)
8198 {
|
8199 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8200 kumpf 1.88 "IndicationService::_aggregationCallBack");
8201
|
8202 kumpf 1.218 IndicationService * service = static_cast<IndicationService *>(q);
|
8203 kumpf 1.88
|
8204 dj.gorey 1.135 AsyncRequest * asyncRequest =
|
8205 kumpf 1.201 static_cast<AsyncRequest *>(op->removeRequest());
8206 AsyncReply * asyncReply = static_cast<AsyncReply *>(op->removeResponse());
|
8207 kumpf 1.88
|
8208 dj.gorey 1.135 IndicationOperationAggregate * operationAggregate =
|
8209 kumpf 1.218 reinterpret_cast<IndicationOperationAggregate *>(userParameter);
8210 PEGASUS_ASSERT(operationAggregate != 0);
|
8211 kumpf 1.88
|
8212 w.otsuka 1.154 CIMResponseMessage * response = 0;
|
8213 kumpf 1.219 MessageType msgType = asyncReply->getType();
8214 PEGASUS_ASSERT((msgType == ASYNC_ASYNC_LEGACY_OP_RESULT) ||
8215 (msgType == ASYNC_ASYNC_MODULE_OP_RESULT));
|
8216 kumpf 1.88
|
8217 kumpf 1.219 if (msgType == ASYNC_ASYNC_LEGACY_OP_RESULT)
|
8218 kumpf 1.88 {
|
8219 kumpf 1.218 response = reinterpret_cast<CIMResponseMessage *>(
8220 (static_cast<AsyncLegacyOperationResult *>(
8221 asyncReply))->get_result());
|
8222 kumpf 1.88 }
|
8223 kumpf 1.219 else if (msgType == ASYNC_ASYNC_MODULE_OP_RESULT)
|
8224 kumpf 1.88 {
|
8225 kumpf 1.218 response = reinterpret_cast<CIMResponseMessage *>(
8226 (static_cast<AsyncModuleOperationResult *>(
8227 asyncReply))->get_result());
|
8228 kumpf 1.88 }
8229
|
8230 kumpf 1.218 PEGASUS_ASSERT(response != 0);
|
8231 kumpf 1.88
8232 delete asyncRequest;
8233 delete asyncReply;
|
8234 kumpf 1.218 service->return_op(op);
|
8235 kumpf 1.88
|
8236 kumpf 1.218 Boolean isDoneAggregation = operationAggregate->appendResponse(response);
|
8237 kumpf 1.88 if (isDoneAggregation)
8238 {
|
8239 kumpf 1.218 service->_handleOperationResponseAggregation(operationAggregate);
|
8240 venkat.puvvada 1.258 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
8241 service->_asyncRequestsPending--;
8242 #endif
|
8243 kumpf 1.88 }
8244
|
8245 kumpf 1.218 PEG_METHOD_EXIT();
|
8246 kumpf 1.88 }
8247
|
8248 kumpf 1.218 void IndicationService::_handleOperationResponseAggregation(
|
8249 kumpf 1.88 IndicationOperationAggregate * operationAggregate)
8250 {
|
8251 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8252 kumpf 1.88 "IndicationService::_handleOperationResponseAggregation");
8253
|
8254 kumpf 1.218 switch (operationAggregate->getRequest(0)->getType())
|
8255 kumpf 1.88 {
8256 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
8257 {
|
8258 kumpf 1.218 _handleCreateResponseAggregation(operationAggregate);
|
8259 kumpf 1.88 break;
8260 }
8261
8262 case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
8263 {
|
8264 kumpf 1.218 _handleDeleteResponseAggregation(operationAggregate);
|
8265 kumpf 1.88 break;
8266 }
8267
8268 default:
8269 {
|
8270 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
|
8271 thilo.boehm 1.242 "Unexpected request type %s "
8272 "in _handleOperationResponseAggregation",
8273 MessageTypeToString(
8274 operationAggregate->getRequest(0)->getType())));
|
8275 kumpf 1.218 PEGASUS_ASSERT(false);
|
8276 kumpf 1.88 break;
8277 }
8278 }
8279
8280 //
8281 // Requests and responses are deleted in destructor
8282 //
8283 delete operationAggregate;
8284
|
8285 kumpf 1.218 PEG_METHOD_EXIT();
|
8286 kumpf 1.88 }
8287
|
8288 kumpf 1.218 void IndicationService::_handleCreateResponseAggregation(
|
8289 kumpf 1.88 IndicationOperationAggregate * operationAggregate)
8290 {
|
8291 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8292 kumpf 1.88 "IndicationService::_handleCreateResponseAggregation");
8293
|
8294 kumpf 1.218 Array<ProviderClassList> acceptedProviders;
|
8295 kumpf 1.88 CIMObjectPath instanceRef;
8296 CIMException cimException;
8297
8298 //
8299 // Examine provider responses
8300 //
|
8301 kumpf 1.218 acceptedProviders.clear();
8302 for (Uint32 i = 0; i < operationAggregate->getNumberResponses(); i++)
|
8303 kumpf 1.88 {
8304 //
|
8305 carolann.graves 1.172 // Find provider from which response was sent
|
8306 kumpf 1.88 //
|
8307 kumpf 1.218 CIMResponseMessage * response = operationAggregate->getResponse(i);
8308 ProviderClassList provider = operationAggregate->findProvider(
8309 response->messageId);
8310 if (response->cimException.getCode() == CIM_ERR_SUCCESS)
|
8311 kumpf 1.88 {
8312 //
|
8313 carolann.graves 1.172 // If response is SUCCESS, provider accepted the subscription
8314 // Add provider to list of providers that accepted subscription
|
8315 kumpf 1.88 //
|
8316 venkat.puvvada 1.275 _addProviderToAcceptedProviderList(
8317 acceptedProviders,
8318 provider);
|
8319 kumpf 1.88 }
8320 else
8321 {
|
8322 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
8323 thilo.boehm 1.242 "Provider (%s) rejected create subscription: %s",
8324 (const char*)
8325 provider.provider.getPath().toString().getCString(),
8326 (const char*)response->cimException.getMessage().getCString()));
|
8327 kumpf 1.88 }
8328 }
8329
8330 CIMCreateSubscriptionRequestMessage * request =
|
8331 dj.gorey 1.135 (CIMCreateSubscriptionRequestMessage *)
|
8332 kumpf 1.218 operationAggregate->getRequest(0);
|
8333 venkat.puvvada 1.221
8334 if (operationAggregate->getOrigType() ==
8335 CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
8336 {
8337 instanceRef = request->subscriptionInstance.getPath();
8338 }
8339
|
8340 venkat.puvvada 1.258
8341 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
8342 if (operationAggregate->getOrigRequest() == 0)
8343 {
8344 //
8345 // There is no request associated with the aggregation object.
8346 // This request must have been sent during the indication
8347 // service initialization because of timeout specified.
8348 //
8349 _updateAcceptedSubscription(
8350 request->subscriptionInstance,
8351 acceptedProviders,
|
8352 venkat.puvvada 1.275 operationAggregate->getIndicationSubclasses());
|
8353 venkat.puvvada 1.258 }
8354 else
8355 #endif
|
8356 kumpf 1.218 if (acceptedProviders.size() == 0)
|
8357 kumpf 1.88 {
8358 //
8359 // No providers accepted this subscription
8360 //
|
8361 kumpf 1.218 if (operationAggregate->requiresResponse())
|
8362 kumpf 1.88 {
8363 //
|
8364 carolann.graves 1.164 // For Create Instance or Modify Instance request, set CIM
8365 // exception for response
|
8366 kumpf 1.88 //
|
8367 kumpf 1.218 cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
|
8368 kumpf 1.243 MessageLoaderParms(
8369 "IndicationService.IndicationService._MSG_NOT_ACCEPTED",
8370 "No providers accepted the subscription."));
|
8371 kumpf 1.88 }
8372 }
8373 else
8374 {
8375 //
8376 // At least one provider accepted the subscription
8377 //
|
8378 kumpf 1.218 if (operationAggregate->getOrigType() ==
|
8379 kumpf 1.88 CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
8380 {
8381 //
8382 // Create Instance -- create the instance in the repository
8383 //
8384 CIMCreateInstanceRequestMessage * origRequest =
8385 (CIMCreateInstanceRequestMessage *)
|
8386 kumpf 1.218 operationAggregate->getOrigRequest();
|
8387 dj.gorey 1.135
|
8388 kumpf 1.247 CIMInstance instance;
|
8389 kumpf 1.88 try
8390 {
|
8391 kumpf 1.218 instanceRef = _subscriptionRepository->createInstance(
8392 request->subscriptionInstance, origRequest->nameSpace,
|
8393 kumpf 1.137 ((IdentityContainer)origRequest->operationContext.get
|
8394 chip 1.162 (IdentityContainer::NAME)).getUserName(),
|
8395 kumpf 1.137 ((AcceptLanguageListContainer)request->operationContext.get
8396 (AcceptLanguageListContainer::NAME)).getLanguages(),
8397 ((ContentLanguageListContainer)request->operationContext.get
8398 (ContentLanguageListContainer::NAME)).getLanguages(),
8399 true);
|
8400 kumpf 1.218 instanceRef.setNameSpace(
8401 request->subscriptionInstance.getPath().getNameSpace());
|
8402 kumpf 1.247 instance = _subscriptionRepository->getInstance(
|
8403 kumpf 1.254 origRequest->nameSpace, instanceRef);
|
8404 kumpf 1.218 instance.setPath(instanceRef);
|
8405 kumpf 1.88 }
|
8406 kumpf 1.218 catch (CIMException& exception)
|
8407 kumpf 1.88 {
8408 cimException = exception;
8409 }
|
8410 kumpf 1.218 catch (Exception& exception)
|
8411 kumpf 1.88 {
|
8412 kumpf 1.218 cimException = PEGASUS_CIM_EXCEPTION(
8413 CIM_ERR_FAILED, exception.getMessage());
|
8414 kumpf 1.88 }
8415
|
8416 kumpf 1.218 if (cimException.getCode() == CIM_ERR_SUCCESS)
|
8417 kumpf 1.88 {
8418 //
8419 // Insert entries into the subscription hash tables
8420 //
|
8421 kumpf 1.218 _subscriptionTable->insertSubscription(
8422 instance,
|
8423 kumpf 1.104 acceptedProviders,
|
8424 venkat.puvvada 1.275 operationAggregate->getIndicationSubclasses());
|
8425 kumpf 1.88
8426 }
8427 }
|
8428 carolann.graves 1.172 else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
|
8429 kumpf 1.88 {
|
8430 venkat.puvvada 1.258
|
8431 kumpf 1.218 PEGASUS_ASSERT(operationAggregate->getOrigType() ==
|
8432 carolann.graves 1.172 CIM_MODIFY_INSTANCE_REQUEST_MESSAGE);
|
8433 kumpf 1.88 //
8434 // Insert entries into the subscription hash tables
8435 //
|
8436 kumpf 1.218 _subscriptionTable->insertSubscription(
8437 request->subscriptionInstance,
|
8438 kumpf 1.104 acceptedProviders,
|
8439 venkat.puvvada 1.275 operationAggregate->getIndicationSubclasses());
|
8440 kumpf 1.88 }
8441 }
8442
|
8443 venkat.puvvada 1.221 // If subscription could not be created, cancel create subscription request
8444 // or commit create subscription request if subscription was created.
8445 if (instanceRef.getKeyBindings().size())
8446 {
8447 if (cimException.getCode() != CIM_ERR_SUCCESS)
8448 {
|
8449 venkat.puvvada 1.264 _cancelCreateSubscription(instanceRef);
|
8450 venkat.puvvada 1.221 }
8451 else
8452 {
|
8453 venkat.puvvada 1.264 _commitCreateSubscription(instanceRef);
|
8454 venkat.puvvada 1.221 }
8455 }
8456
|
8457 kumpf 1.88 //
|
8458 carolann.graves 1.164 // For Create Instance or Modify Instance request, send response
|
8459 kumpf 1.88 //
|
8460 kumpf 1.218 if (operationAggregate->requiresResponse())
|
8461 kumpf 1.88 {
|
8462 kumpf 1.218 if (operationAggregate->getOrigType() ==
|
8463 kumpf 1.88 CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
8464 {
8465 // Note: don't need to set Content-language in the response
|
8466 kumpf 1.213 CIMCreateInstanceResponseMessage* response =
8467 dynamic_cast<CIMCreateInstanceResponseMessage*>(
8468 operationAggregate->getOrigRequest()->buildResponse());
8469 PEGASUS_ASSERT(response != 0);
|
8470 carolann.graves 1.145 response->cimException = cimException;
|
8471 marek 1.280
8472 // put correct SystemName in place
8473 _setSubscriptionSystemName(
8474 instanceRef,
8475 System::getFullyQualifiedHostName());
8476
|
8477 carolann.graves 1.145 response->instanceName = instanceRef;
|
8478 kumpf 1.218 _enqueueResponse(operationAggregate->getOrigRequest(), response);
|
8479 kumpf 1.88 }
8480
|
8481 carolann.graves 1.164 else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
|
8482 kumpf 1.88 {
|
8483 kumpf 1.218 PEGASUS_ASSERT(operationAggregate->getOrigType () ==
8484 CIM_MODIFY_INSTANCE_REQUEST_MESSAGE);
|
8485 kumpf 1.88 // l10n
8486 // Note: don't need to set Content-language in the response
8487 //
|
8488 chip 1.162 CIMResponseMessage * response =
|
8489 kumpf 1.218 operationAggregate->getOrigRequest()->buildResponse();
|
8490 carolann.graves 1.145 response->cimException = cimException;
|
8491 kumpf 1.218 _enqueueResponse(operationAggregate->getOrigRequest(), response);
|
8492 kumpf 1.88 }
|
8493 kumpf 1.137 }
8494
|
8495 kumpf 1.218 PEG_METHOD_EXIT();
|
8496 kumpf 1.1 }
8497
|
8498 kumpf 1.218 void IndicationService::_handleDeleteResponseAggregation(
|
8499 kumpf 1.88 IndicationOperationAggregate * operationAggregate)
|
8500 mday 1.21 {
|
8501 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8502 kumpf 1.88 "IndicationService::_handleDeleteResponseAggregation");
|
8503 kumpf 1.37
|
8504 kumpf 1.88 CIMException cimException;
|
8505 mday 1.21
|
8506 kumpf 1.37 //
|
8507 kumpf 1.88 // Examine provider responses
|
8508 kumpf 1.37 //
|
8509 kumpf 1.218 for (Uint32 i = 0; i < operationAggregate->getNumberResponses(); i++)
|
8510 kumpf 1.37 {
|
8511 kumpf 1.88 //
|
8512 kumpf 1.100 // Find provider from which response was sent and add to list
8513 //
|
8514 kumpf 1.218 CIMResponseMessage * response = operationAggregate->getResponse(i);
8515 ProviderClassList provider = operationAggregate->findProvider(
8516 response->messageId);
|
8517 kumpf 1.100
8518 //
|
8519 kumpf 1.88 // If response is not SUCCESS, provider rejected the delete
8520 //
|
8521 kumpf 1.218 if (response->cimException.getCode() != CIM_ERR_SUCCESS)
|
8522 kumpf 1.88 {
8523 //
8524 // Log a trace message
8525 //
|
8526 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
8527 thilo.boehm 1.242 "Provider (%s) rejected delete subscription: %s",
8528 (const char*)
8529 provider.provider.getPath().toString().getCString(),
8530 (const char*)response->cimException.getMessage().getCString()));
|
8531 kumpf 1.88 }
|
8532 kumpf 1.37 }
|
8533 kumpf 1.88
8534 //
|
8535 carolann.graves 1.164 // For Delete Instance or Modify Instance request, send response
|
8536 kumpf 1.114 //
|
8537 kumpf 1.218 if (operationAggregate->requiresResponse())
|
8538 kumpf 1.111 {
|
8539 kumpf 1.114 CIMResponseMessage * response;
|
8540 kumpf 1.218 if (operationAggregate->getOrigType() ==
|
8541 kumpf 1.114 CIM_DELETE_INSTANCE_REQUEST_MESSAGE)
|
8542 kumpf 1.111 {
|
8543 kumpf 1.114 // l10n
8544 // Note: don't need to set Content-language in the response
|
8545 kumpf 1.218 response = operationAggregate->getOrigRequest()->buildResponse();
|
8546 carolann.graves 1.145 response->cimException = cimException;
|
8547 kumpf 1.111 }
|
8548 kumpf 1.114
|
8549 carolann.graves 1.164 else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
|
8550 kumpf 1.111 {
|
8551 kumpf 1.218 PEGASUS_ASSERT(operationAggregate->getOrigType() ==
8552 CIM_MODIFY_INSTANCE_REQUEST_MESSAGE);
|
8553 kumpf 1.114 // l10n
8554 // Note: don't need to set Content-language in the response
|
8555 kumpf 1.218 response = operationAggregate->getOrigRequest()->buildResponse();
|
8556 carolann.graves 1.145 response->cimException = cimException;
|
8557 kumpf 1.137 }
8558
|
8559 kumpf 1.218 _enqueueResponse(operationAggregate->getOrigRequest(), response);
|
8560 kumpf 1.111 }
8561
|
8562 kumpf 1.218 PEG_METHOD_EXIT();
|
8563 kumpf 1.111 }
8564
|
8565 kumpf 1.218 CIMInstance IndicationService::_createAlertInstance(
8566 const CIMName& alertClassName,
8567 const Array<CIMInstance>& subscriptions)
|
8568 kumpf 1.10 {
|
8569 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8570 kumpf 1.114 "IndicationService::_createAlertInstance");
|
8571 kumpf 1.10
|
8572 kumpf 1.218 CIMInstance indicationInstance(alertClassName);
|
8573 kumpf 1.10
|
8574 dj.gorey 1.135 //
|
8575 kumpf 1.11 // Add property values for all required properties of CIM_AlertIndication
|
8576 dj.gorey 1.135 //
|
8577 kumpf 1.218 indicationInstance.addProperty(
8578 CIMProperty(_PROPERTY_ALERTTYPE, CIMValue((Uint16) _TYPE_OTHER)));
|
8579 kumpf 1.10 //
|
8580 kumpf 1.38 // ATTN: what should Other Alert Type value be??
8581 // Currently using Alert class name
|
8582 kumpf 1.10 //
|
8583 kumpf 1.218 indicationInstance.addProperty(
8584 CIMProperty(_PROPERTY_OTHERALERTTYPE, alertClassName.getString()));
|
8585 kumpf 1.10
|
8586 kumpf 1.218 indicationInstance.addProperty(
8587 CIMProperty(_PROPERTY_PERCEIVEDSEVERITY,
8588 CIMValue((Uint16) _SEVERITY_WARNING)));
|
8589 kumpf 1.10 //
|
8590 kumpf 1.38 // ATTN: what should Probable Cause value be??
8591 // Currently using Unknown
|
8592 kumpf 1.10 //
|
8593 kumpf 1.218 indicationInstance.addProperty(
8594 CIMProperty(_PROPERTY_PROBABLECAUSE,
8595 CIMValue((Uint16) _CAUSE_UNKNOWN)));
|
8596 kumpf 1.10
|
8597 dj.gorey 1.135 //
|
8598 kumpf 1.11 // Add properties specific to each alert class
8599 // ATTN: update once alert classes have been defined
8600 // NB: for _CLASS_NO_PROVIDER_ALERT and _CLASS_PROVIDER_TERMINATED_ALERT,
8601 // one of the properties will be a list of affected subscriptions
|
8602 kumpf 1.13 // It is for that reason that subscriptions is passed in as a parameter
|
8603 dj.gorey 1.135 //
|
8604 kumpf 1.218 if (alertClassName.equal(_CLASS_CIMOM_SHUTDOWN_ALERT))
|
8605 kumpf 1.11 {
8606 }
|
8607 kumpf 1.218 else if (alertClassName.equal(_CLASS_NO_PROVIDER_ALERT))
|
8608 kumpf 1.10 {
8609 }
|
8610 kumpf 1.218 else if (alertClassName.equal(_CLASS_PROVIDER_TERMINATED_ALERT))
|
8611 kumpf 1.10 {
8612 }
|
8613 kumpf 1.11
|
8614 kumpf 1.218 PEG_METHOD_EXIT();
|
8615 kumpf 1.19 return indicationInstance;
|
8616 kumpf 1.10 }
8617
|
8618 mday 1.21
|
8619 kumpf 1.87 #if 0
|
8620 dj.gorey 1.135 void IndicationService::_sendAlertsCallBack(AsyncOpNode *op,
|
8621 kumpf 1.137 MessageQueue *q,
8622 void *parm)
|
8623 mday 1.21 {
|
8624 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8625 kumpf 1.114 "IndicationService::_sendAlertsCallBack");
|
8626 mday 1.21
|
8627 dj.gorey 1.135 IndicationService *service =
|
8628 mday 1.21 static_cast<IndicationService *>(q);
|
8629 dj.gorey 1.135 CIMInstance *_handler =
|
8630 kumpf 1.46 reinterpret_cast<CIMInstance *>(parm);
|
8631 dj.gorey 1.135
|
8632 mday 1.21 AsyncRequest *asyncRequest = static_cast<AsyncRequest *>(op->get_request());
8633 AsyncReply *asyncReply = static_cast<AsyncReply *>(op->get_response());
|
8634 kumpf 1.218 CIMRequestMessage *request = reinterpret_cast<CIMRequestMessage *>(
8635 (static_cast<AsyncLegacyOperationStart *>(asyncRequest))->get_action());
|
8636 mday 1.21
|
8637 dj.gorey 1.135 CIMHandleIndicationResponseMessage* response =
|
8638 kumpf 1.218 reinterpret_cast<CIMHandleIndicationResponseMessage *>(
8639 (static_cast<AsyncLegacyOperationResult *>(
8640 asyncReply))->get_result());
|
8641 mday 1.21
|
8642 kumpf 1.37 PEGASUS_ASSERT(response != 0);
8643 if (response->cimException.getCode() == CIM_ERR_SUCCESS)
8644 {
8645 }
8646 else
8647 {
8648 }
|
8649 dj.gorey 1.135
|
8650 mday 1.21 //
8651 // ATTN: Check for return value indicating invalid queue ID
|
8652 kumpf 1.37 // If received, need to find Handler Manager Service queue ID
|
8653 mday 1.21 // again
8654 //
8655
|
8656 kumpf 1.218 // << Mon Jul 15 09:59:16 2002 mdd >> handler is allocated as an element in
8657 // an array, don't delete here.
|
8658 dj.gorey 1.135 // delete _handler;
|
8659 mday 1.21 delete request;
8660 delete response;
8661 delete asyncRequest;
8662 delete asyncReply;
|
8663 mday 1.29 op->release();
|
8664 mday 1.21 service->return_op(op);
|
8665 kumpf 1.73
|
8666 kumpf 1.218 PEG_METHOD_EXIT();
|
8667 mday 1.21 }
8668
8669
|
8670 kumpf 1.218 void IndicationService::_sendAlerts(
8671 const Array<CIMInstance>& subscriptions,
8672 /* const */ CIMInstance& alertInstance)
|
8673 kumpf 1.10 {
|
8674 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, "IndicationService::_sendAlerts");
|
8675 kumpf 1.114
|
8676 kumpf 1.46 CIMInstance current;
|
8677 kumpf 1.11
|
8678 thilo.boehm 1.242 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
8679 "Sending alert: %s",
8680 (const char*)alertInstance.getClassName().getString().getCString()));
|
8681 kumpf 1.73
|
8682 kumpf 1.10 //
|
8683 kumpf 1.11 // Get list of unique handler instances for all subscriptions in list
|
8684 kumpf 1.10 //
|
8685 kumpf 1.218 for (Uint32 i = 0; i < subscriptions.size(); i++)
|
8686 kumpf 1.11 {
|
8687 thilo.boehm 1.242 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
8688 "Alert subscription: %s",
8689 (const char*)subscriptions[i].getPath().toString().getCString()));
|
8690 kumpf 1.73
|
8691 kumpf 1.11 //
8692 // Get handler instance
8693 //
|
8694 kumpf 1.218 current = _subscriptionRepository->getHandler(subscriptions[i]);
|
8695 kumpf 1.11
|
8696 chip 1.162 // ATTN: For the handlers which do not need subscription instance
8697 // need to check duplicate alter
|
8698 kumpf 1.11
|
8699 yi.zhou 1.157 //
8700 // Send handle indication request to the handler
8701 //
8702 CIMHandleIndicationRequestMessage * handler_request =
|
8703 kumpf 1.218 new CIMHandleIndicationRequestMessage(
8704 XmlWriter::getNextMessageId(),
8705 current.getPath().getNameSpace(),
|
8706 yi.zhou 1.157 current,
|
8707 kumpf 1.218 subscriptions[i],
|
8708 yi.zhou 1.157 alertInstance,
|
8709 kumpf 1.218 QueueIdStack(_handlerService, getQueueId()));
|
8710 kumpf 1.10
|
8711 yi.zhou 1.157 AsyncOpNode* op = this->get_op();
|
8712 kumpf 1.11
|
8713 yi.zhou 1.157 AsyncLegacyOperationStart *async_req =
8714 new AsyncLegacyOperationStart(
8715 op,
8716 _handlerService,
8717 handler_request,
8718 _queueId);
|
8719 kumpf 1.10
|
8720 yi.zhou 1.157 SendAsync(op,
|
8721 kumpf 1.137 _handlerService,
8722 IndicationService::_sendAlertsCallBack,
8723 this,
|
8724 yi.zhou 1.157 (void *)¤t);
|
8725 kumpf 1.10
8726 }
|
8727 kumpf 1.24
|
8728 kumpf 1.218 PEG_METHOD_EXIT();
|
8729 kumpf 1.24 }
|
8730 kumpf 1.87 #endif
|
8731 kumpf 1.24
|
8732 venkat.puvvada 1.255 void IndicationService::sendSubscriptionInitComplete()
|
8733 mday 1.28 {
|
8734 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
8735 venkat.puvvada 1.255 "IndicationService::sendSubscriptionInitComplete");
|
8736 mday 1.28
|
8737 venkat.puvvada 1.267 if (_getEnabledState() == _ENABLEDSTATE_DISABLED)
|
8738 venkat.puvvada 1.258 {
8739 PEG_METHOD_EXIT();
8740 return;
8741 }
|
8742 kumpf 1.88 //
|
8743 carolann.graves 1.158 // Create the Subscription Init Complete request
|
8744 kumpf 1.88 //
|
8745 carolann.graves 1.158 CIMSubscriptionInitCompleteRequestMessage * request =
|
8746 kumpf 1.218 new CIMSubscriptionInitCompleteRequestMessage(
8747 XmlWriter::getNextMessageId(),
8748 QueueIdStack(_providerManager, getQueueId()));
|
8749 kumpf 1.137
|
8750 venkat.puvvada 1.269 CIMSubscriptionInitCompleteRequestMessage *requestCopy =
8751 new CIMSubscriptionInitCompleteRequestMessage(*request);
|
8752 kumpf 1.137 //
|
8753 carolann.graves 1.158 // Send Subscription Initialization Complete request to provider manager
|
8754 venkat.puvvada 1.255 // Provider Manager calls providers' enableIndications method
|
8755 kumpf 1.88 //
|
8756 carolann.graves 1.158 AsyncLegacyOperationStart * asyncRequest =
|
8757 kumpf 1.200 new AsyncLegacyOperationStart(
|
8758 marek 1.211 0,
|
8759 dj.gorey 1.135 _providerManager,
|
8760 venkat.puvvada 1.269 requestCopy);
|
8761 kumpf 1.100
|
8762 kumpf 1.218 AutoPtr<AsyncReply> asyncReply(SendWait(asyncRequest));
|
8763 kumpf 1.100 //
|
8764 carolann.graves 1.158 // Note: the response does not contain interesting data
|
8765 kumpf 1.100 //
|
8766 marek 1.211 delete asyncRequest;
|
8767 kumpf 1.10
|
8768 venkat.puvvada 1.269 // Now send to all indication internal control providers
8769
8770 for (ControlProvIndRegTable::Iterator j =
8771 _controlProvIndRegTable.start (); j; j++)
8772 {
8773 ControlProvIndReg reg = j.value();
8774 String controlProviderName;
8775 reg.provider.getProperty(reg.provider.findProperty(
8776 PEGASUS_PROPERTYNAME_NAME)).getValue().get(controlProviderName);
8777 requestCopy = new CIMSubscriptionInitCompleteRequestMessage(*request);
8778 AsyncModuleOperationStart * asyncRequest =
8779 new AsyncModuleOperationStart(
8780 0,
8781 _moduleController,
8782 controlProviderName,
8783 requestCopy);
8784
8785 AutoPtr<AsyncReply> asyncReply(SendWait(asyncRequest));
8786 delete asyncRequest;
8787 }
8788
8789 venkat.puvvada 1.269 delete request;
8790
|
8791 kumpf 1.218 PEG_METHOD_EXIT();
|
8792 kumpf 1.10 }
8793
|
8794 kumpf 1.218 Boolean IndicationService::_getCreator(
8795 const CIMInstance& instance,
8796 String& creator) const
|
8797 kumpf 1.80 {
|
8798 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, "IndicationService::_getCreator");
|
8799 kumpf 1.80
|
8800 kumpf 1.218 Uint32 creatorIndex = instance.findProperty(
8801 PEGASUS_PROPERTYNAME_INDSUB_CREATOR);
|
8802 kumpf 1.80 if (creatorIndex != PEG_NOT_FOUND)
8803 {
|
8804 kumpf 1.218 CIMValue creatorValue = instance.getProperty(creatorIndex).getValue();
8805 if (creatorValue.isNull())
|
8806 kumpf 1.80 {
|
8807 thilo.boehm 1.248 PEG_TRACE_CSTRING(TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
8808 kumpf 1.80 "Null Subscription Creator property value");
8809
8810 //
8811 // This is a corrupted/invalid instance
8812 //
|
8813 carolann.graves 1.170 PEG_METHOD_EXIT();
|
8814 kumpf 1.80 return false;
8815 }
|
8816 kumpf 1.218 else if ((creatorValue.getType() != CIMTYPE_STRING) ||
8817 (creatorValue.isArray()))
|
8818 kumpf 1.80 {
|
8819 thilo.boehm 1.248 PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
8820 marek 1.238 "Subscription Creator property value of incorrect type:%s %s",
8821 (creatorValue.isArray()) ? " array of" : " ",
8822 cimTypeToString(creatorValue.getType())));
|
8823 kumpf 1.80
8824 //
8825 // This is a corrupted/invalid instance
8826 //
|
8827 carolann.graves 1.170 PEG_METHOD_EXIT();
|
8828 kumpf 1.80 return false;
8829 }
8830 else
8831 {
|
8832 kumpf 1.218 creatorValue.get(creator);
|
8833 kumpf 1.80 }
8834 }
8835 else
8836 {
|
8837 thilo.boehm 1.248 PEG_TRACE_CSTRING(TRC_INDICATION_SERVICE,Tracer::LEVEL1,
|
8838 kumpf 1.80 "Missing Subscription Creator property");
8839
8840 //
8841 // This is a corrupted/invalid instance
8842 //
|
8843 carolann.graves 1.170 PEG_METHOD_EXIT();
|
8844 kumpf 1.80 return false;
8845 }
8846
|
8847 kumpf 1.218 PEG_METHOD_EXIT();
|
8848 kumpf 1.80 return true;
8849 }
8850
|
8851 kumpf 1.218 void IndicationService::_updatePropertyList(
8852 CIMName& className,
8853 CIMPropertyList& propertyList,
8854 Boolean& setTimeRemaining,
8855 Boolean& startTimeAdded,
8856 Boolean& durationAdded)
|
8857 kumpf 1.99 {
|
8858 kumpf 1.218 PEG_METHOD_ENTER( TRC_INDICATION_SERVICE,
|
8859 kumpf 1.99 "IndicationService::_updatePropertyList");
8860
8861 //
8862 // A null propertyList means all properties
8863 // If the class is Subscription, that includes the Time Remaining property
8864 //
|
8865 kumpf 1.218 if (className.equal(PEGASUS_CLASSNAME_INDSUBSCRIPTION) ||
8866 className.equal(PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))
|
8867 kumpf 1.99 {
8868 setTimeRemaining = true;
8869 }
8870 else
8871 {
8872 setTimeRemaining = false;
8873 }
8874 startTimeAdded = false;
8875 durationAdded = false;
|
8876 kumpf 1.218 if (!propertyList.isNull())
|
8877 kumpf 1.99 {
8878 setTimeRemaining = false;
|
8879 kumpf 1.218 Array<CIMName> properties = propertyList.getPropertyNameArray();
|
8880 kumpf 1.99
8881 //
8882 // Add Creator to property list
8883 //
|
8884 kumpf 1.218 if (!ContainsCIMName(properties,
|
8885 kumpf 1.99 PEGASUS_PROPERTYNAME_INDSUB_CREATOR))
8886 {
|
8887 kumpf 1.218 properties.append(PEGASUS_PROPERTYNAME_INDSUB_CREATOR);
|
8888 kumpf 1.99 }
8889
|
8890 venkat.puvvada 1.263 if (className.equal(PEGASUS_CLASSNAME_INDHANDLER_CIMXML) ||
8891 className.equal(PEGASUS_CLASSNAME_LSTNRDST_CIMXML))
8892 {
8893 properties.append(PEGASUS_PROPERTYNAME_LSTNRDST_CREATIONTIME);
8894 }
8895
|
8896 kumpf 1.99 //
8897 // If a Subscription and Time Remaining is requested,
8898 // Ensure Subscription Duration and Start Time are in property list
8899 //
|
8900 kumpf 1.218 if (className.equal(PEGASUS_CLASSNAME_INDSUBSCRIPTION) ||
8901 className.equal(PEGASUS_CLASSNAME_FORMATTEDINDSUBSCRIPTION))
|
8902 kumpf 1.99 {
|
8903 kumpf 1.218 if (ContainsCIMName(properties, _PROPERTY_TIMEREMAINING))
|
8904 kumpf 1.99 {
8905 setTimeRemaining = true;
|
8906 kumpf 1.218 if (!ContainsCIMName(properties, _PROPERTY_STARTTIME))
|
8907 kumpf 1.99 {
|
8908 kumpf 1.218 properties.append(_PROPERTY_STARTTIME);
|
8909 kumpf 1.99 startTimeAdded = true;
8910 }
|
8911 kumpf 1.218 if (!ContainsCIMName(properties, _PROPERTY_DURATION))
|
8912 kumpf 1.99 {
|
8913 kumpf 1.218 properties.append(_PROPERTY_DURATION);
|
8914 kumpf 1.99 durationAdded = true;
8915 }
8916 }
8917 }
|
8918 kumpf 1.218 propertyList.clear();
8919 propertyList.set(properties);
|
8920 kumpf 1.99 }
8921
|
8922 kumpf 1.218 PEG_METHOD_EXIT();
|
8923 kumpf 1.80 }
8924
|
8925 kumpf 1.218 String IndicationService::_getSubscriptionLogString(CIMInstance& subscription)
|
8926 kumpf 1.98 {
8927 //
|
8928 carolann.graves 1.186 // Get Subscription Filter namespace and Name, and Handler namespace and
8929 // Name
|
8930 kumpf 1.98 //
8931 String logString;
8932 CIMValue filterValue;
8933 CIMObjectPath filterPath;
|
8934 carolann.graves 1.186 CIMNamespaceName filterNS;
|
8935 kumpf 1.218 Array<CIMKeyBinding> filterKeyBindings;
|
8936 kumpf 1.98 CIMValue handlerValue;
8937 CIMObjectPath handlerPath;
|
8938 carolann.graves 1.186 CIMNamespaceName handlerNS;
|
8939 kumpf 1.218 Array<CIMKeyBinding> handlerKeyBindings;
8940 filterValue = subscription.getProperty(subscription.findProperty(
8941 PEGASUS_PROPERTYNAME_FILTER)).getValue();
8942 filterValue.get(filterPath);
|
8943 carolann.graves 1.186
8944 //
8945 // Get Filter namespace - if not set in Filter reference property
8946 // value, namespace is the namespace of the subscription
8947 //
|
8948 kumpf 1.218 filterNS = filterPath.getNameSpace();
8949 if (filterNS.isNull())
|
8950 carolann.graves 1.186 {
|
8951 kumpf 1.218 filterNS = subscription.getPath().getNameSpace();
|
8952 carolann.graves 1.186 }
|
8953 kumpf 1.218 logString.append(filterNS.getString());
8954 logString.append(" ");
8955 filterKeyBindings = filterPath.getKeyBindings();
8956 for (Uint32 i = 0; i < filterKeyBindings.size(); i++)
|
8957 kumpf 1.98 {
|
8958 kumpf 1.218 if (filterKeyBindings[i].getName().equal(PEGASUS_PROPERTYNAME_NAME))
|
8959 kumpf 1.98 {
|
8960 kumpf 1.218 logString.append(filterKeyBindings[i].getValue());
8961 logString.append(", ");
|
8962 kumpf 1.98 break;
8963 }
8964 }
|
8965 kumpf 1.218 handlerValue = subscription.getProperty(
8966 subscription.findProperty(PEGASUS_PROPERTYNAME_HANDLER)).getValue();
8967 handlerValue.get(handlerPath);
|
8968 carolann.graves 1.186
8969 //
8970 // Get Handler namespace - if not set in Handler reference property
8971 // value, namespace is the namespace of the subscription
8972 //
|
8973 kumpf 1.218 handlerNS = handlerPath.getNameSpace();
8974 if (handlerNS.isNull())
|
8975 carolann.graves 1.186 {
|
8976 kumpf 1.218 handlerNS = subscription.getPath().getNameSpace();
|
8977 carolann.graves 1.186 }
|
8978 kumpf 1.218 logString.append(handlerNS.getString());
8979 logString.append(" ");
8980 handlerKeyBindings = handlerPath.getKeyBindings();
8981 for (Uint32 j = 0; j < handlerKeyBindings.size(); j++)
|
8982 kumpf 1.98 {
|
8983 kumpf 1.218 if (handlerKeyBindings[j].getName().equal(PEGASUS_PROPERTYNAME_NAME))
|
8984 kumpf 1.98 {
|
8985 kumpf 1.218 logString.append(handlerKeyBindings[j].getValue());
|
8986 kumpf 1.98 break;
8987 }
8988 }
8989
8990 return logString;
8991 }
8992
|
8993 kumpf 1.218 String IndicationService::getProviderLogString(CIMInstance& provider)
|
8994 kumpf 1.98 {
8995 String logString;
|
8996 dj.gorey 1.135
|
8997 kumpf 1.218 logString = provider.getProperty(
8998 provider.findProperty(PEGASUS_PROPERTYNAME_NAME)).getValue().toString();
|
8999 kumpf 1.98
9000 return logString;
|
9001 kumpf 1.105 }
9002
|
9003 kumpf 1.218 CIMClass IndicationService::_getIndicationClass(
9004 const CIMInstance& subscriptionInstance)
|
9005 yi.zhou 1.157 {
|
9006 kumpf 1.218 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
|
9007 chip 1.162 "IndicationService::_getIndicationClass");
|
9008 yi.zhou 1.157
|
9009 venkat.puvvada 1.275 Array<CIMNamespaceName> sourceNamespaces;
|
9010 yi.zhou 1.157 String query;
9011 String queryLanguage;
9012 CIMName indicationClassName;
9013 CIMClass indicationClass;
|
9014 w.otsuka 1.217 String filterName;
|
9015 yi.zhou 1.157
9016 // Get filter properties
|
9017 kumpf 1.218 _subscriptionRepository->getFilterProperties(subscriptionInstance, query,
|
9018 venkat.puvvada 1.275 sourceNamespaces, queryLanguage, filterName);
|
9019 yi.zhou 1.157
9020 // Build the query expression from the filter query
9021 QueryExpression queryExpression = _getQueryExpression(query,
|
9022 chip 1.162 queryLanguage,
|
9023 venkat.puvvada 1.275 sourceNamespaces[0]);
|
9024 yi.zhou 1.157
9025 // Get indication class name from filter query
9026 indicationClassName = _getIndicationClassName(
|
9027 venkat.puvvada 1.275 queryExpression, sourceNamespaces[0]);
|
9028 yi.zhou 1.157
9029 //
9030 // Get the indication class object from the repository
9031 // Specify localOnly=false because superclass properties are needed
9032 // Specify includeQualifiers=false because qualifiers are not needed
9033 //
|
9034 kumpf 1.218 indicationClass = _subscriptionRepository->getClass(
|
9035 venkat.puvvada 1.275 sourceNamespaces[0], indicationClassName, false, false, false,
|
9036 kumpf 1.218 CIMPropertyList());
|
9037 yi.zhou 1.157
|
9038 carolann.graves 1.170 PEG_METHOD_EXIT();
|
9039 yi.zhou 1.157 return indicationClass;
9040 }
|
9041 dj.gorey 1.135
|
9042 yi.zhou 1.229 void IndicationService::_getRelevantSubscriptions(
|
9043 yi.zhou 1.225 const Array<CIMObjectPath> & providedSubscriptionNames,
9044 const CIMName& className,
9045 const CIMNamespaceName& nameSpace,
|
9046 yi.zhou 1.229 const CIMInstance& indicationProvider,
9047 Array<CIMInstance>& subscriptions,
|
9048 marek 1.277 Array<SubscriptionKey>& subscriptionKeys)
|
9049 yi.zhou 1.225 {
9050 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
9051 "IndicationService::_getRelevantlSubscriptions");
9052
|
9053 martin 1.251 //
|
9054 yi.zhou 1.225 // Retrieves list of enabled subscription instances in the specified
9055 // namespace, where the subscription indication class matches or is a
9056 // superclass of the supported class. A subscription is only included
9057 // in the list if the specified provider accepted the subscription.
9058 //
|
9059 yi.zhou 1.229 _subscriptionTable->getMatchingClassNamespaceSubscriptions(
9060 className,
9061 nameSpace,
9062 indicationProvider,
9063 subscriptions,
9064 subscriptionKeys);
|
9065 yi.zhou 1.225
|
9066 martin 1.251 //
|
9067 kumpf 1.253 // If the indication provider included subscriptions in the
|
9068 yi.zhou 1.225 // SubscriptionInstanceNamesContainer, the subset of subscriptions
9069 // specified by the indication provider that also appear in the initial
9070 // subscriptions list is returned.
9071 //
9072 if (providedSubscriptionNames.size() > 0)
9073 {
|
9074 marek 1.280 Uint32 n = providedSubscriptionNames.size();
9075 Array<SubscriptionKey> provSubKeys(n);
9076 for (Uint32 i = 0; i < n; i++)
9077 {
9078 provSubKeys.append(SubscriptionKey(providedSubscriptionNames[i]));
9079 }
|
9080 yi.zhou 1.229 for (Uint32 i = 0; i < subscriptions.size(); i++)
|
9081 yi.zhou 1.225 {
|
9082 marek 1.280 if (!Contains(provSubKeys, subscriptionKeys[i]))
|
9083 yi.zhou 1.225 {
|
9084 yi.zhou 1.229 subscriptions.remove(i);
9085 subscriptionKeys.remove(i);
9086 i--;
|
9087 yi.zhou 1.225 }
9088 }
9089 }
9090
|
9091 yi.zhou 1.229 PEGASUS_ASSERT(subscriptions.size() == subscriptionKeys.size());
|
9092 yi.zhou 1.225 PEG_METHOD_EXIT();
9093 }
9094
9095 Boolean IndicationService::_subscriptionMatch(
9096 const CIMInstance& subscription,
9097 const CIMInstance& indication,
9098 const CIMPropertyList& supportedPropertyList,
9099 QueryExpression& queryExpr,
9100 const CIMNamespaceName sourceNameSpace)
9101 {
9102 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
9103 "IndicationService::_subscriptionMatch");
9104
9105 //
9106 // If supported properties is null (all properties)
9107 // the subscription can be supported
9108 //
9109 if (!supportedPropertyList.isNull ())
9110 {
9111 try
9112 {
9113 yi.zhou 1.225 // Get the class paths in the FROM list
9114 // Since neither WQL nor CQL support joins, so we can
9115 // assume one class path.
|
9116 kumpf 1.253 CIMName indicationClassName =
|
9117 yi.zhou 1.225 queryExpr.getClassPathList()[0].getClassName();
9118
9119 if (!_subscriptionRepository->validateIndicationClassName(
9120 indicationClassName, sourceNameSpace))
9121 {
9122 //
9123 // Invalid FROM class, the subscription does not match
9124 //
9125 PEG_METHOD_EXIT();
9126 return false;
9127 }
9128
9129 //
9130 // Get required property list from filter query (WHERE clause)
9131 //
|
9132 kumpf 1.253 // Note:
|
9133 yi.zhou 1.225 // The class should be the class of the indication
9134 // instance, not the FROM class.
9135 // This is needed because CQL can have class scoping operators
9136 // on properties that may not be the same class
9137 // as the FROM class. The required properties
9138 // for an indication are based on indication instance class,
9139 // not the FROM class.
9140 //
9141
9142 CIMPropertyList requiredPropertyList = _getPropertyList(
9143 queryExpr, sourceNameSpace, indication.getClassName());
9144
9145 //
9146 // If the subscription requires all properties,
9147 // but supported property list does not include all
9148 // properties, the subscription cannot be supported
9149 //
9150 if (requiredPropertyList.isNull ())
9151 {
9152 //
9153 // Current subscription does not match
9154 yi.zhou 1.225 //
9155 PEG_METHOD_EXIT();
9156 return false;
9157 }
9158 else
9159 {
9160 //
9161 // Compare subscription required property list
9162 // with supported property list
9163 //
9164 for (Uint32 j = 0; j < requiredPropertyList.size (); j++)
9165 {
9166 if (!ContainsCIMName
9167 (supportedPropertyList.getPropertyNameArray(),
9168 requiredPropertyList[j]))
9169 {
9170 //
9171 // Current subscription does not match
9172 //
9173 PEG_METHOD_EXIT();
9174 return false;
9175 yi.zhou 1.225 }
9176 }
9177 }
9178 }
9179 catch(const Exception & e)
9180 {
9181 // This subscription is invalid
|
9182 marek 1.238 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
9183 yi.zhou 1.225 "Exception caught trying to verify required properties "
9184 "in a subscription are all contained in the list of "
9185 "supported indication properties: %s",
|
9186 kumpf 1.253 (const char *) e.getMessage ().getCString()));
|
9187 yi.zhou 1.225 PEG_METHOD_EXIT();
9188 return false;
9189 }
9190 catch(const exception & e)
9191 {
9192 // This subscription is invalid
|
9193 marek 1.238 PEG_TRACE ((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
9194 yi.zhou 1.225 "Exception caught trying to verify required properties "
9195 "in a subscription are all contained in the list of "
|
9196 kumpf 1.253 "supported indication properties: %s", e.what ()));
|
9197 yi.zhou 1.225 PEG_METHOD_EXIT();
9198 return false;
9199 }
9200 catch(...)
9201 {
9202 // This subscription is invalid
9203 // skip it
|
9204 marek 1.238 PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
9205 yi.zhou 1.225 "Unknown exception caught trying to verify "
9206 "required properties in a subscription are all contained "
|
9207 kumpf 1.253 "in the list of supported indication properties.");
|
9208 yi.zhou 1.225 PEG_METHOD_EXIT();
9209 return false;
9210 }
9211 }
9212
9213 //
9214 // Check for expired subscription
9215 //
9216 try
9217 {
9218 if (_isExpired(subscription))
9219 {
9220 // Delete expired subscription
9221 CIMObjectPath path = subscription.getPath ();
9222 _deleteExpiredSubscription (path);
|
9223 venkat.puvvada 1.263 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
9224 _sendSubscriptionNotActiveMessagetoHandlerService(path);
9225 #endif
|
9226 yi.zhou 1.225 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL3,
9227 "%s Indication Subscription expired",
9228 (const char*)(indication.getClassName().getString().
9229 getCString())));
9230 PEG_METHOD_EXIT();
9231 return false;
9232 }
9233 }
9234 catch (DateTimeOutOfRangeException&)
9235 {
|
9236 marek 1.238 PEG_TRACE_CSTRING(TRC_INDICATION_SERVICE, Tracer::LEVEL2,
|
9237 yi.zhou 1.225 "Caught DateTimeOutOfRangeException in IndicationService while"
9238 "checking for expired subscription");
9239 PEG_METHOD_EXIT();
9240 return false;
9241 }
9242
9243 //
|
9244 kumpf 1.253 // Evaluate whether the filter criteria are met by the generated
|
9245 yi.zhou 1.225 // indication
9246 //
9247 if (!queryExpr.evaluate(indication))
9248 {
9249 PEG_METHOD_EXIT();
9250 return false;
9251 }
9252
9253 PEG_METHOD_EXIT();
9254 return true;
9255 }
9256
9257 Boolean IndicationService::_formatIndication(
9258 CIMInstance& formattedIndication,
9259 QueryExpression& queryExpr,
9260 const Array<CIMName>& providerSupportedProperties,
9261 const Array<CIMName>& indicationClassProperties)
9262 {
9263 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
9264 "IndicationService::_formatIndication");
9265
9266 yi.zhou 1.225 //
9267 // Call QueryExpression::applyProjection to remove properties
9268 // not listed in the SELECT clause. Note: for CQL,
9269 // this will handle properties on embedded objects.
9270 //
9271 // QueryExpression::applyProjection throws an exception if
9272 // the indication is missing a required property in the SELECT
9273 // clause. Although we have checked for the indication missing
9274 // required properties, it would have not detected missing required
9275 // embedded object properties for CQL. So, we need to catch the
9276 // missing property exception here.
9277 //
9278 try
9279 {
9280 queryExpr.applyProjection(formattedIndication, true);
9281 }
9282 catch (QueryRuntimePropertyException& re)
9283 {
9284 // The indication was missing a required property.
|
9285 thilo.boehm 1.242 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1,
9286 "Apply Projection error: %s",
9287 (const char*)re.getMessage().getCString()));
|
9288 yi.zhou 1.225 PEG_METHOD_EXIT();
|
9289 kumpf 1.253 return false;
|
9290 yi.zhou 1.225 }
9291
9292 //
9293 // Remove any properties that may be left on the indication
9294 // that are not in the indication class. These are properties
9295 // added by the provider incorrectly. It is possible that
9296 // these properties will remain after applyProjection if the
9297 // SELECT clause happens to have a property name not on the
9298 // indication class, and the indication has that same property.
9299 // Note: If SELECT includes all properties ("*"), it's still
9300 // necessary to check, in case the provider added properties
9301 // not in the indication class.
9302 //
9303 for (Uint32 j = 0; j < providerSupportedProperties.size(); j++)
9304 {
9305 Uint32 rmIndex =
9306 formattedIndication.findProperty(providerSupportedProperties[j]);
9307 if (rmIndex != PEG_NOT_FOUND &&
9308 !ContainsCIMName(
9309 indicationClassProperties, providerSupportedProperties[j]))
9310 {
9311 yi.zhou 1.225 formattedIndication.removeProperty(rmIndex);
9312 }
9313 }
9314
9315 PEG_METHOD_EXIT();
9316 return true;
9317 }
9318
9319 void IndicationService::_forwardIndToHandler(
9320 const CIMInstance& matchedSubscription,
9321 const CIMInstance& handlerInstance,
9322 const CIMInstance& formattedIndication,
9323 const CIMNamespaceName& namespaceName,
|
9324 venkat.puvvada 1.270 const OperationContext& operationContext,
9325 DeliveryStatusAggregator *deliveryStatusAggregator)
|
9326 yi.zhou 1.225 {
9327 PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
9328 "IndicationService::_forwardIndToHandler");
9329
|
9330 venkat.puvvada 1.270 CIMHandleIndicationRequestMessage *handler_request =
|
9331 yi.zhou 1.225 new CIMHandleIndicationRequestMessage (
9332 XmlWriter::getNextMessageId (),
9333 namespaceName,
9334 handlerInstance,
9335 formattedIndication,
9336 matchedSubscription,
9337 QueueIdStack(_handlerService, getQueueId()),
9338 String::EMPTY,
9339 String::EMPTY);
9340
9341 handler_request->operationContext = operationContext;
|
9342 venkat.puvvada 1.270 handler_request->deliveryStatusAggregator = deliveryStatusAggregator;
|
9343 yi.zhou 1.225
9344 AsyncLegacyOperationStart *async_req =
9345 new AsyncLegacyOperationStart(
|
9346 venkat.puvvada 1.263 0,
|
9347 yi.zhou 1.225 _handlerService,
|
9348 venkat.puvvada 1.244 handler_request);
|
9349 yi.zhou 1.225
|
9350 thilo.boehm 1.242 PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL4,
9351 "Sending (SendAsync) Indication to %s "
9352 "via CIMHandleIndicationRequestMessage",
9353 (MessageQueue::lookup(_handlerService) ?
9354 MessageQueue::lookup(_handlerService)->getQueueName() :
9355 "BAD queue name")));
|
9356 yi.zhou 1.225
|
9357 venkat.puvvada 1.263 SendForget(async_req);
|
9358 venkat.puvvada 1.270 if (deliveryStatusAggregator)
9359 {
9360 deliveryStatusAggregator->incExpectedResponseCount();
9361 }
|
9362 yi.zhou 1.225 PEG_METHOD_EXIT();
9363 }
9364
|
9365 yi.zhou 1.157 PEGASUS_NAMESPACE_END
|