1 karl 1.47 //%2003////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.1 //
|
3 karl 1.47 // 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 // IBM Corp.; EMC Corporation, The Open Group.
|
7 kumpf 1.1 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
|
14 kumpf 1.27 //
|
15 kumpf 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
27 //
28 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
|
29 kumpf 1.39 // (carolann_graves@hp.com)
30 // Ben Heilbronn, Hewlett-Packard Company (ben_heilbronn@hp.com)
31 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
32 kumpf 1.1 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
35 #ifndef Pegasus_IndicationService_h
36 #define Pegasus_IndicationService_h
37
38 #include <Pegasus/Common/Config.h>
39 #include <Pegasus/Common/MessageQueueService.h>
40 #include <Pegasus/Common/CIMMessage.h>
|
41 kumpf 1.24 #include <Pegasus/Common/IPC.h>
|
42 kumpf 1.54 #include <Pegasus/Common/AcceptLanguages.h> // l10n
43 #include <Pegasus/Common/ContentLanguages.h> // l10n
|
44 kumpf 1.6 #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
|
45 kumpf 1.54 #include <Pegasus/Server/Linkage.h>
|
46 kumpf 1.1 #include <Pegasus/WQL/WQLParser.h>
47 #include <Pegasus/WQL/WQLSelectStatement.h>
48 #include <Pegasus/WQL/WQLSimplePropertySource.h>
49
|
50 kumpf 1.41 #include "ProviderClassList.h"
51 #include "IndicationOperationAggregate.h"
52
|
53 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
54
|
55 kumpf 1.54 class SubscriptionRepository;
56 class SubscriptionTable;
|
57 kumpf 1.1
58 /**
59
|
60 kumpf 1.5 IndicationService class is the service that serves the
|
61 kumpf 1.10 Indication Subscription, Indication Filter, and Indication Handler
|
62 kumpf 1.5 classes, and processes indications.
|
63 kumpf 1.1
64 @author Hewlett-Packard Company
65
66 */
67
68 class PEGASUS_SERVER_LINKAGE IndicationService : public MessageQueueService
69 {
70 public:
71
72 typedef MessageQueueService Base;
73
74 /**
75 Constructs an IndicationSubscription instance and initializes instance
76 variables.
77 */
|
78 kumpf 1.6 IndicationService (
79 CIMRepository * repository,
|
80 kumpf 1.8 ProviderRegistrationManager * providerRegManager);
|
81 kumpf 1.1
82 virtual ~IndicationService(void);
83
|
84 mday 1.2 void handleEnqueue(Message* message);
|
85 kumpf 1.1
86 virtual void handleEnqueue(void);
87
88 virtual void _handle_async_request(AsyncRequest *req);
89
|
90 kumpf 1.54 /**
91 Gets a String containing the Provider Name, for use in a log message to
92 identify the provider.
93
94 @param provider provider instance
95
96 @return String containing the Provider Name
97 */
98 static String getProviderLogString
99 (CIMInstance & provider);
100
|
101 kumpf 1.1 AtomicInt dienow;
102
103 /**
|
104 kumpf 1.5 Operation types for the NotifyProviderRegistration message
|
105 kumpf 1.1 */
|
106 kumpf 1.5 enum Operation {OP_CREATE = 1, OP_DELETE = 2, OP_MODIFY = 3};
|
107 kumpf 1.24
108 static Mutex _mutex;
|
109 kumpf 1.1
|
110 kumpf 1.5 private:
|
111 kumpf 1.1
112 void _initialize (void);
113
114 void _terminate (void);
115
116 void _handleGetInstanceRequest(const Message * message);
117
118 void _handleEnumerateInstancesRequest(const Message * message);
119
120 void _handleEnumerateInstanceNamesRequest(const Message * message);
121
122 void _handleCreateInstanceRequest(const Message * message);
123
124 void _handleModifyInstanceRequest(const Message * message);
125
126 void _handleDeleteInstanceRequest(const Message * message);
127
128 void _handleProcessIndicationRequest(const Message * message);
129
130 /**
|
131 kumpf 1.57 Asynchronous callback function for _handleProcessIndicationRequest.
132 The response from the Handler is checked, and if it is not success, the
133 subscription's On Fatal Error Policy is implemented.
134
135 @param operation shared data structure that controls message
136 processing
137 @param destination target queue of completion callback
138 @param userParameter user parameter for callback processing
139 */
140 static void _handleIndicationCallBack (
141 AsyncOpNode * operation,
142 MessageQueue * destination,
143 void * userParameter);
144
145 /**
|
146 kumpf 1.1 Notifies the Indication Service that a change in provider registration
147 has occurred. The Indication Service retrieves the subscriptions
|
148 kumpf 1.23 affected by the registration change, sends the appropriate Create,
149 Modify, and/or Delete requests to the provider, and sends an alert to
|
150 kumpf 1.10 handler instances of subscriptions that are no longer served by the
151 provider.
|
152 kumpf 1.1 */
153 void _handleNotifyProviderRegistrationRequest(const Message * message);
154
155 /**
|
156 kumpf 1.33 Notifies the Indication Service that a provider has been disabled.
|
157 kumpf 1.51 The Indication Service retrieves the subscriptions served by the
158 disabled provider, and logs a message for each subscription that is no
159 longer served by the provider.
|
160 kumpf 1.1 */
161 void _handleNotifyProviderTerminationRequest(const Message * message);
162
163 /**
|
164 kumpf 1.51 Notifies the Indication Service that a provider has been enabled.
165 The Indication Service retrieves the subscriptions that can be served
166 by the enabled provider, sends Create Subscription and Enable
167 Indications requests to the provider, and logs a message for each
168 subscription that is now served by the provider.
169 */
170 void _handleNotifyProviderEnableRequest (const Message * message);
171
172 /**
|
173 kumpf 1.5 Determines if it is legal to create an instance.
174 Checks for existence of all key and required properties. Checks that
175 properties that MUST NOT exist (based on values of other properties),
176 do not exist. For any property that has a default value, if it does
177 not exist, adds the property with the default value.
178
179 @param instance instance to be created
180 @param nameSpace namespace for instance to be created
181
182 @throw CIM_ERR_INVALID_PARAMETER if instance is invalid
183 @throw CIM_ERR_NOT_SUPPORTED if the specified class is not
184 supported
185
|
186 kumpf 1.54 @return True, if the instance can be created;
|
187 kumpf 1.10 Otherwise throws an exception
|
188 kumpf 1.5 */
189 Boolean _canCreate (
190 CIMInstance & instance,
|
191 kumpf 1.31 const CIMNamespaceName & nameSpace);
|
192 kumpf 1.5
|
193 kumpf 1.21 /**
194 Validates the specified required property in the instance.
|
195 kumpf 1.56 If the property does not exist, or has a null value, or is not of the
196 expected type, an exception is thrown, using the specified message.
|
197 kumpf 1.21
198 This function is called by the _canCreate function, and is used to
199 validate the Filter and Handler properties in Subscription instances,
200 the Name, CreationClassName, Query and Query Language properties in
201 Filter instances, the Name, CreationClassName, and Destination
202 properties in CIMXML Handler instances, and the Name, CreationClassName,
203 Trap Destination, and SNMP Version properties in SNMP Mapper instances.
204
205 @param instance instance to be validated
206 @param propertyName name of property to be validated
|
207 kumpf 1.56 @param expectedType expected CIMType of property value
|
208 kumpf 1.21 @param message message to be used in exception
209
210 @throw CIM_ERR_INVALID_PARAMETER if required property is missing or
211 null
212 */
|
213 kumpf 1.20 void _checkRequiredProperty (
214 CIMInstance & instance,
|
215 kumpf 1.31 const CIMName & propertyName,
|
216 kumpf 1.56 const CIMType expectedType,
|
217 kumpf 1.20 const String & message);
218
|
219 kumpf 1.5 /**
|
220 kumpf 1.15 Validates the specified property and its corresponding Other___
221 property in the instance.
222 If the property does not exist, it is added with the default value.
223 If the property exists, but its value is NULL, its value is set to
224 the default value.
225 If the value of the property is Other, but the corresponding Other___
|
226 kumpf 1.56 property either does not exist, has a value of NULL, or is not of the
227 correct type, an exception is thrown.
|
228 kumpf 1.15 If the value of the property is not Other, but the corresponding
229 Other___ property exists and has a non-NULL value, an exception is
230 thrown.
|
231 kumpf 1.56 If the value of the property is not a supported value, an exception is
232 thrown.
|
233 kumpf 1.15 This function is called by the _canCreate function, and is used to
234 validate the following pairs of properties in Subscription or Handler
235 instances: Subscription State, Other Subscription State, Repeat
236 Notification Policy, Other Repeat Notification Policy, On Fatal Error
237 Policy, Other On Fatal Error Policy, Persistence Type, Other
238 Persistence Type.
239
240 @param instance instance to be validated
241 @param propertyName name of property to be validated
242 @param otherPropertyName name of Other___ property to be validated
243 @param defaultValue default value for property
244 @param otherValue "Other" value for property
|
245 kumpf 1.19 @param validValues set of valid values for property
|
246 kumpf 1.55 @param supportedValues set of supported values for property
|
247 kumpf 1.15
248 @throw CIM_ERR_INVALID_PARAMETER if value of property or Other___
249 property is invalid
250 */
|
251 kumpf 1.20 void _checkPropertyWithOther (
|
252 kumpf 1.15 CIMInstance & instance,
|
253 kumpf 1.31 const CIMName & propertyName,
254 const CIMName & otherPropertyName,
|
255 kumpf 1.15 const Uint16 defaultValue,
|
256 kumpf 1.19 const Uint16 otherValue,
|
257 kumpf 1.55 const Array <Uint16> & validValues,
258 const Array <Uint16> & supportedValues);
|
259 kumpf 1.20
|
260 kumpf 1.21 /**
261 Validates the specified property in the instance.
262 If the property does not exist, it is added with the default value.
263 If the property exists, but its value is NULL, its value is set to
264 the default value.
265 This function is called by the _canCreate function, and is used to
266 validate the System Name and System Creation Class Name properties in
267 Filter and Handler instances, and the Source Namespace property in
268 Filter instances.
269
|
270 kumpf 1.56 Note: currently all properties validated by this function are of type
271 String. To use this function in the future with properties of other
272 types, a type parameter would need to be added, and the default value
273 would need to be passed as a CIMValue instead of a String.
274
|
275 kumpf 1.21 @param instance instance to be validated
276 @param propertyName name of property to be validated
277 @param defaultValue default value for property
278
279 @return the value of the property
280 */
|
281 kumpf 1.20 String _checkPropertyWithDefault (
282 CIMInstance & instance,
|
283 kumpf 1.31 const CIMName & propertyName,
|
284 kumpf 1.20 const String & defaultValue);
|
285 kumpf 1.56
286 /**
287 Validates the specified property in the instance.
288 If the property exists and its value is not NULL, but it is not of
289 the correct type, an exception is thrown.
290 This function is called by the _canCreate function. It is used to
291 validate the FailureTriggerTimeInterval, TimeOfLastStateChange,
292 SubscriptionDuration, SubscriptionStartTime, SubscriptionTimeRemaining,
293 RepeatNotificationInterval, RepeatNotificationGap, and
294 RepeatNotificationCount properties in Subscription instances, the Owner
295 property in Handler instances, and the PortNumber, SNMPSecurityName,
296 and SNMPEngineID properties in SNMP Mapper Handler instances.
297
298 @param instance instance to be validated
299 @param propertyName name of property to be validated
300 @param expectedType expected CIMType for property
301
302 @throw CIM_ERR_INVALID_PARAMETER if property exists and is not null
303 but is not of the correct type
304 */
305 void _checkProperty (
306 kumpf 1.56 CIMInstance & instance,
307 const CIMName & propertyName,
308 const CIMType expectedType);
|
309 kumpf 1.15
310 /**
|
311 kumpf 1.10 Determines if the user is authorized to modify the instance, and if the
312 specified modification is supported. Currently, the only modification
313 supported is of the Subscription State property of the Subscription
314 class.
|
315 kumpf 1.5
316 @param request modification request
317 @param instance instance to be modified
|
318 kumpf 1.37 @param modifiedInstance modified instance
|
319 kumpf 1.5
|
320 kumpf 1.10 @throw CIM_ERR_NOT_SUPPORTED if the specified modification is
|
321 kumpf 1.5 not supported
322 @throw CIM_ERR_ACCESS_DENIED if the user is not authorized to
323 modify the instance
|
324 kumpf 1.37 @throw CIM_ERR_INVALID_PARAMETER if the modifiedInstance is invalid
|
325 kumpf 1.5
|
326 kumpf 1.54 @return True, if the instance can be modified;
|
327 kumpf 1.10 Otherwise throws an exception
|
328 kumpf 1.5 */
329 Boolean _canModify (
330 const CIMModifyInstanceRequestMessage * request,
|
331 kumpf 1.25 const CIMObjectPath & instanceReference,
|
332 kumpf 1.37 const CIMInstance & instance,
333 CIMInstance & modifiedInstance);
|
334 kumpf 1.5
335 /**
|
336 kumpf 1.10 Determines if the user is authorized to delete the instance, and if it
|
337 kumpf 1.11 is legal to delete the instance. If authorized, Subscription instances
|
338 kumpf 1.10 may always be deleted. Filter and non-transient Handler instances may
339 only be deleted if they are not being referenced by any Subscription
340 instances. If the instance to be deleted is a transient Handler, any
341 referencing Subscriptions are also deleted.
|
342 kumpf 1.5
343 @param instanceReference reference for instance to be deleted
344 @param nameSpace namespace for instance to be deleted
|
345 kumpf 1.10 @param currentUser current user
346
347 @throw CIM_ERR_ACCESS_DENIED if the user is not authorized to
348 delete the instance
349 @throw CIM_ERR_FAILED if the instance to be deleted is
350 referenced by a subscription
|
351 kumpf 1.5
|
352 kumpf 1.54 @return True, if the instance can be deleted;
|
353 kumpf 1.10 Otherwise throws an exception
|
354 kumpf 1.1 */
355 Boolean _canDelete (
|
356 kumpf 1.25 const CIMObjectPath & instanceReference,
|
357 kumpf 1.31 const CIMNamespaceName & nameSpace,
|
358 kumpf 1.10 const String & currentUser);
|
359 kumpf 1.1
360 /**
361 Retrieves list of enabled subscription instances in all namespaces,
362 where the subscription indication class matches or is a superclass
|
363 kumpf 1.10 of the supported class, and the properties required to process the
364 subscription are all contained in the list of supported properties.
|
365 kumpf 1.42 If the checkProvider parameter value is True, a subscription is only
366 included in the list returned if the specified provider accepted the
367 subscription. If the checkProvider parameter value is False, the
368 provider parameter is not used (ignored).
|
369 kumpf 1.1
|
370 kumpf 1.10 @param supportedClass the supported class
371 @param nameSpaces the list of supported namespaces
372 @param supportedProperties the list of supported properties
|
373 kumpf 1.42 @param checkProvider indicates whether provider acceptance is
374 checked
375 @param provider the provider (used if checkProvider True)
|
376 kumpf 1.1
|
377 kumpf 1.26 @return list of CIMInstance subscriptions
|
378 kumpf 1.1 */
|
379 kumpf 1.26 Array <CIMInstance> _getMatchingSubscriptions (
|
380 kumpf 1.31 const CIMName & supportedClass,
381 const Array <CIMNamespaceName> nameSpaces,
|
382 kumpf 1.42 const CIMPropertyList & supportedProperties,
|
383 kumpf 1.43 const Boolean checkProvider = false,
|
384 kumpf 1.42 const CIMInstance & provider = CIMInstance ());
|
385 kumpf 1.1
386 /**
387 Retrieves lists of enabled subscription instances in all namespaces
388 that are either newly supported or previously supported, based on the
|
389 kumpf 1.9 supported class, the supported namespaces before and after modification,
390 and the supported properties before and after modification. For
|
391 kumpf 1.10 subscriptions based on the supported class, the newSubscriptions list
|
392 kumpf 1.9 returned contains the subscriptions for which the properties required
393 to process the subscription are all contained in the new list of
394 supported properties, but are not all contained in the old list of
395 supported properties, and/or the filter source namespace is contained in
396 the new list if supported namespaces, but is not contained in the old
397 list of supported namespaces. The formerSubscriptions list returned
398 contains the subscriptions for which the properties required to process
399 the subscription are not all contained in the new list of supported
400 properties, but are all contained in the old list of supported
401 properties, and/or the filter source namespace is not contained in the
402 new list if supported namespaces, but is contained in the old list of
403 supported namespaces.
404
|
405 kumpf 1.10 @param supportedClass the supported class
|
406 kumpf 1.9 @param newNameSpaces namespaces supported after modification
407 @param oldNameSpaces namespaces supported before modification
408 @param newProperties properties supported after modification
409 @param oldProperties properties supported before modification
|
410 kumpf 1.1 @param newSubscriptions the list of newly supported subscriptions
411 @param formerSubscriptions the list of previously supported
412 subscriptions
413 */
414 void _getModifiedSubscriptions (
|
415 kumpf 1.31 const CIMName & supportedClass,
416 const Array <CIMNamespaceName> & newNameSpaces,
417 const Array <CIMNamespaceName> & oldNameSpaces,
|
418 kumpf 1.1 const CIMPropertyList & newProperties,
419 const CIMPropertyList & oldProperties,
|
420 kumpf 1.26 Array <CIMInstance> & newSubscriptions,
421 Array <CIMInstance> & formerSubscriptions);
|
422 kumpf 1.1
423 /**
|
424 kumpf 1.9 Determines if all of the required properties in the specified list
425 are contained in the specified list of supported properties.
426
427 @param requiredProperties the required properties
|
428 kumpf 1.10 @param supportedProperties the supported properties
|
429 kumpf 1.9
|
430 kumpf 1.54 @return true, if all required properties are supported;
|
431 kumpf 1.9 false otherwise
432 */
433 Boolean _inPropertyList (
434 const CIMPropertyList & requiredProperties,
|
435 kumpf 1.10 const CIMPropertyList & supportedProperties);
|
436 kumpf 1.9
437 /**
|
438 kumpf 1.1 Parses the filter query string, and returns the corresponding
439 WQLSelectStatement object.
440
441 @param filterQuery the filter query string
442
443 @return WQLSelectStatement representing the filter query
444 */
445 WQLSelectStatement _getSelectStatement (
446 const String & filterQuery) const;
447
448 /**
449 Extracts the indication class name from the specified WQL select
450 statement, and validates that the name represents a subclass of the
451 Indication class.
452
453 @param selectStatement the WQL select statement
454 @param nameSpaceName the namespace
455
456 @return String containing the indication class name
457 */
|
458 kumpf 1.31 CIMName _getIndicationClassName (
|
459 kumpf 1.1 const WQLSelectStatement & selectStatement,
|
460 kumpf 1.31 const CIMNamespaceName & nameSpaceName) const;
|
461 kumpf 1.15
462 /**
|
463 kumpf 1.1 Retrieves the list of indication providers that serve the specified
464 indication subclasses.
465
466 @param nameSpaceName the namespace name
467 @param indicationClassName the indication class name
468 @param indicationSubclasses the list of indication subclass names
469 @param requiredPropertyList the properties required
470
471 @return list of ProviderClassList structs
472 */
|
473 kumpf 1.10 Array <ProviderClassList> _getIndicationProviders (
|
474 kumpf 1.31 const CIMNamespaceName & nameSpace,
475 const CIMName & indicationClassName,
476 const Array <CIMName> & indicationSubclasses,
|
477 kumpf 1.1 const CIMPropertyList & requiredPropertyList) const;
478
479 /**
480 Retrieves the list of properties referenced by the specified
481 filter query select statement.
482
483 @param selectStatement the WQL select statement
|
484 kumpf 1.22 @param nameSpaceName the namespace
485 @param indicationClassName the indciation class name
|
486 kumpf 1.1
|
487 kumpf 1.22 @return CIMPropertyList of properties referenced by the filter query
488 select statement
|
489 kumpf 1.1 */
490 CIMPropertyList _getPropertyList (
|
491 kumpf 1.11 const WQLSelectStatement & selectStatement,
|
492 kumpf 1.31 const CIMNamespaceName & nameSpaceName,
493 const CIMName & indicationClassName) const;
|
494 kumpf 1.22
495 /**
496 Checks if the property list includes all properties in the specified
497 class. If so, a NULL CIMPropertyList is returned. Otherwise, a
|
498 kumpf 1.32 CIMPropertyList containing the properties is returned.
|
499 kumpf 1.22
500 @param propertyList the list of property names
501 @param nameSpaceName the namespace
502 @param indicationClassName the indciation class name
503
504 @return CIMPropertyList of properties referenced by the filter query
505 select statement
506 */
507 CIMPropertyList _checkPropertyList (
|
508 kumpf 1.29 const Array <CIMName> & propertyList,
|
509 kumpf 1.31 const CIMNamespaceName & nameSpaceName,
510 const CIMName & indicationClassName) const;
|
511 kumpf 1.1
512 /**
513 Extracts the condition (WHERE Clause) from the specified filter query
514 string.
515
516 @param filterQuery the filter query
517
518 @return String containing the filter query condition
519 */
520 String _getCondition (
521 const String & filterQuery) const;
522
523 /**
|
524 kumpf 1.4 Deletes subscriptions referencing the specified handler.
525
526 @param nameSpace the name space
527 @param referenceProperty the name of the reference property in the
528 subscription instance
529 @param handler the handler reference
530 */
531 void _deleteReferencingSubscriptions (
|
532 kumpf 1.31 const CIMNamespaceName & nameSpace,
533 const CIMName & referenceProperty,
|
534 kumpf 1.25 const CIMObjectPath & handler);
|
535 kumpf 1.4
536 /**
537 Determines if specified Subscription has expired
538
539 NOTE: It is assumed that the instance passed to this function is a
540 Subscription instance, and that the Subscription Duration and
541 Start Time properties exist
542
543 @param instance the subscription instance
544
|
545 kumpf 1.54 @return True, if the Subscription has expired;
|
546 kumpf 1.4 False otherwise
547 */
548 Boolean _isExpired (
549 const CIMInstance & instance) const;
550
551 /**
|
552 kumpf 1.5 Deletes specified subscription
553
554 @param subscription the subscription reference
555 */
556 void _deleteExpiredSubscription (
|
557 kumpf 1.25 CIMObjectPath & subscription);
|
558 kumpf 1.21
559 /**
560 Gets the Subscription Time Remaining property
561
562 Calculates time remaining from Subscription Start Time, Subscription
563 Duration, and current date time. If the subscription has a non-null
564 Duration, the Time Remaining is set, and True is returned. If the
565 subscription does not have a non-null Duration, it has no expiration
566 date, and the time remaining is unlimited. In this case, the Time
567 Remaining is not set and False is returned.
568
569 NOTE: It is assumed that the instance passed to this function is a
570 Subscription instance, and that the Start Time property exists and
571 has a value
572
573 @param instance Input the subscription instance
574 @param timeRemaining Output the time remaining (seconds)
575
|
576 kumpf 1.54 @return True, if the subscription has a non-null Duration;
|
577 kumpf 1.21 False otherwise
578 */
579 Boolean _getTimeRemaining (
580 const CIMInstance & instance,
581 Uint64 & timeRemaining) const;
|
582 kumpf 1.5
583 /**
|
584 kumpf 1.4 Sets the Subscription Time Remaining property
585
586 Calculates time remaining from Subscription Start Time, Subscription
587 Duration, and current date time
588
589 NOTE: It is assumed that the instance passed to this function is a
590 Subscription instance, and that the Subscription Duration and
591 Start Time properties exist
592
593 @param instance the subscription instance
594 */
595 void _setTimeRemaining (
596 CIMInstance & instance);
597
598 /**
|
599 kumpf 1.23 Gets the parameter values required to Create or Modify the subscription
|
600 kumpf 1.10 request.
|
601 kumpf 1.5 If no indication providers are found, condition and queryLanguage are
|
602 kumpf 1.3 set to empty string.
603
|
604 kumpf 1.33 @param nameSpaceName Input namespace name (of subscription)
605 @param subscriptionInstance Input subscription instance
606 @param indicationSubclasses Output list of subclasses of indication
607 class in filter query
|
608 kumpf 1.3 @param indicationProviders Output list of providers with associated
609 classes
610 @param propertyList Output list of properties required by the
611 subscription
|
612 kumpf 1.17 @param sourceNameSpace Output source namespace for filter query
|
613 kumpf 1.3 @param condition Output condition part of the filter query
614 @param queryLanguage Output query language in which the filter
615 query is expressed
616 */
|
617 kumpf 1.23 void _getCreateParams (
|
618 kumpf 1.31 const CIMNamespaceName & nameSpaceName,
|
619 kumpf 1.3 const CIMInstance & subscriptionInstance,
|
620 kumpf 1.33 Array <CIMName> & indicationSubclasses,
|
621 kumpf 1.10 Array <ProviderClassList> & indicationProviders,
622 CIMPropertyList & propertyList,
|
623 kumpf 1.31 CIMNamespaceName & sourceNameSpace,
|
624 kumpf 1.10 String & condition,
625 String & queryLanguage);
626
627 /**
|
628 kumpf 1.23 Gets the parameter values required to Create or Modify the subscription
|
629 kumpf 1.10 request.
630
|
631 kumpf 1.33 @param nameSpaceName Input namespace name (of subscription)
632 @param subscriptionInstance Input subscription instance
633 @param indicationSubclasses Output list of subclasses of indication
634 class in filter query
|
635 kumpf 1.10 @param propertyList Output list of properties required by the
636 subscription
|
637 kumpf 1.17 @param sourceNameSpace Output source namespace for filter query
|
638 kumpf 1.10 @param condition Output condition part of the filter query
639 @param queryLanguage Output query language in which the filter
640 query is expressed
641 */
|
642 kumpf 1.23 void _getCreateParams (
|
643 kumpf 1.31 const CIMNamespaceName & nameSpaceName,
|
644 kumpf 1.10 const CIMInstance & subscriptionInstance,
|
645 kumpf 1.33 Array <CIMName> & indicationSubclasses,
|
646 kumpf 1.3 CIMPropertyList & propertyList,
|
647 kumpf 1.31 CIMNamespaceName & sourceNameSpace,
|
648 kumpf 1.3 String & condition,
649 String & queryLanguage);
650
651 /**
|
652 kumpf 1.23 Gets the parameter values required to Delete the subscription request.
|
653 kumpf 1.5
|
654 kumpf 1.33 @param nameSpaceName Input namespace name
655 @param subscriptionInstance Input subscription instance
656 @param indicationSubclasses Output list of subclasses of indication
657 class in filter query
658 @param sourceNameSpace Output source namespace for filter query
|
659 kumpf 1.5
|
660 kumpf 1.23 @return List of providers with associated classes to Delete
|
661 kumpf 1.5 */
|
662 kumpf 1.23 Array <ProviderClassList> _getDeleteParams (
|
663 kumpf 1.31 const CIMNamespaceName & nameSpaceName,
|
664 kumpf 1.33 const CIMInstance & subscriptionInstance,
665 Array <CIMName> & indicationSubclasses,
666 CIMNamespaceName & sourceNameSpace);
|
667 mday 1.13
|
668 kumpf 1.5 /**
|
669 kumpf 1.23 Sends Create subscription request for the specified subscription
|
670 kumpf 1.41 to each provider in the list. Create Subscription requests must be
671 sent to the indication providers in the following cases: (1) on
672 initialization, for each enabled subscription retrieved from the
673 repository, (2) on creation of an enabled subscription instance, (3) on
674 modification of a subscription instance, when the state changes to
675 enabled, and (4) on notification of a provider registration change
676 newly enabling the provider to serve the subscription. In cases (2) and
677 (3), there is an original Create Instance or Modify Instance request to
678 which the Indication Service must respond. In cases (1) and (4), there
679 is an original request (Notify Provider Registration Request), but no
680 response is required.
|
681 kumpf 1.1
682 @param indicationProviders list of providers with associated classes
|
683 kumpf 1.54 @param nameSpace the nameSpace name of the resource being
684 monitored, from the SourceNamespace
685 property of the CIM_IndicationFilter
686 instance for the specified
687 subscription
|
688 kumpf 1.1 @param propertyList the properties referenced by the
689 subscription
690 @param condition the condition part of the filter query
691 @param queryLanguage the query language in which the filter
692 query is expressed
|
693 kumpf 1.23 @param subscription the subscription to be created
|
694 chuck 1.35 @param acceptLangs the language of the response, and
695 future indications
696 @param contentLangs the language of the subscription
|
697 kumpf 1.41 @param origRequest the original request, if any (e.g. Create
698 Instance, Modify Instance, Provider
699 Registration change)
700 @param indicationSubclasses the indication subclasses for the
701 subscription
|
702 kumpf 1.9 @param userName the userName for authentication
703 @param authType the authentication type
704
|
705 kumpf 1.1 */
|
706 kumpf 1.41 void _sendCreateRequests (
|
707 kumpf 1.10 const Array <ProviderClassList> & indicationProviders,
|
708 kumpf 1.31 const CIMNamespaceName & nameSpace,
|
709 kumpf 1.1 const CIMPropertyList & propertyList,
710 const String & condition,
711 const String & queryLanguage,
|
712 kumpf 1.26 const CIMInstance & subscription,
|
713 chuck 1.35 const AcceptLanguages & acceptLangs,
714 const ContentLanguages & contentLangs,
|
715 kumpf 1.41 const CIMRequestMessage * origRequest,
716 const Array <CIMName> & indicationSubclasses,
|
717 kumpf 1.9 const String & userName,
718 const String & authType = String::EMPTY);
|
719 mday 1.13
|
720 kumpf 1.1 /**
|
721 kumpf 1.23 Sends Modify subscription request for the specified subscription
|
722 kumpf 1.41 to each provider in the list. Modify Subscription requests must be
723 sent to the indication providers on notification of a provider
724 registration change, when the provider was formerly serving the
725 subscription, and is still serving the subscription, in the following
726 cases: (1) the provider is newly serving an additional indication
727 subclass specified by the subscription, and (2) the provider is
728 no longer serving an indication subclass specified by the subscription
729 (but is still serving at least one of the indication subclasses).
730 In cases (1) and (2), there is an original request (Notify Provider
731 Registration Request), but no response is required.
|
732 kumpf 1.1
733 @param indicationProviders list of providers with associated classes
|
734 kumpf 1.54 @param nameSpace the nameSpace name of the resource being
735 monitored, from the SourceNamespace
736 property of the CIM_IndicationFilter
737 instance for the specified
738 subscription
|
739 kumpf 1.1 @param propertyList the properties referenced by the
740 subscription
741 @param condition the condition part of the filter query
742 @param queryLanguage the query language in which the filter
743 query is expressed
744 @param subscription the subscription to be modified
|
745 chuck 1.35 @param acceptLangs the language of the response, and
746 future indications
747 @param contentLangs the language of the subscription
|
748 kumpf 1.41 @param origRequest the original request (Provider
749 Registration change)
|
750 kumpf 1.9 @param userName the userName for authentication
751 @param authType the authentication type
|
752 kumpf 1.1 */
753 void _sendModifyRequests (
|
754 kumpf 1.10 const Array <ProviderClassList> & indicationProviders,
|
755 kumpf 1.31 const CIMNamespaceName & nameSpace,
|
756 kumpf 1.1 const CIMPropertyList & propertyList,
757 const String & condition,
758 const String & queryLanguage,
|
759 kumpf 1.26 const CIMInstance & subscription,
|
760 chuck 1.35 const AcceptLanguages & acceptLangs,
761 const ContentLanguages & contentLangs,
|
762 kumpf 1.41 const CIMRequestMessage * origRequest,
|
763 kumpf 1.9 const String & userName,
764 const String & authType = String::EMPTY);
|
765 kumpf 1.1
766 /**
|
767 kumpf 1.23 Sends Delete subscription request for the specified subscription
|
768 kumpf 1.41 to each provider in the list. Delete Subscription requests must be
769 sent to the indication providers in the following cases: (1) on deletion
770 of an enabled subscription instance, (2) on modification of a
771 subscription instance, when the state changes to disabled, and (3) on
772 notification of a provider registration change newly preventing the
773 provider from serving the subscription.
774 In cases (1) and (2), there is an original Delete Instance or Modify
775 Instance request to which the Indication Service must respond. In case
776 (1), there is an original request (Notify Provider Registration
777 Request), but no response is required.
|
778 kumpf 1.1
779 @param indicationProviders list of providers with associated classes
|
780 kumpf 1.54 @param nameSpace the nameSpace name of the resource being
781 monitored, from the SourceNamespace
782 property of the CIM_IndicationFilter
783 instance for the specified
784 subscription
|
785 kumpf 1.1 @param subscription the subscription to be modified
|
786 chuck 1.35 @param acceptLangs the language of the response
787 @param contentLangs the language of the subscription
|
788 kumpf 1.41 @param origRequest the original request (e.g. Delete
789 Instance, Modify Instance, Provider
790 Registration change)
791 @param indicationSubclasses the indication subclasses for the
792 subscription
|
793 kumpf 1.9 @param userName the userName for authentication
794 @param authType the authentication type
|
795 kumpf 1.1 */
|
796 kumpf 1.23 void _sendDeleteRequests (
|
797 kumpf 1.10 const Array <ProviderClassList> & indicationProviders,
|
798 kumpf 1.31 const CIMNamespaceName & nameSpace,
|
799 kumpf 1.26 const CIMInstance & subscription,
|
800 chuck 1.35 const AcceptLanguages & acceptLangs,
801 const ContentLanguages & contentLangs,
|
802 kumpf 1.41 const CIMRequestMessage * origRequest,
803 const Array <CIMName> & indicationSubclasses,
|
804 kumpf 1.9 const String & userName,
805 const String & authType = String::EMPTY);
|
806 kumpf 1.1
807 /**
|
808 kumpf 1.41 Collects responses from providers for aggregation as they are received,
809 and stores them in the IndicationOperationAggregate instance. Calls
810 _handleOperationResponseAggregation to process the responses, once all
811 expected responses have been received.
812
|
813 kumpf 1.57 @param operation shared data structure that controls message
|
814 kumpf 1.41 processing
815 @param destination target queue of completion callback
816 @param userParameter user parameter for callback processing
817 */
818 static void _aggregationCallBack (
819 AsyncOpNode * operation,
820 MessageQueue * destination,
821 void * userParameter);
822
823 /**
824 Calls the appropriate function to processes responses from providers,
825 based on the type of request sent to providers, once all responses have
826 been received.
827
828 @param operationAggregate the operation aggregate instance
829 */
830 void _handleOperationResponseAggregation (
831 IndicationOperationAggregate * operationAggregate);
832
833 /**
834 Processes create subscription responses from providers, once all have
835 kumpf 1.41 been received. Takes the appropriate action, based on the type of the
836 original request, if any, and the responses received. Sends the
837 response to the original request, if required.
838
839 @param operationAggregate the operation aggregate instance
840 */
841 void _handleCreateResponseAggregation (
842 IndicationOperationAggregate * operationAggregate);
843
844 /**
845 Processes enable indications responses from providers, once all have
846 been received.
847
848 @param operationAggregate the operation aggregate instance
849 */
850 void _handleEnableResponseAggregation (
851 IndicationOperationAggregate * operationAggregate);
852
853 /**
854 Processes modify subscription responses from providers, once all have
855 been received. Updates the subscription hash tables.
856 kumpf 1.41
857 @param operationAggregate the operation aggregate instance
858 */
859 void _handleModifyResponseAggregation (
860 IndicationOperationAggregate * operationAggregate);
861
862 /**
863 Processes delete subscription responses from providers, once all have
864 been received. Updates the subscription hash tables appropriately,
865 based on the type of the original request, if any. Sends the response
866 to the original request, if required.
867
868 @param operationAggregate the operation aggregate instance
869 */
870 void _handleDeleteResponseAggregation (
871 IndicationOperationAggregate * operationAggregate);
872
873 /**
|
874 kumpf 1.50 Processes disable indications responses from providers, once all have
875 been received.
876
877 @param operationAggregate the operation aggregate instance
878 */
879 void _handleDisableResponseAggregation
880 (IndicationOperationAggregate * operationAggregate);
881
882 /**
|
883 kumpf 1.1 Creates an alert instance of the specified class.
884
885 @param alertClassName the alert class name
|
886 kumpf 1.7 @param subscriptions subscriptions for which alert is to be
|
887 kumpf 1.1 created
888
889 @return the created alert instance
890 */
891 CIMInstance _createAlertInstance (
|
892 kumpf 1.31 const CIMName & alertClassName,
|
893 kumpf 1.26 const Array <CIMInstance> & subscriptions);
|
894 mday 1.14
|
895 kumpf 1.40 #if 0
|
896 kumpf 1.33 /**
|
897 mday 1.14 Asynchronous completion routine for _sendAlerts
898 */
899
900 static void _sendAlertsCallBack(AsyncOpNode *operation,
901 MessageQueue *callback_destination,
902 void *parameter);
|
903 kumpf 1.1
904 /**
905 Sends specified alert to each unique handler instance for the
906 specified subscriptions in the list.
907
|
908 kumpf 1.7 @param subscriptions subscriptions for which alert is to be
|
909 kumpf 1.1 sent
910 @param alertInstance the alert to be sent
911 */
912 void _sendAlerts (
|
913 kumpf 1.26 const Array <CIMInstance> & subscriptions,
|
914 kumpf 1.1 /* const */ CIMInstance & alertInstance);
|
915 kumpf 1.40 #endif
|
916 mday 1.18
|
917 kumpf 1.16 /**
|
918 kumpf 1.50 Sends an Enable Indications request to the specified providers.
|
919 kumpf 1.16
|
920 kumpf 1.41 @param enableProviders the providers to be enabled
|
921 kumpf 1.16 */
|
922 kumpf 1.23 void _sendEnable (
|
923 kumpf 1.41 const Array <ProviderClassList> & enableProviders,
924 const CIMRequestMessage * origRequest);
|
925 kumpf 1.50
926 /**
927 Sends a Disable Indications request to the specified providers.
928
929 @param disableProviders the providers to be disabled
930 */
931 void _sendDisable
932 (const Array <ProviderClassList> & disableProviders,
933 const CIMRequestMessage * origRequest);
|
934 kumpf 1.16
|
935 kumpf 1.1 WQLSimplePropertySource _getPropertySourceFromInstance(
936 CIMInstance & indicationInstance);
|
937 kumpf 1.5
|
938 kumpf 1.37 /**
939 Gets the value of the Creator property from the specified Subscription
940 instance. If this function returns False, the value of the creator
941 parameter is unchanged.
942
943 @param instance subscription instance
944 @param creator value of Creator property if retrieved
945
|
946 kumpf 1.54 @return True, if the value of the Creator property was retrieved;
|
947 kumpf 1.37 False if Creator property was missing, null, or of an
|
948 kumpf 1.54 incorrect type
|
949 kumpf 1.37 */
950 Boolean _getCreator (
951 const CIMInstance & instance,
952 String & creator) const;
953
954 /**
|
955 kumpf 1.54 Validates the specified SubscriptionState property value.
|
956 kumpf 1.37
|
957 kumpf 1.54 @param state SubscriptionState property value
|
958 kumpf 1.37
|
959 kumpf 1.54 @return True, if the SubscriptionState property value is valid;
960 False otherwise
|
961 kumpf 1.37 */
|
962 kumpf 1.54 Boolean _validateState (
963 const Uint16 state) const;
|
964 kumpf 1.37
|
965 kumpf 1.46 /**
966 This function peforms an authorization test based on the
967 value of the enableSubscriptionForNonprivilegedUsers.
968
969 @param userName String
970
|
971 kumpf 1.54 @return True, if authentication is not enabled or the
972 user is a privileged system user;
973 False, if authentication is enabled and the
974 user is not privileged
|
975 kumpf 1.46 */
976 void _checkNonprivilegedAuthorization (
977 const String & userName);
978
|
979 kumpf 1.48 /**
|
980 kumpf 1.49 Updates the propertyList, in preparation for calling the Repository.
981 If the propertyList is not null, the Creator property must be added to
982 the list. Also, if the request is for the Subscription class, the
983 value of the Time Remaining property need only be calculated if it is
984 requested. In that case, the Subscription Duration and Start Time
985 properties must be added to the list if not already there.
986
987 @param className class name for the request
988 @param propertyList list of properties requested
989 @param setTimeRemaining indicates whether Time Remaining property
990 was requested
991 @param startTimeAdded indicates whether Start Time property was
992 added to the list
993 @param durationAdded indicates whether Duration property was
994 added to the list
995 */
996 void _updatePropertyList
997 (CIMName & className,
998 CIMPropertyList & propertyList,
999 Boolean & setTimeRemaining,
1000 Boolean & startTimeAdded,
1001 kumpf 1.49 Boolean & durationAdded);
1002
1003 /**
|
1004 kumpf 1.48 Gets a String containing the comma-separated Subscription Filter Name
1005 and Handler Name, for use in a log message to identify the subscription.
1006
1007 @param subscription subscription instance
1008
1009 @return String containing the comma-separated Subscription Filter Name
1010 and Handler Name
1011 */
1012 String _getSubscriptionLogString
1013 (CIMInstance & subscription);
1014
|
1015 kumpf 1.54 SubscriptionRepository* _subscriptionRepository;
|
1016 kumpf 1.51
|
1017 kumpf 1.54 SubscriptionTable * _subscriptionTable;
|
1018 kumpf 1.6
|
1019 kumpf 1.8 /**
1020 Handle to Provider Registration Manager
1021 */
1022 ProviderRegistrationManager * _providerRegManager;
|
1023 kumpf 1.5
1024 /**
1025 Integer representing queue ID for accessing Provider Manager Service
1026 */
1027 Uint32 _providerManager;
1028
1029 /**
1030 Integer representing queue ID for accessing Handler Manager Service
1031 */
1032 Uint32 _handlerService;
1033
1034 /**
|
1035 kumpf 1.46 Boolean indicating that the CIM Server has been configured to
1036 allow non-privileged users read and write access to the
1037 Subscription classes.
1038 */
1039 Boolean _enableSubscriptionsForNonprivilegedUsers;
1040
|
1041 kumpf 1.55 /**
1042 Arrays of valid and supported property values
1043
1044 Notes:
1045 Valid values are defined by the CIM Event Schema MOF
1046 Supported values are a subset of the valid values
1047 Some valid values, as defined in the MOF, are not currently supported
1048 by the Pegasus IndicationService
1049
1050 Supported Values
1051 SubscriptionState: Enabled, Disabled
1052 RepeatNotificationPolicy: Unknown, Other, None, Suppress, Delay
1053 OnFatalErrorPolicy: Ignore, Disable, Remove
1054 PersistenceType: Permanent, Transient
1055 */
|
1056 kumpf 1.19 Array <Uint16> _validStates;
1057 Array <Uint16> _validRepeatPolicies;
1058 Array <Uint16> _validErrorPolicies;
1059 Array <Uint16> _validPersistenceTypes;
|
1060 kumpf 1.55 Array <Uint16> _supportedStates;
1061 Array <Uint16> _supportedRepeatPolicies;
1062 Array <Uint16> _supportedErrorPolicies;
1063 Array <Uint16> _supportedPersistenceTypes;
|
1064 kumpf 1.1 };
1065
1066 PEGASUS_NAMESPACE_END
1067
|
1068 kumpf 1.41 #endif /* Pegasus_IndicationService_h */
|