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