1 kumpf 1.1 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.47 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
|
4 kumpf 1.1 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 kumpf 1.47 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 kumpf 1.1 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
|
12 kumpf 1.27 //
|
13 kumpf 1.47 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 kumpf 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 kumpf 1.47 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 kumpf 1.1 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
25 //
|
26 kumpf 1.27 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
|
27 kumpf 1.86 // (carolann_graves@hp.com)
28 // Ben Heilbronn, Hewlett-Packard Company (ben_heilbronn@hp.com)
|
29 kumpf 1.66 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
|
30 david 1.71 // Dave Rosckes (rosckes@us.ibm.com)
|
31 kumpf 1.86 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
32 kumpf 1.1 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.17 #include <Pegasus/Common/Constants.h>
|
37 kumpf 1.60 #include <Pegasus/Common/ArrayInternal.h>
|
38 kumpf 1.1 #include <Pegasus/Common/CIMDateTime.h>
39 #include <Pegasus/Common/CIMProperty.h>
|
40 kumpf 1.16 #include <Pegasus/Common/HashTable.h>
|
41 kumpf 1.1 #include <Pegasus/Common/MessageQueue.h>
|
42 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
43 #include <Pegasus/Common/Stopwatch.h>
44 #endif
|
45 kumpf 1.1 #include <Pegasus/Common/System.h>
46 #include <Pegasus/Common/Tracer.h>
|
47 kumpf 1.6 #include <Pegasus/Common/XmlWriter.h>
|
48 kumpf 1.36 #include <Pegasus/Common/PegasusVersion.h>
|
49 chuck 1.75 #include <Pegasus/Common/AcceptLanguages.h> // l10n
50 #include <Pegasus/Common/ContentLanguages.h> // l10n
|
51 kumpf 1.1 #include <Pegasus/Repository/CIMRepository.h>
|
52 kumpf 1.12 #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
|
53 kumpf 1.1 #include <Pegasus/WQL/WQLParser.h>
54 #include <Pegasus/WQL/WQLSelectStatement.h>
55
56 #include "IndicationService.h"
57
|
58 humberto 1.78 // l10n
59 #include <Pegasus/Common/MessageLoader.h>
60 #include <Pegasus/Common/String.h>
61
|
62 kumpf 1.1 PEGASUS_USING_STD;
63
64 PEGASUS_NAMESPACE_BEGIN
65
|
66 kumpf 1.55 // ATTN-RK-20020730: Temporary hack to fix Windows build
67 Boolean ContainsCIMName(const Array<CIMName>& a, const CIMName& x)
68 {
69 Uint32 n = a.size();
70
71 for (Uint32 i = 0; i < n; i++)
72 {
73 if (a[i].equal(x))
74 return true;
75 }
76
77 return false;
78 }
79
|
80 kumpf 1.44 Mutex IndicationService::_mutex;
81
|
82 kumpf 1.12 IndicationService::IndicationService (
83 CIMRepository * repository,
|
84 kumpf 1.14 ProviderRegistrationManager * providerRegManager)
|
85 kumpf 1.30 : Base (PEGASUS_QUEUENAME_INDICATIONSERVICE,
|
86 kumpf 1.17 MessageQueue::getNextQueueId ()),
|
87 kumpf 1.12 _repository (repository),
|
88 kumpf 1.14 _providerRegManager (providerRegManager)
|
89 kumpf 1.11 {
|
90 kumpf 1.94 _enableSubscriptionsForNonprivilegedUsers = false;
91
92 try
93 {
94 // Determine the value for the configuration parameter
95 // enableSubscriptionsForNonprivilegedUsers
96 ConfigManager* configManager = ConfigManager::getInstance();
97
98 if (String::equalNoCase(
99 configManager->getCurrentValue("enableAuthentication"), "true"))
100 {
101 _enableSubscriptionsForNonprivilegedUsers = String::equalNoCase(
102 configManager->getCurrentValue(
103 "enableSubscriptionsForNonprivilegedUsers"), "true");
104 }
105 else
106 {
107 // Authentication needs to be enabled to perform authorization
108 // tests.
109 _enableSubscriptionsForNonprivilegedUsers = true;
110 }
111 kumpf 1.94 }
112 catch (...)
113 {
114 // If there is an error reading the configuration file then
115 // the value of _enableSubscriptionsForNonprivilegedUsers will
116 // default to false (i.e., the more restrictive security
117 // setting.
118 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
119 "Failure attempting to read configuration parameters during initialization.");
120 }
121
122 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
123 "Value of _enableSubscriptionsForNonprivilegedUsers is %d",
124 _enableSubscriptionsForNonprivilegedUsers);
125
|
126 kumpf 1.38 try
127 {
|
128 kumpf 1.94 // Initialize the Indication Service
|
129 kumpf 1.38 _initialize ();
130 }
|
131 kumpf 1.94 catch (Exception & e)
|
132 kumpf 1.38 {
133 //
134 // ATTN-CAKG-P3-20020425: Log a message
135 //
136 }
|
137 kumpf 1.11 }
|
138 kumpf 1.1
|
139 kumpf 1.11 IndicationService::~IndicationService (void)
140 {
141 }
|
142 kumpf 1.1
|
143 kumpf 1.11 void IndicationService::_handle_async_request(AsyncRequest *req)
144 {
145 if ( req->getType() == async_messages::CIMSERVICE_STOP )
146 {
147 req->op->processing();
|
148 mday 1.72 handle_CimServiceStop(static_cast<CimServiceStop *>(req));
|
149 kumpf 1.73
|
150 kumpf 1.11 //
151 // Call _terminate
152 //
153 _terminate ();
154 }
|
155 kumpf 1.43 else if (req->getType () == async_messages::CIMSERVICE_START)
|
156 kumpf 1.11 {
157 req->op->processing ();
|
158 kumpf 1.1
|
159 kumpf 1.11 handle_CimServiceStart (static_cast <CimServiceStart *> (req));
160 }
161 else if ( req->getType() == async_messages::ASYNC_LEGACY_OP_START )
162 {
|
163 mday 1.40 try
164 {
165 req->op->processing();
166 Message *legacy =
167 (static_cast<AsyncLegacyOperationStart *>(req)->get_action());
168 legacy->put_async(req);
169
170 handleEnqueue(legacy);
171 }
172 catch(Exception & )
173 {
174 PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL3,
175 "Caught Exception in IndicationService while handling a wrapped legacy message ");
176 _make_response(req, async_results::CIM_NAK );
177 }
178
|
179 kumpf 1.11 return;
180 }
181 else
182 Base::_handle_async_request(req);
183 }
|
184 kumpf 1.1
|
185 kumpf 1.11 void IndicationService::handleEnqueue(Message* message)
186 {
|
187 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
188 Stopwatch stopWatch;
189 #endif
|
190 mday 1.40
|
191 chuck 1.75 // l10n
192 // Set the client's requested language into this service thread.
193 // This will allow functions in this service to return messages
194 // in the correct language.
195 CIMMessage * msg = dynamic_cast<CIMMessage *>(message);
196 if (msg != NULL)
197 {
|
198 chuck 1.81 if (msg->thread_changed())
199 {
|
200 chuck 1.75 AcceptLanguages *langs =
201 new AcceptLanguages(msg->acceptLanguages);
202 Thread::setLanguages(langs);
|
203 chuck 1.81 }
|
204 chuck 1.75 }
205 else
206 {
207 Thread::clearLanguages();
208 }
209
|
210 mday 1.40 switch(message->getType())
211 {
212 case CIM_GET_INSTANCE_REQUEST_MESSAGE:
213 try
214 {
|
215 kumpf 1.11 _handleGetInstanceRequest(message);
|
216 mday 1.40 }
217 catch( ... )
218 {
219
220 ;
221 }
222
223 break;
224
225 case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE:
226 try
227 {
|
228 kumpf 1.11 _handleEnumerateInstancesRequest(message);
|
229 mday 1.40 }
230 catch( ... )
231 {
232
233 ;
234 }
235
236 break;
237
238 case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE:
239 try
240 {
241
|
242 kumpf 1.11 _handleEnumerateInstanceNamesRequest(message);
|
243 mday 1.40 }
244 catch( ... )
245 {
246
247 ;
248 }
249
250 break;
251
252 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
253 try
254 {
|
255 kumpf 1.11 _handleCreateInstanceRequest(message);
|
256 mday 1.40 }
257 catch( ... )
258 {
259
260 ;
261 }
262 break;
263
264 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
265 try
266 {
267
|
268 kumpf 1.11 _handleModifyInstanceRequest(message);
|
269 mday 1.40 }
270 catch( ... )
271 {
272
273 ;
274 }
275 break;
276
277 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
278 try
279 {
|
280 kumpf 1.11 _handleDeleteInstanceRequest(message);
|
281 mday 1.40 }
282 catch( ... )
283 {
284
285 ;
286 }
287 break;
288
289 case CIM_PROCESS_INDICATION_REQUEST_MESSAGE:
290 try
291 {
292 _handleProcessIndicationRequest(message);
293 }
294 catch( ... )
295 {
296
297 ;
298 }
299 break;
300
301 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
302 mday 1.40 try
303 {
|
304 kumpf 1.27 _handleNotifyProviderRegistrationRequest(message);
|
305 mday 1.40 }
306 catch( ... )
307 {
308
309 ;
310 }
311 break;
312
313 case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE:
314 try
315 {
|
316 kumpf 1.27 _handleNotifyProviderTerminationRequest(message);
|
317 mday 1.40 }
318 catch( ... )
319 {
320
321 ;
322 }
323 break;
324
325 default:
326 //
327 // A message type not supported by the Indication Service
328 // Should not reach here
329 //
330 // << Mon Apr 29 16:29:10 2002 mdd >>
331 PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL3,
332 "IndicationService::handleEnqueue(msg *) rcv'd unsupported msg "
333 + String(MessageTypeToString(message->getType())));
334 break;
335 }
|
336 kumpf 1.73
337 #ifdef PEGASUS_INDICATION_PERFINST
338 double elapsed = stopWatch.getElapsed ();
339
340 Tracer::trace (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2,
341 "%s: %.3f seconds", MessageTypeToString (message->getType ()), elapsed);
342 #endif
|
343 mday 1.40
344 delete message;
|
345 kumpf 1.11 }
|
346 kumpf 1.1
|
347 kumpf 1.11 void IndicationService::handleEnqueue(void)
348 {
349 Message * message = dequeue();
|
350 kumpf 1.1
|
351 kumpf 1.11 PEGASUS_ASSERT(message != 0);
352 handleEnqueue(message);
353 }
|
354 kumpf 1.1
|
355 kumpf 1.11 void IndicationService::_initialize (void)
356 {
|
357 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
358 Stopwatch stopWatch;
359 #endif
360
|
361 kumpf 1.46 Array <CIMInstance> activeSubscriptions;
362 Array <CIMInstance> noProviderSubscriptions;
|
363 kumpf 1.38 Array <ProviderClassList> enableProviders;
|
364 kumpf 1.11 Boolean duplicate;
|
365 kumpf 1.80 Boolean warningLogged = false;
|
366 kumpf 1.1
|
367 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_initialize");
|
368 mday 1.40
|
369 kumpf 1.11 //
370 // Find required services
|
371 kumpf 1.38 // NOTE: Indication Service expects to find exactly one Provider Manager
372 // Service and exactly one Handler Manager Service
|
373 kumpf 1.11 //
374 Array <Uint32> pmservices;
|
375 kumpf 1.30 find_services (PEGASUS_QUEUENAME_PROVIDERMANAGER_CPP, 0, 0, &pmservices);
|
376 kumpf 1.11 pegasus_yield ();
|
377 kumpf 1.37 PEGASUS_ASSERT (pmservices.size () == 1);
378 _providerManager = pmservices [0];
379
|
380 kumpf 1.11 Array <Uint32> hmservices;
|
381 kumpf 1.30 find_services (PEGASUS_QUEUENAME_INDHANDLERMANAGER, 0, 0, &hmservices);
|
382 kumpf 1.11 pegasus_yield ();
|
383 kumpf 1.37 PEGASUS_ASSERT (hmservices.size () == 1);
384 _handlerService = hmservices [0];
385
|
386 kumpf 1.11 //
|
387 kumpf 1.27 // FUTURE: Add code to find repository service, if repository becomes a
|
388 kumpf 1.11 // service
389 //
|
390 kumpf 1.1
|
391 kumpf 1.11 //
|
392 kumpf 1.32 // Set arrays of valid property values
393 //
394 _validStates.append (_STATE_UNKNOWN);
395 _validStates.append (_STATE_OTHER);
396 _validStates.append (_STATE_ENABLED);
397 _validStates.append (_STATE_ENABLEDDEGRADED);
398 _validStates.append (_STATE_DISABLED);
399 _validRepeatPolicies.append (_POLICY_UNKNOWN);
400 _validRepeatPolicies.append (_POLICY_OTHER);
401 _validRepeatPolicies.append (_POLICY_NONE);
402 _validRepeatPolicies.append (_POLICY_SUPPRESS);
403 _validRepeatPolicies.append (_POLICY_DELAY);
404 _validErrorPolicies.append (_ERRORPOLICY_OTHER);
405 _validErrorPolicies.append (_ERRORPOLICY_IGNORE);
406 _validErrorPolicies.append (_ERRORPOLICY_DISABLE);
407 _validErrorPolicies.append (_ERRORPOLICY_REMOVE);
408 _validPersistenceTypes.append (_PERSISTENCE_OTHER);
409 _validPersistenceTypes.append (_PERSISTENCE_PERMANENT);
410 _validPersistenceTypes.append (_PERSISTENCE_TRANSIENT);
411
412 //
|
413 kumpf 1.11 // Get existing active subscriptions from each namespace in the repository
414 //
|
415 kumpf 1.80 warningLogged = _getActiveSubscriptionsFromRepository (activeSubscriptions);
|
416 kumpf 1.11 noProviderSubscriptions.clear ();
|
417 kumpf 1.1
|
418 kumpf 1.11 String condition;
419 String queryLanguage;
420 CIMPropertyList propertyList;
|
421 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
422 kumpf 1.1
|
423 kumpf 1.83 for (Uint32 i = 0; i < activeSubscriptions.size (); i++)
|
424 kumpf 1.11 {
425 //
426 // Check for expired subscription
427 //
|
428 kumpf 1.46 if (_isExpired (activeSubscriptions [i]))
|
429 kumpf 1.11 {
|
430 kumpf 1.46 CIMObjectPath path = activeSubscriptions [i].getPath ();
431 _deleteExpiredSubscription (path);
|
432 kumpf 1.27
|
433 kumpf 1.11 continue;
434 }
|
435 kumpf 1.1
|
436 kumpf 1.63 CIMNamespaceName sourceNameSpace;
|
437 kumpf 1.73 Array <CIMName> indicationSubclasses;
|
438 kumpf 1.38 _getCreateParams
|
439 kumpf 1.46 (activeSubscriptions [i].getPath ().getNameSpace (),
|
440 kumpf 1.73 activeSubscriptions [i], indicationSubclasses, indicationProviders,
|
441 kumpf 1.27 propertyList, sourceNameSpace, condition, queryLanguage);
|
442 kumpf 1.1
|
443 kumpf 1.11 if (indicationProviders.size () == 0)
444 {
445 //
446 // There are no providers that can support this subscription
|
447 kumpf 1.19 // Implement the subscription's On Fatal Error Policy
448 // If subscription is not disabled or removed,
|
449 kumpf 1.11 // Append this subscription to no provider list
450 //
|
451 kumpf 1.19 if (!_handleError (activeSubscriptions [i]))
452 {
453 noProviderSubscriptions.append (activeSubscriptions [i]);
454 }
|
455 kumpf 1.11 continue;
456 }
|
457 kumpf 1.27
|
458 kumpf 1.11 //
|
459 kumpf 1.38 // Send Create request message to each provider
|
460 kumpf 1.39 // NOTE: These Create requests are not associated with a user request,
461 // so there is no associated authType or userName
|
462 kumpf 1.15 // The Creator from the subscription instance is used for userName,
463 // and authType is not set
|
464 kumpf 1.11 //
|
465 kumpf 1.46 CIMInstance instance = activeSubscriptions [i];
|
466 kumpf 1.80 String creator;
467 if (!_getCreator (instance, creator))
468 {
469 //
470 // This instance from the repository is corrupted
471 // Log a message and skip it
|
472 humberto 1.82 // L10N TODO DONE -- new log message
|
473 kumpf 1.80 //
474 if (!warningLogged)
475 {
|
476 humberto 1.82 //Logger::put (Logger::STANDARD_LOG, System::CIMSERVER,
477 //Logger::WARNING, _MSG_INVALID_INSTANCES);
478 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
479 Logger::WARNING, _MSG_INVALID_INSTANCES_KEY,
480 _MSG_INVALID_INSTANCES);
|
481 kumpf 1.80 warningLogged = true;
482 }
483 break;
484 }
|
485 chuck 1.77
486 //l10n start
|
487 chuck 1.75 // Get the language tags that were saved with the subscription instance
|
488 chuck 1.77 String acceptLangs = String::EMPTY;
489 Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
490 if (propIndex != PEG_NOT_FOUND)
491 {
492 instance.getProperty(propIndex).getValue().get(acceptLangs);
493 }
494 String contentLangs = String::EMPTY;
495 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
496 if (propIndex != PEG_NOT_FOUND)
497 {
498 instance.getProperty(propIndex).getValue().get(contentLangs);
499 }
500 // l10n end
|
501 chuck 1.75
|
502 kumpf 1.88 _sendCreateRequests (indicationProviders, sourceNameSpace,
|
503 kumpf 1.11 propertyList, condition, queryLanguage,
|
504 chuck 1.75 activeSubscriptions [i],
505 AcceptLanguages(acceptLangs), // l10n
506 ContentLanguages(contentLangs), // 110n
|
507 kumpf 1.88 0, // initialize -- no request
508 indicationSubclasses,
509 creator);
|
510 kumpf 1.73
|
511 kumpf 1.11 } // for each active subscription
|
512 kumpf 1.1
|
513 kumpf 1.11 //
|
514 kumpf 1.87 // Log a message for any subscription for which there is no longer any
|
515 kumpf 1.11 // provider
516 //
517 if (noProviderSubscriptions.size () > 0)
518 {
|
519 kumpf 1.87 #if 0
|
520 kumpf 1.11 //
521 // Send NoProviderAlertIndication to handler instances
522 // ATTN: NoProviderAlertIndication must be defined
523 //
524 CIMInstance indicationInstance = _createAlertInstance
525 (_CLASS_NO_PROVIDER_ALERT, noProviderSubscriptions);
|
526 kumpf 1.1
|
527 kumpf 1.73 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
528 "Sending NoProvider Alert for %d subscriptions",
529 noProviderSubscriptions.size ());
|
530 kumpf 1.11 _sendAlerts (noProviderSubscriptions, indicationInstance);
|
531 kumpf 1.87 #endif
532 //
533 // Log a message for each subscription
534 //
535 for (Uint32 i = 0; i < noProviderSubscriptions.size (); i++)
536 {
|
537 kumpf 1.88 Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
|
538 kumpf 1.87 Logger::WARNING, _MSG_NO_PROVIDER_KEY, _MSG_NO_PROVIDER,
539 noProviderSubscriptions [i].getPath ().toString ());
540 }
|
541 kumpf 1.11 }
|
542 kumpf 1.1
|
543 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
544 double elapsed = stopWatch.getElapsed ();
545
546 Tracer::trace (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2,
547 "%s: %.3f seconds", "Initialize", elapsed);
548 #endif
549
|
550 kumpf 1.48 PEG_METHOD_EXIT ();
|
551 kumpf 1.11 }
|
552 kumpf 1.1
|
553 kumpf 1.11 void IndicationService::_terminate (void)
554 {
|
555 kumpf 1.46 Array <CIMInstance> activeSubscriptions;
|
556 kumpf 1.11 CIMInstance indicationInstance;
|
557 kumpf 1.1
|
558 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_terminate");
|
559 kumpf 1.1
|
560 kumpf 1.11 //
|
561 kumpf 1.87 // A message is already logged that CIM Server is shutting down --
562 // no need to log a message
563 //
564 #if 0
565 //
|
566 kumpf 1.73 // Get existing active subscriptions from hash table
|
567 kumpf 1.11 //
568 activeSubscriptions = _getActiveSubscriptions ();
|
569 kumpf 1.1
|
570 kumpf 1.73 if (activeSubscriptions.size () > 0)
571 {
572 //
573 // Create CimomShutdownAlertIndication instance
574 // ATTN: CimomShutdownAlertIndication must be defined
575 //
576 indicationInstance = _createAlertInstance (_CLASS_CIMOM_SHUTDOWN_ALERT,
577 activeSubscriptions);
578
579 //
580 // Send CimomShutdownAlertIndication to each unique handler instance
581 //
582 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
583 "Sending CIMServerShutdown Alert for %d subscriptions",
584 activeSubscriptions.size ());
585 _sendAlerts (activeSubscriptions, indicationInstance);
586 }
|
587 kumpf 1.87 #endif
|
588 kumpf 1.1
|
589 kumpf 1.48 PEG_METHOD_EXIT ();
|
590 kumpf 1.11 }
|
591 kumpf 1.6
|
592 kumpf 1.94 void IndicationService::_checkNonprivilegedAuthorization(
593 const String & userName)
594 {
595 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
596 "IndicationService::_checkNonprivilegedAuthorization");
597
598 Boolean accessDenied = false;
599 try
600 {
601 if (_enableSubscriptionsForNonprivilegedUsers)
602 {
603 return;
604 }
605 else
606 {
607 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
608 "_checkNonprivilegedAuthorization - checking whether user is privileged"
609 + userName);
610 if (!System::isPrivilegedUser(userName))
611 {
612 accessDenied = true;
613 kumpf 1.94 }
614 }
615 }
616 catch (...)
617 {
618 PEG_METHOD_EXIT();
619 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, String::EMPTY);
620 }
621 if (accessDenied)
622 {
623 MessageLoaderParms parms(_MSG_NON_PRIVILEGED_ACCESS_DISABLED_KEY,
624 _MSG_NON_PRIVILEGED_ACCESS_DISABLED, userName);
625 PEG_METHOD_EXIT();
626 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED, parms);
627 }
628 }
629
|
630 kumpf 1.11 void IndicationService::_handleCreateInstanceRequest (const Message * message)
631 {
|
632 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
633 "IndicationService::_handleCreateInstanceRequest");
|
634 kumpf 1.6
|
635 kumpf 1.27 CIMCreateInstanceRequestMessage* request =
|
636 kumpf 1.11 (CIMCreateInstanceRequestMessage*) message;
|
637 kumpf 1.6
|
638 kumpf 1.23 CIMException cimException;
|
639 kumpf 1.88 Boolean responseSent = false;
|
640 kumpf 1.6
|
641 kumpf 1.45 CIMObjectPath instanceRef;
|
642 kumpf 1.1
|
643 kumpf 1.11 CIMInstance instance = request->newInstance.clone ();
|
644 kumpf 1.1
|
645 kumpf 1.11 try
646 {
|
647 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
648
|
649 kumpf 1.11 if (_canCreate (instance, request->nameSpace))
650 {
|
651 chuck 1.75
|
652 kumpf 1.11 //
|
653 kumpf 1.67 // If the instance is of the PEGASUS_CLASSNAME_INDSUBSCRIPTION
654 // class and subscription state is enabled, determine if any
655 // providers can serve the subscription
|
656 kumpf 1.11 //
657 Uint16 subscriptionState;
658 String condition;
659 String queryLanguage;
660 CIMPropertyList requiredProperties;
|
661 kumpf 1.63 CIMNamespaceName sourceNameSpace;
|
662 kumpf 1.73 Array <CIMName> indicationSubclasses;
|
663 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
664 kumpf 1.73
|
665 kumpf 1.64 if (instance.getClassName ().equal
666 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
667 kumpf 1.11 {
668 //
669 // Get subscription state
670 //
|
671 kumpf 1.80 // NOTE: _canCreate has already validated the
672 // SubscriptionState property in the instance; if missing, it
673 // was added with the default value; if null, it was set to
674 // the default value; if invalid, an exception was thrown
675 //
|
676 kumpf 1.11 CIMValue subscriptionStateValue;
677 subscriptionStateValue = instance.getProperty
678 (instance.findProperty (_PROPERTY_STATE)).getValue ();
679 subscriptionStateValue.get (subscriptionState);
|
680 kumpf 1.1
|
681 kumpf 1.11 if ((subscriptionState == _STATE_ENABLED) ||
682 (subscriptionState == _STATE_ENABLEDDEGRADED))
683 {
|
684 kumpf 1.38 _getCreateParams (request->nameSpace, instance,
|
685 kumpf 1.73 indicationSubclasses, indicationProviders,
686 requiredProperties, sourceNameSpace, condition,
687 queryLanguage);
688
|
689 kumpf 1.11 if (indicationProviders.size () == 0)
690 {
691 //
|
692 kumpf 1.27 // There are no providers that can support this
|
693 kumpf 1.11 // subscription
694 //
|
695 kumpf 1.48 PEG_METHOD_EXIT ();
|
696 humberto 1.78
697 // l10n
698
699 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
700 // _MSG_NO_PROVIDERS);
701
702 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
703 MessageLoaderParms(_MSG_NO_PROVIDERS_KEY, _MSG_NO_PROVIDERS));
|
704 kumpf 1.11 }
|
705 kumpf 1.69
|
706 kumpf 1.11 //
|
707 kumpf 1.38 // Send Create request message to each provider
|
708 kumpf 1.11 //
|
709 kumpf 1.88 instanceRef = instance.getPath ();
|
710 kumpf 1.16 instanceRef.setNameSpace (request->nameSpace);
|
711 s.hills 1.91
712 CIMValue filterValue = instance.getProperty(
713 instance.findProperty( _PROPERTY_FILTER ) ).getValue();
714 CIMValue handlerValue = instance.getProperty(
715 instance.findProperty( _PROPERTY_HANDLER ) ).getValue();
716
717 Array< CIMKeyBinding > kb;
718 kb.append( CIMKeyBinding( _PROPERTY_FILTER, filterValue ) );
719 kb.append( CIMKeyBinding( _PROPERTY_HANDLER, handlerValue ) );
720
721 instanceRef.setKeyBindings( kb );
722
|
723 kumpf 1.46 instance.setPath (instanceRef);
|
724 chuck 1.75 // l10n
|
725 kumpf 1.88 _sendCreateRequests (indicationProviders,
|
726 kumpf 1.27 sourceNameSpace, requiredProperties, condition,
|
727 kumpf 1.46 queryLanguage, instance,
|
728 chuck 1.75 request->acceptLanguages,
729 request->contentLanguages,
|
730 kumpf 1.88 request,
731 indicationSubclasses,
732 request->userName, request->authType);
|
733 humberto 1.78
|
734 kumpf 1.11 //
|
735 kumpf 1.88 // Response is sent from _aggregationCallBack
|
736 kumpf 1.11 //
|
737 kumpf 1.88 responseSent = true;
738 }
739 else
740 {
|
741 kumpf 1.73 //
|
742 kumpf 1.88 // Create instance for disabled subscription
|
743 kumpf 1.73 //
|
744 kumpf 1.88 instanceRef = _createInstance (request, instance, false);
|
745 kumpf 1.11 }
746 }
|
747 kumpf 1.88 else
748 {
749 //
750 // Create instance for filter or handler
751 //
752 instanceRef = _createInstance (request, instance, false);
753 }
|
754 kumpf 1.11 }
755 }
756 catch (CIMException & exception)
757 {
|
758 kumpf 1.23 cimException = exception;
|
759 kumpf 1.11 }
760 catch (Exception & exception)
761 {
|
762 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
763 exception.getMessage());
|
764 kumpf 1.11 }
|
765 kumpf 1.1
|
766 kumpf 1.38 //
|
767 kumpf 1.88 // Send response, if it has not already been sent by callback
|
768 kumpf 1.38 //
|
769 kumpf 1.88 if (!responseSent)
770 {
|
771 chuck 1.75 // l10n - no Content-Language in response
|
772 kumpf 1.88 CIMCreateInstanceResponseMessage* response =
773 new CIMCreateInstanceResponseMessage(
774 request->messageId,
775 cimException,
776 request->queueIds.copyAndPop(),
777 instanceRef);
778
779 //
780 // Preserve message key
781 //
782 response->setKey (request->getKey ());
783
784 //
785 // Set response destination
786 //
787 response->dest = request->queueIds.top ();
|
788 kumpf 1.6
|
789 kumpf 1.88 //
790 // Set HTTP method in response from request
791 //
792 response->setHttpMethod (request->getHttpMethod ());
|
793 kumpf 1.69
|
794 kumpf 1.88 Base::_enqueueResponse (request, response);
795 }
|
796 kumpf 1.6
|
797 kumpf 1.48 PEG_METHOD_EXIT ();
|
798 kumpf 1.11 }
|
799 kumpf 1.6
|
800 kumpf 1.11 void IndicationService::_handleGetInstanceRequest (const Message* message)
801 {
|
802 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
803 "IndicationService::_handleGetInstanceRequest");
|
804 kumpf 1.6
|
805 kumpf 1.27 CIMGetInstanceRequestMessage* request =
|
806 kumpf 1.11 (CIMGetInstanceRequestMessage*) message;
|
807 kumpf 1.6
|
808 kumpf 1.23 CIMException cimException;
|
809 kumpf 1.11 CIMInstance instance;
|
810 chuck 1.75 String contentLangs = String::EMPTY; // l10n
|
811 kumpf 1.6
|
812 kumpf 1.19 _repository->read_lock ();
813
|
814 kumpf 1.11 try
815 {
|
816 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
817
|
818 kumpf 1.11 //
819 // Get instance from repository
820 //
|
821 kumpf 1.27 instance = _repository->getInstance (request->nameSpace,
822 request->instanceName, request->localOnly,
823 request->includeQualifiers, request->includeClassOrigin,
|
824 kumpf 1.11 request->propertyList);
|
825 kumpf 1.1
|
826 kumpf 1.11 //
827 // Remove Creator property from instance before returning
828 //
|
829 kumpf 1.80 String creator;
830 if (!_getCreator (instance, creator))
831 {
832 //
833 // This instance from the repository is corrupted
|
834 humberto 1.82 // L10N TODO DONE -- new throw of exception
|
835 kumpf 1.80 //
836 PEG_METHOD_EXIT ();
|
837 humberto 1.82 //throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED,
838 //_MSG_INVALID_INSTANCES);
839 MessageLoaderParms parms(_MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES);
840 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
841
|
842 kumpf 1.80 }
|
843 kumpf 1.38 instance.removeProperty (instance.findProperty
844 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
|
845 kumpf 1.1
|
846 chuck 1.75 // l10n start
847 //
848 // Remove the language properties from instance before returning
849 //
|
850 chuck 1.77 Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
851 if (propIndex != PEG_NOT_FOUND)
852 {
853 instance.removeProperty (propIndex);
854 }
855
856 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
857 if (propIndex != PEG_NOT_FOUND)
858 {
859 // Get the content languages to be sent in the Content-Language header
860 instance.getProperty(propIndex).getValue().get(contentLangs);
861 instance.removeProperty (propIndex);
862 }
|
863 chuck 1.75 // l10n end
864
|
865 kumpf 1.11 //
|
866 kumpf 1.27 // If a subscription with a duration, calculate subscription time
|
867 kumpf 1.11 // remaining, and add property to the instance
868 //
|
869 kumpf 1.64 if (request->instanceName.getClassName ().equal
870 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
871 kumpf 1.11 {
|
872 kumpf 1.35 _setTimeRemaining (instance);
|
873 kumpf 1.11 }
874 }
875 catch (CIMException& exception)
876 {
|
877 kumpf 1.23 cimException = exception;
|
878 kumpf 1.11 }
879 catch (Exception& exception)
880 {
|
881 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
882 exception.getMessage());
|
883 kumpf 1.11 }
|
884 kumpf 1.10
|
885 kumpf 1.19 _repository->read_unlock ();
886
|
887 chuck 1.75 // l10n
888 // Note: setting Content-Language in the response to the contentLanguage
889 // in the repository.
|
890 kumpf 1.11 CIMGetInstanceResponseMessage* response = new CIMGetInstanceResponseMessage
891 (request->messageId,
|
892 kumpf 1.23 cimException,
|
893 kumpf 1.11 request->queueIds.copyAndPop(),
|
894 chuck 1.75 instance,
895 ContentLanguages(contentLangs));
|
896 kumpf 1.1
897 //
|
898 kumpf 1.11 // Preserve message key
|
899 kumpf 1.6 //
|
900 kumpf 1.11 response->setKey (request->getKey ());
|
901 kumpf 1.27
|
902 kumpf 1.6 //
|
903 kumpf 1.11 // Set response destination
|
904 kumpf 1.1 //
|
905 kumpf 1.11 response->dest = request->queueIds.top ();
|
906 kumpf 1.27
|
907 kumpf 1.69 //
908 // Set HTTP method in response from request
909 //
910 response->setHttpMethod (request->getHttpMethod ());
911
|
912 kumpf 1.11 Base::_enqueueResponse (request, response);
|
913 kumpf 1.1
|
914 kumpf 1.48 PEG_METHOD_EXIT ();
|
915 kumpf 1.1 }
916
|
917 kumpf 1.11 void IndicationService::_handleEnumerateInstancesRequest(const Message* message)
|
918 kumpf 1.1 {
|
919 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
920 "IndicationService::_handleEnumerateInstancesRequest");
|
921 kumpf 1.1
|
922 kumpf 1.27 CIMEnumerateInstancesRequestMessage* request =
|
923 kumpf 1.11 (CIMEnumerateInstancesRequestMessage*) message;
|
924 kumpf 1.1
|
925 kumpf 1.46 Array <CIMInstance> enumInstances;
|
926 kumpf 1.80 Array <CIMInstance> returnedInstances;
|
927 kumpf 1.1
|
928 kumpf 1.23 CIMException cimException;
|
929 kumpf 1.11 CIMInstance cimInstance;
|
930 chuck 1.75 String aggregatedLangs = String::EMPTY; // l10n
931
|
932 kumpf 1.11
|
933 kumpf 1.19 _repository->read_lock ();
934
|
935 kumpf 1.11 try
936 {
|
937 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
938
|
939 kumpf 1.50 enumInstances = _repository->enumerateInstancesForClass
940 (request->nameSpace, request->className,
941 request->deepInheritance, request->localOnly,
942 request->includeQualifiers, request->includeClassOrigin,
943 false, request->propertyList);
|
944 chuck 1.75
945 // l10n
946 // Vars used to aggregate the content languages of the subscription
947 // instances.
948 Boolean langMismatch = false;
|
949 chuck 1.77 Uint32 propIndex;
|
950 kumpf 1.27
|
951 kumpf 1.11 //
|
952 chuck 1.77 // Remove Creator and language properties from instances before returning
|
953 kumpf 1.11 //
|
954 kumpf 1.83 for (Uint32 i = 0; i < enumInstances.size (); i++)
|
955 kumpf 1.11 {
|
956 kumpf 1.80 String creator;
957 if (!_getCreator (enumInstances [i], creator))
958 {
959 //
960 // This instance from the repository is corrupted
961 // Skip it
962 //
963 break;
964 }
|
965 kumpf 1.46 enumInstances [i].removeProperty
966 (enumInstances [i].findProperty
|
967 kumpf 1.38 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
|
968 kumpf 1.11
|
969 chuck 1.75 // l10n start
|
970 chuck 1.77 propIndex = enumInstances [i].findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
971 String contentLangs = String::EMPTY;
972 if (propIndex != PEG_NOT_FOUND)
973 {
974 enumInstances [i].getProperty(propIndex).getValue().get(contentLangs);
975 enumInstances [i].removeProperty(propIndex);
976 }
|
977 chuck 1.75
|
978 chuck 1.77 propIndex = enumInstances [i].findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
979 if (propIndex != PEG_NOT_FOUND)
980 {
981 enumInstances [i].removeProperty(propIndex);
982 }
983
984 // Determine what to set into the Content-Language header back to the client
|
985 chuck 1.75 if (!langMismatch)
986 {
987 if (contentLangs == String::EMPTY)
988 {
989 langMismatch = true;
990 aggregatedLangs = String::EMPTY;
991 }
992 else
993 {
994 if (aggregatedLangs == String::EMPTY)
995 {
996 aggregatedLangs = contentLangs;
997 }
998 else if (aggregatedLangs != contentLangs)
999 {
1000 langMismatch = true;
1001 aggregatedLangs = String::EMPTY;
1002 }
1003 }
1004 }
1005 // l10n end
1006 chuck 1.75
|
1007 kumpf 1.11 //
|
1008 kumpf 1.27 // If a subscription with a duration, calculate subscription time
|
1009 kumpf 1.11 // remaining, and add property to the instance
1010 //
|
1011 kumpf 1.64 if (request->className.equal (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
1012 kumpf 1.11 {
|
1013 kumpf 1.46 _setTimeRemaining (enumInstances [i]);
|
1014 kumpf 1.11 }
|
1015 kumpf 1.80
1016 returnedInstances.append (enumInstances [i]);
|
1017 kumpf 1.11 }
|
1018 kumpf 1.1 }
|
1019 kumpf 1.11 catch (CIMException& exception)
|
1020 kumpf 1.1 {
|
1021 kumpf 1.23 cimException = exception;
|
1022 kumpf 1.1 }
|
1023 kumpf 1.11 catch (Exception& exception)
|
1024 kumpf 1.1 {
|
1025 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1026 exception.getMessage());
|
1027 kumpf 1.11 }
|
1028 kumpf 1.1
|
1029 kumpf 1.19 _repository->read_unlock ();
1030
|
1031 chuck 1.75 // l10n
1032 // Note: setting Content-Language in the response to the aggregated
1033 // contentLanguage from the instances in the repository.
|
1034 kumpf 1.27 CIMEnumerateInstancesResponseMessage* response =
|
1035 kumpf 1.11 new CIMEnumerateInstancesResponseMessage(
1036 request->messageId,
|
1037 kumpf 1.23 cimException,
|
1038 kumpf 1.11 request->queueIds.copyAndPop(),
|
1039 kumpf 1.80 returnedInstances,
|
1040 chuck 1.75 ContentLanguages(aggregatedLangs));
|
1041 kumpf 1.1
|
1042 kumpf 1.11 //
1043 // Preserve message key
1044 //
1045 response->setKey (request->getKey ());
|
1046 kumpf 1.27
|
1047 kumpf 1.11 //
1048 // Set response destination
1049 //
1050 response->dest = request->queueIds.top ();
|
1051 kumpf 1.27
|
1052 kumpf 1.69 //
1053 // Set HTTP method in response from request
1054 //
1055 response->setHttpMethod (request->getHttpMethod ());
1056
|
1057 kumpf 1.11 Base::_enqueueResponse (request, response);
|
1058 kumpf 1.1
|
1059 kumpf 1.48 PEG_METHOD_EXIT ();
|
1060 kumpf 1.11 }
|
1061 kumpf 1.1
|
1062 kumpf 1.11 void IndicationService::_handleEnumerateInstanceNamesRequest
1063 (const Message* message)
1064 {
|
1065 kumpf 1.48 PEG_METHOD_ENTER (
1066 TRC_INDICATION_SERVICE,
1067 "IndicationService::_handleEnumerateInstancesNamesRequest");
|
1068 kumpf 1.27
|
1069 kumpf 1.11 CIMEnumerateInstanceNamesRequestMessage* request =
1070 (CIMEnumerateInstanceNamesRequestMessage*) message;
|
1071 kumpf 1.1
|
1072 kumpf 1.45 Array<CIMObjectPath> enumInstanceNames;
|
1073 kumpf 1.1
|
1074 kumpf 1.23 CIMException cimException;
|
1075 kumpf 1.1
|
1076 kumpf 1.19 _repository->read_lock ();
1077
|
1078 kumpf 1.11 try
1079 {
|
1080 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
1081
|
1082 kumpf 1.50 enumInstanceNames = _repository->enumerateInstanceNamesForClass
1083 (request->nameSpace, request->className, false);
|
1084 kumpf 1.11 }
1085 catch (CIMException& exception)
1086 {
|
1087 kumpf 1.23 cimException = exception;
|
1088 kumpf 1.11 }
1089 catch (Exception& exception)
1090 {
|
1091 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1092 exception.getMessage());
|
1093 kumpf 1.11 }
|
1094 kumpf 1.1
|
1095 kumpf 1.19 _repository->read_unlock ();
1096
|
1097 chuck 1.75 // l10n
1098 // Note: not setting Content-Language in the response
|
1099 kumpf 1.11 CIMEnumerateInstanceNamesResponseMessage* response =
1100 new CIMEnumerateInstanceNamesResponseMessage(
1101 request->messageId,
|
1102 kumpf 1.23 cimException,
|
1103 kumpf 1.11 request->queueIds.copyAndPop(),
1104 enumInstanceNames);
|
1105 kumpf 1.1
|
1106 kumpf 1.11 // preserve message key
1107 response->setKey(request->getKey());
|
1108 kumpf 1.1
|
1109 kumpf 1.27
|
1110 kumpf 1.17 // Set the response destination !!!
|
1111 kumpf 1.11 response->dest = request->queueIds.top();
|
1112 kumpf 1.27
|
1113 kumpf 1.69 //
1114 // Set HTTP method in response from request
1115 //
1116 response->setHttpMethod (request->getHttpMethod ());
1117
|
1118 kumpf 1.17 // Note: In this particular case you can call either SendForget
1119 // OR Base::_enqueueResponse
1120 // SendForget(response);
|
1121 kumpf 1.11 Base::_enqueueResponse(request, response);
|
1122 kumpf 1.1
|
1123 kumpf 1.48 PEG_METHOD_EXIT ();
|
1124 kumpf 1.1 }
1125
|
1126 kumpf 1.11 void IndicationService::_handleModifyInstanceRequest (const Message* message)
|
1127 kumpf 1.1 {
|
1128 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
1129 "IndicationService::_handleModifyInstanceRequest");
|
1130 kumpf 1.1
|
1131 kumpf 1.27 CIMModifyInstanceRequestMessage* request =
|
1132 kumpf 1.11 (CIMModifyInstanceRequestMessage*) message;
|
1133 kumpf 1.6
|
1134 kumpf 1.23 CIMException cimException;
|
1135 kumpf 1.88 Boolean responseSent = false;
|
1136 kumpf 1.27
|
1137 kumpf 1.11 try
|
1138 kumpf 1.6 {
|
1139 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
1140
|
1141 kumpf 1.6 //
|
1142 kumpf 1.11 // Get the instance name
|
1143 kumpf 1.6 //
|
1144 kumpf 1.45 CIMObjectPath instanceReference =
|
1145 kumpf 1.46 request->modifiedInstance.getPath ();
|
1146 kumpf 1.27
|
1147 kumpf 1.6 //
|
1148 kumpf 1.11 // Get instance from repository
|
1149 kumpf 1.6 //
|
1150 kumpf 1.19 _repository->read_lock ();
1151
1152 CIMInstance instance;
1153
1154 try
1155 {
|
1156 kumpf 1.27 instance = _repository->getInstance (request->nameSpace,
|
1157 kumpf 1.19 instanceReference);
|
1158 kumpf 1.27 }
|
1159 kumpf 1.19 catch (Exception e)
1160 {
1161 _repository->read_unlock ();
|
1162 kumpf 1.48 PEG_METHOD_EXIT ();
|
1163 kumpf 1.19 throw e;
1164 }
1165
1166 _repository->read_unlock ();
|
1167 kumpf 1.1
|
1168 kumpf 1.80 CIMInstance modifiedInstance = request->modifiedInstance;
1169 if (_canModify (request, instanceReference, instance, modifiedInstance))
|
1170 kumpf 1.1 {
|
1171 kumpf 1.11 //
1172 // Check for expired subscription
1173 //
|
1174 kumpf 1.35 if (_isExpired (instance))
|
1175 kumpf 1.1 {
|
1176 kumpf 1.11 //
1177 // Delete the subscription instance
1178 //
|
1179 kumpf 1.35 instanceReference.setNameSpace (request->nameSpace);
1180 _deleteExpiredSubscription (instanceReference);
|
1181 kumpf 1.27
|
1182 kumpf 1.48 PEG_METHOD_EXIT ();
|
1183 humberto 1.78
1184 // l10n
1185
1186 // String exceptionStr = _MSG_EXPIRED;
1187 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr);
1188
1189 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
1190 MessageLoaderParms(_MSG_EXPIRED_KEY, _MSG_EXPIRED));
1191
|
1192 kumpf 1.1 }
|
1193 kumpf 1.27
|
1194 kumpf 1.15 //
|
1195 kumpf 1.27 // _canModify, above, already checked that propertyList is not
|
1196 kumpf 1.15 // null, and that numProperties is 0 or 1
1197 //
|
1198 kumpf 1.35 CIMPropertyList propertyList = request->propertyList;
|
1199 kumpf 1.51 if (request->propertyList.size () > 0)
|
1200 kumpf 1.1 {
|
1201 kumpf 1.11 //
1202 // Get current state from instance
1203 //
1204 Uint16 currentState;
|
1205 kumpf 1.80 if (!_getState (instance, currentState))
1206 {
1207 //
1208 // This instance from the repository is corrupted
|
1209 humberto 1.82 // L10N TODO DONE -- new throw of exception
|
1210 kumpf 1.80 //
1211 PEG_METHOD_EXIT ();
|
1212 humberto 1.82 //throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED,
1213 //_MSG_INVALID_INSTANCES);
1214 MessageLoaderParms parms(_MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES);
1215 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
|
1216 kumpf 1.80 }
|
1217 kumpf 1.27
|
1218 kumpf 1.11 //
|
1219 kumpf 1.27 // Get new state
|
1220 kumpf 1.11 //
|
1221 kumpf 1.80 // NOTE: _canModify has already validated the
1222 // SubscriptionState property in the instance; if missing, it
1223 // was added with the default value; if null, it was set to
1224 // the default value; if invalid, an exception was thrown
1225 //
|
1226 kumpf 1.11 Uint16 newState;
|
1227 kumpf 1.80 modifiedInstance.getProperty (modifiedInstance.findProperty
1228 (_PROPERTY_STATE)).getValue ().get (newState);
|
1229 kumpf 1.27
|
1230 kumpf 1.11 //
1231 // If Subscription State has changed,
1232 // Set Time of Last State Change to current date time
1233 //
|
1234 kumpf 1.35 CIMDateTime currentDateTime =
1235 CIMDateTime::getCurrentDateTime ();
|
1236 kumpf 1.11 if (newState != currentState)
1237 {
|
1238 kumpf 1.52 if (modifiedInstance.findProperty (_PROPERTY_LASTCHANGE) !=
1239 PEG_NOT_FOUND)
|
1240 kumpf 1.35 {
1241 CIMProperty lastChange = modifiedInstance.getProperty
1242 (modifiedInstance.findProperty
1243 (_PROPERTY_LASTCHANGE));
1244 lastChange.setValue (CIMValue (currentDateTime));
1245 }
1246 else
1247 {
1248 modifiedInstance.addProperty (CIMProperty
1249 (_PROPERTY_LASTCHANGE, CIMValue (currentDateTime)));
1250 }
|
1251 kumpf 1.54 Array <CIMName> properties =
|
1252 kumpf 1.35 propertyList.getPropertyNameArray ();
1253 properties.append (_PROPERTY_LASTCHANGE);
1254 propertyList.set (properties);
|
1255 kumpf 1.11 }
|
1256 kumpf 1.13
1257 //
|
1258 kumpf 1.27 // If Subscription is to be enabled, and this is the first
|
1259 kumpf 1.13 // time, set Subscription Start Time
1260 //
|
1261 kumpf 1.27 if ((newState == _STATE_ENABLED) ||
|
1262 kumpf 1.13 (newState == _STATE_ENABLEDDEGRADED))
1263 {
1264 //
1265 // If Subscription Start Time is null, set value
1266 // to the current date time
1267 //
1268 CIMDateTime startTime;
|
1269 kumpf 1.27 CIMProperty startTimeProperty = instance.getProperty
|
1270 kumpf 1.13 (instance.findProperty (_PROPERTY_STARTTIME));
1271 CIMValue startTimeValue = instance.getProperty
|
1272 kumpf 1.27 (instance.findProperty
|
1273 kumpf 1.13 (_PROPERTY_STARTTIME)).getValue ();
|
1274 kumpf 1.35 Boolean setStart = false;
|
1275 kumpf 1.13 if (startTimeValue.isNull ())
1276 {
|
1277 kumpf 1.35 setStart = true;
|
1278 kumpf 1.13 }
1279 else
1280 {
1281 startTimeValue.get (startTime);
|
1282 kumpf 1.58 if (startTime.equal
1283 (CIMDateTime (_ZERO_INTERVAL_STRING)))
|
1284 kumpf 1.13 {
|
1285 kumpf 1.35 setStart = true;
|
1286 kumpf 1.13 }
1287 }
|
1288 kumpf 1.35
1289 if (setStart)
1290 {
|
1291 kumpf 1.52 if (modifiedInstance.findProperty (_PROPERTY_STARTTIME)
1292 != PEG_NOT_FOUND)
|
1293 kumpf 1.35 {
1294 CIMProperty startTime = modifiedInstance.getProperty
1295 (modifiedInstance.findProperty
1296 (_PROPERTY_STARTTIME));
1297 startTime.setValue (CIMValue (currentDateTime));
1298 }
1299 else
1300 {
1301 modifiedInstance.addProperty (CIMProperty
1302 (_PROPERTY_STARTTIME,
1303 CIMValue (currentDateTime)));
1304 }
1305
|
1306 kumpf 1.54 Array <CIMName> properties =
|
1307 kumpf 1.35 propertyList.getPropertyNameArray ();
1308 properties.append (_PROPERTY_STARTTIME);
1309 propertyList.set (properties);
1310 }
|
1311 kumpf 1.13 }
|
1312 kumpf 1.19
|
1313 chuck 1.75 // l10n
1314 // Add the language properties to the modified instance.
1315 // Note: These came from the Accept-Language and Content-Language
1316 // headers in the HTTP messages, and may be empty.
1317 AcceptLanguages acceptLangs = request->acceptLanguages;
1318 modifiedInstance.addProperty (CIMProperty
1319 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS,
1320 acceptLangs.toString()));
1321
|
1322 chuck 1.77 ContentLanguages contentLangs = request->contentLanguages;
|
1323 chuck 1.75 modifiedInstance.addProperty (CIMProperty
1324 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS,
1325 contentLangs.toString()));
1326
1327 Array <CIMName> properties = propertyList.getPropertyNameArray ();
1328 properties.append (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
1329 properties.append (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
1330 propertyList.set (properties);
1331 // l10n -end
1332
|
1333 kumpf 1.11 //
|
1334 kumpf 1.27 // If subscription is to be enabled, determine if there are
|
1335 kumpf 1.11 // any indication providers that can serve the subscription
1336 //
|
1337 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
1338 kumpf 1.11 CIMPropertyList requiredProperties;
|
1339 kumpf 1.63 CIMNamespaceName sourceNameSpace;
|
1340 kumpf 1.11 String condition;
1341 String queryLanguage;
|
1342 kumpf 1.73 Array <CIMName> indicationSubclasses;
|
1343 kumpf 1.27
1344 if (((newState == _STATE_ENABLED) ||
|
1345 kumpf 1.11 (newState == _STATE_ENABLEDDEGRADED))
|
1346 kumpf 1.27 && ((currentState != _STATE_ENABLED) &&
|
1347 kumpf 1.11 (currentState != _STATE_ENABLEDDEGRADED)))
1348 {
1349 //
|
1350 kumpf 1.27 // Subscription was previously not enabled but is now to
|
1351 kumpf 1.11 // be enabled
1352 //
|
1353 kumpf 1.38 _getCreateParams (request->nameSpace, instance,
|
1354 kumpf 1.73 indicationSubclasses, indicationProviders,
1355 requiredProperties, sourceNameSpace, condition,
1356 queryLanguage);
|
1357 kumpf 1.27
|
1358 kumpf 1.11 if (indicationProviders.size () == 0)
1359 {
1360 //
|
1361 kumpf 1.27 // There are no providers that can support this
|
1362 kumpf 1.11 // subscription
1363 //
|
1364 kumpf 1.46 instance.setPath (instanceReference);
1365 _handleError (instance);
|
1366 kumpf 1.48 PEG_METHOD_EXIT ();
|
1367 humberto 1.78
1368 // l10n
1369
1370 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
1371 // _MSG_NO_PROVIDERS);
1372
1373 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
1374 MessageLoaderParms(_MSG_NO_PROVIDERS_KEY, _MSG_NO_PROVIDERS));
|
1375 kumpf 1.11 }
1376 }
|
1377 kumpf 1.19
|
1378 kumpf 1.11 //
1379 // Modify the instance in the repository
1380 //
1381 _repository->write_lock ();
|
1382 kumpf 1.35
|
1383 kumpf 1.11 try
1384 {
|
1385 kumpf 1.46 modifiedInstance.setPath (instanceReference);
|
1386 kumpf 1.11 _repository->modifyInstance (request->nameSpace,
|
1387 kumpf 1.46 modifiedInstance,
|
1388 kumpf 1.35 request->includeQualifiers, propertyList);
|
1389 david 1.71
1390 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1391 "IndicationService::_handleModifyInstanceRequest - Name Space: $0 Instance name: $1",
1392 request->nameSpace.getString(),
1393 modifiedInstance.getClassName().getString());
1394 }
|
1395 kumpf 1.23 catch (CIMException & exception)
1396 {
1397 cimException = exception;
1398 }
|
1399 kumpf 1.11 catch (Exception & exception)
1400 {
|
1401 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1402 exception.getMessage());
1403 }
1404
1405 _repository->write_unlock ();
|
1406 kumpf 1.27
|
1407 kumpf 1.23 if (cimException.getCode() != CIM_ERR_SUCCESS)
1408 {
|
1409 kumpf 1.11 CIMModifyInstanceResponseMessage* response =
1410 new CIMModifyInstanceResponseMessage (
1411 request->messageId,
|
1412 kumpf 1.23 cimException,
1413 request->queueIds.copyAndPop ());
|
1414 kumpf 1.27
|
1415 kumpf 1.11 //
1416 // Preserve message key
1417 //
1418 response->setKey (request->getKey ());
|
1419 kumpf 1.27
|
1420 kumpf 1.11 //
1421 // Set response destination
1422 //
1423 response->dest = request->queueIds.top ();
|
1424 kumpf 1.27
|
1425 kumpf 1.69 //
1426 // Set HTTP method in response from request
1427 //
1428 response->setHttpMethod (request->getHttpMethod ());
1429
|
1430 kumpf 1.11 Base::_enqueueResponse (request, response);
|
1431 kumpf 1.27
|
1432 kumpf 1.48 PEG_METHOD_EXIT ();
|
1433 kumpf 1.11 return;
1434 }
|
1435 kumpf 1.27
|
1436 kumpf 1.11 //
|
1437 kumpf 1.38 // If subscription is newly enabled, send Create requests
1438 // and enable providers
|
1439 kumpf 1.11 //
|
1440 kumpf 1.27 if (((newState == _STATE_ENABLED) ||
|
1441 kumpf 1.11 (newState == _STATE_ENABLEDDEGRADED))
|
1442 kumpf 1.27 && ((currentState != _STATE_ENABLED) &&
|
1443 kumpf 1.11 (currentState != _STATE_ENABLEDDEGRADED)))
|
1444 kumpf 1.1 {
|
1445 kumpf 1.16 instanceReference.setNameSpace (request->nameSpace);
|
1446 kumpf 1.46 instance.setPath (instanceReference);
|
1447 chuck 1.75 // l10n
|
1448 kumpf 1.88 _sendCreateRequests (indicationProviders,
|
1449 kumpf 1.27 sourceNameSpace, requiredProperties, condition,
|
1450 kumpf 1.14 queryLanguage,
|
1451 kumpf 1.46 instance,
|
1452 chuck 1.75 request->acceptLanguages,
1453 request->contentLanguages,
|
1454 kumpf 1.88 request,
1455 indicationSubclasses,
1456 request->userName, request->authType);
|
1457 humberto 1.78
|
1458 kumpf 1.73 //
|
1459 kumpf 1.88 // Response is sent from _aggregationCallBack
|
1460 kumpf 1.73 //
|
1461 kumpf 1.88 responseSent = true;
|
1462 kumpf 1.1 }
|
1463 kumpf 1.11 else if ((newState == _STATE_DISABLED) &&
1464 ((currentState == _STATE_ENABLED) ||
1465 (currentState == _STATE_ENABLEDDEGRADED)))
1466 {
1467 //
|
1468 kumpf 1.27 // Subscription was previously enabled but is now to be
|
1469 kumpf 1.11 // disabled
1470 //
|
1471 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
1472 kumpf 1.88 instanceReference.setNameSpace (request->nameSpace);
1473 instance.setPath (instanceReference);
|
1474 kumpf 1.73 indicationProviders = _getDeleteParams (request->nameSpace,
1475 instance, indicationSubclasses, sourceNameSpace);
|
1476 kumpf 1.27
|
1477 kumpf 1.11 //
|
1478 kumpf 1.38 // Send Delete requests
|
1479 kumpf 1.11 //
|
1480 chuck 1.75 //l10n
|
1481 kumpf 1.11 if (indicationProviders.size () > 0)
1482 {
|
1483 kumpf 1.38 _sendDeleteRequests (indicationProviders,
|
1484 kumpf 1.90 sourceNameSpace,
|
1485 kumpf 1.46 instance,
|
1486 chuck 1.75 request->acceptLanguages,
1487 request->contentLanguages,
|
1488 kumpf 1.88 request,
1489 indicationSubclasses,
|
1490 kumpf 1.15 request->userName, request->authType);
|
1491 kumpf 1.88
1492 //
1493 // Response is sent from _aggregationCallBack
1494 //
1495 responseSent = true;
|
1496 kumpf 1.11 }
1497 }
|
1498 kumpf 1.1 }
1499 }
|
1500 kumpf 1.11 }
1501 catch (CIMException& exception)
|
1502 kumpf 1.1 {
|
1503 kumpf 1.23 cimException = exception;
|
1504 kumpf 1.1 }
|
1505 kumpf 1.11 catch (Exception& exception)
|
1506 kumpf 1.1 {
|
1507 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1508 exception.getMessage());
|
1509 kumpf 1.1 }
1510
|
1511 kumpf 1.38 //
|
1512 kumpf 1.88 // Send response, if it has not already been sent from callback
|
1513 kumpf 1.38 //
|
1514 kumpf 1.88 if (!responseSent)
1515 {
|
1516 chuck 1.75 // l10n
|
1517 kumpf 1.88 // Note: don't need to set content-language in the response.
1518 CIMModifyInstanceResponseMessage* response =
1519 new CIMModifyInstanceResponseMessage(
1520 request->messageId,
1521 cimException,
1522 request->queueIds.copyAndPop());
|
1523 kumpf 1.1
|
1524 kumpf 1.88 //
1525 // Preserve message key
1526 //
1527 response->setKey (request->getKey ());
|
1528 kumpf 1.27
|
1529 kumpf 1.88 //
1530 // Set response destination
1531 //
1532 response->dest = request->queueIds.top ();
|
1533 kumpf 1.27
|
1534 kumpf 1.88 //
1535 // Set HTTP method in response from request
1536 //
1537 response->setHttpMethod (request->getHttpMethod ());
|
1538 kumpf 1.69
|
1539 kumpf 1.88 Base::_enqueueResponse (request, response);
1540 }
|
1541 kumpf 1.1
|
1542 kumpf 1.48 PEG_METHOD_EXIT ();
|
1543 kumpf 1.1 }
1544
|
1545 kumpf 1.11 void IndicationService::_handleDeleteInstanceRequest (const Message* message)
|
1546 kumpf 1.1 {
|
1547 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
1548 "IndicationService::_handleDeleteInstanceRequest");
|
1549 kumpf 1.1
|
1550 kumpf 1.27 CIMDeleteInstanceRequestMessage* request =
|
1551 kumpf 1.11 (CIMDeleteInstanceRequestMessage*) message;
|
1552 kumpf 1.1
|
1553 kumpf 1.23 CIMException cimException;
|
1554 kumpf 1.88 Boolean responseSent = false;
|
1555 kumpf 1.1
1556 try
1557 {
|
1558 kumpf 1.94 _checkNonprivilegedAuthorization(request->userName);
1559
|
1560 kumpf 1.11 //
|
1561 kumpf 1.27 // Check if instance may be deleted -- a filter or handler instance
|
1562 kumpf 1.11 // referenced by a subscription instance may not be deleted
1563 //
|
1564 kumpf 1.16 if (_canDelete (request->instanceName, request->nameSpace,
1565 request->userName))
|
1566 kumpf 1.11 {
|
1567 kumpf 1.88 //
1568 // If a subscription, get the instance from the repository
1569 //
1570 CIMInstance subscriptionInstance;
|
1571 kumpf 1.64 if (request->instanceName.getClassName ().equal
1572 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
1573 kumpf 1.1 {
|
1574 kumpf 1.19 _repository->read_lock ();
1575
1576 try
1577 {
|
1578 kumpf 1.27 subscriptionInstance = _repository->getInstance
|
1579 kumpf 1.11 (request->nameSpace, request->instanceName);
|
1580 kumpf 1.19 }
1581 catch (Exception e)
1582 {
1583 _repository->read_unlock ();
|
1584 kumpf 1.48 PEG_METHOD_EXIT ();
|
1585 kumpf 1.19 throw e;
1586 }
1587
1588 _repository->read_unlock ();
|
1589 kumpf 1.1 }
1590
1591 //
|
1592 kumpf 1.11 // Delete instance from repository
|
1593 kumpf 1.1 //
|
1594 kumpf 1.11 _repository->write_lock ();
1595
1596 try
|
1597 kumpf 1.1 {
|
1598 kumpf 1.27 _repository->deleteInstance (request->nameSpace,
|
1599 kumpf 1.11 request->instanceName);
|
1600 david 1.71
1601 Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
1602 "IndicationService::_handleDeleteInstanceRequest - Name Space: $0 Instance name: $1",
1603 request->nameSpace.getString(),
1604 request->instanceName.getClassName().getString());
|
1605 kumpf 1.1 }
|
1606 kumpf 1.23 catch (CIMException & exception)
1607 {
1608 cimException = exception;
1609 }
|
1610 kumpf 1.11 catch (Exception & exception)
|
1611 kumpf 1.1 {
|
1612 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1613 exception.getMessage());
1614 }
|
1615 kumpf 1.11
|
1616 kumpf 1.23 _repository->write_unlock ();
|
1617 kumpf 1.1
|
1618 kumpf 1.23 if (cimException.getCode() != CIM_ERR_SUCCESS)
1619 {
|
1620 kumpf 1.11 CIMDeleteInstanceResponseMessage* response =
1621 new CIMDeleteInstanceResponseMessage (
1622 request->messageId,
|
1623 kumpf 1.23 cimException,
|
1624 kumpf 1.11 request->queueIds.copyAndPop ());
|
1625 kumpf 1.1
1626 //
|
1627 kumpf 1.11 // Preserve message key
|
1628 kumpf 1.1 //
|
1629 kumpf 1.11 response->setKey (request->getKey ());
|
1630 kumpf 1.1
1631 //
|
1632 kumpf 1.11 // Set response destination
|
1633 kumpf 1.1 //
|
1634 kumpf 1.11 response->dest = request->queueIds.top ();
|
1635 kumpf 1.1
|
1636 kumpf 1.69 //
1637 // Set HTTP method in response from request
1638 //
1639 response->setHttpMethod (request->getHttpMethod ());
1640
|
1641 kumpf 1.11 Base::_enqueueResponse (request, response);
|
1642 kumpf 1.1
|
1643 kumpf 1.48 PEG_METHOD_EXIT ();
|
1644 kumpf 1.11 return;
|
1645 kumpf 1.1 }
|
1646 kumpf 1.88
1647 if (request->instanceName.getClassName ().equal
1648 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
1649 {
1650 //
1651 // If subscription is active, send delete requests to providers
1652 // and update hash tables
1653 //
1654 Uint16 subscriptionState;
1655 CIMValue subscriptionStateValue;
1656 subscriptionStateValue = subscriptionInstance.getProperty
1657 (subscriptionInstance.findProperty
1658 (_PROPERTY_STATE)).getValue ();
1659 subscriptionStateValue.get (subscriptionState);
1660
1661 if ((subscriptionState == _STATE_ENABLED) ||
1662 (subscriptionState == _STATE_ENABLEDDEGRADED))
1663 {
1664 Array <ProviderClassList> indicationProviders;
1665 Array <CIMName> indicationSubclasses;
1666 CIMNamespaceName sourceNamespaceName;
1667 kumpf 1.88 CIMObjectPath instanceReference = request->instanceName;
1668 instanceReference.setNameSpace (request->nameSpace);
1669 subscriptionInstance.setPath (instanceReference);
1670
1671 indicationProviders = _getDeleteParams
1672 (request->nameSpace, subscriptionInstance,
1673 indicationSubclasses, sourceNamespaceName);
1674
1675 //
1676 // Send Delete requests
1677 //
1678 // l10n
1679 _sendDeleteRequests (indicationProviders,
|
1680 kumpf 1.90 sourceNamespaceName, subscriptionInstance,
|
1681 kumpf 1.88 request->acceptLanguages,
1682 request->contentLanguages,
1683 request,
1684 indicationSubclasses,
1685 request->userName, request->authType);
1686
1687 //
1688 // Response is sent from _aggregationCallBack
1689 //
1690 responseSent = true;
1691 }
1692 }
|
1693 kumpf 1.11 }
1694 }
1695 catch (CIMException& exception)
1696 {
|
1697 kumpf 1.23 cimException = exception;
|
1698 kumpf 1.11 }
1699 catch (Exception& exception)
1700 {
|
1701 kumpf 1.23 cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1702 exception.getMessage());
|
1703 kumpf 1.11 }
1704
|
1705 kumpf 1.38 //
|
1706 kumpf 1.88 // Send response, if it has not already been sent from callback
|
1707 kumpf 1.38 //
|
1708 kumpf 1.88 if (!responseSent)
1709 {
1710 CIMDeleteInstanceResponseMessage* response =
1711 new CIMDeleteInstanceResponseMessage(
1712 request->messageId,
1713 cimException,
1714 request->queueIds.copyAndPop());
|
1715 kumpf 1.11
|
1716 kumpf 1.88 //
1717 // Preserve message key
1718 //
1719 response->setKey (request->getKey ());
|
1720 kumpf 1.27
|
1721 kumpf 1.88 //
1722 // Set response destination
1723 //
1724 response->dest = request->queueIds.top ();
|
1725 kumpf 1.27
|
1726 kumpf 1.88 //
1727 // Set HTTP method in response from request
1728 //
1729 response->setHttpMethod (request->getHttpMethod ());
|
1730 kumpf 1.69
|
1731 kumpf 1.88 Base::_enqueueResponse (request, response);
1732 }
|
1733 kumpf 1.11
|
1734 kumpf 1.48 PEG_METHOD_EXIT ();
|
1735 kumpf 1.11 }
1736
|
1737 chuck 1.75 // l10n TODO - might need to globalize another flow and another consumer interface
1738 // (ie. mdd's) if we can't agree on one export flow and consumer interface
1739 // (see PEP67)
1740
|
1741 kumpf 1.11 void IndicationService::_handleProcessIndicationRequest (const Message* message)
1742 {
|
1743 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
1744 Stopwatch stopWatch;
1745 double elapsed;
1746 #endif
1747
|
1748 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
1749 "IndicationService::_handleProcessIndicationRequest");
|
1750 kumpf 1.11
1751 CIMProcessIndicationRequestMessage* request =
1752 (CIMProcessIndicationRequestMessage*) message;
1753
|
1754 kumpf 1.23 CIMException cimException;
|
1755 kumpf 1.11
1756 CIMProcessIndicationResponseMessage* response =
1757 new CIMProcessIndicationResponseMessage(
1758 request->messageId,
|
1759 kumpf 1.23 cimException,
|
1760 kumpf 1.11 request->queueIds.copyAndPop());
1761
1762 String filterQuery;
1763 Boolean match;
1764
|
1765 kumpf 1.46 Array <CIMInstance> matchedSubscriptions;
1766 CIMInstance handlerNamedInstance;
|
1767 kumpf 1.11
1768 WQLSelectStatement selectStatement;
1769
1770 CIMInstance handler;
1771 CIMInstance indication = request->indicationInstance;
|
1772 kumpf 1.73
1773 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
1774 "Received Indication " + indication.getClassName().getString());
1775
|
1776 kumpf 1.11 try
1777 {
|
1778 kumpf 1.73 WQLSimplePropertySource propertySource =
1779 _getPropertySourceFromInstance (indication);
|
1780 kumpf 1.11
|
1781 kumpf 1.37 //
|
1782 kumpf 1.39 // Check if property list contains all properties of class
|
1783 kumpf 1.37 // If so, set to null
1784 //
|
1785 kumpf 1.67 Array <CIMName> propertyNames;
1786 CIMPropertyList propertyList;
|
1787 kumpf 1.83 for (Uint32 i = 0; i < indication.getPropertyCount(); i++)
|
1788 kumpf 1.67 propertyNames.append(indication.getProperty(i).getName());
1789 propertyList = _checkPropertyList (propertyNames,
1790 request->nameSpace, indication.getClassName ());
|
1791 kumpf 1.37
|
1792 kumpf 1.63 Array <CIMNamespaceName> nameSpaces;
|
1793 kumpf 1.15 nameSpaces.append (request->nameSpace);
|
1794 kumpf 1.67
|
1795 kumpf 1.68 if (request->subscriptionInstanceNames.size() > 0)
1796 {
|
1797 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
1798 stopWatch.reset ();
1799 #endif
1800
|
1801 kumpf 1.83 for (Uint32 i = 0; i < request->subscriptionInstanceNames.size();
|
1802 kumpf 1.68 i++)
1803 {
|
1804 kumpf 1.73 //
1805 // Look up the subscription in the active subscriptions table
1806 //
1807 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
1808 (request->subscriptionInstanceNames [i]);
1809 ActiveSubscriptionsTableEntry tableValue;
|
1810 kumpf 1.86 if (_lockedLookupActiveSubscriptionsEntry(
1811 activeSubscriptionsKey,
1812 tableValue))
|
1813 kumpf 1.73 {
1814 matchedSubscriptions.append (tableValue.subscription);
1815 }
|
1816 kumpf 1.68 }
|
1817 kumpf 1.73
1818 #ifdef PEGASUS_INDICATION_PERFINST
1819 elapsed = stopWatch.getElapsed ();
1820
1821 Tracer::trace (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2,
1822 "%s: %.3f seconds",
1823 "Look up Subscriptions", elapsed);
1824 #endif
|
1825 kumpf 1.68 }
1826 else
1827 {
|
1828 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
1829 stopWatch.reset ();
1830 #endif
1831
|
1832 kumpf 1.68 matchedSubscriptions = _getMatchingSubscriptions(
|
1833 kumpf 1.89 indication.getClassName (), nameSpaces, propertyList,
1834 true, request->provider);
|
1835 kumpf 1.73
1836 #ifdef PEGASUS_INDICATION_PERFINST
1837 elapsed = stopWatch.getElapsed ();
1838
1839 Tracer::trace (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2,
1840 "%s: %.3f seconds",
1841 "Get Matching Subscriptions", elapsed);
1842 #endif
|
1843 kumpf 1.68 }
|
1844 kumpf 1.11
|
1845 kumpf 1.83 for (Uint32 i = 0; i < matchedSubscriptions.size(); i++)
|
1846 kumpf 1.11 {
1847 match = true;
1848
|
1849 kumpf 1.66 //
1850 // copy the indication, format it based on the subscription,
1851 // and send the formatted indication to the consumer
1852 //
1853 CIMInstance formattedIndication = indication.clone();
1854
|
1855 kumpf 1.15 //
1856 // Check for expired subscription
1857 //
|
1858 kumpf 1.46 if (_isExpired (matchedSubscriptions [i]))
|
1859 kumpf 1.15 {
|
1860 kumpf 1.46 CIMObjectPath path = matchedSubscriptions [i].getPath ();
1861 _deleteExpiredSubscription (path);
|
1862 kumpf 1.27
|
1863 kumpf 1.15 continue;
1864 }
1865
|
1866 kumpf 1.16 _getFilterProperties (
|
1867 kumpf 1.46 matchedSubscriptions[i],
1868 matchedSubscriptions[i].getPath ().getNameSpace (),
|
1869 kumpf 1.16 filterQuery);
|
1870 kumpf 1.11
1871 selectStatement = _getSelectStatement (filterQuery);
1872
1873 if (selectStatement.hasWhereClause())
|
1874 kumpf 1.1 {
|
1875 kumpf 1.73 #ifdef PEGASUS_INDICATION_PERFINST
1876 stopWatch.reset ();
1877 #endif
1878
|
1879 kumpf 1.11 if (!selectStatement.evaluateWhereClause(&propertySource))
|
1880 kumpf 1.1 {
|
1881 kumpf 1.11 match = false;
|
1882 kumpf 1.1 }
|
1883 kumpf 1.73
1884 #ifdef PEGASUS_INDICATION_PERFINST
1885 elapsed = stopWatch.getElapsed ();
1886
1887 Tracer::trace (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2,
1888 "%s: %.3f seconds",
1889 "Evaluate WHERE clause", elapsed);
1890 #endif
|
1891 kumpf 1.1 }
1892
|
1893 kumpf 1.11 if (match)
|
1894 kumpf 1.1 {
|
1895 kumpf 1.67 //
1896 // Format indication
1897 // Remove properties not listed in SELECT clause from
1898 // indication as they are not required to be passed to consumer
1899 // If SELECT includes all properties ("*"), pass all properties
1900 // to the consumer
1901 //
1902 if (!selectStatement.getAllProperties ())
1903 {
1904 CIMPropertyList selectPropertyList;
1905 Array <CIMName> selectPropertyNames;
|
1906 kumpf 1.34
|
1907 kumpf 1.67 //
1908 // Get properties listed in SELECT clause
1909 //
1910 selectPropertyList =
1911 selectStatement.getSelectPropertyList ();
1912 selectPropertyNames =
1913 selectPropertyList.getPropertyNameArray ();
|
1914 kumpf 1.34
|
1915 kumpf 1.67 //
1916 // Remove properties not listed in SELECT clause
|
1917 kumpf 1.66 // from indication
1918 //
1919 for (Uint32 j = 0; j < propertyNames.size(); j++)
1920 {
|
1921 kumpf 1.67 if (!ContainsCIMName (selectPropertyNames,
1922 propertyNames[j]))
|
1923 kumpf 1.66 {
1924 formattedIndication.removeProperty(
1925 formattedIndication.findProperty
1926 (propertyNames[j]));
1927 }
1928 }
|
1929 kumpf 1.67 }
|
1930 kumpf 1.66
|
1931 kumpf 1.67 handlerNamedInstance = _getHandler
1932 (matchedSubscriptions[i]);
|
1933 kumpf 1.1
|
1934 chuck 1.75 // l10n
1935 // Note: not expecting any language in the response
|
1936 kumpf 1.67 CIMRequestMessage * handler_request =
1937 new CIMHandleIndicationRequestMessage (
1938 XmlWriter::getNextMessageId (),
1939 request->nameSpace,
1940 handlerNamedInstance,
1941 formattedIndication,
|
1942 chuck 1.75 QueueIdStack(_handlerService, getQueueId()),
1943 String::EMPTY,
1944 String::EMPTY,
1945 request->contentLanguages);
1946
|
1947 kumpf 1.79 handler_request->operationContext = request->operationContext;
1948
|
1949 kumpf 1.67 AsyncOpNode* op = this->get_op();
|
1950 kumpf 1.11
|
1951 kumpf 1.67 AsyncLegacyOperationStart *async_req =
|
1952 kumpf 1.11 new AsyncLegacyOperationStart(
|
1953 kumpf 1.67 get_next_xid(),
1954 op,
1955 _handlerService,
1956 handler_request,
1957 _queueId);
1958
1959 PEG_TRACE_STRING(TRC_INDICATION_SERVICE, Tracer::LEVEL4,
|
1960 kumpf 1.73 "Sending (SendWait) Indication to " +
|
1961 kumpf 1.67 ((MessageQueue::lookup(_handlerService)) ?
1962 String(((MessageQueue::lookup
1963 (_handlerService))->getQueueName())) :
1964 String("BAD queue name")) +
1965 "via CIMHandleIndicationRequestMessage");
|
1966 mday 1.40
|
1967 kumpf 1.44 AsyncReply *async_reply = SendWait(async_req);
|
1968 kumpf 1.1
|
1969 kumpf 1.15 //
|
1970 kumpf 1.27 // ATTN-CAKG-P1-20020326: Check for error - implement
|
1971 kumpf 1.15 // subscription's OnFatalErrorPolicy
1972 //
1973
|
1974 kumpf 1.67 response =
1975 reinterpret_cast<CIMProcessIndicationResponseMessage *>
1976 ((static_cast<AsyncLegacyOperationResult *>
1977 (async_reply))->get_result());
|
1978 kumpf 1.1
|
1979 kumpf 1.37 //
1980 // Recipient deletes request
1981 //
1982
|
1983 kumpf 1.44 delete async_reply;
|
1984 kumpf 1.1 }
1985 }
|
1986 kumpf 1.11 }
1987 catch (CIMException& exception)
1988 {
|
1989 kumpf 1.23 response->cimException = exception;
|
1990 kumpf 1.11 }
1991 catch (Exception& exception)
1992 {
|
1993 kumpf 1.23 response->cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,
1994 exception.getMessage());
|
1995 kumpf 1.11 }
1996
1997 _enqueueResponse(request, response);
1998
|
1999 kumpf 1.48 PEG_METHOD_EXIT ();
|
2000 kumpf 1.11
2001 return;
2002 }
2003
2004 void IndicationService::_handleNotifyProviderRegistrationRequest
2005 (const Message* message)
2006 {
|
2007 kumpf 1.48 PEG_METHOD_ENTER (
2008 TRC_INDICATION_SERVICE,
2009 "IndicationService::_handleNotifyProviderRegistrationRequest");
|
2010 kumpf 1.11
|
2011 kumpf 1.27 CIMNotifyProviderRegistrationRequestMessage* request =
|
2012 kumpf 1.11 (CIMNotifyProviderRegistrationRequestMessage*) message;
2013
|
2014 kumpf 1.23 CIMException cimException;
|
2015 mday 1.8
|
2016 kumpf 1.12 CIMInstance provider = request->provider;
|
2017 kumpf 1.15 CIMInstance providerModule = request->providerModule;
|
2018 kumpf 1.63 CIMName className = request->className;
2019 Array <CIMNamespaceName> newNameSpaces = request->newNamespaces;
2020 Array <CIMNamespaceName> oldNameSpaces = request->oldNamespaces;
|
2021 kumpf 1.11 CIMPropertyList newPropertyNames = request->newPropertyNames;
2022 CIMPropertyList oldPropertyNames = request->oldPropertyNames;
|
2023 kumpf 1.6
|
2024 kumpf 1.46 Array <CIMInstance> newSubscriptions;
2025 Array <CIMInstance> formerSubscriptions;
|
2026 kumpf 1.16 Array <ProviderClassList> indicationProviders;
2027 ProviderClassList indicationProvider;
|
2028 kumpf 1.6
|
2029 kumpf 1.11 newSubscriptions.clear ();
2030 formerSubscriptions.clear ();
|
2031 kumpf 1.1
|
2032 kumpf 1.11 switch (request->operation)
2033 {
2034 case OP_CREATE:
2035 {
|
2036 kumpf 1.10 //
|
2037 kumpf 1.11 // Get matching subscriptions
|
2038 kumpf 1.10 //
|
2039 kumpf 1.27 newSubscriptions = _getMatchingSubscriptions (className,
|
2040 kumpf 1.15 newNameSpaces, newPropertyNames);
|
2041 kumpf 1.11
2042 break;
2043 }
|
2044 kumpf 1.10
|
2045 kumpf 1.11 case OP_DELETE:
2046 {
|
2047 kumpf 1.10 //
|
2048 kumpf 1.11 // Get matching subscriptions
|
2049 kumpf 1.10 //
|
2050 kumpf 1.27 formerSubscriptions = _getMatchingSubscriptions (className,
|
2051 kumpf 1.15 oldNameSpaces, oldPropertyNames);
|
2052 kumpf 1.11
2053 break;
|
2054 kumpf 1.10 }
2055
|
2056 kumpf 1.11 case OP_MODIFY:
|
2057 kumpf 1.10 {
|
2058 kumpf 1.11 //
2059 // Get lists of affected subscriptions
2060 //
|
2061 kumpf 1.15 _getModifiedSubscriptions (className, newNameSpaces, oldNameSpaces,
|
2062 kumpf 1.27 newPropertyNames, oldPropertyNames,
|
2063 kumpf 1.15 newSubscriptions, formerSubscriptions);
|
2064 kumpf 1.11
2065 break;
|
2066 kumpf 1.10 }
|
2067 kumpf 1.11 default:
2068 //
2069 // Error condition: operation not supported
2070 //
|
2071 kumpf 1.48 PEG_METHOD_EXIT ();
|
2072 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
2073 kumpf 1.11 break;
2074 } // switch
2075
2076 //
2077 // Construct provider class list from input provider and class name
2078 //
|
2079 kumpf 1.12 indicationProvider.provider = provider;
|
2080 kumpf 1.15 indicationProvider.providerModule = providerModule;
|
2081 kumpf 1.11 indicationProvider.classList.append (className);
2082 indicationProviders.append (indicationProvider);
|
2083 kumpf 1.10
|
2084 kumpf 1.11 if (newSubscriptions.size () > 0)
2085 {
2086 CIMPropertyList requiredProperties;
2087 String condition;
2088 String queryLanguage;
|
2089 kumpf 1.10
2090 //
|
2091 kumpf 1.38 // Send Create or Modify request for each subscription that can newly
|
2092 kumpf 1.16 // be supported
|
2093 kumpf 1.10 //
|
2094 kumpf 1.83 for (Uint32 i = 0; i < newSubscriptions.size (); i++)
|
2095 kumpf 1.10 {
|
2096 kumpf 1.63 CIMNamespaceName sourceNameSpace;
|
2097 kumpf 1.73 Array <CIMName> indicationSubclasses;
|
2098 kumpf 1.38 _getCreateParams
|
2099 kumpf 1.46 (newSubscriptions [i].getPath ().getNameSpace (),
|
2100 kumpf 1.73 newSubscriptions [i], indicationSubclasses,
|
2101 kumpf 1.27 requiredProperties, sourceNameSpace, condition, queryLanguage);
|
2102 kumpf 1.11
2103 //
|
2104 kumpf 1.39 // NOTE: These Create or Modify requests are not associated with a
2105 // user request, so there is no associated authType or userName
|
2106 kumpf 1.27 // The Creator from the subscription instance is used for
|
2107 kumpf 1.16 // userName, and authType is not set
|
2108 kumpf 1.15 //
|
2109 kumpf 1.80 // NOTE: the subscriptions in the newSubscriptions list came from
2110 // the IndicationService's internal hash tables, and thus
2111 // each instance is known to have a valid Creator property
2112 //
|
2113 kumpf 1.46 CIMInstance instance = newSubscriptions [i];
|
2114 kumpf 1.15 String creator = instance.getProperty (instance.findProperty
|
2115 kumpf 1.38 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue ().toString ();
|
2116 kumpf 1.11
|
2117 chuck 1.77 // l10n start
2118 String acceptLangs = String::EMPTY;
2119 Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
2120 if (propIndex != PEG_NOT_FOUND)
2121 {
2122 instance.getProperty(propIndex).getValue().get(acceptLangs);
2123 }
2124 String contentLangs = String::EMPTY;
2125 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
2126 if (propIndex != PEG_NOT_FOUND)
2127 {
2128 instance.getProperty(propIndex).getValue().get(contentLangs);
2129 }
2130 // l10n end
|
2131 chuck 1.75
|
2132 kumpf 1.11 //
|
2133 kumpf 1.73 // Look up the subscription in the active subscriptions table
|
2134 kumpf 1.16 //
|
2135 kumpf 1.73 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
2136 (newSubscriptions [i].getPath ());
2137 ActiveSubscriptionsTableEntry tableValue;
|
2138 kumpf 1.86 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
|
2139 kumpf 1.73 tableValue))
|
2140 kumpf 1.16 {
|
2141 kumpf 1.70 //
|
2142 kumpf 1.73 // If the provider is already in the subscription's list,
2143 // send a Modify request, otherwise send a Create request
|
2144 kumpf 1.70 //
|
2145 kumpf 1.73 Uint32 providerIndex = _providerInList (provider, tableValue);
2146 if (providerIndex != PEG_NOT_FOUND)
2147 {
2148 //
2149 // Send Modify requests
2150 //
|
2151 chuck 1.75 // l10n
|
2152 kumpf 1.73 _sendModifyRequests (indicationProviders,
|
2153 kumpf 1.90 sourceNameSpace,
|
2154 chuck 1.75 requiredProperties, condition, queryLanguage,
2155 newSubscriptions [i],
2156 AcceptLanguages(acceptLangs),
2157 ContentLanguages(contentLangs),
|
2158 kumpf 1.88 request,
|
2159 chuck 1.75 creator);
|
2160 kumpf 1.73 }
2161 else
2162 {
2163 //
2164 // Send Create requests
2165 //
|
2166 chuck 1.75 // l10n
|
2167 kumpf 1.88 _sendCreateRequests (indicationProviders,
|
2168 kumpf 1.73 sourceNameSpace, requiredProperties, condition,
|
2169 chuck 1.75 queryLanguage, newSubscriptions [i],
2170 AcceptLanguages(acceptLangs),
2171 ContentLanguages(contentLangs),
|
2172 kumpf 1.88 request,
2173 indicationSubclasses,
2174 creator);
|
2175 kumpf 1.73 }
2176 } // subscription found in table
|
2177 kumpf 1.16 else
|
2178 kumpf 1.10 {
|
2179 kumpf 1.16 //
|
2180 kumpf 1.73 // Subscription not found in Active Subscriptions table
|
2181 kumpf 1.16 //
|
2182 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
2183 "Subscription (" + activeSubscriptionsKey +
2184 ") not found in ActiveSubscriptionsTable");
|
2185 kumpf 1.1 }
2186 }
|
2187 kumpf 1.87
2188 //
2189 // NOTE: When a provider that was previously not serving a subscription
|
2190 kumpf 1.88 // now serves the subscription due to a provider registration change,
|
2191 kumpf 1.87 // a log message is sent, even if there were previously other providers
2192 // serving the subscription
2193 //
2194
2195 //
2196 // Log a message for each subscription
2197 //
|
2198 kumpf 1.88 CIMClass providerClass = _repository->getClass
|
2199 kumpf 1.87 (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER);
2200 CIMInstance providerCopy = provider.clone ();
2201 CIMObjectPath path = providerCopy.buildPath (providerClass);
2202 providerCopy.setPath (path);
2203 for (Uint32 j = 0; j < newSubscriptions.size (); j++)
2204 {
2205 Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
|
2206 kumpf 1.88 Logger::WARNING, _MSG_PROVIDER_NOW_SERVING_KEY,
|
2207 kumpf 1.87 _MSG_PROVIDER_NOW_SERVING,
2208 providerCopy.getPath ().toString (),
2209 newSubscriptions [j].getPath ().toString ());
2210 }
|
2211 kumpf 1.1 }
|
2212 kumpf 1.11
2213 if (formerSubscriptions.size () > 0)
|
2214 kumpf 1.1 {
|
2215 kumpf 1.16 CIMPropertyList requiredProperties;
2216 String condition;
2217 String queryLanguage;
|
2218 kumpf 1.11
2219 //
|
2220 kumpf 1.38 // Send Delete or Modify request for each subscription that can no
|
2221 kumpf 1.16 // longer be supported
|
2222 kumpf 1.11 //
|
2223 kumpf 1.83 for (Uint32 i = 0; i < formerSubscriptions.size (); i++)
|
2224 kumpf 1.11 {
|
2225 kumpf 1.80 //
|
2226 kumpf 1.39 // NOTE: These Delete or Modify requests are not associated with a
2227 // user request, so there is no associated authType or userName
|
2228 kumpf 1.16 // The Creator from the subscription instance is used for userName,
2229 // and authType is not set
|
2230 kumpf 1.80 //
2231 // NOTE: the subscriptions in the formerSubscriptions list came
2232 // from the IndicationService's internal hash tables, and thus
2233 // each instance is known to have a valid Creator property
2234 //
|
2235 kumpf 1.46 CIMInstance instance = formerSubscriptions [i];
|
2236 kumpf 1.15 String creator = instance.getProperty (instance.findProperty
|
2237 kumpf 1.38 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR)).getValue ().toString ();
|
2238 chuck 1.77 // l10n start
2239 String acceptLangs = String::EMPTY;
2240 Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
2241 if (propIndex != PEG_NOT_FOUND)
2242 {
2243 instance.getProperty(propIndex).getValue().get(acceptLangs);
2244 }
2245 String contentLangs = String::EMPTY;
2246 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
2247 if (propIndex != PEG_NOT_FOUND)
2248 {
2249 instance.getProperty(propIndex).getValue().get(contentLangs);
2250 }
2251 // l10n end
|
2252 chuck 1.75
|
2253 kumpf 1.16 //
|
2254 kumpf 1.73 // Look up the subscription in the active subscriptions table
|
2255 kumpf 1.37 // If class list contains only the class name from the current
|
2256 kumpf 1.38 // operation, send a Delete request
2257 // Otherwise, send a Modify request
|
2258 kumpf 1.16 //
|
2259 kumpf 1.73 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
2260 (formerSubscriptions [i].getPath ());
2261 ActiveSubscriptionsTableEntry tableValue;
|
2262 kumpf 1.86 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
|
2263 kumpf 1.73 tableValue))
|
2264 kumpf 1.16 {
|
2265 kumpf 1.73 Uint32 providerIndex = _providerInList (provider, tableValue);
2266 if (providerIndex != PEG_NOT_FOUND)
|
2267 kumpf 1.37 {
|
2268 kumpf 1.88 CIMNamespaceName sourceNameSpace;
2269 Array <CIMName> indicationSubclasses;
2270 _getCreateParams
2271 (formerSubscriptions [i].getPath ().getNameSpace (),
2272 formerSubscriptions [i], indicationSubclasses,
2273 requiredProperties, sourceNameSpace, condition,
2274 queryLanguage);
2275
|
2276 kumpf 1.73 //
2277 // If class list contains only the class name from the
2278 // current delete, send a Delete request
2279 //
2280 if ((tableValue.providers [providerIndex].classList.size ()
2281 == 1) &&
2282 (tableValue.providers [providerIndex].classList
2283 [0].equal (className)))
2284 {
|
2285 chuck 1.75 // l10n
|
2286 kumpf 1.73 _sendDeleteRequests (indicationProviders,
|
2287 kumpf 1.90 sourceNameSpace,
|
2288 chuck 1.75 formerSubscriptions [i],
2289 AcceptLanguages(acceptLangs),
2290 ContentLanguages(contentLangs),
|
2291 kumpf 1.88 request,
2292 indicationSubclasses,
|
2293 chuck 1.75 creator);
|
2294 kumpf 1.73 }
2295
|
2296 kumpf 1.70 //
|
2297 kumpf 1.73 // Otherwise, send a Modify request
|
2298 kumpf 1.70 //
|
2299 kumpf 1.73 else
2300 {
2301 Uint32 classIndex = _classInList (className,
2302 tableValue.providers [providerIndex]);
2303 if (classIndex != PEG_NOT_FOUND)
2304 {
2305 //
2306 // Send Modify requests
2307 //
|
2308 chuck 1.75 // l10n
|
2309 kumpf 1.73 _sendModifyRequests (indicationProviders,
|
2310 kumpf 1.90 sourceNameSpace,
|
2311 kumpf 1.73 requiredProperties, condition, queryLanguage,
|
2312 chuck 1.75 formerSubscriptions [i],
2313 AcceptLanguages(acceptLangs),
2314 ContentLanguages(contentLangs),
|
2315 kumpf 1.88 request,
|
2316 chuck 1.75 creator);
|
2317 kumpf 1.73 }
2318 else
2319 {
|
2320 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
2321 Tracer::LEVEL2,
2322 "Class " + className.getString() +
2323 " not found in tableValue.providers");
|
2324 kumpf 1.73 }
2325 }
2326 }
2327 else
2328 {
|
2329 kumpf 1.37 //
|
2330 kumpf 1.73 // The subscription was not served by the provider
|
2331 kumpf 1.37 //
2332 }
|
2333 kumpf 1.16 }
2334 else
2335 {
|
2336 kumpf 1.37 //
|
2337 kumpf 1.88 // Subscription not found in Active Subscriptions table
|
2338 kumpf 1.37 //
|
2339 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
2340 "Subscription (" + activeSubscriptionsKey +
2341 ") not found in ActiveSubscriptionsTable");
|
2342 kumpf 1.16 }
|
2343 kumpf 1.11 }
|
2344 kumpf 1.1
|
2345 kumpf 1.87 #if 0
|
2346 kumpf 1.11 //
2347 // Create NoProviderAlertIndication instance
2348 // ATTN: NoProviderAlertIndication must be defined
2349 //
|
2350 kumpf 1.27 CIMInstance indicationInstance = _createAlertInstance
|
2351 kumpf 1.11 (_CLASS_NO_PROVIDER_ALERT, formerSubscriptions);
|
2352 kumpf 1.27
|
2353 kumpf 1.11 //
2354 // Send NoProviderAlertIndication to each unique handler instance
2355 //
|
2356 kumpf 1.73 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
2357 "Sending NoProvider Alert for %d subscriptions",
2358 formerSubscriptions.size ());
|
2359 kumpf 1.11 _sendAlerts (formerSubscriptions, indicationInstance);
|
2360 kumpf 1.87 #endif
2361 //
|
2362 kumpf 1.88 // NOTE: When a provider that was previously serving a subscription
2363 // no longer serves the subscription due to a provider registration
2364 // change, a log message is sent, even if there are still other
|
2365 kumpf 1.87 // providers serving the subscription
2366 //
2367
2368 //
2369 // Log a message for each subscription
2370 //
|
2371 kumpf 1.88 CIMClass providerClass = _repository->getClass
|
2372 kumpf 1.87 (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER);
2373 CIMInstance providerCopy = provider.clone ();
2374 CIMObjectPath path = providerCopy.buildPath (providerClass);
2375 providerCopy.setPath (path);
2376 for (Uint32 j = 0; j < formerSubscriptions.size (); j++)
2377 {
|
2378 kumpf 1.88 Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
|
2379 kumpf 1.87 Logger::WARNING, _MSG_PROVIDER_NO_LONGER_SERVING_KEY,
2380 _MSG_PROVIDER_NO_LONGER_SERVING,
2381 providerCopy.getPath ().toString (),
2382 formerSubscriptions [j].getPath ().toString ());
2383 }
|
2384 kumpf 1.11 }
|
2385 kumpf 1.1
|
2386 kumpf 1.48 PEG_METHOD_EXIT ();
|
2387 kumpf 1.1 }
2388
|
2389 kumpf 1.73 Uint32 IndicationService::_providerInList
2390 (const CIMInstance & provider,
2391 const ActiveSubscriptionsTableEntry & tableValue)
2392 {
2393 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2394 "IndicationService::_providerInList");
2395
2396 //
2397 // Look for the provider in the list
2398 //
|
2399 kumpf 1.83 for (Uint32 i = 0; i < tableValue.providers.size (); i++)
|
2400 kumpf 1.73 {
2401 if (tableValue.providers [i].provider.identical (provider))
2402 {
2403 return i;
2404 }
2405 }
2406
2407 return PEG_NOT_FOUND;
2408
2409 PEG_METHOD_EXIT ();
2410 }
2411
2412 Uint32 IndicationService::_classInList
2413 (const CIMName & className,
2414 const ProviderClassList & providerClasses)
2415 {
2416 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2417 "IndicationService::_classInList");
2418
2419 //
2420 // Look for the class in the list
2421 kumpf 1.73 //
|
2422 kumpf 1.83 for (Uint32 i = 0; i < providerClasses.classList.size (); i++)
|
2423 kumpf 1.73 {
2424 if (providerClasses.classList [i].equal (className))
2425 {
2426 return i;
2427 }
2428 }
2429
2430 return PEG_NOT_FOUND;
2431
2432 PEG_METHOD_EXIT ();
2433 }
2434
|
2435 kumpf 1.11 void IndicationService::_handleNotifyProviderTerminationRequest
2436 (const Message * message)
|
2437 kumpf 1.1 {
|
2438 kumpf 1.46 Array <CIMInstance> providerSubscriptions;
|
2439 kumpf 1.11 CIMInstance indicationInstance;
2440
|
2441 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2442 "IndicationService::_handleNotifyProviderTermination");
|
2443 kumpf 1.1
|
2444 kumpf 1.27 CIMNotifyProviderTerminationRequestMessage* request =
|
2445 kumpf 1.11 (CIMNotifyProviderTerminationRequestMessage*) message;
2446
|
2447 kumpf 1.38 Array <CIMInstance> providers = request->providers;
|
2448 kumpf 1.11
|
2449 kumpf 1.83 for (Uint32 i = 0; i < providers.size (); i++)
|
2450 kumpf 1.38 {
2451 //
2452 // Get list of affected subscriptions
2453 //
|
2454 kumpf 1.73 // _getProviderSubscriptions also updates the Active Subscriptions
2455 // hash table, and implements each subscription's On Fatal Error
2456 // policy, if necessary
2457 //
|
2458 kumpf 1.38 providerSubscriptions.clear ();
2459 providerSubscriptions = _getProviderSubscriptions (providers [i]);
2460
|
2461 kumpf 1.73 if (providerSubscriptions.size () > 0)
2462 {
2463 //
2464 // NOTE: When a provider that was previously serving a subscription
2465 // no longer serves the subscription due to a provider termination,
2466 // an alert is always sent, even if there are still other providers
2467 // serving the subscription
2468 //
2469
|
2470 kumpf 1.87 #if 0
|
2471 kumpf 1.73 //
2472 // Create ProviderTerminatedAlertIndication instance
2473 // ATTN: ProviderTerminatedAlertIndication must be defined
2474 //
2475 indicationInstance = _createAlertInstance
2476 (_CLASS_PROVIDER_TERMINATED_ALERT, providerSubscriptions);
2477
2478 //
2479 // Send ProviderTerminatedAlertIndication to each unique handler
2480 // instance
2481 //
2482 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
2483 "Sending ProviderDisabled Alert for %d subscriptions",
2484 providerSubscriptions.size ());
2485 _sendAlerts (providerSubscriptions, indicationInstance);
|
2486 kumpf 1.87 #endif
2487 //
2488 // Log a message for each subscription
2489 //
|
2490 kumpf 1.88 CIMClass providerClass = _repository->getClass
|
2491 kumpf 1.87 (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER);
2492 CIMInstance providerCopy = providers [i].clone ();
2493 CIMObjectPath path = providerCopy.buildPath (providerClass);
2494 providerCopy.setPath (path);
2495 for (Uint32 j = 0; j < providerSubscriptions.size (); j++)
2496 {
|
2497 kumpf 1.88 Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
2498 Logger::WARNING, _MSG_PROVIDER_NO_LONGER_SERVING_KEY,
|
2499 kumpf 1.87 _MSG_PROVIDER_NO_LONGER_SERVING,
2500 providerCopy.getPath ().toString (),
2501 providerSubscriptions [j].getPath ().toString ());
2502 }
|
2503 kumpf 1.73 }
|
2504 kumpf 1.38 }
|
2505 kumpf 1.11
|
2506 kumpf 1.48 PEG_METHOD_EXIT ();
|
2507 kumpf 1.11 }
|
2508 kumpf 1.1
|
2509 kumpf 1.19 Boolean IndicationService::_handleError (
|
2510 kumpf 1.46 const CIMInstance subscription)
|
2511 kumpf 1.19 {
|
2512 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2513 "IndicationService::_handleError");
|
2514 kumpf 1.19
2515 Boolean handleError = false;
2516
2517 //
2518 // Get the value of the On Fatal Error Policy property
2519 //
2520 CIMValue errorPolicyValue;
2521 Uint16 onFatalErrorPolicy;
|
2522 kumpf 1.46 errorPolicyValue = subscription.getProperty
2523 (subscription.findProperty
|
2524 kumpf 1.19 (_PROPERTY_ONFATALERRORPOLICY)).getValue ();
2525 errorPolicyValue.get (onFatalErrorPolicy);
2526
2527 if (errorPolicyValue == _ERRORPOLICY_DISABLE)
2528 {
2529 //
|
2530 kumpf 1.39 // FUTURE: Failure Trigger Time Interval should be allowed to pass
2531 // before implementing On Fatal Error Policy
|
2532 kumpf 1.19 //
2533 // Set the Subscription State to disabled
2534 //
2535 _disableSubscription (subscription);
2536 handleError = true;
2537 }
2538 else if (errorPolicyValue == _ERRORPOLICY_REMOVE)
2539 {
2540 //
|
2541 kumpf 1.39 // FUTURE: Failure Trigger Time Interval should be allowed to pass
2542 // before implementing On Fatal Error Policy
|
2543 kumpf 1.19 //
2544 // Delete the subscription
2545 //
2546 _deleteSubscription (subscription);
2547 handleError = true;
2548 }
2549
|
2550 kumpf 1.48 PEG_METHOD_EXIT ();
|
2551 kumpf 1.19 return handleError;
2552 }
2553
2554 void IndicationService::_disableSubscription (
|
2555 kumpf 1.46 CIMInstance subscription)
|
2556 kumpf 1.19 {
|
2557 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2558 "IndicationService::_disableSubscription");
|
2559 kumpf 1.19
2560 //
2561 // Create property list
2562 //
2563 CIMPropertyList propertyList;
|
2564 kumpf 1.54 Array <CIMName> properties;
|
2565 kumpf 1.19 properties.append (_PROPERTY_STATE);
2566 propertyList = CIMPropertyList (properties);
2567
2568 //
2569 // Set Time of Last State Change to current date time
2570 //
|
2571 kumpf 1.46 CIMInstance instance = subscription;
|
2572 kumpf 1.35 CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
|
2573 kumpf 1.52 if (instance.findProperty (_PROPERTY_LASTCHANGE) == PEG_NOT_FOUND)
|
2574 kumpf 1.19 {
|
2575 kumpf 1.27 instance.addProperty
|
2576 kumpf 1.19 (CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime));
2577 }
|
2578 kumpf 1.27 else
|
2579 kumpf 1.19 {
|
2580 kumpf 1.27 CIMProperty lastChange = instance.getProperty
|
2581 kumpf 1.19 (instance.findProperty (_PROPERTY_LASTCHANGE));
2582 lastChange.setValue (CIMValue (currentDateTime));
2583 }
2584
2585 //
2586 // Set Subscription State to Disabled
2587 //
|
2588 kumpf 1.27 CIMProperty state = instance.getProperty (instance.findProperty
|
2589 kumpf 1.19 (_PROPERTY_STATE));
2590 state.setValue (CIMValue (_STATE_DISABLED));
2591
2592 //
2593 // Modify the instance in the repository
2594 //
2595 _repository->write_lock ();
|
2596 kumpf 1.27
|
2597 kumpf 1.19 try
2598 {
|
2599 kumpf 1.27 _repository->modifyInstance
|
2600 kumpf 1.46 (subscription.getPath ().getNameSpace (),
|
2601 kumpf 1.19 subscription, false, propertyList);
2602 }
2603 catch (Exception & exception)
2604 {
2605 //
|
2606 kumpf 1.38 // ATTN-CAKG-P3-20020425: Log a message
|
2607 kumpf 1.19 //
2608 }
2609
2610 _repository->write_unlock ();
2611
|
2612 kumpf 1.48 PEG_METHOD_EXIT ();
|
2613 kumpf 1.19 }
2614
2615 void IndicationService::_deleteSubscription (
|
2616 kumpf 1.46 const CIMInstance subscription)
|
2617 kumpf 1.19 {
|
2618 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2619 "IndicationService::_deleteSubscription");
|
2620 kumpf 1.19
2621 //
2622 // Delete referencing subscription instance from repository
2623 //
2624 _repository->write_lock ();
2625
2626 try
2627 {
|
2628 kumpf 1.27 _repository->deleteInstance
|
2629 kumpf 1.46 (subscription.getPath ().getNameSpace (),
2630 subscription.getPath ());
|
2631 kumpf 1.19 }
2632 catch (Exception & exception)
2633 {
2634 //
|
2635 kumpf 1.38 // ATTN-CAKG-P3-20020425: Log a message
|
2636 kumpf 1.19 //
2637 }
2638
2639 _repository->write_unlock ();
2640
|
2641 kumpf 1.48 PEG_METHOD_EXIT ();
|
2642 kumpf 1.19 }
2643
|
2644 kumpf 1.11 Boolean IndicationService::_canCreate (
2645 CIMInstance & instance,
|
2646 kumpf 1.63 const CIMNamespaceName & nameSpace)
|
2647 kumpf 1.11 {
|
2648 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canCreate");
|
2649 kumpf 1.4
|
2650 kumpf 1.11 // REVIEW: Derived classes of CIM_IndicationSubscription not
2651 // handled. It is reasonable for a user to derive from this
2652 // class and add extra properties.
|
2653 kumpf 1.4
|
2654 kumpf 1.11 // REVIEW: how does the provider manager know to forward
2655 // requests to this service? Is it by class name? If so,
2656 // shouldn't the provider use an is-a operator on the new
2657 // class?
|
2658 kumpf 1.4
|
2659 kumpf 1.11 //
2660 // Check all required properties exist
|
2661 kumpf 1.34 // For a property that has a default value, if it does not exist or is
2662 // null, add or set property with default value
2663 // For a property that has a specified set of valid values, validate
|
2664 kumpf 1.11 //
|
2665 kumpf 1.64 if (instance.getClassName ().equal (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
2666 kumpf 1.11 {
2667 //
2668 // Filter and Handler are key properties for Subscription
2669 // No other properties are required
2670 //
|
2671 kumpf 1.34 _checkRequiredProperty (instance, _PROPERTY_FILTER, _MSG_KEY_PROPERTY);
2672 _checkRequiredProperty (instance, _PROPERTY_HANDLER, _MSG_KEY_PROPERTY);
|
2673 kumpf 1.1
|
2674 kumpf 1.34 //
2675 // Subscription State, Repeat Notificastion Policy, and On Fatal Error
2676 // Policy properties each has a default value, a corresponding
2677 // Other___ property, and a set of valid values
2678 //
2679 _checkPropertyWithOther (instance, _PROPERTY_STATE,
2680 _PROPERTY_OTHERSTATE, (Uint16) _STATE_ENABLED,
2681 (Uint16) _STATE_OTHER, _validStates);
|
2682 kumpf 1.22
|
2683 kumpf 1.34 _checkPropertyWithOther (instance, _PROPERTY_REPEATNOTIFICATIONPOLICY,
|
2684 kumpf 1.22 _PROPERTY_OTHERREPEATNOTIFICATIONPOLICY, (Uint16) _POLICY_NONE,
|
2685 kumpf 1.32 (Uint16) _POLICY_OTHER, _validRepeatPolicies);
|
2686 kumpf 1.22
|
2687 kumpf 1.34 _checkPropertyWithOther (instance, _PROPERTY_ONFATALERRORPOLICY,
|
2688 kumpf 1.32 _PROPERTY_OTHERONFATALERRORPOLICY, (Uint16) _ERRORPOLICY_IGNORE,
2689 (Uint16) _ERRORPOLICY_OTHER, _validErrorPolicies);
|
2690 kumpf 1.27 }
|
2691 kumpf 1.11 else // Filter or Handler
2692 {
|
2693 kumpf 1.1 //
|
2694 kumpf 1.11 // Name, CreationClassName, SystemName, and SystemCreationClassName
|
2695 kumpf 1.27 // are key properties for Filter and Handler
|
2696 kumpf 1.11 // CreationClassName and Name must exist
2697 // If others do not exist, add and set to default
|
2698 kumpf 1.1 //
|
2699 kumpf 1.34 _checkRequiredProperty (instance, _PROPERTY_NAME, _MSG_KEY_PROPERTY);
2700 _checkRequiredProperty (instance, _PROPERTY_CREATIONCLASSNAME,
2701 _MSG_KEY_PROPERTY);
|
2702 kumpf 1.1
|
2703 kumpf 1.34 _checkPropertyWithDefault (instance, _PROPERTY_SYSTEMNAME,
2704 System::getFullyQualifiedHostName ());
|
2705 kumpf 1.1
|
2706 kumpf 1.34 _checkPropertyWithDefault (instance, _PROPERTY_SYSTEMCREATIONCLASSNAME,
2707 System::getSystemCreationClassName ());
|
2708 kumpf 1.1
|
2709 kumpf 1.64 if (instance.getClassName ().equal (PEGASUS_CLASSNAME_INDFILTER))
|
2710 kumpf 1.10 {
2711 //
|
2712 kumpf 1.11 // Query and QueryLanguage properties are required for Filter
|
2713 kumpf 1.10 //
|
2714 kumpf 1.34 _checkRequiredProperty (instance, _PROPERTY_QUERY, _MSG_PROPERTY);
2715 _checkRequiredProperty (instance, _PROPERTY_QUERYLANGUAGE,
2716 _MSG_PROPERTY);
|
2717 kumpf 1.1
|
2718 kumpf 1.10 //
|
2719 kumpf 1.11 // Default value for Source Namespace is the namespace of the
2720 // Filter registration
|
2721 kumpf 1.10 //
|
2722 kumpf 1.63 CIMNamespaceName sourceNameSpace = CIMNamespaceName
2723 (_checkPropertyWithDefault (instance, _PROPERTY_SOURCENAMESPACE,
2724 nameSpace.getString()));
|
2725 kumpf 1.15
2726 //
2727 // Validate the query and indication class name
2728 // An exception is thrown if the query is invalid or the class
2729 // is not an indication class
2730 //
2731 String filterQuery = instance.getProperty (instance.findProperty
2732 (_PROPERTY_QUERY)).getValue ().toString ();
|
2733 kumpf 1.27 WQLSelectStatement selectStatement =
|
2734 kumpf 1.15 _getSelectStatement (filterQuery);
|
2735 kumpf 1.63 CIMName indicationClassName = _getIndicationClassName
|
2736 kumpf 1.15 (selectStatement, sourceNameSpace);
|
2737 kumpf 1.11 }
|
2738 kumpf 1.10
|
2739 kumpf 1.11 //
|
2740 kumpf 1.27 // Currently only two direct subclasses of Indication handler
2741 // class are supported -- further subclassing is not currently
|
2742 kumpf 1.11 // supported
2743 //
|
2744 kumpf 1.64 else if ((instance.getClassName ().equal
2745 (PEGASUS_CLASSNAME_INDHANDLER_CIMXML)) ||
2746 (instance.getClassName ().equal
2747 (PEGASUS_CLASSNAME_INDHANDLER_SNMP)))
|
2748 kumpf 1.11 {
|
2749 kumpf 1.34 _checkPropertyWithOther (instance, _PROPERTY_PERSISTENCETYPE,
|
2750 kumpf 1.32 _PROPERTY_OTHERPERSISTENCETYPE, (Uint16) _PERSISTENCE_PERMANENT,
2751 (Uint16) _PERSISTENCE_OTHER, _validPersistenceTypes);
|
2752 kumpf 1.11
|
2753 kumpf 1.64 if (instance.getClassName ().equal
2754 (PEGASUS_CLASSNAME_INDHANDLER_CIMXML))
|
2755 kumpf 1.11 {
|
2756 kumpf 1.13 //
|
2757 kumpf 1.27 // Destination property is required for CIMXML
|
2758 kumpf 1.13 // Handler subclass
2759 //
|
2760 kumpf 1.34 _checkRequiredProperty (instance, _PROPERTY_DESTINATION,
2761 _MSG_PROPERTY);
|
2762 kumpf 1.11 }
2763
|
2764 kumpf 1.64 if (instance.getClassName ().equal
2765 (PEGASUS_CLASSNAME_INDHANDLER_SNMP))
|
2766 kumpf 1.11 {
|
2767 kumpf 1.74 //
2768 // TargetHost property is required for SNMP
2769 // Handler subclass
2770 //
2771 _checkRequiredProperty (instance, _PROPERTY_TARGETHOST,
2772 _MSG_PROPERTY);
2773
|
2774 kumpf 1.11 //
|
2775 kumpf 1.74 // TargetHostFormat property is required for SNMP
|
2776 kumpf 1.13 // Handler subclass
2777 //
|
2778 kumpf 1.74 _checkRequiredProperty (instance, _PROPERTY_TARGETHOSTFORMAT,
|
2779 kumpf 1.34 _MSG_PROPERTY);
|
2780 kumpf 1.13
2781 //
|
2782 kumpf 1.74 // SNMPVersion property is required for SNMP Handler
|
2783 kumpf 1.11 //
|
2784 kumpf 1.74 _checkRequiredProperty (instance, _PROPERTY_SNMPVERSION,
|
2785 kumpf 1.34 _MSG_PROPERTY);
|
2786 kumpf 1.11 }
2787 }
2788
2789 else
2790 {
2791 //
2792 // A class not currently served by the Indication Service
2793 //
|
2794 kumpf 1.48 PEG_METHOD_EXIT ();
|
2795 humberto 1.78
2796 // l10n
2797
2798 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
2799 // _MSG_CLASS_NOT_SERVED);
2800
2801 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
2802 MessageLoaderParms(_MSG_CLASS_NOT_SERVED_KEY, _MSG_CLASS_NOT_SERVED));
|
2803 kumpf 1.11 }
|
2804 kumpf 1.1 }
2805
|
2806 kumpf 1.48 PEG_METHOD_EXIT ();
|
2807 kumpf 1.11 return true;
|
2808 kumpf 1.22 }
2809
|
2810 kumpf 1.34 void IndicationService::_checkRequiredProperty (
2811 CIMInstance & instance,
|
2812 kumpf 1.63 const CIMName & propertyName,
|
2813 kumpf 1.34 const String & message)
2814 {
|
2815 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2816 "IndicationService::_checkRequiredProperty");
|
2817 kumpf 1.34
2818 Boolean missingProperty = false;
2819
2820 //
2821 // Required property must exist in instance
2822 //
|
2823 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
2824 kumpf 1.34 {
2825 missingProperty = true;
2826 }
2827 else
2828 {
2829 //
2830 // Get the property
2831 //
2832 CIMProperty theProperty = instance.getProperty
2833 (instance.findProperty (propertyName));
2834 CIMValue theValue = theProperty.getValue ();
2835
2836 //
2837 // Required property must have a non-null value
2838 //
2839 if (theValue.isNull ())
2840 {
2841 missingProperty = true;
2842 }
2843 }
2844
2845 kumpf 1.34 if (missingProperty)
2846 {
|
2847 humberto 1.78
2848 // l10n
2849
2850 String exceptionStr = _MSG_MISSING_REQUIRED;
2851 // exceptionStr.append (propertyName.getString());
2852 exceptionStr.append ("$0");
2853 exceptionStr.append (message);
2854
2855 String message_key;
2856 if (strcmp(message.getCString(), _MSG_KEY_PROPERTY) == 0) {
2857 message_key = _MSG_KEY_PROPERTY_KEY;
2858 } else if (strcmp(message.getCString(), _MSG_PROPERTY) == 0) {
2859 message_key = _MSG_PROPERTY_KEY;
2860 } else {
2861 message_key = String("");
2862 }
2863
2864 PEG_METHOD_EXIT ();
2865
2866 // l10n
2867
2868 humberto 1.78 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
2869 // exceptionStr);
2870
2871 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
2872 MessageLoaderParms(message_key,
2873 exceptionStr, propertyName.getString()));
2874
|
2875 kumpf 1.34 }
|
2876 kumpf 1.48 PEG_METHOD_EXIT ();
|
2877 kumpf 1.34 }
2878
2879 void IndicationService::_checkPropertyWithOther (
|
2880 kumpf 1.22 CIMInstance & instance,
|
2881 kumpf 1.63 const CIMName & propertyName,
2882 const CIMName & otherPropertyName,
|
2883 kumpf 1.22 const Uint16 defaultValue,
|
2884 kumpf 1.32 const Uint16 otherValue,
2885 const Array <Uint16> & validValues)
|
2886 kumpf 1.22 {
2887 Uint16 result = defaultValue;
2888
|
2889 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
2890 "IndicationService::_checkPropertyWithOther");
|
2891 kumpf 1.22
2892 //
2893 // If the property doesn't exist, add it with the default value
2894 //
|
2895 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
2896 kumpf 1.22 {
2897 instance.addProperty (CIMProperty (propertyName,
2898 CIMValue (defaultValue)));
2899 }
2900 else
2901 {
2902 //
2903 // Get the property
2904 //
2905 CIMProperty theProperty = instance.getProperty
2906 (instance.findProperty (propertyName));
2907 CIMValue theValue = theProperty.getValue ();
2908
2909 //
|
2910 kumpf 1.80 // Check that the value is of the correct type
2911 //
2912 if ((theValue.getType () != CIMTYPE_UINT16) || (theValue.isArray ()))
2913 {
|
2914 humberto 1.82 // L10N TODO DONE -- new throw of exception
2915
2916 String exceptionStr;
|
2917 kumpf 1.80 if (theValue.isArray ())
2918 {
|
2919 humberto 1.82 MessageLoaderParms parms(
2920 "IndicationService.IndicationService._MSG_INVALID_TYPE_ARRAY_OF_FOR_PROPERTY",
2921 "Invalid type array of $0 for property $1",
2922 cimTypeToString(theValue.getType()),
2923 propertyName.getString());
2924
2925 exceptionStr.append(MessageLoader::getMessage(parms));
2926 }
2927 else{
2928 MessageLoaderParms parms(
2929 "IndicationService.IndicationService._MSG_INVALID_TYPE_FOR_PROPERTY",
2930 "Invalid type $0 for property $1",
2931 cimTypeToString(theValue.getType()),
2932 propertyName.getString());
2933
2934 exceptionStr.append(MessageLoader::getMessage(parms));
|
2935 kumpf 1.80 }
2936 PEG_METHOD_EXIT ();
2937 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
2938 exceptionStr);
2939 }
2940
2941 //
|
2942 kumpf 1.22 // If the value is null, set to the default value
2943 //
2944 if (theValue.isNull ())
2945 {
2946 theProperty.setValue (CIMValue (defaultValue));
2947 }
2948 else
2949 {
2950 theValue.get (result);
2951
2952 //
|
2953 kumpf 1.35 // Validate the value
|
2954 kumpf 1.22 //
|
2955 kumpf 1.32 if (!Contains (validValues, result))
2956 {
|
2957 humberto 1.78 // l10n
2958
|
2959 kumpf 1.32 String exceptionStr = _MSG_INVALID_VALUE;
|
2960 humberto 1.78 // exceptionStr.append (theValue.toString ());
2961 exceptionStr.append ("$0");
|
2962 kumpf 1.32 exceptionStr.append (_MSG_FOR_PROPERTY);
|
2963 humberto 1.78 // exceptionStr.append (propertyName.getString());
2964 exceptionStr.append ("$1");
2965
|
2966 kumpf 1.48 PEG_METHOD_EXIT ();
|
2967 humberto 1.78
2968 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
2969 // exceptionStr);
2970
2971 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
2972 MessageLoaderParms(_MSG_INVALID_VALUE_FOR_PROPERTY_KEY, exceptionStr,
2973 theValue.toString(), propertyName.getString()));
|
2974 kumpf 1.32 }
|
2975 kumpf 1.22 }
2976
2977 //
2978 // If the value is Other, the Other
2979 // property must exist and value must not be NULL
2980 //
2981 if (result == otherValue)
2982 {
|
2983 kumpf 1.52 if (instance.findProperty (otherPropertyName) == PEG_NOT_FOUND)
|
2984 kumpf 1.22 {
|
2985 humberto 1.78 // l10n
2986
2987 String exceptionStr = _MSG_MISSING_REQUIRED;
2988 // exceptionStr.append (otherPropertyName.getString());
2989 exceptionStr.append ("$0");
2990 exceptionStr.append (_MSG_PROPERTY);
2991
2992 PEG_METHOD_EXIT ();
2993
2994 // l10n
2995
2996 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
2997 // exceptionStr);
2998
2999 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
3000 MessageLoaderParms(_MSG_PROPERTY_KEY,
3001 exceptionStr,
3002 otherPropertyName.getString()));
3003
|
3004 kumpf 1.22 }
3005 else
3006 {
3007 CIMProperty otherProperty = instance.getProperty
3008 (instance.findProperty (otherPropertyName));
3009 CIMValue theOtherValue = otherProperty.getValue ();
3010 if (theOtherValue.isNull ())
3011 {
|
3012 humberto 1.78 // l10n
3013
|
3014 kumpf 1.22 String exceptionStr = _MSG_MISSING_REQUIRED;
|
3015 humberto 1.78 // exceptionStr.append (otherPropertyName.getString());
3016 exceptionStr.append ("$0");
|
3017 kumpf 1.22 exceptionStr.append (_MSG_PROPERTY);
|
3018 humberto 1.78
|
3019 kumpf 1.48 PEG_METHOD_EXIT ();
|
3020 humberto 1.78
3021 // l10n
3022 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
3023 // exceptionStr);
3024
3025 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
3026 MessageLoaderParms(_MSG_PROPERTY_KEY,
3027 exceptionStr,
3028 otherPropertyName.getString()));
|
3029 kumpf 1.22 }
3030 }
3031 }
3032
3033 //
3034 // If value is not Other, Other property must not exist
3035 // or must be NULL
3036 //
|
3037 kumpf 1.52 else if (instance.findProperty (otherPropertyName) != PEG_NOT_FOUND)
|
3038 kumpf 1.22 {
3039 CIMProperty otherProperty = instance.getProperty
3040 (instance.findProperty (otherPropertyName));
3041 CIMValue theOtherValue = otherProperty.getValue ();
3042 if (!theOtherValue.isNull ())
3043 {
|
3044 humberto 1.78 // l10n
3045
3046 // String exceptionStr = otherPropertyName.getString();
3047 String exceptionStr ("$0");
3048 exceptionStr.append (_MSG_PROPERTY_PRESENT);
3049 // exceptionStr.append (propertyName.getString());
3050 exceptionStr.append ("$1");
3051 exceptionStr.append (_MSG_VALUE_NOT);
3052 // exceptionStr.append (CIMValue (otherValue).toString ());
3053 exceptionStr.append ("$2");
3054
|
3055 kumpf 1.48 PEG_METHOD_EXIT ();
|
3056 humberto 1.78
3057 // l10n
3058
3059 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
3060 // exceptionStr);
3061
3062 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
3063 MessageLoaderParms(_MSG_PROPERTY_PRESENT_BUT_VALUE_NOT_KEY,
3064 exceptionStr,
3065 otherPropertyName.getString(),
3066 propertyName.getString(),
3067 CIMValue (otherValue).toString ()));
|
3068 kumpf 1.22 }
3069 }
3070 }
3071
|
3072 kumpf 1.48 PEG_METHOD_EXIT ();
|
3073 kumpf 1.1 }
3074
|
3075 kumpf 1.34 String IndicationService::_checkPropertyWithDefault (
3076 CIMInstance & instance,
|
3077 kumpf 1.63 const CIMName & propertyName,
|
3078 kumpf 1.34 const String & defaultValue)
3079 {
3080 String result = defaultValue;
3081
|
3082 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
3083 "IndicationService::_checkPropertyWithDefault");
|
3084 kumpf 1.34
3085 //
3086 // If the property doesn't exist, add it with the default value
3087 //
|
3088 kumpf 1.52 if (instance.findProperty (propertyName) == PEG_NOT_FOUND)
|
3089 kumpf 1.34 {
3090 instance.addProperty (CIMProperty (propertyName,
3091 CIMValue (defaultValue)));
3092 }
3093 else
3094 {
3095 //
3096 // Get the property
3097 //
3098 CIMProperty theProperty = instance.getProperty
3099 (instance.findProperty (propertyName));
3100 CIMValue theValue = theProperty.getValue ();
3101
3102 //
3103 // If the value is null, set to the default value
3104 //
3105 if (theValue.isNull ())
3106 {
3107 theProperty.setValue (CIMValue (defaultValue));
3108 }
3109 else
3110 kumpf 1.34 {
3111 theValue.get (result);
3112 }
3113 }
3114
3115 return result;
3116
|
3117 kumpf 1.48 PEG_METHOD_EXIT ();
|
3118 kumpf 1.34 }
3119
|
3120 kumpf 1.88 CIMObjectPath IndicationService::_createInstance (
3121 CIMCreateInstanceRequestMessage * request,
3122 CIMInstance instance,
3123 Boolean enabled)
3124 {
3125 CIMObjectPath instanceRef;
3126 CIMException cimException;
3127
3128 //
3129 // Add creator property to Instance
3130 // NOTE: userName is only set in the request if authentication
3131 // is turned on
3132 //
3133 String currentUser = request->userName;
3134 if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CREATOR) ==
3135 PEG_NOT_FOUND)
3136 {
3137 instance.addProperty (CIMProperty
3138 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR, currentUser));
3139 }
3140 else
3141 kumpf 1.88 {
3142 CIMProperty creator = instance.getProperty
3143 (instance.findProperty
3144 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR));
3145 creator.setValue (CIMValue (currentUser));
3146 }
3147
3148 // l10n
3149 // Add the language properties to the Instance
3150 // Note: These came from the Accept-Language and Content-Language
3151 // headers in the HTTP messages, and may be empty.
3152 AcceptLanguages acceptLangs = request->acceptLanguages;
3153 if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS) ==
3154 PEG_NOT_FOUND)
3155 {
3156 instance.addProperty (CIMProperty
3157 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS,
3158 acceptLangs.toString()));
3159 }
3160 else
3161 {
3162 kumpf 1.88 CIMProperty langs = instance.getProperty
3163 (instance.findProperty
3164 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS));
3165 langs.setValue (CIMValue (acceptLangs.toString()));
3166 }
3167
3168 ContentLanguages contentLangs = request->contentLanguages;
3169 if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS) ==
3170 PEG_NOT_FOUND)
3171 {
3172 instance.addProperty (CIMProperty
3173 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS,
3174 contentLangs.toString()));
3175 }
3176 else
3177 {
3178 CIMProperty langs = instance.getProperty
3179 (instance.findProperty
3180 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS));
3181 langs.setValue (CIMValue (contentLangs.toString()));
3182 }
3183 kumpf 1.88 // l10n -end
3184
3185 if (instance.getClassName ().equal
3186 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
3187 {
3188 //
3189 // Set Time of Last State Change to current date time
3190 //
3191 CIMDateTime currentDateTime =
3192 CIMDateTime::getCurrentDateTime ();
3193 if (instance.findProperty (_PROPERTY_LASTCHANGE) ==
3194 PEG_NOT_FOUND)
3195 {
3196 instance.addProperty
3197 (CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime));
3198 }
3199 else
3200 {
3201 CIMProperty lastChange = instance.getProperty
3202 (instance.findProperty (_PROPERTY_LASTCHANGE));
3203 lastChange.setValue (CIMValue (currentDateTime));
3204 kumpf 1.88 }
3205
3206 CIMDateTime startDateTime;
3207 if (enabled)
3208 {
3209 startDateTime = currentDateTime;
3210 }
3211 else
3212 {
3213 //
3214 // If subscription is not enabled, set Subscription
3215 // Start Time to null CIMDateTime value
3216 //
3217 startDateTime = CIMDateTime ();
3218 }
3219
3220 //
3221 // Set Subscription Start Time
3222 //
3223 if (instance.findProperty (_PROPERTY_STARTTIME) ==
3224 PEG_NOT_FOUND)
3225 kumpf 1.88 {
3226 instance.addProperty
3227 (CIMProperty (_PROPERTY_STARTTIME, startDateTime));
3228 }
3229 else
3230 {
3231 CIMProperty startTime = instance.getProperty
3232 (instance.findProperty (_PROPERTY_STARTTIME));
3233 startTime.setValue (CIMValue (startDateTime));
3234 }
3235 }
3236
3237 //
3238 // Create instance in repository
3239 //
3240 _repository->write_lock ();
3241
3242 try
3243 {
3244 instanceRef = _repository->createInstance (
3245 request->nameSpace,
3246 kumpf 1.88 instance);
3247
3248 Logger::put (
3249 Logger::STANDARD_LOG,
3250 System::CIMSERVER,
3251 Logger::TRACE,
3252 "IndicationService::_handleCreateInstanceRequest - Name Space: $0 Instance name: $1",
3253 request->nameSpace.getString (),
3254 instance.getClassName ().getString ());
3255 }
3256 catch (CIMException & exception)
3257 {
3258 _repository->write_unlock ();
3259 cimException = exception;
3260 throw cimException;
3261 }
3262 catch (Exception & exception)
3263 {
3264 _repository->write_unlock ();
3265 cimException = PEGASUS_CIM_EXCEPTION
3266 (CIM_ERR_FAILED, exception.getMessage ());
3267 kumpf 1.88 throw cimException;
3268 }
3269
3270 _repository->write_unlock ();
3271 return instanceRef;
3272 }
3273
|
3274 kumpf 1.11 Boolean IndicationService::_canModify (
3275 const CIMModifyInstanceRequestMessage * request,
|
3276 kumpf 1.45 const CIMObjectPath & instanceReference,
|
3277 kumpf 1.80 const CIMInstance & instance,
3278 CIMInstance & modifiedInstance)
|
3279 kumpf 1.1 {
|
3280 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify");
|
3281 kumpf 1.1
|
3282 kumpf 1.11 //
|
3283 kumpf 1.27 // Currently, only modification allowed is of Subscription State
|
3284 kumpf 1.11 // property in Subscription class
3285 //
|
3286 kumpf 1.64 if (!instanceReference.getClassName ().equal
3287 (PEGASUS_CLASSNAME_INDSUBSCRIPTION))
|
3288 kumpf 1.11 {
|
3289 kumpf 1.48 PEG_METHOD_EXIT ();
|
3290 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3291 kumpf 1.11 }
|
3292 kumpf 1.1
|
3293 kumpf 1.11 if (request->includeQualifiers)
|
3294 kumpf 1.1 {
|
3295 kumpf 1.48 PEG_METHOD_EXIT ();
|
3296 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3297 kumpf 1.11 }
|
3298 kumpf 1.1
|
3299 kumpf 1.11 //
3300 // Request is invalid if property list is null, meaning all properties
3301 // are to be updated
3302 //
3303 if (request->propertyList.isNull ())
3304 {
|
3305 kumpf 1.48 PEG_METHOD_EXIT ();
|
3306 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3307 kumpf 1.11 }
|
3308 kumpf 1.1
|
3309 kumpf 1.11 //
3310 // Request is invalid if more than one property is specified
3311 //
|
3312 kumpf 1.51 else if (request->propertyList.size () > 1)
|
3313 kumpf 1.1 {
|
3314 kumpf 1.48 PEG_METHOD_EXIT ();
|
3315 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3316 kumpf 1.1 }
|
3317 kumpf 1.11
3318 //
3319 // For request to be valid, zero or one property must be specified
3320 // If one property specified, it must be Subscription State property
3321 //
|
3322 kumpf 1.51 else if ((request->propertyList.size () == 1) &&
|
3323 kumpf 1.64 (!request->propertyList[0].equal (_PROPERTY_STATE)))
|
3324 kumpf 1.1 {
|
3325 kumpf 1.48 PEG_METHOD_EXIT ();
|
3326 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY);
|
3327 kumpf 1.1 }
3328
|
3329 kumpf 1.80 //
3330 // Check the SubscriptionState property in the modified instance
3331 //
3332 _checkPropertyWithOther (modifiedInstance, _PROPERTY_STATE,
3333 _PROPERTY_OTHERSTATE, (Uint16) _STATE_ENABLED, (Uint16) _STATE_OTHER,
3334 _validStates);
|
3335 kumpf 1.32
|
3336 kumpf 1.11 //
3337 // Get creator from instance
3338 //
|
3339 kumpf 1.80 String creator;
3340 if (!_getCreator (instance, creator))
3341 {
3342 //
3343 // This instance from the repository is corrupted
|
3344 humberto 1.82 // L10N TODO DONE -- new throw of exception
|
3345 kumpf 1.80 //
3346 PEG_METHOD_EXIT ();
|
3347 humberto 1.82 //throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED,
3348 //_MSG_INVALID_INSTANCES);
3349 MessageLoaderParms parms(_MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES);
3350 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
|
3351 kumpf 1.80 }
|
3352 kumpf 1.1
|
3353 kumpf 1.11 //
3354 // Current user must be privileged user or instance Creator to modify
|
3355 kumpf 1.13 // NOTE: if authentication was not turned on when instance was created,
3356 // instance creator will be String::EMPTY
|
3357 kumpf 1.27 // If creator is String::EMPTY, anyone may modify or delete the
|
3358 kumpf 1.13 // instance
3359 //
3360 String currentUser = request->userName;
3361 if ((creator != String::EMPTY) &&
|
3362 kumpf 1.27 (!System::isPrivilegedUser (currentUser)) &&
|
3363 kumpf 1.11 (currentUser != creator))
3364 {
|
3365 kumpf 1.48 PEG_METHOD_EXIT ();
|
3366 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, String::EMPTY);
|
3367 kumpf 1.11 }
|
3368 kumpf 1.1
|
3369 kumpf 1.11 return true;
|
3370 kumpf 1.48 PEG_METHOD_EXIT ();
|
3371 kumpf 1.1 }
3372
|
3373 kumpf 1.11 Boolean IndicationService::_canDelete (
|
3374 kumpf 1.45 const CIMObjectPath & instanceReference,
|
3375 kumpf 1.63 const CIMNamespaceName & nameSpace,
|
3376 kumpf 1.16 const String & currentUser)
|
3377 kumpf 1.1 {
|
3378 kumpf 1.63 CIMName superClass;
3379 CIMName propName;
|
3380 kumpf 1.11
|
3381 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canDelete");
|
3382 kumpf 1.1
|
3383 kumpf 1.11 //
|
3384 kumpf 1.16 // Get the instance to be deleted from the respository
3385 //
|
3386 kumpf 1.19 CIMInstance instance;
3387
3388 _repository->read_lock ();
3389
3390 try
3391 {
3392 instance = _repository->getInstance (nameSpace, instanceReference);
3393 }
3394 catch (Exception e)
3395 {
3396 _repository->read_unlock ();
|
3397 kumpf 1.48 PEG_METHOD_EXIT ();
|
3398 kumpf 1.19 throw e;
3399 }
3400
3401 _repository->read_unlock ();
|
3402 kumpf 1.16
3403 //
3404 // Get creator from instance
3405 //
|
3406 kumpf 1.80 String creator;
3407 if (!_getCreator (instance, creator))
3408 {
3409 //
3410 // This instance from the repository is corrupted
3411 // Allow the delete if a Privileged User
3412 // (or authentication turned off),
3413 // Otherwise disallow as access denied
3414 //
3415 if ((!System::isPrivilegedUser (currentUser)) &&
3416 (currentUser != String::EMPTY))
3417 {
3418 PEG_METHOD_EXIT ();
3419 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_ACCESS_DENIED, String::EMPTY);
3420 }
3421 }
|
3422 kumpf 1.16
3423 //
3424 // Current user must be privileged user or instance Creator to delete
3425 // NOTE: if authentication was not turned on when instance was created,
3426 // instance creator will be String::EMPTY
|
3427 kumpf 1.27 // If creator is String::EMPTY, anyone may modify or delete the
|
3428 kumpf 1.16 // instance
3429 //
3430 if ((creator != String::EMPTY) &&
3431 (!System::isPrivilegedUser (currentUser)) &&
3432 (currentUser != creator))
3433 {
|
3434 kumpf 1.48 PEG_METHOD_EXIT ();
|
3435 kumpf 1.57 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, String::EMPTY);
|
3436 kumpf 1.16 }
3437
3438 //
|
3439 kumpf 1.11 // Get the class and superclass of the instance to be deleted
3440 //
|
3441 kumpf 1.19 CIMClass refClass;
3442 _repository->read_lock ();
3443
3444 try
3445 {
3446 refClass = _repository->getClass (nameSpace,
3447 instanceReference.getClassName ());
3448 }
3449 catch (Exception e)
3450 {
3451 _repository->read_unlock ();
|
3452 kumpf 1.48 PEG_METHOD_EXIT ();
|
3453 kumpf 1.19 throw e;
3454 }
3455
3456 _repository->read_unlock ();
|
3457 kumpf 1.1
|
3458 kumpf 1.11 superClass = refClass.getSuperClassName();
|
3459 kumpf 1.1
|
3460 kumpf 1.11 //
|
3461 kumpf 1.27 // If the class or superclass is Filter or Handler, check for
|
3462 kumpf 1.11 // subscription instances referring to the instance to be deleted
3463 //
|
3464 kumpf 1.64 if ((superClass.equal (PEGASUS_CLASSNAME_INDFILTER)) ||
3465 (superClass.equal (PEGASUS_CLASSNAME_INDHANDLER)) ||
3466 (instanceReference.getClassName().equal (PEGASUS_CLASSNAME_INDFILTER))
3467 || (instanceReference.getClassName().equal (PEGASUS_CLASSNAME_INDHANDLER)))
3468 {
3469 if ((superClass.equal (PEGASUS_CLASSNAME_INDFILTER)) ||
3470 (instanceReference.getClassName().equal
3471 (PEGASUS_CLASSNAME_INDFILTER)))
|
3472 kumpf 1.11 {
3473 propName = _PROPERTY_FILTER;
3474 }
|
3475 kumpf 1.64 else if (superClass.equal (PEGASUS_CLASSNAME_INDHANDLER))
|
3476 kumpf 1.1 {
|
3477 kumpf 1.11 propName = _PROPERTY_HANDLER;
|
3478 kumpf 1.1
|
3479 kumpf 1.11 //
|
3480 kumpf 1.27 // If deleting transient handler, first delete any referencing
|
3481 kumpf 1.11 // subscriptions
3482 //
3483 if (_isTransient (nameSpace, instanceReference))
|
3484 kumpf 1.1 {
|
3485 kumpf 1.11 _deleteReferencingSubscriptions (nameSpace, propName,
3486 instanceReference);
|
3487 kumpf 1.48 PEG_METHOD_EXIT ();
|
3488 kumpf 1.11 return true;
|
3489 kumpf 1.1 }
|
3490 kumpf 1.11 }
|
3491 kumpf 1.1
|
3492 kumpf 1.11 //
|
3493 kumpf 1.22 // Get all the subscriptions in the same namespace from the respository
|
3494 kumpf 1.11 //
|
3495 kumpf 1.46 Array <CIMInstance> subscriptions = _getSubscriptions (nameSpace);
|
3496 kumpf 1.1
|
3497 kumpf 1.11 CIMValue propValue;
|
3498 kumpf 1.1
|
3499 kumpf 1.11 //
|
3500 kumpf 1.27 // Check each subscription for a reference to the instance to be
|
3501 kumpf 1.11 // deleted
3502 //
|
3503 kumpf 1.83 for (Uint32 i = 0; i < subscriptions.size(); i++)
|
3504 kumpf 1.11 {
3505 //
3506 // Get the subscription Filter or Handler property value
3507 //
|
3508 kumpf 1.46 propValue = subscriptions[i].getProperty
3509 (subscriptions[i].findProperty
|
3510 kumpf 1.11 (propName)).getValue();
|
3511 kumpf 1.27
|
3512 kumpf 1.45 CIMObjectPath ref;
|
3513 kumpf 1.11 propValue.get (ref);
|
3514 kumpf 1.4
|
3515 kumpf 1.11 //
|
3516 kumpf 1.27 // If the current subscription Filter or Handler is the instance
|
3517 kumpf 1.11 // to be deleted, it may not be deleted
3518 //
3519 // ATTN: Can namespaces in the references cause comparison failure?
3520 //
3521 if (instanceReference == ref)
3522 {
|
3523 kumpf 1.48 PEG_METHOD_EXIT ();
|
3524 humberto 1.78
3525 // l10n
3526
3527 // String exceptionStr = _MSG_REFERENCED;
3528 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr);
3529
3530 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
3531 MessageLoaderParms(_MSG_REFERENCED_KEY, _MSG_REFERENCED));
|
3532 kumpf 1.1 }
3533 }
3534 }
3535
|
3536 kumpf 1.48 PEG_METHOD_EXIT ();
|
3537 kumpf 1.11 return true;
3538 }
|
3539 kumpf 1.4
|
3540 kumpf 1.1
|
3541 kumpf 1.80 Boolean IndicationService::_getActiveSubscriptionsFromRepository (
3542 Array <CIMInstance> & activeSubscriptions) const
|
3543 kumpf 1.1 {
|
3544 kumpf 1.63 Array <CIMNamespaceName> nameSpaceNames;
|
3545 kumpf 1.46 Array <CIMInstance> subscriptions;
|
3546 kumpf 1.11 CIMValue subscriptionStateValue;
3547 Uint16 subscriptionState;
|
3548 kumpf 1.80 Boolean warningLogged = false;
|
3549 kumpf 1.11
|
3550 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
3551 kumpf 1.73 "IndicationService::_getActiveSubscriptionsFromRepository");
|
3552 kumpf 1.1
|
3553 kumpf 1.80 activeSubscriptions.clear ();
3554
|
3555 kumpf 1.11 //
3556 // Get list of namespaces in repository
3557 //
|
3558 kumpf 1.22 nameSpaceNames = _getNameSpaceNames ();
|
3559 kumpf 1.1
|
3560 kumpf 1.11 //
3561 // Get existing subscriptions from each namespace in the repository
3562 //
|
3563 kumpf 1.83 for (Uint32 i = 0; i < nameSpaceNames.size (); i++)
|
3564 kumpf 1.1 {
3565
|
3566 kumpf 1.11 //
3567 // Get existing subscriptions in current namespace
3568 //
|
3569 kumpf 1.22 subscriptions = _getSubscriptions (nameSpaceNames [i]);
|
3570 kumpf 1.19
|
3571 kumpf 1.1 //
|
3572 kumpf 1.11 // Process each subscription
|
3573 kumpf 1.1 //
|
3574 kumpf 1.83 for (Uint32 j = 0; j < subscriptions.size (); j++)
|
3575 kumpf 1.1 {
3576 //
|
3577 kumpf 1.11 // Get subscription state
|
3578 kumpf 1.1 //
|
3579 kumpf 1.80 if (!_getState (subscriptions [j], subscriptionState))
3580 {
3581 //
3582 // This instance from the repository is corrupted
3583 // Skip it
|
3584 humberto 1.82 // L10N TODO DONE -- new log message
|
3585 kumpf 1.80 //
3586 if (!warningLogged)
3587 {
|
3588 humberto 1.82 //Logger::put (Logger::STANDARD_LOG, System::CIMSERVER,
3589 //Logger::WARNING, _MSG_INVALID_INSTANCES);
3590 Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER,
3591 Logger::WARNING,
3592 _MSG_INVALID_INSTANCES_KEY,
3593 _MSG_INVALID_INSTANCES);
|
3594 kumpf 1.80 warningLogged = true;
3595 }
3596 break;
3597 }
|
3598 kumpf 1.1
3599 //
|
3600 kumpf 1.11 // Process each enabled subscription
|
3601 kumpf 1.1 //
|
3602 kumpf 1.11 if ((subscriptionState == _STATE_ENABLED) ||
3603 (subscriptionState == _STATE_ENABLEDDEGRADED))
|
3604 kumpf 1.1 {
|
3605 kumpf 1.13 //
|
3606 kumpf 1.46 // CIMInstances returned from repository do not include
|
3607 kumpf 1.13 // namespace
3608 // Set namespace here
3609 //
|
3610 kumpf 1.45 CIMObjectPath instanceName =
|
3611 kumpf 1.46 subscriptions [j].getPath ();
|
3612 kumpf 1.13 instanceName.setNameSpace (nameSpaceNames [i]);
|
3613 kumpf 1.46 subscriptions [j].setPath (instanceName);
3614 activeSubscriptions.append (subscriptions [j]);
|
3615 kumpf 1.11 } // if subscription is enabled
3616 } // for each subscription
3617 } // for each namespace
|
3618 kumpf 1.1
|
3619 kumpf 1.48 PEG_METHOD_EXIT ();
|
3620 kumpf 1.80 return warningLogged;
|
3621 kumpf 1.1 }
3622
|
3623 kumpf 1.93 Array <CIMInstance> IndicationService::_getActiveSubscriptions ()
|
3624 kumpf 1.73 {
3625 Array <CIMInstance> activeSubscriptions;
3626
3627 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
3628 "IndicationService::_getActiveSubscriptions");
|
3629 kumpf 1.86
3630 // Do not call any other methods that need _activeSubscriptionsTableLock
|
3631 kumpf 1.93 ReadLock lock(_activeSubscriptionsTableLock);
|
3632 kumpf 1.86
|
3633 kumpf 1.73 //
3634 // Iterate through the subscription table
3635 //
3636 for (ActiveSubscriptionsTable::Iterator i =
3637 _activeSubscriptionsTable.start (); i; i++)
3638 {
3639 //
3640 // Append subscription to the list
3641 //
3642 activeSubscriptions.append (i.value ().subscription);
3643 }
3644
3645 PEG_METHOD_EXIT ();
3646 return activeSubscriptions;
3647 }
3648
|
3649 kumpf 1.11
|
3650 kumpf 1.46 Array <CIMInstance> IndicationService::_getMatchingSubscriptions (
|
3651 kumpf 1.63 const CIMName & supportedClass,
3652 const Array <CIMNamespaceName> nameSpaces,
|
3653 kumpf 1.89 const CIMPropertyList & supportedProperties,
3654 const Boolean checkProvider,
3655 const CIMInstance & provider)
|
3656 kumpf 1.1 {
|
3657 kumpf 1.46 Array <CIMInstance> matchingSubscriptions;
3658 Array <CIMInstance> subscriptions;
|
3659 kumpf 1.1
|
3660 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
3661 "IndicationService::_getMatchingSubscriptions");
|
3662 kumpf 1.1
|
3663 kumpf 1.83 for (Uint32 i = 0; i < nameSpaces.size (); i++)
|
3664 kumpf 1.11 {
3665 //
|
3666 kumpf 1.73 // Look up the indicationClass-sourceNamespace pair in the
3667 // Subscription Classes table
|
3668 kumpf 1.11 //
|
3669 kumpf 1.73 String subscriptionClassesKey = _generateSubscriptionClassesKey
3670 (supportedClass, nameSpaces [i]);
3671 SubscriptionClassesTableEntry tableValue;
|
3672 kumpf 1.86 if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey,
|
3673 kumpf 1.73 tableValue))
3674 {
3675 subscriptions = tableValue.subscriptions;
|
3676 kumpf 1.83 for (Uint32 j = 0; j < subscriptions.size (); j++)
|
3677 kumpf 1.73 {
3678 Boolean match = true;
3679
|
3680 kumpf 1.89 if (checkProvider)
3681 {
3682 //
3683 // Check if the provider who generated this indication
3684 // accepted this subscription
3685 //
3686 String activeSubscriptionsKey =
3687 _generateActiveSubscriptionsKey
3688 (subscriptions [j].getPath ());
3689 ActiveSubscriptionsTableEntry tableValue;
3690 if (_lockedLookupActiveSubscriptionsEntry
3691 (activeSubscriptionsKey, tableValue))
3692 {
3693 //
3694 // If provider is not in list, it did not accept the
3695 // subscription
3696 //
3697 if ((_providerInList (provider, tableValue)) ==
3698 PEG_NOT_FOUND)
3699 {
3700 match = false;
3701 kumpf 1.89 break;
3702 }
3703 }
3704 }
3705
|
3706 kumpf 1.73 //
3707 // If supported properties is null (all properties)
3708 // the subscription can be supported
3709 //
3710 if (!supportedProperties.isNull ())
3711 {
3712 String filterQuery;
3713 WQLSelectStatement selectStatement;
3714 CIMName indicationClassName;
3715 CIMNamespaceName sourceNameSpace;
3716 CIMPropertyList propertyList;
|
3717 kumpf 1.11
3718 //
|
3719 kumpf 1.73 // Get filter properties
3720 //
3721 _getFilterProperties (subscriptions [j],
3722 nameSpaces [i], filterQuery, sourceNameSpace);
3723 selectStatement = _getSelectStatement (filterQuery);
3724
3725 //
3726 // Get indication class name from filter query
3727 //
3728 indicationClassName = _getIndicationClassName
3729 (selectStatement, sourceNameSpace);
3730
3731 //
3732 // Get property list from filter query (FROM and
3733 // WHERE clauses)
3734 //
3735 propertyList = _getPropertyList (selectStatement,
3736 sourceNameSpace, indicationClassName);
3737
3738 //
3739 // If the subscription requires all properties,
3740 kumpf 1.73 // but supported property list does not include all
3741 // properties, the subscription cannot be supported
|
3742 kumpf 1.11 //
|
3743 kumpf 1.73 if (propertyList.isNull ())
3744 {
3745 match = false;
|
3746 kumpf 1.89 break;
|
3747 kumpf 1.73 }
3748 else
|
3749 kumpf 1.11 {
3750 //
|
3751 kumpf 1.73 // Compare subscription property list
3752 // with supported property list
|
3753 kumpf 1.11 //
|
3754 kumpf 1.83 for (Uint32 k = 0;
|
3755 kumpf 1.73 k < propertyList.size () && match;
3756 k++)
|
3757 kumpf 1.11 {
|
3758 kumpf 1.73 if (!ContainsCIMName
3759 (supportedProperties.getPropertyNameArray(),
3760 propertyList[k]))
|
3761 kumpf 1.11 {
|
3762 kumpf 1.73 match = false;
|
3763 kumpf 1.89 break;
|
3764 kumpf 1.11 }
3765 }
3766 }
|
3767 kumpf 1.73 }
|
3768 kumpf 1.11
|
3769 kumpf 1.73 if (match)
3770 {
|
3771 kumpf 1.11 //
|
3772 kumpf 1.16 // Add current subscription to list
|
3773 kumpf 1.11 //
|
3774 kumpf 1.73 matchingSubscriptions.append (subscriptions [j]);
3775 }
3776 }
3777 }
3778 }
|
3779 kumpf 1.1
|
3780 kumpf 1.48 PEG_METHOD_EXIT ();
|
3781 kumpf 1.19 return matchingSubscriptions;
|
3782 kumpf 1.1 }
3783
|
3784 kumpf 1.11 void IndicationService::_getModifiedSubscriptions (
|
3785 kumpf 1.63 const CIMName & supportedClass,
3786 const Array <CIMNamespaceName> & newNameSpaces,
3787 const Array <CIMNamespaceName> & oldNameSpaces,
|
3788 kumpf 1.11 const CIMPropertyList & newProperties,
3789 const CIMPropertyList & oldProperties,
|
3790 kumpf 1.46 Array <CIMInstance> & newSubscriptions,
3791 Array <CIMInstance> & formerSubscriptions)
|
3792 kumpf 1.1 {
|
3793 kumpf 1.73 Array <CIMInstance> newList;
3794 Array <CIMInstance> formerList;
3795 Array <CIMInstance> bothList;
|
3796 kumpf 1.1
|
3797 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
3798 "IndicationService::_getModifiedSubscriptions");
|
3799 kumpf 1.1
|
3800 kumpf 1.11 newSubscriptions.clear ();
3801 formerSubscriptions.clear ();
3802
|
3803 kumpf 1.1 //
|
3804 kumpf 1.73 // For each newly supported namespace, lookup to retrieve list of
3805 // subscriptions for the indication class-source namespace pair
3806 //
|
3807 kumpf 1.83 for (Uint32 i = 0; i < newNameSpaces.size (); i++)
|
3808 kumpf 1.73 {
3809 //
3810 // Look up the indicationClass-sourceNamespace pair in the
3811 // Subscription Classes table
3812 //
3813 String subscriptionClassesKey = _generateSubscriptionClassesKey
3814 (supportedClass, newNameSpaces [i]);
3815 SubscriptionClassesTableEntry tableValue;
|
3816 kumpf 1.86 if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey,
|
3817 kumpf 1.73 tableValue))
3818 {
|
3819 kumpf 1.83 for (Uint32 j = 0; j < tableValue.subscriptions.size (); j++)
|
3820 kumpf 1.73 newList.append (tableValue.subscriptions [j]);
3821 }
3822 }
3823
3824 //
3825 // For each formerly supported namespace, lookup to retrieve list of
3826 // subscriptions for the indication class-source namespace pair
3827 //
|
3828 kumpf 1.83 for (Uint32 k = 0; k < oldNameSpaces.size (); k++)
|
3829 kumpf 1.73 {
3830 //
3831 // Look up the indicationClass-sourceNamespace pair in the
3832 // Subscription Classes table
3833 //
3834 String subscriptionClassesKey = _generateSubscriptionClassesKey
3835 (supportedClass, oldNameSpaces [k]);
3836 SubscriptionClassesTableEntry tableValue;
|
3837 kumpf 1.86 if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey,
|
3838 kumpf 1.73 tableValue))
3839 {
|
3840 kumpf 1.83 for (Uint32 m = 0; m < tableValue.subscriptions.size (); m++)
|
3841 kumpf 1.73 formerList.append (tableValue.subscriptions [m]);
3842 }
3843 }
3844
3845 //
3846 // Find subscriptions that appear in both lists, and move them to a third
3847 // list
|
3848 kumpf 1.1 //
|
3849 kumpf 1.73 Sint8 found;
|
3850 kumpf 1.83 for (Uint32 p = 0; p < newList.size (); p++)
|
3851 kumpf 1.73 {
3852 found = -1;
|
3853 kumpf 1.83 for (Uint32 q = 0; q < formerList.size (); q++)
|
3854 kumpf 1.73 {
3855 if (newList [p].identical (formerList [q]))
3856 {
3857 found = q;
3858 bothList.append (newList [p]);
3859 break;
3860 }
3861 }
3862 if (found >= 0)
3863 {
3864 newList.remove (p);
3865 p--;
3866 formerList.remove (found);
3867 }
3868 }
|
3869 kumpf 1.1
3870 //
|
3871 kumpf 1.73 // For indicationClassName-sourceNamespace pair that is now supported, but
3872 // previously was not, add to list of newly supported subscriptions if
3873 // required properties are now supported
|
3874 kumpf 1.1 //
|
3875 kumpf 1.83 for (Uint32 n = 0; n < newList.size (); n++)
|
3876 kumpf 1.1 {
|
3877 kumpf 1.73 String filterQuery;
3878 WQLSelectStatement selectStatement;
3879 CIMName indicationClassName;
3880 CIMNamespaceName sourceNameSpace;
3881 CIMPropertyList requiredProperties;
|
3882 kumpf 1.11
3883 //
|
3884 kumpf 1.73 // Get filter properties
3885 //
3886 _getFilterProperties (newList [n],
3887 newList [n].getPath ().getNameSpace (), filterQuery,
3888 sourceNameSpace);
3889 selectStatement = _getSelectStatement (filterQuery);
3890
3891 //
3892 // Get indication class name from filter query (FROM clause)
3893 //
3894 indicationClassName = _getIndicationClassName (selectStatement,
3895 sourceNameSpace);
3896
3897 //
3898 // Get property list from filter query (FROM and WHERE
3899 // clauses)
|
3900 kumpf 1.11 //
|
3901 kumpf 1.73 requiredProperties = _getPropertyList (selectStatement,
3902 sourceNameSpace, indicationClassName);
|
3903 kumpf 1.19
|
3904 kumpf 1.1 //
|
3905 kumpf 1.73 // Check if required properties are now supported
|
3906 kumpf 1.1 //
|
3907 kumpf 1.73 if (_inPropertyList (requiredProperties, newProperties))
|
3908 kumpf 1.1 {
|
3909 kumpf 1.73 newSubscriptions.append (newList [n]);
3910 }
3911 }
|
3912 kumpf 1.13
|
3913 kumpf 1.73 //
3914 // For indicationClassName-sourceNamespace pair that was previously
3915 // supported, but now is not, add to list of formerly supported
3916 // subscriptions
3917 //
|
3918 kumpf 1.83 for (Uint32 f = 0; f < formerList.size (); f++)
|
3919 kumpf 1.73 {
3920 formerSubscriptions.append (formerList [f]);
3921 }
|
3922 kumpf 1.1
|
3923 kumpf 1.73 //
3924 // For indicationClassName-sourceNamespace pair that is now supported,
3925 // and was also previously supported, add to appropriate list, based on
3926 // required properties
3927 //
|
3928 kumpf 1.83 for (Uint32 b = 0; b < bothList.size (); b++)
|
3929 kumpf 1.73 {
3930 String filterQuery;
3931 WQLSelectStatement selectStatement;
3932 CIMName indicationClassName;
3933 CIMNamespaceName sourceNameSpace;
3934 CIMPropertyList requiredProperties;
3935 Boolean newMatch = false;
3936 Boolean formerMatch = false;
|
3937 kumpf 1.1
|
3938 kumpf 1.73 //
3939 // Get filter properties
3940 //
3941 _getFilterProperties (bothList [b],
3942 bothList [b].getPath ().getNameSpace (), filterQuery,
3943 sourceNameSpace);
3944 selectStatement = _getSelectStatement (filterQuery);
3945
3946 //
3947 // Get indication class name from filter query (FROM clause)
3948 //
3949 indicationClassName = _getIndicationClassName (selectStatement,
3950 sourceNameSpace);
3951
3952 //
3953 // Get property list from filter query (FROM and WHERE
3954 // clauses)
3955 //
3956 requiredProperties = _getPropertyList (selectStatement,
3957 sourceNameSpace, indicationClassName);
|
3958 kumpf 1.1
|
3959 kumpf 1.73 //
3960 // Check required properties
3961 //
3962 newMatch = _inPropertyList (requiredProperties,
3963 newProperties);
3964 formerMatch = _inPropertyList (requiredProperties,
3965 oldProperties);
|
3966 kumpf 1.15
|
3967 kumpf 1.73 //
3968 // Add current subscription to appropriate list
3969 //
3970 if (newMatch && !formerMatch)
3971 {
3972 newSubscriptions.append (bothList [b]);
3973 }
3974 else if (!newMatch && formerMatch)
3975 {
3976 formerSubscriptions.append (bothList [b]);
3977 }
3978 }
|
3979 kumpf 1.11
|
3980 kumpf 1.48 PEG_METHOD_EXIT ();
|
3981 kumpf 1.11 }
3982
|
3983 kumpf 1.63 Array <CIMNamespaceName> IndicationService::_getNameSpaceNames (void) const
|
3984 kumpf 1.22 {
|
3985 kumpf 1.63 Array <CIMNamespaceName> nameSpaceNames;
|
3986 kumpf 1.22
|
3987 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
3988 kumpf 1.73 "IndicationService::_getNameSpaceNames");
|
3989 kumpf 1.22
3990 _repository->read_lock ();
3991
3992 try
3993 {
3994 nameSpaceNames = _repository->enumerateNameSpaces ();
3995 }
3996 catch (Exception e)
3997 {
3998 _repository->read_unlock ();
|
3999 kumpf 1.48 PEG_METHOD_EXIT ();
|
4000 kumpf 1.22 throw e;
4001 }
4002
4003 _repository->read_unlock ();
4004
|
4005 kumpf 1.48 PEG_METHOD_EXIT ();
|
4006 kumpf 1.22 return nameSpaceNames;
4007 }
4008
|
4009 kumpf 1.46 Array <CIMInstance> IndicationService::_getSubscriptions (
|
4010 kumpf 1.63 const CIMNamespaceName & nameSpaceName) const
|
4011 kumpf 1.22 {
|
4012 kumpf 1.46 Array <CIMInstance> subscriptions;
|
4013 kumpf 1.22
|
4014 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4015 "IndicationService::_getSubscriptions");
|
4016 kumpf 1.22
4017 //
4018 // Get existing subscriptions in current namespace
4019 //
4020 _repository->read_lock ();
4021
4022 try
4023 {
4024 subscriptions = _repository->enumerateInstances
4025 (nameSpaceName, PEGASUS_CLASSNAME_INDSUBSCRIPTION);
4026 }
4027 catch (CIMException e)
4028 {
4029 //
4030 // Some namespaces may not include the subscription class
4031 // In that case, just return no subscriptions
4032 // Any other exception is an error
4033 //
4034 if (e.getCode () != CIM_ERR_INVALID_CLASS)
4035 {
4036 _repository->read_unlock ();
|
4037 kumpf 1.48 PEG_METHOD_EXIT ();
|
4038 kumpf 1.22 throw e;
4039 }
4040 }
4041
4042 _repository->read_unlock ();
4043
|
4044 kumpf 1.48 PEG_METHOD_EXIT ();
|
4045 kumpf 1.22 return subscriptions;
4046 }
4047
|
4048 kumpf 1.15 Boolean IndicationService::_inPropertyList (
4049 const CIMPropertyList & requiredProperties,
4050 const CIMPropertyList & supportedProperties)
4051 {
|
4052 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4053 "IndicationService::_inPropertyList");
|
4054 kumpf 1.22
|
4055 kumpf 1.15 //
4056 // If property list is null (all properties)
4057 // all the required properties are supported
4058 //
4059 if (supportedProperties.isNull ())
4060 {
4061 return true;
4062 }
4063 else
4064 {
4065 //
4066 // If the subscription requires all properties,
|
4067 kumpf 1.27 // but property list does not include all
|
4068 kumpf 1.15 // properties, the required properties cannot be supported
4069 //
4070 if (requiredProperties.isNull ())
4071 {
4072 return false;
4073 }
4074 else
4075 {
4076 //
4077 // Compare required property list
4078 // with property list
4079 //
|
4080 kumpf 1.83 for (Uint32 i = 0; i < requiredProperties.size (); i++)
|
4081 kumpf 1.15 {
|
4082 kumpf 1.55 if (!ContainsCIMName (supportedProperties.getPropertyNameArray (),
|
4083 kumpf 1.51 requiredProperties[i]))
|
4084 kumpf 1.15 {
4085 return false;
4086 }
4087 }
4088 }
4089 }
4090
|
4091 kumpf 1.48 PEG_METHOD_EXIT ();
|
4092 kumpf 1.15 return true;
4093 }
4094
|
4095 kumpf 1.46 Array <CIMInstance> IndicationService::_getProviderSubscriptions (
|
4096 kumpf 1.16 const CIMInstance & provider)
|
4097 kumpf 1.1 {
|
4098 kumpf 1.46 Array <CIMInstance> providerSubscriptions;
|
4099 kumpf 1.11
|
4100 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4101 "IndicationService::_getProviderSubscriptions");
|
4102 kumpf 1.11
|
4103 kumpf 1.86 // Do not call any other methods that need _activeSubscriptionsTableLock
4104 WriteLock lock(_activeSubscriptionsTableLock);
4105
|
4106 kumpf 1.11 //
|
4107 kumpf 1.16 // Iterate through the subscription table
|
4108 kumpf 1.11 //
|
4109 kumpf 1.73 for (ActiveSubscriptionsTable::Iterator i =
4110 _activeSubscriptionsTable.start (); i; i++)
|
4111 kumpf 1.16 {
4112 //
4113 // If provider matches, append subscription to the list
4114 //
|
4115 kumpf 1.83 for (Uint32 j = 0; j < i.value ().providers.size (); j++)
|
4116 kumpf 1.16 {
|
4117 kumpf 1.73 ActiveSubscriptionsTableEntry tableValue = i.value ();
4118 if (tableValue.providers [j].provider.identical (provider))
4119 {
4120 //
4121 // Add the subscription to the list
4122 //
4123 providerSubscriptions.append (tableValue.subscription);
4124
4125 //
4126 // Remove the provider from the list of providers serving the
4127 // subscription
4128 //
4129 tableValue.providers.remove (j);
|
4130 kumpf 1.86 _removeActiveSubscriptionsEntry (i.key ());
|
4131 kumpf 1.73
4132 if (tableValue.providers.size () > 0)
4133 {
4134 //
4135 // Insert updated entry into Active Subscriptions table
4136 //
4137 _insertActiveSubscriptionsEntry (tableValue.subscription,
4138 tableValue.providers);
4139 }
4140 else
4141 {
4142 //
4143 // If the terminated provider was the only provider serving
4144 // the subscription, implement the subscription's On Fatal
4145 // Error Policy
4146 //
4147 _handleError (tableValue.subscription);
4148 }
4149 }
|
4150 kumpf 1.16 }
4151 }
|
4152 kumpf 1.11
|
4153 kumpf 1.48 PEG_METHOD_EXIT ();
|
4154 kumpf 1.19 return providerSubscriptions;
|
4155 kumpf 1.11 }
4156
|
4157 kumpf 1.16 void IndicationService::_getFilterProperties (
|
4158 kumpf 1.11 const CIMInstance & subscription,
|
4159 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
4160 kumpf 1.16 String & query,
|
4161 kumpf 1.63 CIMNamespaceName & sourceNameSpace,
|
4162 kumpf 1.27 String & queryLanguage)
|
4163 kumpf 1.11 {
4164 CIMValue filterValue;
|
4165 kumpf 1.45 CIMObjectPath filterReference;
|
4166 kumpf 1.11 CIMInstance filterInstance;
4167
|
4168 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4169 "IndicationService::_getFilterProperties");
|
4170 kumpf 1.11
4171 filterValue = subscription.getProperty (subscription.findProperty
4172 (_PROPERTY_FILTER)).getValue ();
4173
4174 filterValue.get (filterReference);
4175
|
4176 kumpf 1.19 _repository->read_lock ();
4177
4178 try
4179 {
|
4180 kumpf 1.27 filterInstance = _repository->getInstance (nameSpaceName,
|
4181 kumpf 1.19 filterReference);
4182 }
4183 catch (Exception e)
4184 {
4185 _repository->read_unlock ();
|
4186 kumpf 1.48 PEG_METHOD_EXIT ();
|
4187 kumpf 1.19 throw e;
4188 }
4189
4190 _repository->read_unlock ();
|
4191 kumpf 1.11
|
4192 kumpf 1.27 query = filterInstance.getProperty (filterInstance.findProperty
|
4193 kumpf 1.11 (_PROPERTY_QUERY)).getValue ().toString ();
4194
|
4195 kumpf 1.27 sourceNameSpace = filterInstance.getProperty (filterInstance.findProperty
|
4196 kumpf 1.16 (_PROPERTY_SOURCENAMESPACE)).getValue ().toString ();
4197
4198 queryLanguage = filterInstance.getProperty
4199 (filterInstance.findProperty (_PROPERTY_QUERYLANGUAGE)).
4200 getValue ().toString ();
4201
|
4202 kumpf 1.48 PEG_METHOD_EXIT ();
|
4203 kumpf 1.11 }
4204
|
4205 kumpf 1.16 void IndicationService::_getFilterProperties (
|
4206 kumpf 1.14 const CIMInstance & subscription,
|
4207 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
4208 kumpf 1.16 String & query,
|
4209 kumpf 1.63 CIMNamespaceName & sourceNameSpace)
|
4210 kumpf 1.14 {
4211 CIMValue filterValue;
|
4212 kumpf 1.45 CIMObjectPath filterReference;
|
4213 kumpf 1.14 CIMInstance filterInstance;
4214
|
4215 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4216 "IndicationService::_getFilterProperties");
|
4217 kumpf 1.14
4218 filterValue = subscription.getProperty (subscription.findProperty
4219 (_PROPERTY_FILTER)).getValue ();
4220
4221 filterValue.get (filterReference);
4222
|
4223 kumpf 1.19 _repository->read_lock ();
4224
4225 try
4226 {
|
4227 kumpf 1.27 filterInstance = _repository->getInstance (nameSpaceName,
|
4228 kumpf 1.19 filterReference);
4229 }
4230 catch (Exception e)
4231 {
4232 _repository->read_unlock ();
|
4233 kumpf 1.48 PEG_METHOD_EXIT ();
|
4234 kumpf 1.19 throw e;
4235 }
4236
4237 _repository->read_unlock ();
|
4238 kumpf 1.14
|
4239 kumpf 1.27 query = filterInstance.getProperty (filterInstance.findProperty
|
4240 kumpf 1.16 (_PROPERTY_QUERY)).getValue ().toString ();
4241
|
4242 kumpf 1.27 sourceNameSpace = filterInstance.getProperty (filterInstance.findProperty
|
4243 kumpf 1.14 (_PROPERTY_SOURCENAMESPACE)).getValue ().toString ();
4244
|
4245 kumpf 1.48 PEG_METHOD_EXIT ();
|
4246 kumpf 1.14 }
4247
|
4248 kumpf 1.16 void IndicationService::_getFilterProperties (
|
4249 kumpf 1.11 const CIMInstance & subscription,
|
4250 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
4251 kumpf 1.27 String & query)
|
4252 kumpf 1.11 {
4253 CIMValue filterValue;
|
4254 kumpf 1.45 CIMObjectPath filterReference;
|
4255 kumpf 1.11 CIMInstance filterInstance;
4256
|
4257 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4258 "IndicationService::_getFilterProperties");
|
4259 kumpf 1.1
|
4260 kumpf 1.11 filterValue = subscription.getProperty (subscription.findProperty
4261 (_PROPERTY_FILTER)).getValue ();
|
4262 kumpf 1.1
|
4263 kumpf 1.11 filterValue.get (filterReference);
|
4264 kumpf 1.1
|
4265 kumpf 1.19 _repository->read_lock ();
4266
4267 try
4268 {
|
4269 kumpf 1.27 filterInstance = _repository->getInstance (nameSpaceName,
|
4270 kumpf 1.19 filterReference);
4271 }
4272 catch (Exception e)
4273 {
4274 _repository->read_unlock ();
|
4275 kumpf 1.48 PEG_METHOD_EXIT ();
|
4276 kumpf 1.19 throw e;
4277 }
4278
4279 _repository->read_unlock ();
|
4280 kumpf 1.1
|
4281 kumpf 1.27 query = filterInstance.getProperty (filterInstance.findProperty
|
4282 kumpf 1.16 (_PROPERTY_QUERY)).getValue ().toString ();
|
4283 kumpf 1.1
|
4284 kumpf 1.48 PEG_METHOD_EXIT ();
|
4285 kumpf 1.11 }
|
4286 kumpf 1.1
|
4287 kumpf 1.11 WQLSelectStatement IndicationService::_getSelectStatement (
4288 const String & filterQuery) const
4289 {
4290 WQLSelectStatement selectStatement;
|
4291 kumpf 1.1
|
4292 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4293 "IndicationService::_getSelectStatement");
|
4294 kumpf 1.1
|
4295 kumpf 1.11 try
4296 {
4297 selectStatement.clear ();
|
4298 kumpf 1.44
4299 _mutex.lock(pegasus_thread_self());
4300
|
4301 kumpf 1.11 WQLParser::parse (filterQuery, selectStatement);
|
4302 kumpf 1.44
4303 _mutex.unlock();
|
4304 kumpf 1.11 }
4305 catch (ParseError & pe)
4306 {
|
4307 kumpf 1.15 String exceptionStr = pe.getMessage ();
|
4308 kumpf 1.76 _mutex.unlock();
|
4309 kumpf 1.48 PEG_METHOD_EXIT ();
|
4310 kumpf 1.15 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, exceptionStr);
|
4311 kumpf 1.11 }
4312 catch (MissingNullTerminator & mnt)
4313 {
|
4314 kumpf 1.15 String exceptionStr = mnt.getMessage ();
|
4315 kumpf 1.76 _mutex.unlock();
|
4316 kumpf 1.48 PEG_METHOD_EXIT ();
|
4317 kumpf 1.15 throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, exceptionStr);
|
4318 kumpf 1.11 }
|
4319 kumpf 1.1
|
4320 kumpf 1.48 PEG_METHOD_EXIT ();
|
4321 kumpf 1.11 return selectStatement;
|
4322 kumpf 1.1 }
4323
|
4324 kumpf 1.63 CIMName IndicationService::_getIndicationClassName (
|
4325 kumpf 1.11 const WQLSelectStatement & selectStatement,
|
4326 kumpf 1.63 const CIMNamespaceName & nameSpaceName) const
|
4327 kumpf 1.1 {
|
4328 kumpf 1.63 CIMName indicationClassName;
4329 Array <CIMName> indicationSubclasses;
|
4330 kumpf 1.1
|
4331 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4332 "IndicationService::_getIndicationClassName");
|
4333 kumpf 1.1
|
4334 kumpf 1.11 indicationClassName = selectStatement.getClassName ();
4335
|
4336 kumpf 1.1 //
|
4337 kumpf 1.15 // Validate that class is an Indication class
4338 // The Indication Qualifier should exist and have the value True
|
4339 kumpf 1.1 //
|
4340 kumpf 1.15 Boolean validClass = false;
|
4341 kumpf 1.19 CIMClass theClass;
4342 _repository->read_lock ();
4343
4344 try
4345 {
|
4346 kumpf 1.92 theClass = _repository->getClass (
4347 nameSpaceName,
4348 indicationClassName,
4349 false,
4350 true,
4351 false,
4352 CIMPropertyList());
|
4353 kumpf 1.19 }
4354 catch (Exception e)
4355 {
4356 _repository->read_unlock ();
|
4357 kumpf 1.48 PEG_METHOD_EXIT ();
|
4358 kumpf 1.19 throw e;
4359 }
4360
4361 _repository->read_unlock ();
4362
|
4363 kumpf 1.52 if (theClass.findQualifier (_QUALIFIER_INDICATION) != PEG_NOT_FOUND)
|
4364 kumpf 1.15 {
|
4365 kumpf 1.27 CIMQualifier theQual = theClass.getQualifier (theClass.findQualifier
|
4366 kumpf 1.15 (_QUALIFIER_INDICATION));
4367 CIMValue theVal = theQual.getValue ();
4368 if (!theVal.isNull ())
4369 {
4370 Boolean indicationClass;
4371 theVal.get (indicationClass);
4372 validClass = indicationClass;
4373 }
4374 }
|
4375 kumpf 1.1
|
4376 kumpf 1.15 if (!validClass)
|
4377 kumpf 1.1 {
|
4378 humberto 1.78 // l10n
4379
4380 // String exceptionStr = _MSG_INVALID_CLASSNAME;
|
4381 humberto 1.84 String exceptionStr = String("Invalid indication class name ");
|
4382 humberto 1.78 // exceptionStr.append (indicationClassName.getString());
|
4383 humberto 1.84 exceptionStr.append ("$0");
|
4384 humberto 1.78 // exceptionStr.append (_MSG_IN_FROM);
|
4385 humberto 1.85 exceptionStr.append (" in FROM clause of ");
|
4386 humberto 1.78 // exceptionStr.append (PEGASUS_CLASSNAME_INDFILTER.getString());
|
4387 humberto 1.85 exceptionStr.append ("$1");
|
4388 kumpf 1.15 exceptionStr.append (" ");
|
4389 humberto 1.78 // exceptionStr.append (_PROPERTY_QUERY.getString());
|
4390 humberto 1.85 exceptionStr.append ("$2");
|
4391 kumpf 1.11 exceptionStr.append (_MSG_PROPERTY);
|
4392 humberto 1.78
|
4393 kumpf 1.48 PEG_METHOD_EXIT ();
|
4394 humberto 1.78
4395 // l10n
4396
4397 // throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER,
4398 // exceptionStr);
4399
4400 throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER,
4401 MessageLoaderParms (
4402 _MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY_KEY,
4403 exceptionStr,
4404 indicationClassName.getString(),
4405 PEGASUS_CLASSNAME_INDFILTER.getString(),
4406 _PROPERTY_QUERY.getString()));
|
4407 kumpf 1.11 }
|
4408 kumpf 1.1
|
4409 kumpf 1.48 PEG_METHOD_EXIT ();
|
4410 kumpf 1.19 return indicationClassName;
|
4411 kumpf 1.1 }
4412
|
4413 kumpf 1.63 Array <CIMName> IndicationService::_getIndicationSubclasses (
4414 const CIMNamespaceName & nameSpace,
4415 const CIMName & indicationClassName) const
|
4416 kumpf 1.22 {
|
4417 kumpf 1.63 Array <CIMName> indicationSubclasses;
|
4418 kumpf 1.22
4419 const char METHOD_NAME [] = "IndicationService::_getIndicationSubclasses";
4420
|
4421 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4422 "IndicationService::_getIndicationSubclasses");
|
4423 kumpf 1.22
4424 _repository->read_lock ();
4425
4426 try
4427 {
4428 indicationSubclasses = _repository->enumerateClassNames
4429 (nameSpace, indicationClassName, true);
4430 }
4431 catch (Exception e)
4432 {
4433 _repository->read_unlock ();
|
4434 kumpf 1.48 PEG_METHOD_EXIT ();
|
4435 kumpf 1.22 throw e;
4436 }
4437
4438 _repository->read_unlock ();
4439
4440 indicationSubclasses.append (indicationClassName);
4441
|
4442 kumpf 1.48 PEG_METHOD_EXIT ();
|
4443 kumpf 1.22 return indicationSubclasses;
4444 }
4445
|
4446 kumpf 1.27 Array <ProviderClassList>
|
4447 kumpf 1.11 IndicationService::_getIndicationProviders (
|
4448 kumpf 1.63 const CIMNamespaceName & nameSpace,
4449 const CIMName & indicationClassName,
4450 const Array <CIMName> & indicationSubclasses,
|
4451 kumpf 1.11 const CIMPropertyList & requiredPropertyList) const
|
4452 kumpf 1.1 {
|
4453 kumpf 1.16 ProviderClassList provider;
4454 Array <ProviderClassList> indicationProviders;
|
4455 kumpf 1.12 Array <CIMInstance> providerInstances;
4456 Array <CIMInstance> providerModuleInstances;
4457 Boolean duplicate = false;
|
4458 kumpf 1.1
|
4459 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4460 "IndicationService::_getIndicationProviders");
|
4461 kumpf 1.1
|
4462 kumpf 1.11 //
|
4463 kumpf 1.12 // For each indication subclass, get providers
|
4464 kumpf 1.1 //
|
4465 kumpf 1.83 for (Uint32 i = 0; i < indicationSubclasses.size (); i++)
|
4466 kumpf 1.1 {
4467 //
|
4468 kumpf 1.12 // Get providers that can serve the subscription
|
4469 kumpf 1.1 //
|
4470 kumpf 1.12 providerInstances.clear ();
4471 providerModuleInstances.clear ();
4472 if (_providerRegManager->getIndicationProviders
4473 (nameSpace,
4474 indicationSubclasses [i],
|
4475 kumpf 1.14 requiredPropertyList,
|
4476 kumpf 1.12 providerInstances,
4477 providerModuleInstances))
|
4478 kumpf 1.1 {
|
4479 kumpf 1.27 PEGASUS_ASSERT (providerInstances.size () ==
|
4480 kumpf 1.12 providerModuleInstances.size ());
|
4481 kumpf 1.27
|
4482 kumpf 1.1 //
|
4483 kumpf 1.27 // Merge into list of ProviderClassList structs
|
4484 kumpf 1.1 //
|
4485 kumpf 1.83 for (Uint32 j = 0; j < providerInstances.size () && !duplicate; j++)
|
4486 kumpf 1.1 {
|
4487 kumpf 1.12 provider.classList.clear ();
4488 duplicate = false;
|
4489 kumpf 1.1
4490 //
|
4491 kumpf 1.12 // See if indication provider is already in list
|
4492 kumpf 1.1 //
|
4493 kumpf 1.83 for (Uint32 k = 0;
|
4494 kumpf 1.12 k < indicationProviders.size () && !duplicate; k++)
|
4495 kumpf 1.1 {
|
4496 kumpf 1.27 if ((providerInstances [j].identical
|
4497 kumpf 1.12 (indicationProviders [k].provider)) &&
4498 (providerModuleInstances [j].identical
4499 (indicationProviders [k].providerModule)))
|
4500 kumpf 1.1 {
|
4501 kumpf 1.12 //
4502 // Indication provider is already in list
4503 // Add subclass to provider's class list
4504 //
|
4505 kumpf 1.27 indicationProviders [k].classList.append
|
4506 kumpf 1.12 (indicationSubclasses [i]);
4507 duplicate = true;
|
4508 kumpf 1.1 }
|
4509 kumpf 1.11 }
|
4510 kumpf 1.27
|
4511 kumpf 1.12 if (!duplicate)
|
4512 kumpf 1.11 {
|
4513 kumpf 1.1 //
|
4514 kumpf 1.11 // Current provider is not yet in list
4515 // Create new list entry
|
4516 kumpf 1.1 //
|
4517 kumpf 1.12 provider.provider = providerInstances [j];
4518 provider.providerModule = providerModuleInstances [j];
4519 provider.classList.append (indicationSubclasses [i]);
4520 indicationProviders.append (provider);
4521 }
4522 } // for each indication provider instance
4523 } // if any providers
4524 } // for each indication subclass
|
4525 kumpf 1.27
|
4526 kumpf 1.48 PEG_METHOD_EXIT ();
|
4527 kumpf 1.19 return indicationProviders;
|
4528 kumpf 1.1 }
4529
|
4530 kumpf 1.27 CIMPropertyList IndicationService::_getPropertyList
|
4531 kumpf 1.17 (const WQLSelectStatement & selectStatement,
|
4532 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
4533 const CIMName & indicationClassName) const
|
4534 kumpf 1.1 {
|
4535 kumpf 1.67 CIMPropertyList propertyList;
|
4536 kumpf 1.1
|
4537 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4538 "IndicationService::_getPropertyList");
|
4539 kumpf 1.1
4540 //
|
4541 kumpf 1.11 // Get all the properties referenced in the projection list (SELECT clause)
|
4542 kumpf 1.1 //
|
4543 kumpf 1.67 propertyList = selectStatement.getSelectPropertyList ();
4544 if (propertyList.isNull ())
|
4545 kumpf 1.11 {
|
4546 kumpf 1.67 //
4547 // Return null property list for all properties
4548 //
4549 return propertyList;
4550 }
4551 else
4552 {
4553 Array <CIMName> propertyArray;
4554
4555 //
4556 // Get selected property names
4557 //
4558 propertyArray = propertyList.getPropertyNameArray ();
4559
4560 //
4561 // Get all the properties referenced in the condition (WHERE clause)
4562 //
4563 if (selectStatement.hasWhereClause ())
|
4564 kumpf 1.11 {
|
4565 kumpf 1.67 CIMPropertyList
4566 wherePropertyList = selectStatement.getWherePropertyList ();
4567
|
4568 kumpf 1.11 //
|
4569 kumpf 1.67 // WHERE property list may not be NULL (may be empty)
|
4570 kumpf 1.11 //
|
4571 kumpf 1.67 for (Uint32 j = 0; j < wherePropertyList.size(); j++)
|
4572 kumpf 1.11 {
|
4573 kumpf 1.67 //
4574 // Add property name to the list if not already there
4575 //
4576 if (!ContainsCIMName (propertyArray, wherePropertyList[j]))
|
4577 kumpf 1.11 {
|
4578 kumpf 1.67 propertyArray.append (wherePropertyList[j]);
|
4579 kumpf 1.11 }
|
4580 kumpf 1.1 }
4581 }
|
4582 kumpf 1.67
4583 return _checkPropertyList (propertyArray, nameSpaceName,
4584 indicationClassName);
|
4585 kumpf 1.11 }
|
4586 kumpf 1.37 }
4587
4588 CIMPropertyList IndicationService::_checkPropertyList
|
4589 kumpf 1.54 (const Array <CIMName> & propertyList,
|
4590 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
4591 const CIMName & indicationClassName) const
|
4592 kumpf 1.37 {
|
4593 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4594 "IndicationService::_checkPropertyList");
|
4595 kumpf 1.37
|
4596 kumpf 1.14 //
|
4597 kumpf 1.17 // Check if list includes all properties in class
4598 // If so, must be set to NULL
|
4599 kumpf 1.14 //
|
4600 kumpf 1.19 CIMClass indicationClass;
4601 _repository->read_lock ();
4602
4603 try
4604 {
|
4605 kumpf 1.89 //
4606 // Get the indication class object from the repository
4607 // Specify localOnly=false because superclass properties are needed
4608 // Specify includeQualifiers=false because qualifiers are not needed
4609 //
|
4610 kumpf 1.27 indicationClass = _repository->getClass (nameSpaceName,
|
4611 kumpf 1.89 indicationClassName, false, false);
|
4612 kumpf 1.19 }
4613 catch (Exception e)
4614 {
4615 _repository->read_unlock ();
|
4616 kumpf 1.48 PEG_METHOD_EXIT ();
|
4617 kumpf 1.19 throw e;
4618 }
4619
4620 _repository->read_unlock ();
4621
|
4622 kumpf 1.17 Boolean allProperties = true;
|
4623 kumpf 1.37 for (Uint32 i = 0;
4624 i < indicationClass.getPropertyCount () && allProperties; i++)
|
4625 kumpf 1.17 {
|
4626 kumpf 1.55 if (!ContainsCIMName (propertyList,
|
4627 kumpf 1.37 indicationClass.getProperty (i).getName ()))
|
4628 kumpf 1.17 {
4629 allProperties = false;
4630 }
4631 }
|
4632 kumpf 1.14
|
4633 kumpf 1.17 if (allProperties)
4634 {
4635 //
4636 // Return NULL CIMPropertyList
4637 //
|
4638 kumpf 1.48 PEG_METHOD_EXIT ();
|
4639 kumpf 1.18 return CIMPropertyList ();
|
4640 kumpf 1.17 }
4641 else
4642 {
|
4643 kumpf 1.48 PEG_METHOD_EXIT ();
|
4644 kumpf 1.19 return CIMPropertyList (propertyList);
|
4645 kumpf 1.17 }
|
4646 kumpf 1.11 }
4647
|
4648 kumpf 1.27 String IndicationService::_getCondition
|
4649 kumpf 1.11 (const String & filterQuery) const
4650 {
4651 String condition = String::EMPTY;
4652
|
4653 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4654 "IndicationService::_getCondition");
|
4655 kumpf 1.11
4656 //
4657 // Get condition substring from filter query
4658 //
4659 if (filterQuery.find (_QUERY_WHERE) != PEG_NOT_FOUND)
4660 {
|
4661 kumpf 1.27 condition = filterQuery.subString (filterQuery.find
|
4662 kumpf 1.11 (_QUERY_WHERE) + 6);
4663 }
4664
|
4665 kumpf 1.48 PEG_METHOD_EXIT ();
|
4666 kumpf 1.19 return condition;
|
4667 kumpf 1.11 }
4668
4669
|
4670 kumpf 1.46 CIMInstance IndicationService::_getHandler (
4671 const CIMInstance & subscription) const
|
4672 kumpf 1.11 {
4673 CIMValue handlerValue;
|
4674 kumpf 1.45 CIMObjectPath handlerRef;
|
4675 kumpf 1.11 CIMInstance handlerInstance;
4676
|
4677 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_getHandler");
|
4678 kumpf 1.11
4679 //
4680 // Get Handler reference from subscription instance
4681 //
|
4682 kumpf 1.46 handlerValue = subscription.getProperty
4683 (subscription.findProperty
|
4684 kumpf 1.11 (_PROPERTY_HANDLER)).getValue ();
4685
4686 handlerValue.get (handlerRef);
4687
4688 //
4689 // Get Handler instance from the repository
4690 //
|
4691 kumpf 1.19 _repository->read_lock ();
4692
4693 try
4694 {
|
4695 kumpf 1.27 handlerInstance = _repository->getInstance
|
4696 kumpf 1.46 (subscription.getPath ().getNameSpace (), handlerRef);
|
4697 kumpf 1.19 }
4698 catch (Exception e)
4699 {
4700 _repository->read_unlock ();
|
4701 kumpf 1.48 PEG_METHOD_EXIT ();
|
4702 kumpf 1.19 throw e;
4703 }
4704
4705 _repository->read_unlock ();
|
4706 kumpf 1.11
|
4707 kumpf 1.13 //
|
4708 kumpf 1.46 // Set namespace in path in CIMInstance
|
4709 kumpf 1.13 //
|
4710 kumpf 1.27 handlerRef.setNameSpace
|
4711 kumpf 1.46 (subscription.getPath ().getNameSpace ());
4712 handlerInstance.setPath (handlerRef);
|
4713 kumpf 1.11
|
4714 kumpf 1.48 PEG_METHOD_EXIT ();
|
4715 kumpf 1.46 return handlerInstance;
|
4716 kumpf 1.11 }
4717
4718 Boolean IndicationService::_isTransient (
|
4719 kumpf 1.63 const CIMNamespaceName & nameSpace,
|
4720 kumpf 1.45 const CIMObjectPath & handler) const
|
4721 kumpf 1.11 {
4722 CIMValue persistenceValue;
4723 Uint16 persistenceType;
4724
|
4725 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4726 "IndicationService::_isTransient");
|
4727 kumpf 1.11
4728 //
|
4729 kumpf 1.38 // Get the handler instance from the respository
|
4730 kumpf 1.11 //
|
4731 kumpf 1.19 CIMInstance instance;
4732 _repository->read_lock ();
4733
4734 try
4735 {
4736 instance = _repository->getInstance (nameSpace, handler);
4737 }
4738 catch (Exception e)
4739 {
4740 _repository->read_unlock ();
|
4741 kumpf 1.48 PEG_METHOD_EXIT ();
|
4742 kumpf 1.19 throw e;
4743 }
4744
4745 _repository->read_unlock ();
|
4746 kumpf 1.11
4747 //
4748 // Get Persistence Type
4749 //
4750 persistenceValue = instance.getProperty (instance.findProperty
4751 (_PROPERTY_PERSISTENCETYPE)).getValue ();
4752 persistenceValue.get (persistenceType);
4753
4754 //
4755 // If Persistence Type is Other, Other Persistence Type
4756 // property must exist
4757 //
4758 if (persistenceType == _PERSISTENCE_TRANSIENT)
4759 {
|
4760 kumpf 1.48 PEG_METHOD_EXIT ();
|
4761 kumpf 1.11 return true;
4762 }
4763 else
4764 {
|
4765 kumpf 1.48 PEG_METHOD_EXIT ();
|
4766 kumpf 1.11 return false;
4767 }
4768 }
4769
4770 void IndicationService::_deleteReferencingSubscriptions (
|
4771 kumpf 1.63 const CIMNamespaceName & nameSpace,
4772 const CIMName & referenceProperty,
|
4773 kumpf 1.45 const CIMObjectPath & handler)
|
4774 kumpf 1.11 {
|
4775 kumpf 1.46 Array <CIMInstance> subscriptions;
|
4776 kumpf 1.11
|
4777 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4778 "IndicationService::_deleteReferencingSubscriptions");
|
4779 kumpf 1.11
4780 //
4781 // Get existing subscriptions in the namespace
4782 //
|
4783 kumpf 1.22 subscriptions = _getSubscriptions (nameSpace);
|
4784 kumpf 1.11
4785 //
|
4786 kumpf 1.27 // Check each subscription for a reference to the specified instance
|
4787 kumpf 1.11 //
|
4788 kumpf 1.83 for (Uint32 i = 0; i < subscriptions.size (); i++)
|
4789 kumpf 1.11 {
|
4790 kumpf 1.1 //
|
4791 kumpf 1.11 // Get the reference property value from the subscription instance
|
4792 kumpf 1.1 //
|
4793 kumpf 1.46 CIMValue propValue = subscriptions [i].getProperty
4794 (subscriptions [i].findProperty
|
4795 kumpf 1.11 (referenceProperty)).getValue ();
|
4796 kumpf 1.45 CIMObjectPath ref;
|
4797 kumpf 1.11 propValue.get (ref);
|
4798 kumpf 1.1
4799 //
|
4800 kumpf 1.11 // If the current subscription references the specified instance,
4801 // delete it
|
4802 kumpf 1.1 //
|
4803 kumpf 1.11 if (handler == ref)
|
4804 kumpf 1.1 {
|
4805 kumpf 1.88 //
4806 // Delete referencing subscription instance from repository
4807 //
4808 _repository->write_lock ();
4809
4810 try
4811 {
4812 //
4813 // Namespace and host must not be set in path passed to
4814 // repository
4815 //
4816 CIMObjectPath path ("", CIMNamespaceName (),
4817 subscriptions [i].getPath ().getClassName(),
4818 subscriptions [i].getPath ().getKeyBindings());
4819 _repository->deleteInstance (nameSpace, path);
4820 }
4821 catch (Exception & exception)
4822 {
4823 //
4824 // Deletion of referencing subscription failed
4825 //
4826 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
4827 "Exception caught in deleting referencing subscription (" +
4828 subscriptions[i].getPath().toString() + "): " +
4829 exception.getMessage ());
4830 }
4831 _repository->write_unlock ();
4832
|
4833 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
4834 kumpf 1.73 Array <CIMName> indicationSubclasses;
4835 CIMNamespaceName sourceNamespaceName;
|
4836 kumpf 1.88
4837 CIMObjectPath path = subscriptions [i].getPath ();
4838 path.setNameSpace (nameSpace);
4839 subscriptions [i].setPath (path);
4840
|
4841 kumpf 1.38 indicationProviders = _getDeleteParams (nameSpace,
|
4842 kumpf 1.73 subscriptions [i], indicationSubclasses, sourceNamespaceName);
|
4843 kumpf 1.12
4844 //
|
4845 kumpf 1.38 // Send Delete requests
|
4846 kumpf 1.12 //
|
4847 kumpf 1.88 // NOTE: These Delete requests are not associated with a user
4848 // request, so there is no associated authType or userName
4849 // The Creator from the subscription instance is used for userName,
4850 // and authType is not set
4851 //
|
4852 kumpf 1.46 CIMInstance instance = subscriptions [i];
|
4853 kumpf 1.80 String creator = String::EMPTY;
|
4854 kumpf 1.88 _getCreator (instance, creator);
|
4855 chuck 1.75
|
4856 chuck 1.77 // l10n start
4857 String acceptLangs = String::EMPTY;
4858 Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
4859 if (propIndex != PEG_NOT_FOUND)
4860 {
4861 instance.getProperty(propIndex).getValue().get(acceptLangs);
4862 }
4863 String contentLangs = String::EMPTY;
4864 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
4865 if (propIndex != PEG_NOT_FOUND)
4866 {
4867 instance.getProperty(propIndex).getValue().get(contentLangs);
4868 }
4869 // l10n end
|
4870 chuck 1.75
|
4871 kumpf 1.45 CIMObjectPath instanceName =
|
4872 kumpf 1.46 subscriptions [i].getPath ();
|
4873 kumpf 1.16 instanceName.setNameSpace (nameSpace);
|
4874 kumpf 1.46 subscriptions [i].setPath (instanceName);
|
4875 chuck 1.75 // l10n
|
4876 kumpf 1.90 _sendDeleteRequests (indicationProviders, sourceNamespaceName,
|
4877 chuck 1.75 subscriptions [i],
4878 AcceptLanguages(acceptLangs),
4879 ContentLanguages(contentLangs),
|
4880 kumpf 1.88 0, // no request
4881 indicationSubclasses,
|
4882 chuck 1.75 creator);
|
4883 kumpf 1.11 }
4884 }
4885
|
4886 kumpf 1.48 PEG_METHOD_EXIT ();
|
4887 kumpf 1.11 }
4888
4889 Boolean IndicationService::_isExpired (
4890 const CIMInstance & instance) const
4891 {
|
4892 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_isExpired");
|
4893 kumpf 1.11
|
4894 kumpf 1.35 Boolean isExpired = true;
4895 Uint64 timeRemaining = 0;
|
4896 kumpf 1.1
|
4897 kumpf 1.11 //
|
4898 kumpf 1.35 // Get time remaining, if subscription has a duration
|
4899 kumpf 1.11 //
|
4900 kumpf 1.35 if (_getTimeRemaining (instance, timeRemaining))
|
4901 kumpf 1.13 {
|
4902 kumpf 1.35 if (timeRemaining > 0)
4903 {
4904 isExpired = false;
4905 }
|
4906 kumpf 1.13 }
4907 else
4908 {
|
4909 kumpf 1.35 //
4910 // If there is no duration, the subscription has no expiration date
4911 //
4912 isExpired = false;
|
4913 kumpf 1.13 }
|
4914 kumpf 1.1
|
4915 kumpf 1.48 PEG_METHOD_EXIT ();
|
4916 kumpf 1.35 return isExpired;
|
4917 kumpf 1.1 }
4918
|
4919 kumpf 1.11 void IndicationService::_deleteExpiredSubscription (
|
4920 kumpf 1.45 CIMObjectPath & subscription)
|
4921 kumpf 1.1 {
|
4922 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
4923 "IndicationService::_deleteExpiredSubscription");
|
4924 kumpf 1.1
|
4925 kumpf 1.88 CIMInstance subscriptionInstance;
4926 Array <ProviderClassList> indicationProviders;
|
4927 kumpf 1.63 CIMNamespaceName nameSpace = subscription.getNameSpace ();
4928 subscription.setNameSpace (CIMNamespaceName ());
|
4929 kumpf 1.35
|
4930 kumpf 1.11 //
|
4931 kumpf 1.88 // Get instance from repository
4932 //
4933 _repository->read_lock ();
4934
4935 try
4936 {
4937 subscriptionInstance = _repository->getInstance
4938 (nameSpace, subscription);
4939 }
4940 catch (Exception e)
4941 {
4942 _repository->read_unlock ();
4943 PEG_METHOD_EXIT ();
4944 throw e;
4945 }
4946
4947 _repository->read_unlock ();
4948
4949 //
|
4950 kumpf 1.11 // Delete the subscription instance
4951 //
4952 _repository->write_lock ();
|
4953 kumpf 1.1
|
4954 kumpf 1.11 try
4955 {
4956 _repository->deleteInstance (nameSpace, subscription);
4957 }
4958 catch (Exception & exception)
4959 {
|
4960 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
4961 "Exception caught in deleting expired subscription (" +
4962 subscriptionInstance.getPath().toString() + "): " +
4963 exception.getMessage ());
|
4964 kumpf 1.11 }
|
4965 kumpf 1.1
|
4966 kumpf 1.11 _repository->write_unlock ();
|
4967 kumpf 1.1
|
4968 kumpf 1.88 //
4969 // If subscription was active, send delete requests to providers
4970 // and update hash tables
4971 //
4972 Uint16 subscriptionState;
4973 CIMValue subscriptionStateValue;
4974 subscriptionStateValue = subscriptionInstance.getProperty
4975 (subscriptionInstance.findProperty
4976 (_PROPERTY_STATE)).getValue ();
4977 subscriptionStateValue.get (subscriptionState);
4978
4979 if ((subscriptionState == _STATE_ENABLED) ||
4980 (subscriptionState == _STATE_ENABLEDDEGRADED))
4981 {
4982 Array <CIMName> indicationSubclasses;
4983 CIMNamespaceName sourceNamespaceName;
4984
4985 subscription.setNameSpace (nameSpace);
4986 subscriptionInstance.setPath (subscription);
4987
4988 indicationProviders = _getDeleteParams
4989 kumpf 1.88 (nameSpace, subscriptionInstance,
4990 indicationSubclasses, sourceNamespaceName);
4991
4992 //
4993 // Send Delete requests
4994 //
4995 // NOTE: These Delete requests are not associated with a user request,
4996 // so there is no associated authType or userName
4997 // The Creator from the subscription instance is used for userName,
4998 // and authType is not set
4999 //
5000 String creator;
5001 _getCreator (subscriptionInstance, creator);
5002
5003 //
5004 // Get the language tags that were saved with the subscription instance
5005 //
5006 String acceptLangs = String::EMPTY;
5007 Uint32 propIndex = subscriptionInstance.findProperty
5008 (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS);
5009 if (propIndex != PEG_NOT_FOUND)
5010 kumpf 1.88 {
5011 subscriptionInstance.getProperty (propIndex).getValue ().get
5012 (acceptLangs);
5013 }
5014 String contentLangs = String::EMPTY;
5015 propIndex = subscriptionInstance.findProperty
5016 (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS);
5017 if (propIndex != PEG_NOT_FOUND)
5018 {
5019 subscriptionInstance.getProperty (propIndex).getValue ().get
5020 (contentLangs);
5021 }
5022
5023 // l10n
5024 subscriptionInstance.setPath (subscription);
5025 _sendDeleteRequests (indicationProviders,
|
5026 kumpf 1.90 sourceNamespaceName, subscriptionInstance,
|
5027 kumpf 1.88 AcceptLanguages(acceptLangs),
5028 ContentLanguages(contentLangs),
5029 0, // no request
5030 indicationSubclasses,
5031 creator);
5032 }
5033
5034 PEG_METHOD_EXIT ();
5035 }
|
5036 kumpf 1.1
|
5037 kumpf 1.35 Boolean IndicationService::_getTimeRemaining (
5038 const CIMInstance & instance,
5039 Uint64 & timeRemaining) const
|
5040 kumpf 1.1 {
|
5041 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5042 "IndicationService::_getTimeRemaining");
|
5043 kumpf 1.1
|
5044 kumpf 1.35 Boolean hasDuration = true;
5045 timeRemaining = 0;
5046
|
5047 kumpf 1.11 //
5048 // Calculate time remaining from subscription
5049 // start time, subscription duration, and current date time
5050 //
|
5051 kumpf 1.1
|
5052 kumpf 1.11 //
|
5053 kumpf 1.27 // NOTE: It is assumed that the instance passed to this method is a
|
5054 kumpf 1.35 // subscription instance, and that the Start Time property exists
5055 // and has a value
|
5056 kumpf 1.11 //
|
5057 kumpf 1.1
|
5058 kumpf 1.11 //
5059 // Get Subscription Start Time
5060 //
5061 CIMValue startTimeValue;
5062 CIMDateTime startTime;
|
5063 kumpf 1.27 startTimeValue = instance.getProperty
|
5064 kumpf 1.11 (instance.findProperty (_PROPERTY_STARTTIME)).getValue ();
5065 startTimeValue.get (startTime);
|
5066 kumpf 1.1
|
5067 kumpf 1.11 //
5068 // Get Subscription Duration
5069 //
|
5070 kumpf 1.52 if (instance.findProperty (_PROPERTY_DURATION) != PEG_NOT_FOUND)
|
5071 kumpf 1.35 {
5072 CIMValue durationValue;
5073 durationValue = instance.getProperty
5074 (instance.findProperty (_PROPERTY_DURATION)).getValue ();
5075 if (durationValue.isNull ())
5076 {
5077 hasDuration = false;
5078 }
5079 else
5080 {
5081 Uint64 duration;
5082 durationValue.get (duration);
|
5083 kumpf 1.1
|
5084 kumpf 1.35 //
5085 // Get current date time, and calculate Subscription Time Remaining
5086 //
5087 CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime ();
|
5088 kumpf 1.65
5089 Sint64 difference;
5090 try
5091 {
5092 difference = CIMDateTime::getDifference
5093 (startTime, currentDateTime);
5094 }
5095 // Check if the date time is out of range.
5096 catch (DateTimeOutOfRangeException& e)
5097 {
5098 // ATTN: P4 SF 10/15/2002 May need to handle this error more
5099 // appropriately.
5100 PEG_METHOD_EXIT();
5101 throw e;
5102 }
5103
|
5104 kumpf 1.35 PEGASUS_ASSERT (difference >= 0);
5105 if (((Sint64) duration - difference) >= 0)
5106 {
5107 timeRemaining = (Sint64) duration - difference;
5108 }
5109 }
5110 }
5111 else
|
5112 kumpf 1.1 {
|
5113 kumpf 1.35 hasDuration = false;
|
5114 kumpf 1.1 }
|
5115 kumpf 1.35
|
5116 kumpf 1.48 PEG_METHOD_EXIT ();
|
5117 kumpf 1.35 return hasDuration;
5118 }
5119
5120 void IndicationService::_setTimeRemaining (
5121 CIMInstance & instance)
5122 {
|
5123 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5124 "IndicationService::_setTimeRemaining");
|
5125 kumpf 1.35
5126 Uint64 timeRemaining = 0;
5127 if (_getTimeRemaining (instance, timeRemaining))
|
5128 kumpf 1.1 {
|
5129 kumpf 1.35 //
5130 // Add or set the value of the property with the calculated value
5131 //
|
5132 kumpf 1.52 if (instance.findProperty (_PROPERTY_TIMEREMAINING) == PEG_NOT_FOUND)
|
5133 kumpf 1.35 {
5134 instance.addProperty (CIMProperty
5135 (_PROPERTY_TIMEREMAINING, timeRemaining));
5136 }
5137 else
5138 {
5139 CIMProperty remaining = instance.getProperty
5140 (instance.findProperty (_PROPERTY_TIMEREMAINING));
5141 remaining.setValue (CIMValue (timeRemaining));
5142 }
|
5143 kumpf 1.1 }
5144
|
5145 kumpf 1.48 PEG_METHOD_EXIT ();
|
5146 kumpf 1.1 }
5147
|
5148 kumpf 1.38 void IndicationService::_getCreateParams (
|
5149 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
5150 kumpf 1.11 const CIMInstance & subscriptionInstance,
|
5151 kumpf 1.73 Array <CIMName> & indicationSubclasses,
|
5152 kumpf 1.16 Array <ProviderClassList> & indicationProviders,
|
5153 kumpf 1.11 CIMPropertyList & propertyList,
|
5154 kumpf 1.63 CIMNamespaceName & sourceNameSpace,
|
5155 kumpf 1.11 String & condition,
5156 String & queryLanguage)
|
5157 kumpf 1.1 {
|
5158 kumpf 1.11 String filterQuery;
5159 WQLSelectStatement selectStatement;
|
5160 kumpf 1.63 CIMName indicationClassName;
|
5161 kumpf 1.11 condition = String::EMPTY;
5162 queryLanguage = String::EMPTY;
|
5163 kumpf 1.1
|
5164 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5165 "IndicationService::_getCreateParams");
|
5166 kumpf 1.1
|
5167 kumpf 1.11 //
|
5168 kumpf 1.16 // Get filter properties
|
5169 kumpf 1.11 //
|
5170 kumpf 1.27 _getFilterProperties (subscriptionInstance, nameSpaceName,
|
5171 kumpf 1.16 filterQuery, sourceNameSpace, queryLanguage);
|
5172 kumpf 1.11 selectStatement = _getSelectStatement (filterQuery);
|
5173 kumpf 1.27
|
5174 kumpf 1.11 //
5175 // Get indication class name from filter query (FROM clause)
5176 //
5177 indicationClassName = _getIndicationClassName (selectStatement,
|
5178 kumpf 1.27 sourceNameSpace);
5179
|
5180 kumpf 1.1 //
5181 // Get list of subclass names for indication class
5182 //
|
5183 kumpf 1.27 indicationSubclasses = _getIndicationSubclasses (sourceNameSpace,
|
5184 kumpf 1.22 indicationClassName);
|
5185 kumpf 1.19
|
5186 kumpf 1.11 //
|
5187 kumpf 1.27 // Get property list from filter query (FROM and WHERE
|
5188 kumpf 1.11 // clauses)
5189 //
|
5190 kumpf 1.70 propertyList = _getPropertyList (selectStatement,
5191 sourceNameSpace, indicationClassName);
|
5192 kumpf 1.1
5193 //
|
5194 kumpf 1.11 // Get indication provider class lists
|
5195 kumpf 1.1 //
|
5196 kumpf 1.27 indicationProviders = _getIndicationProviders
5197 (sourceNameSpace, indicationClassName, indicationSubclasses,
|
5198 kumpf 1.11 propertyList);
5199
5200 if (indicationProviders.size () > 0)
|
5201 kumpf 1.1 {
|
5202 kumpf 1.11 //
5203 // Get condition from filter query (WHERE clause)
5204 //
5205 if (selectStatement.hasWhereClause ())
5206 {
5207 condition = _getCondition (filterQuery);
5208 }
|
5209 kumpf 1.16 }
5210
|
5211 kumpf 1.48 PEG_METHOD_EXIT ();
|
5212 kumpf 1.16 }
|
5213 kumpf 1.27
|
5214 kumpf 1.38 void IndicationService::_getCreateParams (
|
5215 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
5216 kumpf 1.16 const CIMInstance & subscriptionInstance,
|
5217 kumpf 1.73 Array <CIMName> & indicationSubclasses,
|
5218 kumpf 1.16 CIMPropertyList & propertyList,
|
5219 kumpf 1.63 CIMNamespaceName & sourceNameSpace,
|
5220 kumpf 1.16 String & condition,
5221 String & queryLanguage)
5222 {
5223 String filterQuery;
5224 WQLSelectStatement selectStatement;
5225 condition = String::EMPTY;
5226 queryLanguage = String::EMPTY;
5227
|
5228 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5229 "IndicationService::_getCreateParams");
|
5230 kumpf 1.16
5231 //
5232 // Get filter properties
5233 //
|
5234 kumpf 1.27 _getFilterProperties (subscriptionInstance, nameSpaceName,
|
5235 kumpf 1.16 filterQuery, sourceNameSpace, queryLanguage);
5236 selectStatement = _getSelectStatement (filterQuery);
|
5237 kumpf 1.27
|
5238 kumpf 1.16 //
|
5239 kumpf 1.27 // Get property list from filter query (FROM and WHERE
|
5240 kumpf 1.16 // clauses)
5241 //
|
5242 kumpf 1.70 CIMName indicationClassName = _getIndicationClassName (selectStatement,
5243 sourceNameSpace);
5244 propertyList = _getPropertyList (selectStatement,
5245 sourceNameSpace, indicationClassName);
|
5246 kumpf 1.11
|
5247 kumpf 1.16 //
5248 // Get condition from filter query (WHERE clause)
5249 //
5250 if (selectStatement.hasWhereClause ())
5251 {
5252 condition = _getCondition (filterQuery);
|
5253 kumpf 1.1 }
5254
|
5255 kumpf 1.73 //
5256 // Get indication class name from filter query (FROM clause)
5257 //
5258 indicationClassName = _getIndicationClassName (selectStatement,
5259 sourceNameSpace);
5260
5261 //
5262 // Get list of subclass names for indication class
5263 //
5264 indicationSubclasses = _getIndicationSubclasses (sourceNameSpace,
5265 indicationClassName);
5266
|
5267 kumpf 1.48 PEG_METHOD_EXIT ();
|
5268 kumpf 1.1 }
|
5269 kumpf 1.27
|
5270 kumpf 1.38 Array <ProviderClassList> IndicationService::_getDeleteParams (
|
5271 kumpf 1.63 const CIMNamespaceName & nameSpaceName,
|
5272 kumpf 1.73 const CIMInstance & subscriptionInstance,
5273 Array <CIMName> & indicationSubclasses,
5274 CIMNamespaceName & sourceNameSpace)
|
5275 kumpf 1.1 {
|
5276 kumpf 1.11 String filterQuery;
5277 WQLSelectStatement selectStatement;
|
5278 kumpf 1.63 CIMName indicationClassName;
|
5279 kumpf 1.11 CIMPropertyList propertyList;
|
5280 kumpf 1.16 Array <ProviderClassList> indicationProviders;
|
5281 kumpf 1.6
|
5282 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5283 "IndicationService::_getDeleteParams");
|
5284 kumpf 1.1
5285 //
|
5286 kumpf 1.16 // Get filter properties
|
5287 kumpf 1.11 //
|
5288 kumpf 1.27 _getFilterProperties (subscriptionInstance, nameSpaceName,
|
5289 kumpf 1.16 filterQuery, sourceNameSpace);
|
5290 kumpf 1.11 selectStatement = _getSelectStatement (filterQuery);
|
5291 kumpf 1.27
|
5292 kumpf 1.11 //
5293 // Get indication class name from filter query (FROM clause)
5294 //
5295 indicationClassName = _getIndicationClassName (selectStatement,
|
5296 kumpf 1.27 sourceNameSpace);
5297
|
5298 kumpf 1.11 //
5299 // Get list of subclass names for indication class
5300 //
|
5301 kumpf 1.27 indicationSubclasses = _getIndicationSubclasses (sourceNameSpace,
|
5302 kumpf 1.22 indicationClassName);
|
5303 kumpf 1.19
|
5304 kumpf 1.11 //
|
5305 kumpf 1.27 // Get property list from filter query (FROM and WHERE
|
5306 kumpf 1.11 // clauses)
|
5307 kumpf 1.1 //
|
5308 kumpf 1.70 propertyList = _getPropertyList (selectStatement,
5309 sourceNameSpace, indicationClassName);
|
5310 kumpf 1.1
5311 //
|
5312 kumpf 1.73 // Get indication provider class lists from Active Subscriptions table
|
5313 kumpf 1.11 //
|
5314 kumpf 1.73 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
5315 (subscriptionInstance.getPath ());
5316 ActiveSubscriptionsTableEntry tableValue;
|
5317 kumpf 1.86 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
|
5318 kumpf 1.73 tableValue))
5319 {
5320 indicationProviders = tableValue.providers;
5321 }
5322 else
5323 {
5324 //
|
5325 kumpf 1.88 // Subscription not found in Active Subscriptions table
|
5326 kumpf 1.73 //
|
5327 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5328 "Subscription (" + activeSubscriptionsKey +
5329 ") not found in ActiveSubscriptionsTable");
|
5330 kumpf 1.73 }
|
5331 kumpf 1.11
|
5332 kumpf 1.48 PEG_METHOD_EXIT ();
|
5333 kumpf 1.11 return indicationProviders;
5334 }
|
5335 kumpf 1.27
|
5336 kumpf 1.88 // l10n
5337 void IndicationService::_sendCreateRequests
5338 (const Array <ProviderClassList> & indicationProviders,
5339 const CIMNamespaceName & nameSpace,
5340 const CIMPropertyList & propertyList,
5341 const String & condition,
5342 const String & queryLanguage,
5343 const CIMInstance & subscription,
5344 const AcceptLanguages & acceptLangs,
5345 const ContentLanguages & contentLangs,
5346 const CIMRequestMessage * origRequest,
5347 const Array <CIMName> & indicationSubclasses,
5348 const String & userName,
5349 const String & authType)
5350 {
5351 CIMValue propValue;
5352 Uint16 repeatNotificationPolicy;
|
5353 mday 1.20
|
5354 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
5355 kumpf 1.88 "IndicationService::_sendCreateRequests");
|
5356 kumpf 1.31
|
5357 kumpf 1.88 //
5358 // Get repeat notification policy value from subscription instance
5359 //
5360 propValue = subscription.getProperty
5361 (subscription.findProperty
5362 (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();
5363 propValue.get (repeatNotificationPolicy);
5364
5365 CIMRequestMessage * aggRequest;
|
5366 kumpf 1.27
|
5367 kumpf 1.88 if (origRequest == 0)
5368 {
5369 //
5370 // Initialize -- no request associated with this create
5371 //
5372 aggRequest = 0;
5373 }
5374 else
5375 {
5376 //
5377 // Create Instance, Modify Instance, or Provider Registration Change
5378 //
5379 switch (origRequest->getType ())
5380 {
5381 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
5382 {
5383 CIMCreateInstanceRequestMessage * request =
5384 (CIMCreateInstanceRequestMessage *) origRequest;
5385 CIMCreateInstanceRequestMessage * requestCopy =
5386 new CIMCreateInstanceRequestMessage (* request);
5387 aggRequest = requestCopy;
5388 kumpf 1.88 break;
5389 }
5390
5391 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
5392 {
5393 CIMModifyInstanceRequestMessage * request =
5394 (CIMModifyInstanceRequestMessage *) origRequest;
5395 CIMModifyInstanceRequestMessage * requestCopy =
5396 new CIMModifyInstanceRequestMessage (* request);
5397 aggRequest = requestCopy;
5398 break;
5399 }
5400
5401 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
5402 {
5403 CIMNotifyProviderRegistrationRequestMessage * request =
5404 (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
5405 CIMNotifyProviderRegistrationRequestMessage * requestCopy =
5406 new CIMNotifyProviderRegistrationRequestMessage (* request);
5407 aggRequest = requestCopy;
5408 break;
5409 kumpf 1.88 }
5410
5411 default:
5412 {
5413 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5414 "Unexpected origRequest type " +
5415 String (MessageTypeToString (origRequest->getType ())) +
5416 " in _sendCreateRequests");
5417 break;
5418 }
5419 }
5420 }
5421
5422 //
5423 // Create an aggregate object for the create subscription requests
5424 //
5425 IndicationOperationAggregate * operationAggregate =
5426 new IndicationOperationAggregate (aggRequest, indicationSubclasses);
5427 operationAggregate->setNumberIssued (indicationProviders.size ());
5428
5429 //
5430 kumpf 1.88 // Send Create request to each provider
5431 //
5432 for (Uint32 i = 0; i < indicationProviders.size (); i++)
5433 {
5434 struct enableProviderList * epl =
5435 new enableProviderList (indicationProviders [i], subscription);
5436
5437 //
5438 // Create the create subscription request
5439 //
5440 // l10n
5441 CIMCreateSubscriptionRequestMessage * request =
5442 new CIMCreateSubscriptionRequestMessage
5443 (XmlWriter::getNextMessageId (),
5444 nameSpace,
5445 subscription,
5446 epl->pcl->classList,
5447 epl->pcl->provider,
5448 epl->pcl->providerModule,
5449 propertyList,
5450 repeatNotificationPolicy,
5451 kumpf 1.88 condition,
5452 queryLanguage,
5453 QueueIdStack (_providerManager, getQueueId ()),
5454 authType,
5455 userName,
5456 contentLangs,
5457 acceptLangs);
5458
5459 //
5460 // Store a copy of the request in the operation aggregate instance
5461 //
5462 CIMCreateSubscriptionRequestMessage * requestCopy =
5463 new CIMCreateSubscriptionRequestMessage (* request);
5464 operationAggregate->appendRequest (requestCopy);
5465
5466 AsyncOpNode * op = this->get_op ();
5467
5468 AsyncLegacyOperationStart * async_req =
5469 new AsyncLegacyOperationStart
5470 (get_next_xid (),
5471 op,
5472 kumpf 1.88 _providerManager,
5473 request,
5474 _queueId);
5475
5476 SendAsync
5477 (op,
5478 _providerManager,
5479 IndicationService::_aggregationCallBack,
5480 this,
5481 operationAggregate);
5482 }
|
5483 kumpf 1.31
|
5484 kumpf 1.48 PEG_METHOD_EXIT ();
|
5485 mday 1.20 }
5486
|
5487 kumpf 1.88 // l10n
5488 void IndicationService::_sendModifyRequests
|
5489 kumpf 1.16 (const Array <ProviderClassList> & indicationProviders,
|
5490 kumpf 1.63 const CIMNamespaceName & nameSpace,
|
5491 kumpf 1.11 const CIMPropertyList & propertyList,
5492 const String & condition,
5493 const String & queryLanguage,
|
5494 kumpf 1.46 const CIMInstance & subscription,
|
5495 chuck 1.75 const AcceptLanguages & acceptLangs,
|
5496 kumpf 1.88 const ContentLanguages & contentLangs,
5497 const CIMRequestMessage * origRequest,
|
5498 kumpf 1.15 const String & userName,
5499 const String & authType)
|
5500 kumpf 1.11 {
5501 CIMValue propValue;
5502 Uint16 repeatNotificationPolicy;
5503
|
5504 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
5505 kumpf 1.88 "IndicationService::_sendModifyRequests");
|
5506 kumpf 1.1
5507 //
|
5508 kumpf 1.14 // Get repeat notification policy value from subscription instance
|
5509 kumpf 1.1 //
|
5510 kumpf 1.46 propValue = subscription.getProperty
|
5511 kumpf 1.88 (subscription.findProperty
|
5512 kumpf 1.11 (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue ();
5513 propValue.get (repeatNotificationPolicy);
5514
|
5515 kumpf 1.88 CIMRequestMessage * aggRequest;
5516
5517 //
5518 // Create an aggregate object for the modify subscription requests
5519 //
5520 if (origRequest)
5521 {
5522 //
5523 // Provider Registration Change
5524 //
5525 if (origRequest->getType () ==
5526 CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
5527 {
5528 CIMNotifyProviderRegistrationRequestMessage * request =
5529 (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
5530 CIMNotifyProviderRegistrationRequestMessage * requestCopy =
5531 new CIMNotifyProviderRegistrationRequestMessage (* request);
5532 aggRequest = requestCopy;
5533 }
5534 else
5535 {
5536 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5537 "Unexpected origRequest type " +
5538 String (MessageTypeToString (origRequest->getType ())) +
5539 " in _sendModifyRequests");
5540 }
5541 }
5542 else
5543 {
5544 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5545 "No origRequest in _sendModifyRequests");
5546 }
5547
5548 Array <CIMName> indicationSubclasses; // empty array -- not needed
5549 IndicationOperationAggregate * operationAggregate =
5550 new IndicationOperationAggregate (aggRequest, indicationSubclasses);
5551 operationAggregate->setNumberIssued (indicationProviders.size ());
5552
5553 //
5554 // Send Modify request to each provider
5555 //
5556 for (Uint32 i = 0; i < indicationProviders.size (); i++)
5557 kumpf 1.88 {
5558 struct enableProviderList * epl =
5559 new enableProviderList (indicationProviders[i], subscription);
5560
5561 // l10n
5562 CIMModifySubscriptionRequestMessage * request =
5563 new CIMModifySubscriptionRequestMessage
5564 (XmlWriter::getNextMessageId (),
5565 nameSpace,
5566 subscription,
5567 epl->pcl->classList,
5568 epl->pcl->provider,
5569 epl->pcl->providerModule,
5570 propertyList,
5571 repeatNotificationPolicy,
5572 condition,
5573 queryLanguage,
5574 QueueIdStack (_providerManager, getQueueId ()),
5575 authType,
5576 userName,
5577 contentLangs,
5578 kumpf 1.88 acceptLangs);
5579
5580 //
5581 // Store a copy of the request in the operation aggregate instance
5582 //
5583 CIMModifySubscriptionRequestMessage * requestCopy =
5584 new CIMModifySubscriptionRequestMessage (* request);
5585 operationAggregate->appendRequest (requestCopy);
5586
5587 AsyncOpNode * op = this->get_op ();
5588
5589 AsyncLegacyOperationStart * async_req =
5590 new AsyncLegacyOperationStart
5591 (get_next_xid (),
5592 op,
5593 _providerManager,
5594 request,
5595 _queueId);
5596
5597 SendAsync
5598 (op,
5599 kumpf 1.88 _providerManager,
5600 IndicationService::_aggregationCallBack,
5601 this,
5602 operationAggregate);
5603 }
5604
5605 PEG_METHOD_EXIT ();
5606 }
5607
5608 // l10n
5609 void IndicationService::_sendDeleteRequests
5610 (const Array <ProviderClassList> & indicationProviders,
5611 const CIMNamespaceName & nameSpace,
5612 const CIMInstance & subscription,
5613 const AcceptLanguages & acceptLangs,
5614 const ContentLanguages & contentLangs,
5615 const CIMRequestMessage * origRequest,
5616 const Array <CIMName> & indicationSubclasses,
5617 const String & userName,
5618 const String & authType)
5619 {
5620 kumpf 1.88 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5621 "IndicationService::_sendDeleteRequests");
5622
5623 CIMRequestMessage * aggRequest;
5624
5625 if (origRequest == 0)
5626 {
5627 //
5628 // Delete a referencing or expired subscription -- no request
5629 // associated with this delete
5630 //
5631 aggRequest = 0;
5632 }
5633 else
5634 {
5635 //
5636 // Delete Instance, Modify Instance, or Provider Registration Change
5637 //
5638 switch (origRequest->getType ())
5639 {
5640 case CIM_DELETE_INSTANCE_REQUEST_MESSAGE:
5641 kumpf 1.88 {
5642 CIMDeleteInstanceRequestMessage * request =
5643 (CIMDeleteInstanceRequestMessage *) origRequest;
5644 CIMDeleteInstanceRequestMessage * requestCopy =
5645 new CIMDeleteInstanceRequestMessage (* request);
5646 aggRequest = requestCopy;
5647 break;
5648 }
5649
5650 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
5651 {
5652 CIMModifyInstanceRequestMessage * request =
5653 (CIMModifyInstanceRequestMessage *) origRequest;
5654 CIMModifyInstanceRequestMessage * requestCopy =
5655 new CIMModifyInstanceRequestMessage (* request);
5656 aggRequest = requestCopy;
5657 break;
5658 }
5659
5660 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
5661 {
5662 kumpf 1.88 CIMNotifyProviderRegistrationRequestMessage * request =
5663 (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
5664 CIMNotifyProviderRegistrationRequestMessage * requestCopy =
5665 new CIMNotifyProviderRegistrationRequestMessage (* request);
5666 aggRequest = requestCopy;
5667 break;
5668 }
5669
5670 default:
5671 {
5672 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5673 "Unexpected origRequest type " +
5674 String (MessageTypeToString (origRequest->getType ())) +
5675 " in _sendDeleteRequests");
5676 break;
5677 }
5678 }
5679 }
5680
|
5681 kumpf 1.11 //
|
5682 kumpf 1.88 // Create an aggregate object for the delete subscription requests
|
5683 kumpf 1.11 //
|
5684 kumpf 1.88 IndicationOperationAggregate * operationAggregate =
5685 new IndicationOperationAggregate (aggRequest, indicationSubclasses);
5686 operationAggregate->setNumberIssued (indicationProviders.size ());
|
5687 mday 1.20
|
5688 kumpf 1.88 //
5689 // Send Delete request to each provider
5690 //
|
5691 kumpf 1.83 for (Uint32 i = 0; i < indicationProviders.size (); i++)
|
5692 kumpf 1.11 {
|
5693 kumpf 1.88
5694 struct enableProviderList * epl =
5695 new enableProviderList (indicationProviders [i], subscription);
5696
5697 // l10n
5698 CIMDeleteSubscriptionRequestMessage * request =
5699 new CIMDeleteSubscriptionRequestMessage
|
5700 kumpf 1.11 (XmlWriter::getNextMessageId (),
5701 nameSpace,
|
5702 kumpf 1.46 subscription,
|
5703 kumpf 1.88 epl->pcl->classList,
5704 epl->pcl->provider,
5705 epl->pcl->providerModule,
5706 QueueIdStack (_providerManager, getQueueId ()),
5707 authType,
5708 userName,
5709 contentLangs,
5710 acceptLangs);
5711
5712 //
5713 // Store a copy of the request in the operation aggregate instance
5714 //
5715 CIMDeleteSubscriptionRequestMessage * requestCopy =
5716 new CIMDeleteSubscriptionRequestMessage (* request);
5717 operationAggregate->appendRequest (requestCopy);
5718
5719 AsyncOpNode * op = this->get_op ();
|
5720 kumpf 1.1
|
5721 kumpf 1.11 AsyncLegacyOperationStart * async_req =
5722 new AsyncLegacyOperationStart
5723 (get_next_xid (),
5724 op,
5725 _providerManager,
5726 request,
5727 _queueId);
|
5728 kumpf 1.1
|
5729 kumpf 1.88 SendAsync
5730 (op,
5731 _providerManager,
5732 IndicationService::_aggregationCallBack,
5733 this,
5734 operationAggregate);
5735 }
5736
5737 PEG_METHOD_EXIT ();
5738 }
5739
5740 void IndicationService::_aggregationCallBack (
5741 AsyncOpNode * op,
5742 MessageQueue * q,
5743 void * userParameter)
5744 {
5745 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5746 "IndicationService::_aggregationCallBack");
5747
5748 IndicationService * service = static_cast <IndicationService *> (q);
5749
5750 kumpf 1.88 AsyncRequest * asyncRequest =
5751 static_cast <AsyncRequest *> (op->get_request ());
5752 AsyncReply * asyncReply = static_cast <AsyncReply *> (op->get_response ());
5753
5754 IndicationOperationAggregate * operationAggregate =
5755 reinterpret_cast <IndicationOperationAggregate *> (userParameter);
5756 PEGASUS_ASSERT (operationAggregate != 0);
5757 PEGASUS_ASSERT (operationAggregate->valid ());
5758
5759 CIMResponseMessage * response;
5760 Uint32 msgType = asyncReply->getType ();
5761 PEGASUS_ASSERT ((msgType == async_messages::ASYNC_LEGACY_OP_RESULT) ||
5762 (msgType == async_messages::ASYNC_MODULE_OP_RESULT));
5763
5764 if (msgType == async_messages::ASYNC_LEGACY_OP_RESULT)
5765 {
5766 response = reinterpret_cast <CIMResponseMessage *>
5767 ((static_cast <AsyncLegacyOperationResult *>
5768 (asyncReply))->get_result ());
5769 }
5770 else if (msgType == async_messages::ASYNC_MODULE_OP_RESULT)
5771 kumpf 1.88 {
5772 response = reinterpret_cast <CIMResponseMessage *>
5773 ((static_cast <AsyncModuleOperationResult *>
5774 (asyncReply))->get_result ());
5775 }
5776
5777 PEGASUS_ASSERT (response != 0);
5778
5779 delete asyncRequest;
5780 delete asyncReply;
5781 op->release ();
5782 service->return_op (op);
5783
5784 Boolean isDoneAggregation = operationAggregate->appendResponse (response);
5785 if (isDoneAggregation)
5786 {
5787 service->_handleOperationResponseAggregation (operationAggregate);
5788 }
5789
5790 PEG_METHOD_EXIT ();
5791 }
5792 kumpf 1.88
5793 void IndicationService::_handleOperationResponseAggregation (
5794 IndicationOperationAggregate * operationAggregate)
5795 {
5796 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5797 "IndicationService::_handleOperationResponseAggregation");
5798
5799 switch (operationAggregate->getRequest (0)->getType ())
5800 {
5801 case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE:
5802 {
5803 _handleCreateResponseAggregation (operationAggregate);
5804 break;
5805 }
5806
5807 case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE:
5808 {
5809 _handleEnableResponseAggregation (operationAggregate);
5810 break;
5811 }
5812
5813 kumpf 1.88 case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE:
5814 {
5815 _handleModifyResponseAggregation (operationAggregate);
5816 break;
5817 }
5818
5819 case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE:
5820 {
5821 _handleDeleteResponseAggregation (operationAggregate);
5822 break;
5823 }
5824
5825 default:
5826 {
5827 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5828 "Unexpected request type " +
5829 String (MessageTypeToString
5830 (operationAggregate->getRequest (0)->getType ())) +
5831 " in _handleOperationResponseAggregation");
5832 break;
5833 }
5834 kumpf 1.88 }
5835
5836 //
5837 // Requests and responses are deleted in destructor
5838 //
5839 delete operationAggregate;
5840
5841 PEG_METHOD_EXIT ();
5842 }
5843
5844 void IndicationService::_handleCreateResponseAggregation (
5845 IndicationOperationAggregate * operationAggregate)
5846 {
5847 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
5848 "IndicationService::_handleCreateResponseAggregation");
5849
5850 Array <ProviderClassList> enableProviders;
5851 CIMObjectPath instanceRef;
5852 CIMException cimException;
5853
5854 //
5855 kumpf 1.88 // Examine provider responses
5856 //
5857 Uint32 accepted = 0;
5858 for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
5859 {
5860 //
5861 // If response is SUCCESS, provider accepted the subscription
5862 // Add provider to list of providers to enable
5863 //
5864 CIMResponseMessage * response = operationAggregate->getResponse (i);
5865 ProviderClassList provider = operationAggregate->findProvider
5866 (response->messageId);
5867 if (response->cimException.getCode () == CIM_ERR_SUCCESS)
5868 {
5869 //
5870 // Find provider from which response was sent
5871 //
5872 accepted++;
5873 enableProviders.append (provider);
5874 }
5875 else
5876 kumpf 1.88 {
5877 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
5878 "Provider (" + provider.provider.getPath().toString() +
5879 ") rejected create subscription: " +
5880 response->cimException.getMessage ());
5881 }
5882 }
5883
5884 CIMCreateSubscriptionRequestMessage * request =
5885 (CIMCreateSubscriptionRequestMessage *)
5886 operationAggregate->getRequest (0);
5887 if (accepted == 0)
5888 {
5889 //
5890 // No providers accepted this subscription
5891 //
5892 if (operationAggregate->getOrigType () == 0)
5893 {
5894 //
5895 // For Initialize
5896 // Implement the subscription's On Fatal Error Policy
5897 kumpf 1.88 // If subscription is not disabled or removed, send alert
5898 //
5899 if (!_handleError (request->subscriptionInstance))
5900 {
5901 #if 0
5902 //
5903 // Send alert
5904 //
5905 //
5906 // Send NoProviderAlertIndication to handler instances
5907 // ATTN: NoProviderAlertIndication must be defined
5908 //
5909 Array <CIMInstance> subscriptions;
5910 subscriptions.append (request->subscriptionInstance);
5911 CIMInstance indicationInstance = _createAlertInstance
5912 (_CLASS_NO_PROVIDER_ALERT, subscriptions);
5913
5914 Tracer::trace (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
5915 "Sending NoProvider Alert for %d subscriptions",
5916 subscriptions.size ());
5917 _sendAlerts (subscriptions, indicationInstance);
5918 kumpf 1.88 #endif
5919 //
5920 // Log a message for the subscription
5921 //
5922 Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER,
5923 Logger::WARNING, _MSG_NO_PROVIDER_KEY, _MSG_NO_PROVIDER,
5924 request->subscriptionInstance.getPath ().toString ());
5925 }
5926 }
5927
5928 else if (operationAggregate->requiresResponse ())
5929 {
5930 //
5931 // For Create Instance or Modify Instance
5932 // set CIM exception for response
5933 //
5934 // l10n
5935 cimException = PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED,
5936 MessageLoaderParms (_MSG_NOT_ACCEPTED_KEY, _MSG_NOT_ACCEPTED));
5937 }
5938 }
5939 kumpf 1.88
5940 else
5941 {
5942 //
5943 // At least one provider accepted the subscription
5944 //
5945 if (operationAggregate->getOrigType () ==
5946 CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
5947 {
5948 //
5949 // Provider Registration Change
5950 //
5951 CIMNotifyProviderRegistrationRequestMessage * origRequest =
5952 (CIMNotifyProviderRegistrationRequestMessage *)
5953 operationAggregate->getOrigRequest ();
5954 ProviderClassList provider;
5955 provider.provider = origRequest->provider;
5956 provider.providerModule = origRequest->providerModule;
5957 provider.classList.append (origRequest->className);
5958
5959 //
5960 kumpf 1.88 // Update the entry in the active subscriptions hash table
5961 //
5962 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
5963 (request->subscriptionInstance.getPath ());
5964 ActiveSubscriptionsTableEntry tableValue;
5965 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
5966 tableValue))
5967 {
5968 tableValue.providers.append (provider);
5969 {
5970 WriteLock lock (_activeSubscriptionsTableLock);
5971 _removeActiveSubscriptionsEntry (activeSubscriptionsKey);
5972 _insertActiveSubscriptionsEntry (tableValue.subscription,
5973 tableValue.providers);
5974 }
5975 }
5976 else
5977 {
5978 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
5979 "Subscription (" + activeSubscriptionsKey +
5980 ") not found in ActiveSubscriptionsTable");
5981 kumpf 1.88 //
5982 // The subscription may have been deleted in the mean time
5983 // If so, no further update is required
5984 //
5985 }
5986 }
5987 else if (operationAggregate->getOrigType () ==
5988 CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
5989 {
5990 //
5991 // Create Instance -- create the instance in the repository
5992 //
5993 CIMCreateInstanceRequestMessage * origRequest =
5994 (CIMCreateInstanceRequestMessage *)
5995 operationAggregate->getOrigRequest ();
5996
5997 CIMInstance instance = request->subscriptionInstance;
5998 try
5999 {
6000 instanceRef = _createInstance
6001 (origRequest, request->subscriptionInstance, true);
6002 kumpf 1.88 instanceRef.setNameSpace
6003 (request->subscriptionInstance.getPath().getNameSpace());
6004 instance.setPath (instanceRef);
6005 }
6006 catch (CIMException & exception)
6007 {
6008 cimException = exception;
6009 }
6010 catch (Exception & exception)
6011 {
6012 cimException = PEGASUS_CIM_EXCEPTION
6013 (CIM_ERR_FAILED, exception.getMessage ());
6014 }
6015
6016 if (cimException.getCode () == CIM_ERR_SUCCESS)
6017 {
6018 //
6019 // Insert entries into the subscription hash tables
6020 //
6021 _insertToHashTables (instance,
6022 enableProviders,
6023 kumpf 1.88 operationAggregate->getIndicationSubclasses (),
6024 request->nameSpace);
6025
6026 //
6027 // Send Enable message to each provider that accepted
6028 // subscription
6029 //
6030 _sendEnable (enableProviders,
6031 operationAggregate->getOrigRequest ());
6032 }
6033 }
6034 else // Initialize or Modify Instance
6035 {
6036 PEGASUS_ASSERT ((operationAggregate->getOrigType () == 0) ||
6037 (operationAggregate->getOrigType () ==
6038 CIM_MODIFY_INSTANCE_REQUEST_MESSAGE));
6039
6040 //
6041 // Insert entries into the subscription hash tables
6042 //
6043 _insertToHashTables (request->subscriptionInstance,
6044 kumpf 1.88 enableProviders,
6045 operationAggregate->getIndicationSubclasses (),
6046 request->nameSpace);
6047
6048 //
6049 // Send Enable message to each provider that accepted subscription
6050 //
6051 _sendEnable (enableProviders,
6052 operationAggregate->getOrigRequest ());
6053 }
6054 }
6055
6056 //
6057 // For Create Instance or Modify Instance, send response
6058 //
6059 if (operationAggregate->requiresResponse ())
6060 {
6061 CIMResponseMessage * response;
6062 if (operationAggregate->getOrigType () ==
6063 CIM_CREATE_INSTANCE_REQUEST_MESSAGE)
6064 {
6065 kumpf 1.88 // l10n
6066 // Note: don't need to set Content-language in the response
6067 response = new CIMCreateInstanceResponseMessage (
6068 operationAggregate->getOrigMessageId (),
6069 cimException,
6070 operationAggregate->getOrigRequest ()->queueIds.copyAndPop (),
6071 instanceRef);
6072 }
6073
6074 else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
6075 {
6076 // l10n
6077 // Note: don't need to set Content-language in the response
6078 //
6079 response = new CIMModifyInstanceResponseMessage (
6080 operationAggregate->getOrigMessageId (),
6081 cimException,
6082 operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
6083 }
6084
6085 //
6086 kumpf 1.88 // Preserve message key
6087 //
6088 response->setKey (operationAggregate->getOrigRequest ()->getKey ());
6089
6090 //
6091 // Set response destination
6092 //
6093 response->dest = operationAggregate->getOrigDest ();
|
6094 mday 1.20
|
6095 kumpf 1.88 //
6096 // Set HTTP method in response from request
6097 //
6098 response->setHttpMethod
6099 (operationAggregate->getOrigRequest ()->getHttpMethod ());
6100
6101 Base::_enqueueResponse
6102 (operationAggregate->getOrigRequest (), response);
|
6103 kumpf 1.1 }
6104
|
6105 kumpf 1.48 PEG_METHOD_EXIT ();
|
6106 kumpf 1.1 }
6107
|
6108 kumpf 1.88 void IndicationService::_handleEnableResponseAggregation (
6109 IndicationOperationAggregate * operationAggregate)
|
6110 mday 1.20 {
|
6111 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6112 kumpf 1.88 "IndicationService::_handleEnableResponseAggregation");
|
6113 mday 1.20
|
6114 kumpf 1.37 //
|
6115 kumpf 1.88 // Examine provider responses
|
6116 kumpf 1.37 //
|
6117 kumpf 1.88 for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
|
6118 kumpf 1.37 {
6119 //
|
6120 kumpf 1.88 // If response is not SUCCESS, provider rejected the enable
|
6121 kumpf 1.37 //
|
6122 kumpf 1.88 CIMResponseMessage * response = operationAggregate->getResponse (i);
6123 if (response->cimException.getCode () != CIM_ERR_SUCCESS)
6124 {
6125 //
6126 // Find provider from which response was sent
6127 // Log a trace message
6128 //
6129 ProviderClassList provider = operationAggregate->findProvider
6130 (response->messageId);
6131 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
6132 "Provider (" + provider.provider.getPath ().toString() +
6133 ") rejected enable indications: " +
6134 response->cimException.getMessage ());
6135 }
|
6136 kumpf 1.37 }
6137
|
6138 kumpf 1.88 PEG_METHOD_EXIT ();
|
6139 mday 1.20 }
6140
|
6141 kumpf 1.88 void IndicationService::_handleModifyResponseAggregation (
6142 IndicationOperationAggregate * operationAggregate)
|
6143 kumpf 1.1 {
|
6144 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6145 kumpf 1.88 "IndicationService::_handleModifyResponseAggregation");
|
6146 kumpf 1.1
6147 //
|
6148 kumpf 1.88 // Examine provider responses
|
6149 kumpf 1.1 //
|
6150 kumpf 1.88 for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
6151 {
6152 //
6153 // If response is not SUCCESS, provider rejected the modification
6154 //
6155 CIMResponseMessage * response = operationAggregate->getResponse (i);
6156 if (response->cimException.getCode () != CIM_ERR_SUCCESS)
6157 {
6158 //
6159 // Find provider from which response was sent
6160 // Log a trace message
6161 //
6162 ProviderClassList provider = operationAggregate->findProvider
6163 (response->messageId);
6164 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
6165 "Provider (" + provider.provider.getPath ().toString() +
6166 ") rejected modify subscription: " +
6167 response->cimException.getMessage ());
6168 }
6169 }
|
6170 kumpf 1.1
6171 //
|
6172 kumpf 1.88 // Update subscription hash tables
|
6173 kumpf 1.1 //
|
6174 kumpf 1.88 CIMModifySubscriptionRequestMessage * request =
6175 (CIMModifySubscriptionRequestMessage *)
6176 operationAggregate->getRequest (0);
|
6177 mday 1.20
|
6178 kumpf 1.88 CIMNotifyProviderRegistrationRequestMessage * origRequest =
6179 (CIMNotifyProviderRegistrationRequestMessage *)
6180 operationAggregate->getOrigRequest ();
|
6181 mday 1.20
|
6182 kumpf 1.88 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
6183 (request->subscriptionInstance.getPath ());
6184 ActiveSubscriptionsTableEntry tableValue;
6185 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
6186 tableValue))
6187 {
6188 Uint32 providerIndex = _providerInList (origRequest->provider,
6189 tableValue);
6190 if (providerIndex != PEG_NOT_FOUND)
6191 {
6192 Uint32 classIndex = _classInList (origRequest->className,
6193 tableValue.providers [providerIndex]);
6194 if (classIndex == PEG_NOT_FOUND)
6195 {
6196 tableValue.providers [providerIndex].classList.append
6197 (origRequest->className);
6198 }
6199 else // classIndex != PEG_NOT_FOUND
6200 {
6201 tableValue.providers [providerIndex].classList.remove
6202 (classIndex);
6203 kumpf 1.88 }
6204 {
6205 WriteLock lock(_activeSubscriptionsTableLock);
6206 _removeActiveSubscriptionsEntry
6207 (activeSubscriptionsKey);
6208 _insertActiveSubscriptionsEntry
6209 (tableValue.subscription, tableValue.providers);
6210 }
6211 }
6212 else
6213 {
6214 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6215 "Provider (" + origRequest->provider.getPath().toString() +
6216 ") not found in list for Subscription (" +
6217 activeSubscriptionsKey +
6218 ") in ActiveSubscriptionsTable");
6219 }
6220 }
6221 else
6222 {
6223 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6224 kumpf 1.88 "Subscription (" + activeSubscriptionsKey +
6225 ") not found in ActiveSubscriptionsTable");
|
6226 kumpf 1.11 }
|
6227 kumpf 1.1
|
6228 kumpf 1.48 PEG_METHOD_EXIT ();
|
6229 kumpf 1.1 }
6230
|
6231 kumpf 1.88 void IndicationService::_handleDeleteResponseAggregation (
6232 IndicationOperationAggregate * operationAggregate)
|
6233 mday 1.21 {
|
6234 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6235 kumpf 1.88 "IndicationService::_handleDeleteResponseAggregation");
|
6236 kumpf 1.37
|
6237 kumpf 1.88 CIMException cimException;
|
6238 mday 1.21
|
6239 kumpf 1.37 //
|
6240 kumpf 1.88 // Examine provider responses
|
6241 kumpf 1.37 //
|
6242 kumpf 1.88 for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++)
|
6243 kumpf 1.37 {
|
6244 kumpf 1.88 //
6245 // If response is not SUCCESS, provider rejected the delete
6246 //
6247 CIMResponseMessage * response = operationAggregate->getResponse (i);
6248 if (response->cimException.getCode () != CIM_ERR_SUCCESS)
6249 {
6250 //
6251 // Find provider from which response was sent
6252 // Log a trace message
6253 //
6254 ProviderClassList provider = operationAggregate->findProvider
6255 (response->messageId);
6256 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3,
6257 "Provider (" + provider.provider.getPath ().toString() +
6258 ") rejected delete subscription: " +
6259 response->cimException.getMessage ());
6260 }
|
6261 kumpf 1.37 }
|
6262 kumpf 1.88
6263 //
6264 // Update subscription hash tables
6265 //
6266 CIMDeleteSubscriptionRequestMessage * request =
6267 (CIMDeleteSubscriptionRequestMessage *)
6268 operationAggregate->getRequest (0);
6269
6270 if (operationAggregate->getOrigType () ==
6271 CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE)
|
6272 kumpf 1.37 {
|
6273 kumpf 1.88 CIMNotifyProviderRegistrationRequestMessage * origRequest =
6274 (CIMNotifyProviderRegistrationRequestMessage *)
6275 operationAggregate->getOrigRequest ();
6276
|
6277 mday 1.21 //
|
6278 kumpf 1.88 // Update the entry in the active subscriptions hash table
|
6279 kumpf 1.37 //
|
6280 kumpf 1.88 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
6281 (request->subscriptionInstance.getPath ());
6282 ActiveSubscriptionsTableEntry tableValue;
6283 if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey,
6284 tableValue))
6285 {
6286 Uint32 providerIndex = _providerInList (origRequest->provider,
6287 tableValue);
6288 if (providerIndex != PEG_NOT_FOUND)
6289 {
6290 tableValue.providers.remove (providerIndex);
6291 {
6292 WriteLock lock (_activeSubscriptionsTableLock);
6293 _removeActiveSubscriptionsEntry (activeSubscriptionsKey);
6294 _insertActiveSubscriptionsEntry (tableValue.subscription,
6295 tableValue.providers);
6296 }
6297 }
6298 else
6299 {
6300 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6301 kumpf 1.88 "Provider (" + origRequest->provider.getPath().toString() +
6302 ") not found in list for Subscription (" +
6303 activeSubscriptionsKey +
6304 ") in ActiveSubscriptionsTable");
6305 }
6306 }
6307 else
6308 {
6309 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6310 "Subscription (" + activeSubscriptionsKey +
6311 ") not found in ActiveSubscriptionsTable");
6312 }
|
6313 kumpf 1.37 }
6314
|
6315 kumpf 1.88 //
6316 // Delete Instance, Modify Instance, or Delete Referencing or Expired
6317 // Subscription
6318 //
6319 else
6320 {
6321 //
6322 // Remove entries from the subscription hash tables
6323 //
6324 _removeFromHashTables (request->subscriptionInstance,
6325 operationAggregate->getIndicationSubclasses (),
6326 request->nameSpace);
6327 }
|
6328 kumpf 1.10
6329 //
|
6330 kumpf 1.88 // For Delete Instance or Modify Instance, send response
|
6331 kumpf 1.10 //
|
6332 kumpf 1.88 if (operationAggregate->requiresResponse ())
|
6333 kumpf 1.10 {
|
6334 kumpf 1.88 CIMResponseMessage * response;
6335 if (operationAggregate->getOrigType () ==
6336 CIM_DELETE_INSTANCE_REQUEST_MESSAGE)
6337 {
6338 // l10n
6339 // Note: don't need to set Content-language in the response
6340 response = new CIMDeleteInstanceResponseMessage (
6341 operationAggregate->getOrigMessageId (),
6342 cimException,
6343 operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
6344 }
|
6345 mday 1.21
|
6346 kumpf 1.88 else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE
6347 {
6348 // l10n
6349 // Note: don't need to set Content-language in the response
6350 //
6351 response = new CIMModifyInstanceResponseMessage (
6352 operationAggregate->getOrigMessageId (),
6353 cimException,
6354 operationAggregate->getOrigRequest ()->queueIds.copyAndPop ());
6355 }
|
6356 mday 1.21
|
6357 kumpf 1.88 //
6358 // Preserve message key
6359 //
6360 response->setKey (operationAggregate->getOrigRequest ()->getKey ());
6361
6362 //
6363 // Set response destination
6364 //
6365 response->dest = operationAggregate->getOrigDest ();
|
6366 chuck 1.75
|
6367 kumpf 1.88 //
6368 // Set HTTP method in response from request
6369 //
6370 response->setHttpMethod
6371 (operationAggregate->getOrigRequest ()->getHttpMethod ());
6372
6373 Base::_enqueueResponse
6374 (operationAggregate->getOrigRequest (), response);
|
6375 kumpf 1.10 }
6376
|
6377 kumpf 1.48 PEG_METHOD_EXIT ();
|
6378 kumpf 1.10 }
6379
|
6380 kumpf 1.73 String IndicationService::_generateActiveSubscriptionsKey (
6381 const CIMObjectPath & subscriptionRef)
|
6382 kumpf 1.16 {
|
6383 kumpf 1.73 String activeSubscriptionsKey;
|
6384 kumpf 1.16
|
6385 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6386 kumpf 1.73 "IndicationService::_generateActiveSubscriptionsKey");
|
6387 kumpf 1.16
6388 //
6389 // Append subscription namespace name to key
6390 //
|
6391 kumpf 1.73 activeSubscriptionsKey.append
6392 (subscriptionRef.getNameSpace ().getString());
6393
6394 //
6395 // Get filter and handler key bindings from subscription reference
6396 //
6397 Array<CIMKeyBinding> subscriptionKB = subscriptionRef.getKeyBindings ();
6398 Array<CIMKeyBinding> filterKB;
6399 Array<CIMKeyBinding> handlerKB;
|
6400 kumpf 1.83 for (Uint32 i = 0; i < subscriptionKB.size (); i++)
|
6401 kumpf 1.73 {
6402 if ((subscriptionKB [i].getName () == _PROPERTY_FILTER) &&
6403 (subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE))
6404 {
6405 CIMObjectPath filterRef (subscriptionKB [i].getValue ());
6406 filterKB = filterRef.getKeyBindings ();
6407 }
6408 if ((subscriptionKB [i].getName () == _PROPERTY_HANDLER) &&
6409 (subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE))
6410 {
6411 CIMObjectPath handlerRef (subscriptionKB [i].getValue ());
6412 handlerKB = handlerRef.getKeyBindings ();
6413 }
6414 }
|
6415 kumpf 1.16
6416 //
6417 // Append subscription filter key values to key
6418 //
|
6419 kumpf 1.83 for (Uint32 j = 0; j < filterKB.size (); j++)
|
6420 kumpf 1.73 {
6421 activeSubscriptionsKey.append (filterKB [j].getValue ());
6422 }
6423
6424 //
6425 // Append subscription handler key values to key
6426 //
|
6427 kumpf 1.83 for (Uint32 k = 0; k < handlerKB.size (); k++)
|
6428 kumpf 1.73 {
6429 activeSubscriptionsKey.append (handlerKB [k].getValue ());
6430 }
6431
6432 PEG_METHOD_EXIT ();
6433 return activeSubscriptionsKey;
6434 }
6435
|
6436 kumpf 1.86 Boolean IndicationService::_lockedLookupActiveSubscriptionsEntry (
6437 const String & key,
6438 ActiveSubscriptionsTableEntry & tableEntry)
6439 {
6440 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6441 "IndicationService::_lockedLookupActiveSubscriptionsEntry");
6442
6443 ReadLock lock(_activeSubscriptionsTableLock);
6444
6445 return (_activeSubscriptionsTable.lookup (key, tableEntry));
6446
6447 PEG_METHOD_EXIT ();
6448 }
6449
|
6450 kumpf 1.73 void IndicationService::_insertActiveSubscriptionsEntry (
6451 const CIMInstance & subscription,
6452 const Array <ProviderClassList> & providers)
6453 {
6454 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6455 "IndicationService::_insertActiveSubscriptionsEntry");
6456
6457 String activeSubscriptionsKey = _generateActiveSubscriptionsKey
6458 (subscription.getPath ());
6459 ActiveSubscriptionsTableEntry entry;
6460 entry.subscription = subscription;
6461 entry.providers = providers;
|
6462 kumpf 1.86
|
6463 kumpf 1.73 _activeSubscriptionsTable.insert (activeSubscriptionsKey, entry);
|
6464 kumpf 1.16
|
6465 kumpf 1.73 #ifdef PEGASUS_INDICATION_HASHTRACE
6466 String traceString;
6467 traceString.append (activeSubscriptionsKey);
6468 traceString.append (" Providers: ");
|
6469 kumpf 1.83 for (Uint32 i = 0; i < providers.size (); i++)
|
6470 kumpf 1.16 {
|
6471 kumpf 1.73 String providerName = providers [i].provider.getProperty
6472 (providers [i].provider.findProperty
6473 (_PROPERTY_NAME)).getValue ().toString ();
6474 traceString.append (providerName);
6475 traceString.append (" Classes: ");
|
6476 kumpf 1.83 for (Uint32 j = 0; j < providers[i].classList.size (); j++)
|
6477 kumpf 1.73 {
6478 traceString.append (providers[i].classList[j].getString());
6479 traceString.append (" ");
6480 }
|
6481 kumpf 1.16 }
|
6482 kumpf 1.73
6483 PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3,
6484 "INSERTED _activeSubscriptionsTable entry: " + traceString);
6485 #endif
6486
6487 PEG_METHOD_EXIT ();
6488 }
6489
|
6490 kumpf 1.86 void IndicationService::_removeActiveSubscriptionsEntry (
6491 const String & key)
6492 {
6493 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6494 "IndicationService::_removeActiveSubscriptionsEntry");
6495
6496 _activeSubscriptionsTable.remove (key);
6497 #ifdef PEGASUS_INDICATION_HASHTRACE
6498 PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL,
6499 Tracer::LEVEL3,
6500 "REMOVED _activeSubscriptionsTable entry: " + key);
6501 #endif
6502
6503 PEG_METHOD_EXIT ();
6504 }
6505
|
6506 kumpf 1.73 String IndicationService::_generateSubscriptionClassesKey (
6507 const CIMName & indicationClassName,
6508 const CIMNamespaceName & sourceNamespaceName)
6509 {
6510 String subscriptionClassesKey;
6511
6512 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6513 "IndicationService::_generateSubscriptionClassesKey");
6514
6515 //
6516 // Append indication class name to key
6517 //
6518 subscriptionClassesKey.append (indicationClassName.getString ());
|
6519 kumpf 1.16
6520 //
|
6521 kumpf 1.73 // Append source namespace name to key
|
6522 kumpf 1.16 //
|
6523 kumpf 1.73 subscriptionClassesKey.append (sourceNamespaceName.getString ());
6524
6525 PEG_METHOD_EXIT ();
6526 return subscriptionClassesKey;
6527 }
6528
|
6529 kumpf 1.86 Boolean IndicationService::_lockedLookupSubscriptionClassesEntry (
6530 const String & key,
6531 SubscriptionClassesTableEntry & tableEntry)
6532 {
6533 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6534 "IndicationService::_lockedLookupSubscriptionClassesEntry");
6535
6536 ReadLock lock(_subscriptionClassesTableLock);
6537
6538 return (_subscriptionClassesTable.lookup (key, tableEntry));
6539
6540 PEG_METHOD_EXIT ();
6541 }
6542
6543 void IndicationService::_lockedInsertSubscriptionClassesEntry (
|
6544 kumpf 1.73 const CIMName & indicationClassName,
6545 const CIMNamespaceName & sourceNamespaceName,
6546 const Array <CIMInstance> & subscriptions)
6547 {
6548 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6549 kumpf 1.86 "IndicationService::_lockedInsertSubscriptionClassesEntry");
|
6550 kumpf 1.16
|
6551 kumpf 1.73 String subscriptionClassesKey = _generateSubscriptionClassesKey
6552 (indicationClassName, sourceNamespaceName);
6553 SubscriptionClassesTableEntry entry;
6554 entry.indicationClassName = indicationClassName;
6555 entry.sourceNamespaceName = sourceNamespaceName;
6556 entry.subscriptions = subscriptions;
|
6557 kumpf 1.86 {
6558 WriteLock lock(_subscriptionClassesTableLock);
6559 _subscriptionClassesTable.insert (subscriptionClassesKey, entry);
6560 }
|
6561 kumpf 1.73
6562 #ifdef PEGASUS_INDICATION_HASHTRACE
6563 String traceString;
6564 traceString.append (subscriptionClassesKey);
6565 traceString.append (" Subscriptions: ");
|
6566 kumpf 1.83 for (Uint32 i = 0; i < subscriptions.size (); i++)
|
6567 kumpf 1.16 {
|
6568 kumpf 1.73 traceString.append (subscriptions [i].getPath ().toString());
6569 traceString.append (" ");
|
6570 kumpf 1.16 }
|
6571 kumpf 1.73
6572 PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3,
6573 "INSERTED _subscriptionClassesTable entry: " + traceString);
6574 #endif
6575
6576 PEG_METHOD_EXIT ();
6577 }
6578
|
6579 kumpf 1.86 void IndicationService::_lockedRemoveSubscriptionClassesEntry (
6580 const String & key)
6581 {
6582 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6583 "IndicationService::_lockedRemoveSubscriptionClassesEntry");
6584
6585 WriteLock lock(_subscriptionClassesTableLock);
6586
6587 _subscriptionClassesTable.remove (key);
6588
6589 #ifdef PEGASUS_INDICATION_HASHTRACE
6590 PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3,
6591 "REMOVED _subscriptionClassesTable entry: " + key);
6592 #endif
6593
6594 PEG_METHOD_EXIT ();
6595 }
6596
|
6597 kumpf 1.73 void IndicationService::_insertToHashTables (
6598 const CIMInstance & subscription,
6599 const Array <ProviderClassList> & providers,
6600 const Array <CIMName> & indicationSubclassNames,
6601 const CIMNamespaceName & sourceNamespaceName)
6602 {
6603 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6604 "IndicationService::_insertToHashTables");
|
6605 kumpf 1.16
6606 //
|
6607 kumpf 1.73 // Insert entry into active subscriptions table
|
6608 kumpf 1.16 //
|
6609 kumpf 1.86 {
6610 WriteLock lock(_activeSubscriptionsTableLock);
6611 _insertActiveSubscriptionsEntry (subscription, providers);
6612 }
|
6613 kumpf 1.73
6614 //
6615 // Insert or update entries in subscription classes table
6616 //
|
6617 kumpf 1.83 for (Uint32 i = 0; i < indicationSubclassNames.size (); i++)
|
6618 kumpf 1.73 {
6619 String subscriptionClassesKey = _generateSubscriptionClassesKey
6620 (indicationSubclassNames [i], sourceNamespaceName);
6621 SubscriptionClassesTableEntry tableValue;
|
6622 kumpf 1.86 if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey,
|
6623 kumpf 1.73 tableValue))
6624 {
6625 //
6626 // If entry exists for this IndicationClassName-SourceNamespace
6627 // pair, remove old entry and insert new entry
6628 //
6629 Array <CIMInstance> subscriptions = tableValue.subscriptions;
6630 subscriptions.append (subscription);
|
6631 kumpf 1.86 _lockedRemoveSubscriptionClassesEntry (subscriptionClassesKey);
6632 _lockedInsertSubscriptionClassesEntry (indicationSubclassNames [i],
|
6633 kumpf 1.73 sourceNamespaceName, subscriptions);
6634 }
6635 else
6636 {
6637 //
6638 // If no entry exists for this
6639 // IndicationClassName-SourceNamespace pair, insert new entry
6640 //
6641 Array <CIMInstance> subscriptions;
6642 subscriptions.append (subscription);
|
6643 kumpf 1.86 _lockedInsertSubscriptionClassesEntry (indicationSubclassNames [i],
|
6644 kumpf 1.73 sourceNamespaceName, subscriptions);
6645 }
6646 }
|
6647 kumpf 1.16
|
6648 kumpf 1.48 PEG_METHOD_EXIT ();
|
6649 kumpf 1.16 }
6650
|
6651 kumpf 1.73 void IndicationService::_removeFromHashTables (
|
6652 kumpf 1.46 const CIMInstance & subscription,
|
6653 kumpf 1.73 const Array <CIMName> & indicationSubclassNames,
6654 const CIMNamespaceName & sourceNamespaceName)
|
6655 kumpf 1.16 {
|
6656 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
|
6657 kumpf 1.73 "IndicationService::_removeFromHashTables");
6658
6659 //
6660 // Remove entry from active subscriptions table
6661 //
|
6662 kumpf 1.86 {
6663 WriteLock lock(_activeSubscriptionsTableLock);
|
6664 kumpf 1.73
|
6665 kumpf 1.86 _removeActiveSubscriptionsEntry (
6666 _generateActiveSubscriptionsKey (subscription.getPath ()));
6667 }
|
6668 kumpf 1.73
6669 //
6670 // Remove or update entries in subscription classes table
6671 //
|
6672 kumpf 1.83 for (Uint32 i = 0; i < indicationSubclassNames.size (); i++)
|
6673 kumpf 1.73 {
6674 String subscriptionClassesKey = _generateSubscriptionClassesKey
6675 (indicationSubclassNames [i], sourceNamespaceName);
6676 SubscriptionClassesTableEntry tableValue;
|
6677 kumpf 1.86 if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey,
|
6678 kumpf 1.73 tableValue))
6679 {
6680 //
6681 // If entry exists for this IndicationClassName-SourceNamespace
6682 // pair, remove subscription from the list
6683 //
6684 Array <CIMInstance> subscriptions = tableValue.subscriptions;
|
6685 kumpf 1.83 for (Uint32 j = 0; j < subscriptions.size (); j++)
|
6686 kumpf 1.73 {
6687 if (subscriptions [j].getPath().identical
6688 (subscription.getPath()))
6689 {
6690 subscriptions.remove (j);
6691 }
6692 }
|
6693 kumpf 1.16
|
6694 kumpf 1.73 //
6695 // Remove the old entry
6696 //
|
6697 kumpf 1.86 _lockedRemoveSubscriptionClassesEntry (subscriptionClassesKey);
|
6698 kumpf 1.73
6699 //
6700 // If there are still subscriptions in the list, insert the
6701 // new entry
6702 //
6703 if (subscriptions.size () > 0)
6704 {
|
6705 kumpf 1.86 _lockedInsertSubscriptionClassesEntry (
6706 indicationSubclassNames [i],
|
6707 kumpf 1.73 sourceNamespaceName, subscriptions);
6708 }
6709 }
6710 else
6711 {
6712 //
6713 // Entry not found in Subscription Classes table
6714 //
|
6715 kumpf 1.88 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6716 "Indication subclass and namespace (" + subscriptionClassesKey +
6717 ") not found in SubscriptionClassesTable");
|
6718 kumpf 1.73 }
6719 }
|
6720 kumpf 1.16
|
6721 kumpf 1.48 PEG_METHOD_EXIT ();
|
6722 kumpf 1.16 }
6723
|
6724 kumpf 1.11 CIMInstance IndicationService::_createAlertInstance (
|
6725 kumpf 1.63 const CIMName & alertClassName,
|
6726 kumpf 1.46 const Array <CIMInstance> & subscriptions)
|
6727 kumpf 1.10 {
|
6728 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6729 "IndicationService::_createAlertInstance");
|
6730 kumpf 1.10
|
6731 kumpf 1.11 CIMInstance indicationInstance (alertClassName);
|
6732 kumpf 1.10
|
6733 kumpf 1.27 //
|
6734 kumpf 1.11 // Add property values for all required properties of CIM_AlertIndication
|
6735 kumpf 1.27 //
6736 indicationInstance.addProperty
|
6737 kumpf 1.11 (CIMProperty (_PROPERTY_ALERTTYPE, CIMValue ((Uint16) _TYPE_OTHER)));
|
6738 kumpf 1.10 //
|
6739 kumpf 1.38 // ATTN: what should Other Alert Type value be??
6740 // Currently using Alert class name
|
6741 kumpf 1.10 //
|
6742 kumpf 1.27 indicationInstance.addProperty
|
6743 kumpf 1.63 (CIMProperty (_PROPERTY_OTHERALERTTYPE, alertClassName.getString()));
|
6744 kumpf 1.10
|
6745 kumpf 1.27 indicationInstance.addProperty
|
6746 kumpf 1.11 (CIMProperty (_PROPERTY_PERCEIVEDSEVERITY,
6747 CIMValue ((Uint16) _SEVERITY_WARNING)));
|
6748 kumpf 1.10 //
|
6749 kumpf 1.38 // ATTN: what should Probable Cause value be??
6750 // Currently using Unknown
|
6751 kumpf 1.10 //
|
6752 kumpf 1.27 indicationInstance.addProperty
|
6753 kumpf 1.11 (CIMProperty (_PROPERTY_PROBABLECAUSE,
|
6754 kumpf 1.27 CIMValue ((Uint16) _CAUSE_UNKNOWN)));
|
6755 kumpf 1.10
|
6756 kumpf 1.27 //
|
6757 kumpf 1.11 // Add properties specific to each alert class
6758 // ATTN: update once alert classes have been defined
6759 // NB: for _CLASS_NO_PROVIDER_ALERT and _CLASS_PROVIDER_TERMINATED_ALERT,
6760 // one of the properties will be a list of affected subscriptions
|
6761 kumpf 1.13 // It is for that reason that subscriptions is passed in as a parameter
|
6762 kumpf 1.27 //
|
6763 kumpf 1.64 if (alertClassName.equal (_CLASS_CIMOM_SHUTDOWN_ALERT))
|
6764 kumpf 1.11 {
6765 }
|
6766 kumpf 1.64 else if (alertClassName.equal (_CLASS_NO_PROVIDER_ALERT))
|
6767 kumpf 1.10 {
6768 }
|
6769 kumpf 1.64 else if (alertClassName.equal (_CLASS_PROVIDER_TERMINATED_ALERT))
|
6770 kumpf 1.10 {
6771 }
|
6772 kumpf 1.11
|
6773 kumpf 1.48 PEG_METHOD_EXIT ();
|
6774 kumpf 1.19 return indicationInstance;
|
6775 kumpf 1.10 }
6776
|
6777 mday 1.21
|
6778 kumpf 1.87 #if 0
|
6779 kumpf 1.27 void IndicationService::_sendAlertsCallBack(AsyncOpNode *op,
6780 MessageQueue *q,
|
6781 mday 1.21 void *parm)
6782 {
|
6783 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
6784 "IndicationService::_sendAlertsCallBack");
|
6785 mday 1.21
|
6786 kumpf 1.27 IndicationService *service =
|
6787 mday 1.21 static_cast<IndicationService *>(q);
|
6788 kumpf 1.46 CIMInstance *_handler =
6789 reinterpret_cast<CIMInstance *>(parm);
|
6790 kumpf 1.27
|
6791 mday 1.21 AsyncRequest *asyncRequest = static_cast<AsyncRequest *>(op->get_request());
6792 AsyncReply *asyncReply = static_cast<AsyncReply *>(op->get_response());
6793 CIMRequestMessage *request = reinterpret_cast<CIMRequestMessage *>
6794 ((static_cast<AsyncLegacyOperationStart *>(asyncRequest))->get_action());
6795
|
6796 kumpf 1.27 CIMHandleIndicationResponseMessage* response =
|
6797 mday 1.21 reinterpret_cast<CIMHandleIndicationResponseMessage *>
6798 ((static_cast<AsyncLegacyOperationResult *>
6799 (asyncReply))->get_result());
6800
|
6801 kumpf 1.37 PEGASUS_ASSERT(response != 0);
6802 if (response->cimException.getCode() == CIM_ERR_SUCCESS)
6803 {
6804 }
6805 else
6806 {
6807 }
6808
|
6809 mday 1.21 //
6810 // ATTN: Check for return value indicating invalid queue ID
|
6811 kumpf 1.37 // If received, need to find Handler Manager Service queue ID
|
6812 mday 1.21 // again
6813 //
6814
|
6815 mday 1.49 // << Mon Jul 15 09:59:16 2002 mdd >> handler is allocated as an element in an array,
6816 // don't delete here.
6817 // delete _handler;
|
6818 mday 1.21 delete request;
6819 delete response;
6820 delete asyncRequest;
6821 delete asyncReply;
|
6822 mday 1.29 op->release();
|
6823 mday 1.21 service->return_op(op);
|
6824 kumpf 1.73
6825 PEG_METHOD_EXIT ();
|
6826 mday 1.21 }
6827
6828
|
6829 kumpf 1.11 void IndicationService::_sendAlerts (
|
6830 kumpf 1.46 const Array <CIMInstance> & subscriptions,
|
6831 kumpf 1.11 /* const */ CIMInstance & alertInstance)
|
6832 kumpf 1.10 {
|
6833 kumpf 1.46 CIMInstance current;
|
6834 kumpf 1.11 Boolean duplicate;
|
6835 kumpf 1.46 Array <CIMInstance> handlers;
|
6836 kumpf 1.27
|
6837 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendAlerts");
|
6838 kumpf 1.10
|
6839 kumpf 1.11 handlers.clear ();
6840
|
6841 kumpf 1.73 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
6842 "Sending alert: " + alertInstance.getClassName().getString());
6843
|
6844 kumpf 1.10 //
|
6845 kumpf 1.11 // Get list of unique handler instances for all subscriptions in list
|
6846 kumpf 1.10 //
|
6847 kumpf 1.83 for (Uint32 i = 0; i < subscriptions.size (); i++)
|
6848 kumpf 1.11 {
|
6849 kumpf 1.73 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4,
6850 "Alert subscription: " + subscriptions [i].getPath().toString());
6851
|
6852 kumpf 1.11 //
6853 // Get handler instance
6854 //
|
6855 kumpf 1.13 current = _getHandler (subscriptions [i]);
|
6856 kumpf 1.11
6857 //
6858 // Merge into list of unique handler instances
6859 //
6860 duplicate = false;
|
6861 kumpf 1.83 for (Uint32 j = 0; j < handlers.size () && !duplicate; j++)
|
6862 kumpf 1.11 {
|
6863 kumpf 1.56 if ((current.identical (handlers [j])) &&
|
6864 kumpf 1.46 (current.getPath () == handlers [j].getPath ()))
|
6865 kumpf 1.11 {
6866 duplicate = true;
6867 }
6868 }
6869
6870 if (!duplicate)
6871 {
6872 handlers.append (current);
6873 }
6874 }
|
6875 kumpf 1.10
6876 //
|
6877 kumpf 1.11 // Send handle indication request to each handler
|
6878 kumpf 1.10 //
|
6879 kumpf 1.83 for (Uint32 k = 0; k < handlers.size (); k++)
|
6880 kumpf 1.11 {
6881 CIMHandleIndicationRequestMessage * handler_request =
6882 new CIMHandleIndicationRequestMessage (
6883 XmlWriter::getNextMessageId (),
|
6884 kumpf 1.46 handlers[k].getPath ().getNameSpace (),
6885 handlers[k],
|
6886 kumpf 1.11 alertInstance,
6887 QueueIdStack (_handlerService, getQueueId ()));
6888
6889 AsyncOpNode* op = this->get_op();
|
6890 kumpf 1.27
6891 AsyncLegacyOperationStart *async_req =
|
6892 kumpf 1.11 new AsyncLegacyOperationStart(
6893 get_next_xid(),
6894 op,
6895 _handlerService,
6896 handler_request,
6897 _queueId);
|
6898 kumpf 1.10
|
6899 kumpf 1.27 SendAsync(op,
6900 _handlerService,
|
6901 mday 1.21 IndicationService::_sendAlertsCallBack,
|
6902 kumpf 1.27 this,
|
6903 kumpf 1.46 (void *)&handlers[k]);
|
6904 kumpf 1.10
|
6905 kumpf 1.25 // <<< Fri Apr 5 06:24:14 2002 mdd >>>
6906 // AsyncReply *async_reply = SendWait(async_req);
|
6907 kumpf 1.10 }
|
6908 kumpf 1.24
|
6909 kumpf 1.48 PEG_METHOD_EXIT ();
|
6910 kumpf 1.24 }
|
6911 kumpf 1.87 #endif
|
6912 kumpf 1.24
|
6913 kumpf 1.88 void IndicationService::_sendEnable (
6914 const Array <ProviderClassList> & enableProviders,
6915 const CIMRequestMessage * origRequest)
|
6916 mday 1.28 {
|
6917 kumpf 1.88 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendEnable");
|
6918 kumpf 1.31
|
6919 kumpf 1.88 CIMRequestMessage * aggRequest;
|
6920 kumpf 1.31
|
6921 kumpf 1.88 if (origRequest == 0)
|
6922 kumpf 1.31 {
|
6923 kumpf 1.88 //
6924 // Initialize -- no request associated with this enable
6925 //
6926 aggRequest = 0;
|
6927 kumpf 1.31 }
6928 else
6929 {
|
6930 kumpf 1.88 //
6931 // Create Instance, Modify Instance, or Provider Registration Change
6932 //
6933 switch (origRequest->getType ())
6934 {
6935 case CIM_CREATE_INSTANCE_REQUEST_MESSAGE:
6936 {
6937 CIMCreateInstanceRequestMessage * request =
6938 (CIMCreateInstanceRequestMessage *) origRequest;
6939 CIMCreateInstanceRequestMessage * requestCopy =
6940 new CIMCreateInstanceRequestMessage (* request);
6941 aggRequest = requestCopy;
6942 break;
6943 }
6944
6945 case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE:
6946 {
6947 CIMModifyInstanceRequestMessage * request =
6948 (CIMModifyInstanceRequestMessage *) origRequest;
6949 CIMModifyInstanceRequestMessage * requestCopy =
6950 new CIMModifyInstanceRequestMessage (* request);
6951 kumpf 1.88 aggRequest = requestCopy;
6952 break;
6953 }
6954
6955 case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE:
6956 {
6957 CIMNotifyProviderRegistrationRequestMessage * request =
6958 (CIMNotifyProviderRegistrationRequestMessage *) origRequest;
6959 CIMNotifyProviderRegistrationRequestMessage * requestCopy =
6960 new CIMNotifyProviderRegistrationRequestMessage (* request);
6961 aggRequest = requestCopy;
6962 break;
6963 }
6964
6965 default:
6966 {
6967 PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2,
6968 "Unexpected origRequest type " +
6969 String (MessageTypeToString (origRequest->getType ())) +
6970 " in _sendEnable");
6971 break;
6972 kumpf 1.88 }
6973 }
|
6974 kumpf 1.31 }
|
6975 mday 1.28
|
6976 kumpf 1.88 //
6977 // Create an aggregate object for the enable indications requests
6978 //
6979 Array <CIMName> indicationSubclasses; // empty array -- not needed
6980 IndicationOperationAggregate * operationAggregate =
6981 new IndicationOperationAggregate (aggRequest, indicationSubclasses);
6982 operationAggregate->setNumberIssued (enableProviders.size ());
|
6983 mday 1.28
|
6984 kumpf 1.88 //
6985 // Send Enable request to each provider
6986 //
6987 for (Uint32 i = 0; i < enableProviders.size (); i++)
6988 {
6989 //
6990 // Create the enable indications request
6991 //
6992 CIMEnableIndicationsRequestMessage * request =
6993 new CIMEnableIndicationsRequestMessage
6994 (XmlWriter::getNextMessageId (),
6995 enableProviders [i].provider,
6996 enableProviders [i].providerModule,
6997 QueueIdStack (_providerManager, getQueueId ()));
|
6998 kumpf 1.31
|
6999 kumpf 1.88 //
7000 // Store a copy of the request in the operation aggregate instance
7001 //
7002 CIMEnableIndicationsRequestMessage * requestCopy =
7003 new CIMEnableIndicationsRequestMessage (* request);
7004 operationAggregate->appendRequest (requestCopy);
|
7005 mday 1.28
|
7006 kumpf 1.88 AsyncOpNode* op = this->get_op ();
|
7007 mday 1.28
|
7008 kumpf 1.88 AsyncLegacyOperationStart * async_req =
7009 new AsyncLegacyOperationStart
7010 (get_next_xid (),
7011 op,
7012 _providerManager,
7013 request,
7014 _queueId);
|
7015 kumpf 1.24
|
7016 kumpf 1.88 SendAsync
7017 (op,
7018 _providerManager,
7019 IndicationService::_aggregationCallBack,
7020 this,
7021 operationAggregate);
7022 }
|
7023 kumpf 1.10
|
7024 kumpf 1.48 PEG_METHOD_EXIT ();
|
7025 kumpf 1.10 }
7026
|
7027 kumpf 1.11 WQLSimplePropertySource IndicationService::_getPropertySourceFromInstance(
7028 CIMInstance& indicationInstance)
|
7029 kumpf 1.6 {
|
7030 kumpf 1.11 Boolean booleanValue;
7031 WQLSimplePropertySource source;
7032
|
7033 kumpf 1.48 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE,
7034 "IndicationService::_getPropertySourceFromInstance");
|
7035 kumpf 1.31
|
7036 kumpf 1.83 for (Uint32 i=0; i < indicationInstance.getPropertyCount(); i++)
|
7037 kumpf 1.11 {
7038 CIMProperty property = indicationInstance.getProperty(i);
7039 CIMValue propertyValue = property.getValue();
7040 CIMType type = property.getType();
|
7041 kumpf 1.63 CIMName propertyName = property.getName();
|
7042 kumpf 1.11
7043 switch (type)
7044 {
|
7045 kumpf 1.53 case CIMTYPE_UINT8:
|
7046 kumpf 1.11 Uint8 propertyValueUint8;
7047 propertyValue.get(propertyValueUint8);
|
7048 kumpf 1.63 source.addValue(propertyName.getString(),
|
7049 kumpf 1.11 WQLOperand(propertyValueUint8, WQL_INTEGER_VALUE_TAG));
7050 break;
7051
|
7052 kumpf 1.53 case CIMTYPE_UINT16:
|
7053 kumpf 1.11 Uint16 propertyValueUint16;
7054 propertyValue.get(propertyValueUint16);
|
7055 kumpf 1.63 source.addValue(propertyName.getString(),
|
7056 kumpf 1.11 WQLOperand(propertyValueUint16, WQL_INTEGER_VALUE_TAG));
7057 break;
7058
|
7059 kumpf 1.53 case CIMTYPE_UINT32:
|
7060 kumpf 1.11 Uint32 propertyValueUint32;
7061 propertyValue.get(propertyValueUint32);
|
7062 kumpf 1.63 source.addValue(propertyName.getString(),
|
7063 kumpf 1.11 WQLOperand(propertyValueUint32, WQL_INTEGER_VALUE_TAG));
7064 break;
7065
|
7066 kumpf 1.53 case CIMTYPE_UINT64:
|
7067 kumpf 1.11 Uint64 propertyValueUint64;
7068 propertyValue.get(propertyValueUint64);
|
7069 kumpf 1.63 source.addValue(propertyName.getString(),
|
7070 kumpf 1.11 WQLOperand(propertyValueUint64, WQL_INTEGER_VALUE_TAG));
7071 break;
7072
|
7073 kumpf 1.53 case CIMTYPE_SINT8:
|
7074 kumpf 1.11 Sint8 propertyValueSint8;
7075 propertyValue.get(propertyValueSint8);
|
7076 kumpf 1.63 source.addValue(propertyName.getString(),
|
7077 kumpf 1.11 WQLOperand(propertyValueSint8, WQL_INTEGER_VALUE_TAG));
7078 break;
7079
|
7080 kumpf 1.53 case CIMTYPE_SINT16:
|
7081 kumpf 1.11 Sint16 propertyValueSint16;
7082 propertyValue.get(propertyValueSint16);
|
7083 kumpf 1.63 source.addValue(propertyName.getString(),
|
7084 kumpf 1.11 WQLOperand(propertyValueSint16, WQL_INTEGER_VALUE_TAG));
7085 break;
7086
|
7087 kumpf 1.53 case CIMTYPE_SINT32:
|
7088 kumpf 1.11 Sint32 propertyValueSint32;
7089 propertyValue.get(propertyValueSint32);
|
7090 kumpf 1.63 source.addValue(propertyName.getString(),
|
7091 kumpf 1.11 WQLOperand(propertyValueSint32, WQL_INTEGER_VALUE_TAG));
7092 break; break;
7093
|
7094 kumpf 1.53 case CIMTYPE_SINT64:
|
7095 kumpf 1.11 Sint64 propertyValueSint64;
7096 propertyValue.get(propertyValueSint64);
|
7097 kumpf 1.63 source.addValue(propertyName.getString(),
|
7098 kumpf 1.11 WQLOperand(propertyValueSint64, WQL_INTEGER_VALUE_TAG));
7099 break;
7100
|
7101 kumpf 1.53 case CIMTYPE_REAL32:
|
7102 kumpf 1.11 Real32 propertyValueReal32;
7103 propertyValue.get(propertyValueReal32);
|
7104 kumpf 1.63 source.addValue(propertyName.getString(),
|
7105 kumpf 1.11 WQLOperand(propertyValueReal32, WQL_DOUBLE_VALUE_TAG));
7106 break;
|
7107 kumpf 1.10
|
7108 kumpf 1.53 case CIMTYPE_REAL64:
|
7109 kumpf 1.11 Real64 propertyValueReal64;
7110 propertyValue.get(propertyValueReal64);
|
7111 kumpf 1.63 source.addValue(propertyName.getString(),
|
7112 kumpf 1.11 WQLOperand(propertyValueReal64, WQL_DOUBLE_VALUE_TAG));
7113 break;
|
7114 kumpf 1.6
|
7115 kumpf 1.53 case CIMTYPE_BOOLEAN :
|
7116 kumpf 1.11 property.getValue().get(booleanValue);
|
7117 kumpf 1.63 source.addValue(propertyName.getString(),
|
7118 kumpf 1.11 WQLOperand(booleanValue, WQL_BOOLEAN_VALUE_TAG));
7119 break;
|
7120 kumpf 1.6
|
7121 kumpf 1.53 case CIMTYPE_CHAR16:
7122 case CIMTYPE_STRING :
|
7123 kumpf 1.63 source.addValue(propertyName.getString(),
|
7124 kumpf 1.11 WQLOperand(property.getValue().toString(),
7125 WQL_STRING_VALUE_TAG));
7126 break;
|
7127 kumpf 1.6
|
7128 kumpf 1.53 case CIMTYPE_DATETIME :
|
7129 kumpf 1.63 source.addValue (propertyName.getString(),
|
7130 kumpf 1.31 WQLOperand ());
7131 break;
|
7132 kumpf 1.6 }
7133 }
|
7134 kumpf 1.10
|
7135 kumpf 1.48 PEG_METHOD_EXIT ();
|
7136 kumpf 1.19 return source;
|
7137 kumpf 1.6 }
|
7138 kumpf 1.1
|
7139 kumpf 1.80 Boolean IndicationService::_getCreator (
7140 const CIMInstance & instance,
7141 String & creator) const
7142 {
7143 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_getCreator");
7144
7145 Uint32 creatorIndex = instance.findProperty
7146 (PEGASUS_PROPERTYNAME_INDSUB_CREATOR);
7147 if (creatorIndex != PEG_NOT_FOUND)
7148 {
7149 CIMValue creatorValue = instance.getProperty
7150 (creatorIndex).getValue ();
7151 if (creatorValue.isNull ())
7152 {
7153 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7154 Tracer::LEVEL4,
7155 "Null Subscription Creator property value");
7156
7157 //
7158 // This is a corrupted/invalid instance
7159 //
7160 kumpf 1.80 return false;
7161 }
7162 else if ((creatorValue.getType () != CIMTYPE_STRING) ||
7163 (creatorValue.isArray ()))
7164 {
7165 String traceString;
7166 if (creatorValue.isArray ())
7167 {
7168 traceString.append ("array of ");
7169 }
7170 traceString.append (cimTypeToString (creatorValue.getType ()));
7171 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7172 Tracer::LEVEL4,
7173 "Subscription Creator property value of incorrect type: "
7174 + traceString);
7175
7176 //
7177 // This is a corrupted/invalid instance
7178 //
7179 return false;
7180 }
7181 kumpf 1.80 else
7182 {
7183 creatorValue.get (creator);
7184 }
7185 }
7186 else
7187 {
7188 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7189 Tracer::LEVEL4,
7190 "Missing Subscription Creator property");
7191
7192 //
7193 // This is a corrupted/invalid instance
7194 //
7195 return false;
7196 }
7197
7198 PEG_METHOD_EXIT ();
7199 return true;
7200 }
7201
7202 kumpf 1.80 Boolean IndicationService::_getState (
7203 const CIMInstance & instance,
7204 Uint16 & state) const
7205 {
7206 PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_getState");
7207
7208 Uint32 stateIndex = instance.findProperty (_PROPERTY_STATE);
7209 if (stateIndex != PEG_NOT_FOUND)
7210 {
7211 CIMValue stateValue = instance.getProperty
7212 (stateIndex).getValue ();
7213 if (stateValue.isNull ())
7214 {
7215 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7216 Tracer::LEVEL4,
7217 "Null SubscriptionState property value");
7218
7219 //
7220 // This is a corrupted/invalid instance
7221 //
7222 return false;
7223 kumpf 1.80 }
7224 else if ((stateValue.getType () != CIMTYPE_UINT16) ||
7225 (stateValue.isArray ()))
7226 {
7227 String traceString;
7228 if (stateValue.isArray ())
7229 {
7230 traceString.append ("array of ");
7231 }
7232 traceString.append (cimTypeToString (stateValue.getType ()));
7233 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7234 Tracer::LEVEL4,
7235 "SubscriptionState property value of incorrect type: "
7236 + traceString);
7237
7238 //
7239 // This is a corrupted/invalid instance
7240 //
7241 return false;
7242 }
7243 else
7244 kumpf 1.80 {
7245 stateValue.get (state);
7246
7247 //
7248 // Validate the value
7249 //
7250 if (!Contains (_validStates, state))
7251 {
7252 //
7253 // This is a corrupted/invalid instance
7254 //
7255 return false;
7256 }
7257 }
7258 }
7259 else
7260 {
7261 PEG_TRACE_STRING (TRC_INDICATION_SERVICE,
7262 Tracer::LEVEL4,
7263 "Missing SubscriptionState property");
7264
7265 kumpf 1.80 //
7266 // This is a corrupted/invalid instance
7267 //
7268 return false;
7269 }
7270
7271 PEG_METHOD_EXIT ();
7272 return true;
7273 }
7274
7275
|
7276 kumpf 1.11 //
7277 // Class names
7278 //
|
7279 kumpf 1.1
|
7280 kumpf 1.11 /**
7281 The name of the CIMOM Shutdown alert indication class
7282 */
7283 //
7284 // ATTN: Update once CimomShutdownAlertIndication has been defined
7285 //
|
7286 kumpf 1.63 const CIMName IndicationService::_CLASS_CIMOM_SHUTDOWN_ALERT =
7287 CIMName ("CIM_AlertIndication");
|
7288 kumpf 1.1
|
7289 kumpf 1.11 /**
7290 The name of the No Provider alert indication class
7291 */
7292 //
7293 // ATTN: Update once NoProviderAlertIndication has been defined
7294 //
|
7295 kumpf 1.63 const CIMName IndicationService::_CLASS_NO_PROVIDER_ALERT =
7296 CIMName ("CIM_AlertIndication");
|
7297 kumpf 1.1
|
7298 kumpf 1.11 /**
7299 The name of the CIMOM shutdown alert indication class
7300 */
7301 //
7302 // ATTN: Update once ProviderTerminatedAlertIndication has been defined
7303 //
|
7304 kumpf 1.63 const CIMName IndicationService::_CLASS_PROVIDER_TERMINATED_ALERT =
7305 CIMName ("CIM_AlertIndication");
|
7306 kumpf 1.1
7307
7308 //
|
7309 kumpf 1.11 // Property names
|
7310 kumpf 1.1 //
7311
|
7312 kumpf 1.11 /**
7313 The name of the filter reference property for indication subscription class
7314 */
|
7315 kumpf 1.63 const CIMName IndicationService::_PROPERTY_FILTER = CIMName ("Filter");
|
7316 kumpf 1.1
|
7317 kumpf 1.11 /**
7318 The name of the handler reference property for indication subscription class
7319 */
|
7320 kumpf 1.63 const CIMName IndicationService::_PROPERTY_HANDLER = CIMName ("Handler");
|
7321 kumpf 1.1
|
7322 kumpf 1.11 /**
|
7323 kumpf 1.27 The name of the subscription state property for indication subscription
|
7324 kumpf 1.11 class
7325 */
|
7326 kumpf 1.63 const CIMName IndicationService::_PROPERTY_STATE =
7327 CIMName ("SubscriptionState");
|
7328 kumpf 1.10
|
7329 kumpf 1.11 /**
|
7330 kumpf 1.27 The name of the Other Subscription State property for Indication
|
7331 kumpf 1.11 Subscription class
7332 */
|
7333 kumpf 1.63 const CIMName IndicationService::_PROPERTY_OTHERSTATE =
7334 CIMName ("OtherSubscriptionState");
|
7335 kumpf 1.10
|
7336 kumpf 1.11 /**
7337 The name of the repeat notification policy property for indication
7338 subscription class
7339 */
|
7340 kumpf 1.63 const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONPOLICY =
7341 CIMName ("RepeatNotificationPolicy");
|
7342 kumpf 1.10
|
7343 kumpf 1.11 /**
7344 The name of the other repeat notification policy property for
7345 indication subscription class
7346 */
|
7347 kumpf 1.63 const CIMName IndicationService::_PROPERTY_OTHERREPEATNOTIFICATIONPOLICY =
7348 CIMName ("OtherRepeatNotificationPolicy");
|
7349 kumpf 1.10
|
7350 kumpf 1.11 /**
7351 The name of the repeat notification interval property for indication
7352 subscription class
7353 */
|
7354 kumpf 1.63 const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONINTERVAL =
7355 CIMName ("RepeatNotificationInterval");
|
7356 kumpf 1.1
|
7357 kumpf 1.11 /**
7358 The name of the repeat notification gap property for indication
7359 subscription class
7360 */
|
7361 kumpf 1.63 const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONGAP =
7362 CIMName ("RepeatNotificationGap");
|
7363 kumpf 1.1
|
7364 kumpf 1.11 /**
7365 The name of the repeat notification count property for indication
7366 subscription class
7367 */
|
7368 kumpf 1.63 const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONCOUNT =
7369 CIMName ("RepeatNotificationCount");
|
7370 kumpf 1.1
|
7371 kumpf 1.11 /**
|
7372 kumpf 1.27 The name of the On Fatal Error Policy property for Indication Subscription
|
7373 kumpf 1.11 class
7374 */
|
7375 kumpf 1.63 const CIMName IndicationService::_PROPERTY_ONFATALERRORPOLICY =
7376 CIMName ("OnFatalErrorPolicy");
|
7377 kumpf 1.1
|
7378 kumpf 1.11 /**
|
7379 kumpf 1.27 The name of the Other On Fatal Error Policy property for Indication
|
7380 kumpf 1.11 Subscription class
7381 */
|
7382 kumpf 1.63 const CIMName IndicationService::_PROPERTY_OTHERONFATALERRORPOLICY =
7383 CIMName ("OtherOnFatalErrorPolicy");
|
7384 kumpf 1.1
|
7385 kumpf 1.11 /**
|
7386 kumpf 1.27 The name of the Time Of Last State Change property for Indication
|
7387 kumpf 1.11 Subscription class
7388 */
|
7389 kumpf 1.63 const CIMName IndicationService::_PROPERTY_LASTCHANGE =
7390 CIMName ("TimeOfLastStateChange");
|
7391 kumpf 1.1
|
7392 kumpf 1.11 /**
|
7393 kumpf 1.27 The name of the Subscription Start Time property for Indication
|
7394 kumpf 1.11 Subscription class
7395 */
|
7396 kumpf 1.63 const CIMName IndicationService::_PROPERTY_STARTTIME =
7397 CIMName ("SubscriptionStartTime");
|
7398 kumpf 1.1
|
7399 kumpf 1.11 /**
|
7400 kumpf 1.27 The name of the Subscription Duration property for Indication
|
7401 kumpf 1.11 Subscription class
7402 */
|
7403 kumpf 1.63 const CIMName IndicationService::_PROPERTY_DURATION =
7404 CIMName ("SubscriptionDuration");
|
7405 kumpf 1.1
|
7406 kumpf 1.11 /**
|
7407 kumpf 1.27 The name of the Subscription Time Remaining property for Indication
|
7408 kumpf 1.11 Subscription class
7409 */
|
7410 kumpf 1.63 const CIMName IndicationService::_PROPERTY_TIMEREMAINING =
7411 CIMName ("SubscriptionTimeRemaining");
|
7412 kumpf 1.1
|
7413 kumpf 1.11 /**
7414 The name of the query property for indication filter class
7415 */
|
7416 kumpf 1.63 const CIMName IndicationService::_PROPERTY_QUERY = CIMName ("Query");
|
7417 kumpf 1.1
|
7418 kumpf 1.11 /**
7419 The name of the query language property for indication filter class
7420 */
|
7421 kumpf 1.63 const CIMName IndicationService::_PROPERTY_QUERYLANGUAGE =
7422 CIMName ("QueryLanguage");
|
7423 kumpf 1.1
|
7424 kumpf 1.11 /**
7425 The name of the Source Namespace property for indication filter class
7426 */
|
7427 kumpf 1.63 const CIMName IndicationService::_PROPERTY_SOURCENAMESPACE =
7428 CIMName ("SourceNamespace");
|
7429 kumpf 1.1
|
7430 kumpf 1.11 /**
7431 The name of the name property for indication filter and indications handler classes
7432 */
|
7433 kumpf 1.63 const CIMName IndicationService::_PROPERTY_NAME = CIMName ("Name");
|
7434 kumpf 1.1
|
7435 kumpf 1.11 /**
|
7436 kumpf 1.27 The name of the creation class name property for indication filter and
|
7437 kumpf 1.11 indications handler classes
7438 */
|
7439 kumpf 1.63 const CIMName IndicationService::_PROPERTY_CREATIONCLASSNAME =
7440 CIMName ("CreationClassName");
|
7441 kumpf 1.1
|
7442 kumpf 1.11 /**
|
7443 kumpf 1.27 The name of the system name property for indication filter and indications
|
7444 kumpf 1.11 handler classes
7445 */
|
7446 kumpf 1.63 const CIMName IndicationService::_PROPERTY_SYSTEMNAME =
7447 CIMName ("SystemName");
|
7448 kumpf 1.1
|
7449 kumpf 1.11 /**
|
7450 kumpf 1.27 The name of the system creation class name property for indication filter
|
7451 kumpf 1.11 and indications handler classes
7452 */
|
7453 kumpf 1.63 const CIMName IndicationService::_PROPERTY_SYSTEMCREATIONCLASSNAME =
7454 CIMName ("SystemCreationClassName");
|
7455 kumpf 1.1
|
7456 kumpf 1.11 /**
7457 The name of the Persistence Type property for Indication Handler class
7458 */
|
7459 kumpf 1.63 const CIMName IndicationService::_PROPERTY_PERSISTENCETYPE =
7460 CIMName ("PersistenceType");
|
7461 kumpf 1.1
|
7462 kumpf 1.11 /**
|
7463 kumpf 1.27 The name of the Other Persistence Type property for Indication Handler
|
7464 kumpf 1.11 class
7465 */
|
7466 kumpf 1.63 const CIMName IndicationService::_PROPERTY_OTHERPERSISTENCETYPE =
7467 CIMName ("OtherPersistenceType");
|
7468 kumpf 1.1
|
7469 kumpf 1.11 /**
|
7470 kumpf 1.27 The name of the Destination property for CIM XML Indication Handler
|
7471 kumpf 1.13 subclass
|
7472 kumpf 1.11 */
|
7473 kumpf 1.63 const CIMName IndicationService::_PROPERTY_DESTINATION =
7474 CIMName ("Destination");
|
7475 kumpf 1.1
|
7476 kumpf 1.11 /**
|
7477 kumpf 1.74 The name of the TargetHost property for SNMP Mapper Indication
|
7478 kumpf 1.13 Handler subclass
7479 */
|
7480 kumpf 1.74 const CIMName IndicationService::_PROPERTY_TARGETHOST =
7481 CIMName ("TargetHost");
7482
7483 /**
7484 The name of the TargetHostFormat property for SNMP Indication Handler subclass
7485 */
7486 const CIMName IndicationService::_PROPERTY_TARGETHOSTFORMAT =
7487 CIMName ("TargetHostFormat");
|
7488 kumpf 1.13
7489 /**
|
7490 kumpf 1.74 The name of the SNMPVersion property for SNMP Indication Handler class
|
7491 kumpf 1.11 */
|
7492 kumpf 1.74 const CIMName IndicationService::_PROPERTY_SNMPVERSION =
|
7493 kumpf 1.63 CIMName ("SNMPVersion");
|
7494 kumpf 1.1
|
7495 kumpf 1.11 /**
7496 The name of the Alert Type property for Alert Indication class
7497 */
|
7498 kumpf 1.63 const CIMName IndicationService::_PROPERTY_ALERTTYPE = CIMName ("AlertType");
|
7499 kumpf 1.1
|
7500 kumpf 1.11 /**
7501 The name of the Other Alert Type property for Alert Indication class
7502 */
|
7503 kumpf 1.63 const CIMName IndicationService::_PROPERTY_OTHERALERTTYPE =
7504 CIMName ("OtherAlertType");
|
7505 kumpf 1.1
|
7506 kumpf 1.11 /**
7507 The name of the Perceived Severity property for Alert Indication class
7508 */
|
7509 kumpf 1.63 const CIMName IndicationService::_PROPERTY_PERCEIVEDSEVERITY =
7510 CIMName ("PerceivedSeverity");
|
7511 kumpf 1.1
|
7512 kumpf 1.11 /**
7513 The name of the Probable Cause property for Alert Indication class
7514 */
|
7515 kumpf 1.63 const CIMName IndicationService::_PROPERTY_PROBABLECAUSE =
7516 CIMName ("ProbableCause");
|
7517 kumpf 1.1
|
7518 kumpf 1.11 /**
|
7519 kumpf 1.16 The name of the Provider Name property for Provider class
|
7520 kumpf 1.11 */
|
7521 kumpf 1.63 const CIMName IndicationService::_PROPERTY_PROVIDERNAME = CIMName ("Name");
|
7522 kumpf 1.1
|
7523 kumpf 1.11 /**
|
7524 kumpf 1.16 The name of the Provider Module Name property for Provider class
|
7525 kumpf 1.11 */
|
7526 kumpf 1.63 const CIMName IndicationService::_PROPERTY_PROVIDERMODULENAME =
7527 CIMName ("ProviderModuleName");
|
7528 kumpf 1.10
|
7529 kumpf 1.1
|
7530 kumpf 1.11 //
|
7531 kumpf 1.15 // Qualifier names
7532 //
7533
7534 /**
7535 The name of the Indication qualifier for classes
7536 */
|
7537 kumpf 1.63 const CIMName IndicationService::_QUALIFIER_INDICATION = CIMName ("INDICATION");
|
7538 kumpf 1.15
|
7539 kumpf 1.1
|
7540 kumpf 1.11 //
7541 // Other literal values
7542 //
|
7543 kumpf 1.1
|
7544 kumpf 1.11 /**
7545 The WHERE keyword in WQL
7546 */
7547 const char IndicationService::_QUERY_WHERE [] = "WHERE";
|
7548 kumpf 1.1
|
7549 kumpf 1.11 /**
7550 The string representing the asterisk all properties symbol in WQL
7551 */
7552 const char IndicationService::_QUERY_ALLPROPERTIES [] = "*";
|
7553 kumpf 1.1
|
7554 kumpf 1.58 /**
7555 A zero value CIMDateTime interval
7556 */
7557 const char IndicationService::_ZERO_INTERVAL_STRING [] =
7558 "00000000000000.000000:000";
|
7559 kumpf 1.1
|
7560 kumpf 1.11 //
7561 // Message substrings used in exception messages
7562 //
|
7563 kumpf 1.1
|
7564 humberto 1.78 // l10n
7565
7566 // some have been commented out and put directly in the code for localization
7567
7568 // this one is tricky because it is used in _checkRequiredProperty with the two below
|
7569 kumpf 1.11 const char IndicationService::_MSG_MISSING_REQUIRED [] = "Missing required ";
|
7570 kumpf 1.1
|
7571 kumpf 1.11 const char IndicationService::_MSG_KEY_PROPERTY [] = " key property";
|
7572 humberto 1.78 const char IndicationService::_MSG_KEY_PROPERTY_KEY [] =
7573 "IndicationService.IndicationService._MSG_KEY_PROPERTY";
|
7574 kumpf 1.1
|
7575 kumpf 1.11 const char IndicationService::_MSG_PROPERTY [] = " property";
|
7576 humberto 1.78 const char IndicationService::_MSG_PROPERTY_KEY [] =
7577 "IndicationService.IndicationService._MSG_PROPERTY";
|
7578 kumpf 1.1
|
7579 kumpf 1.27 const char IndicationService::_MSG_PROPERTY_PRESENT [] =
|
7580 kumpf 1.11 " property present, but ";
|
7581 kumpf 1.1
|
7582 kumpf 1.11 const char IndicationService::_MSG_VALUE_NOT [] = " value not ";
|
7583 kumpf 1.1
|
7584 humberto 1.78 const char IndicationService::_MSG_PROPERTY_PRESENT_BUT_VALUE_NOT_KEY [] =
7585 "IndicationService.IndicationService._MSG_PROPERTY_PRESENT_BUT_VALUE_NOT";
7586
7587
|
7588 kumpf 1.27 const char IndicationService::_MSG_NO_PROVIDERS [] =
|
7589 kumpf 1.11 "There are no providers capable of serving the subscription";
|
7590 humberto 1.78 const char IndicationService::_MSG_NO_PROVIDERS_KEY [] =
7591 "IndicationService.IndicationService._MSG_NO_PROVIDERS";
|
7592 kumpf 1.1
|
7593 kumpf 1.27 const char IndicationService::_MSG_NOT_ACCEPTED [] =
|
7594 kumpf 1.15 "No providers accepted the subscription";
|
7595 humberto 1.78 const char IndicationService::_MSG_NOT_ACCEPTED_KEY [] =
7596 "IndicationService.IndicationService._MSG_NOT_ACCEPTED";
|
7597 kumpf 1.15
|
7598 kumpf 1.27 const char IndicationService::_MSG_INVALID_CLASSNAME [] =
|
7599 kumpf 1.11 "Invalid indication class name ";
|
7600 kumpf 1.1
|
7601 kumpf 1.11 const char IndicationService::_MSG_IN_FROM [] = " in FROM clause of ";
|
7602 kumpf 1.1
|
7603 humberto 1.78 const char IndicationService::_MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY_KEY [] =
7604 "IndicationService.IndicationService._MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY";
7605
|
7606 kumpf 1.27 const char IndicationService::_MSG_EXPIRED [] =
|
7607 kumpf 1.11 "Expired subscription may not be modified; has been deleted";
|
7608 humberto 1.78 const char IndicationService::_MSG_EXPIRED_KEY [] =
7609 "IndicationService.IndicationService._MSG_EXPIRED";
|
7610 kumpf 1.15
|
7611 kumpf 1.27 const char IndicationService::_MSG_REFERENCED [] =
|
7612 kumpf 1.15 "A Filter or Handler referenced by a subscription may not be deleted";
|
7613 humberto 1.78 const char IndicationService::_MSG_REFERENCED_KEY [] =
7614 "IndicationService.IndicationService._MSG_REFERENCED";
7615
|
7616 kumpf 1.32
7617 const char IndicationService::_MSG_INVALID_VALUE [] =
7618 "Invalid value ";
7619
|
7620 kumpf 1.80 const char IndicationService::_MSG_INVALID_TYPE [] =
7621 "Invalid type ";
7622
|
7623 kumpf 1.32 const char IndicationService::_MSG_FOR_PROPERTY [] =
7624 " for property ";
|
7625 kumpf 1.1
|
7626 kumpf 1.80 const char IndicationService::_MSG_ARRAY_OF [] =
7627 " array of ";
7628
|
7629 humberto 1.78 const char IndicationService::_MSG_INVALID_VALUE_FOR_PROPERTY_KEY [] =
7630 "IndicationService.IndicationService._MSG_INVALID_VALUE_FOR_PROPERTY";
7631
|
7632 kumpf 1.38 const char IndicationService::_MSG_CLASS_NOT_SERVED [] =
7633 "The specified class is not served by the Indication Service";
|
7634 kumpf 1.80
|
7635 humberto 1.78 const char IndicationService::_MSG_CLASS_NOT_SERVED_KEY [] =
7636 "IndicationService.IndicationService._MSG_CLASS_NOT_SERVED";
|
7637 kumpf 1.80
7638 const char IndicationService::_MSG_INVALID_INSTANCES [] =
7639 "One or more invalid Subscription instances were ignored";
|
7640 humberto 1.82
7641 const char IndicationService::_MSG_INVALID_INSTANCES_KEY [] =
7642 "IndicationService.IndicationService.INVALID_SUBSCRIPTION_INSTANCES_IGNORED";
|
7643 kumpf 1.87
7644 const char IndicationService::_MSG_PROVIDER_NO_LONGER_SERVING [] =
7645 "Provider ($0) is no longer serving subscription ($1)";
7646
7647 const char IndicationService::_MSG_PROVIDER_NO_LONGER_SERVING_KEY [] =
7648 "IndicationService.IndicationService._MSG_PROVIDER_NO_LONGER_SERVING";
7649
7650 const char IndicationService::_MSG_PROVIDER_NOW_SERVING [] =
7651 "Provider ($0) is now serving subscription ($1)";
7652
7653 const char IndicationService::_MSG_PROVIDER_NOW_SERVING_KEY [] =
7654 "IndicationService.IndicationService._MSG_PROVIDER_NOW_SERVING";
7655
7656 const char IndicationService::_MSG_NO_PROVIDER [] =
7657 "Subscription ($0) has no provider";
7658
7659 const char IndicationService::_MSG_NO_PROVIDER_KEY [] =
7660 "IndicationService.IndicationService._MSG_NO_PROVIDER";
|
7661 kumpf 1.94
7662 const char IndicationService::_MSG_NON_PRIVILEGED_ACCESS_DISABLED [] =
7663 "User ($0) is not authorized to perform this operation.";
7664
7665 const char IndicationService::_MSG_NON_PRIVILEGED_ACCESS_DISABLED_KEY [] =
7666 "IndicationService.IndicationService._MSG_NON_PRIVILEGED_ACCESS_DISABLED";
|
7667 kumpf 1.1
7668 PEGASUS_NAMESPACE_END
|