(file) Return to IndicationService.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / IndicationService

File: [Pegasus] / pegasus / src / Pegasus / IndicationService / IndicationService.h (download)
Revision: 1.27, Fri May 31 23:57:13 2002 UTC (22 years, 1 month ago) by kumpf
Branch: MAIN
CVS Tags: VERSION_2_00_RC_4, VERSION_2_00_RC_3, VERSION_2_00_RC_2, VERSION_2_00_RC_1, VERSION_2_00_BRANCH, VERSION_1_10
Changes since 1.26: +3 -3 lines
HP-RK Update license header.

//%/////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
// The Open Group, Tivoli Systems
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
//
// Modified By:  Carol Ann Krug Graves, Hewlett-Packard Company
//               (carolann_graves@hp.com)
//
// Modified By:  Ben Heilbronn, Hewlett-Packard Company
//               (ben_heilbronn@hp.com)
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_IndicationService_h
#define Pegasus_IndicationService_h

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/MessageQueueService.h>
#include <Pegasus/Common/CIMMessage.h>
#include <Pegasus/Common/IPC.h>
#include <Pegasus/Repository/CIMRepository.h>
#include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
#include <Pegasus/WQL/WQLParser.h>
#include <Pegasus/WQL/WQLSelectStatement.h>
#include <Pegasus/WQL/WQLSimplePropertySource.h>

PEGASUS_NAMESPACE_BEGIN

/**
    Entry for list of indication providers
 */
struct providerClassList
{
    CIMInstance provider;
    CIMInstance providerModule;
    Array <String> classList;
      providerClassList() 
      {
      }
      
      providerClassList(const providerClassList & rh)
	 : provider(rh.provider),
	   providerModule(rh.providerModule),
	   classList(rh.classList)
      {
	 
      }
      providerClassList & operator= (const providerClassList & rh)
      {
	 if( this != &rh)
	 {
	    provider = rh.provider;
	    providerModule = rh.providerModule;
	    classList = rh.classList;
	 }
	 return *this;
      }
};

typedef struct providerClassList ProviderClassList;

struct enableProviderList
{
      ProviderClassList *pcl;
      CIMInstance *cni;
      
      enableProviderList(const ProviderClassList & list, 
			 const CIMInstance & instance)
      {
	 pcl = new ProviderClassList(list);
	 cni = new CIMInstance (instance);
	 
      }

      ~enableProviderList() 
      {
	 delete pcl;
	 delete cni;
      }
      
};


/**
    Entry for Subscription table
 */
struct SubscriptionTableEntry
{
    CIMInstance subscription;
    CIMInstance provider;
    Array <String> classList;
};

/**
    Table for subscription information.
    The table keys are generated by concatenating the Subscription namespace 
    name, Filter and Handler key values, and Provider key values.  Each table 
    value includes the Subscription, the Provider, and the list of classnames.
    The key allows quick access when the subscription and provider are both 
    known (i.e. initialize, instance operations, provider registration changes).
    When only the provider is known (i.e. provider termination), an iterator is
    used to search the table.  That is, the table is designed to optimize all 
    operations except provider termination.
 */
typedef HashTable <String, 
                   SubscriptionTableEntry, 
                   EqualFunc <String>, 
                   HashFunc <String> > SubscriptionTable;

/**

    IndicationService class is the service that serves the
    Indication Subscription, Indication Filter, and Indication Handler
    classes, and processes indications.

    @author  Hewlett-Packard Company

 */

class PEGASUS_SERVER_LINKAGE IndicationService : public MessageQueueService
{
public:

    typedef MessageQueueService Base;

    /**
        Constructs an IndicationSubscription instance and initializes instance
        variables.
     */
    IndicationService (
        CIMRepository * repository,
        ProviderRegistrationManager * providerRegManager);

    virtual ~IndicationService(void);

    void handleEnqueue(Message* message);

    virtual void handleEnqueue(void); 

    virtual void _handle_async_request(AsyncRequest *req);

    AtomicInt dienow;

    /**
        Operation types for the NotifyProviderRegistration message
     */
    enum Operation {OP_CREATE = 1, OP_DELETE = 2, OP_MODIFY = 3};

    static Mutex _mutex;

private:

    void _initialize (void);

    void _terminate (void);

    void _handleGetInstanceRequest(const Message * message);

    void _handleEnumerateInstancesRequest(const Message * message);

    void _handleEnumerateInstanceNamesRequest(const Message * message);

    void _handleCreateInstanceRequest(const Message * message);

    void _handleModifyInstanceRequest(const Message * message);

    void _handleDeleteInstanceRequest(const Message * message);

    void _handleProcessIndicationRequest(const Message * message);

    /**
	Notifies the Indication Service that a change in provider registration
	has occurred.  The Indication Service retrieves the subscriptions
	affected by the registration change, sends the appropriate Create,
        Modify, and/or Delete requests to the provider, and sends an alert to 
        handler instances of subscriptions that are no longer served by the 
        provider.
    */
    void _handleNotifyProviderRegistrationRequest(const Message * message);

    /**
        Notifies the Indication Service that a provider has
        terminated (either intentionally or abnormally).  The 
        Indication Service retrieves the subscriptions affected by the
        termination, and sends an alert to handler instances of
        subscriptions that are no longer served by the provider.
     */
    void _handleNotifyProviderTerminationRequest(const Message * message);

    /**
        Implements the subscription's On Fatal Error Policy.
        This function is called when a fatal error has occurred in the
        indication provider or indication handler, and the subscription can no
        longer be served.
        If the subscription's policy is Disable, the Subscription State is
        set to Disabled.
        If the subscription's policy is Remove, the subscription instance is 
        deleted.

        @param   subscription          the subscription named instance

        @return  True if the subscription has been disabled or deleted
                 False otherwise
     */
    Boolean _handleError (
        const CIMInstance subscription);

    /**
        Disables the subscription.
        This function is called when a fatal error has occurred in the
        indication provider or indication handler, the subscription can no
        longer be served, and the subscription's policy is Disable.
        The Subscription State is set to Disabled.

        @param   subscription          the subscription named instance
     */
    void _disableSubscription (
        CIMInstance subscription);

    /**
        Deletes the subscription instance.
        This function is called when a fatal error has occurred in the
        indication provider or indication handler, the subscription can no
        longer be served, and the subscription's policy is Remove.
        The subscription instance is deleted.

        @param   subscription          the subscription named instance
     */
    void _deleteSubscription (
        const CIMInstance subscription);

    /**
        Determines if it is legal to create an instance. 
        Checks for existence of all key and required properties.  Checks that 
        properties that MUST NOT exist (based on values of other properties), 
        do not exist.  For any property that has a default value, if it does 
        not exist, adds the property with the default value.

        @param   instance              instance to be created
        @param   nameSpace             namespace for instance to be created

        @throw   CIM_ERR_INVALID_PARAMETER  if instance is invalid
        @throw   CIM_ERR_NOT_SUPPORTED      if the specified class is not 
                                            supported

        @return  True if the instance can be created
                 Otherwise throws an exception
     */
    Boolean _canCreate (
        CIMInstance & instance,
        const String & nameSpace);

    /**
        Validates the specified required property in the instance.
        If the property does not exist, or has a null value, an exceptiuon is 
        thrown, using the specified message.

        This function is called by the _canCreate function, and is used to 
        validate the  Filter and Handler properties in Subscription instances,
        the Name, CreationClassName, Query and Query Language properties in 
        Filter instances, the Name, CreationClassName, and Destination 
        properties in CIMXML Handler instances, and the Name, CreationClassName,
        Trap Destination, and SNMP Version properties in SNMP Mapper instances.

        @param   instance              instance to be validated
        @param   propertyName          name of property to be validated
        @param   message               message to be used in exception

        @throw   CIM_ERR_INVALID_PARAMETER  if required property is missing or 
                                            null
     */
    void _checkRequiredProperty (
        CIMInstance & instance,
        const String & propertyName,
        const String & message);

    /**
        Validates the specified property and its corresponding Other___
        property in the instance.
        If the property does not exist, it is added with the default value.
        If the property exists, but its value is NULL, its value is set to
        the default value.
        If the value of the property is Other, but the corresponding Other___
        property either does not exist or has a value of NULL, an exception is 
        thrown.  
        If the value of the property is not Other, but the corresponding
        Other___ property exists and has a non-NULL value, an exception is
        thrown.
        This function is called by the _canCreate function, and is used to 
        validate the following pairs of properties in Subscription or Handler 
        instances: Subscription State, Other Subscription State, Repeat 
        Notification Policy, Other Repeat Notification Policy, On Fatal Error 
        Policy, Other On Fatal Error Policy, Persistence Type, Other 
        Persistence Type.

        @param   instance              instance to be validated
        @param   propertyName          name of property to be validated
        @param   otherPropertyName     name of Other___ property to be validated
        @param   defaultValue          default value for property
        @param   otherValue            "Other" value for property
        @param   validValues           set of valid values for property

        @throw   CIM_ERR_INVALID_PARAMETER  if value of property or Other___ 
                                            property is invalid
     */
    void _checkPropertyWithOther (
        CIMInstance & instance,
        const String & propertyName,
        const String & otherPropertyName,
        const Uint16 defaultValue,
        const Uint16 otherValue,
        const Array <Uint16> & validValues);

    /**
        Validates the specified property in the instance.
        If the property does not exist, it is added with the default value.
        If the property exists, but its value is NULL, its value is set to
        the default value.
        This function is called by the _canCreate function, and is used to 
        validate the System Name and System Creation Class Name properties in
        Filter and Handler instances, and the Source Namespace property in 
        Filter instances.

        @param   instance              instance to be validated
        @param   propertyName          name of property to be validated
        @param   defaultValue          default value for property

        @return  the value of the property

     */
    String _checkPropertyWithDefault (
        CIMInstance & instance,
        const String & propertyName,
        const String & defaultValue);

    /**
        Determines if the user is authorized to modify the instance, and if the
        specified modification is supported.  Currently, the only modification 
        supported is of the Subscription State property of the Subscription 
        class.

        @param   request               modification request
        @param   instance              instance to be modified

        @throw   CIM_ERR_NOT_SUPPORTED      if the specified modification is 
                                            not supported
        @throw   CIM_ERR_ACCESS_DENIED      if the user is not authorized to
                                            modify the instance

        @return  True if the instance can be modified
                 Otherwise throws an exception
     */
    Boolean _canModify (
        const CIMModifyInstanceRequestMessage * request,
        const CIMObjectPath & instanceReference,
        CIMInstance & instance);

    /**
        Determines if the user is authorized to delete the instance, and if it 
        is legal to delete the instance.  If authorized, Subscription instances 
        may always be deleted.  Filter and non-transient Handler instances may 
        only be deleted if they are not being referenced by any Subscription 
        instances. If the instance to be deleted is a transient Handler, any 
        referencing Subscriptions are also deleted.

        @param   instanceReference     reference for instance to be deleted
        @param   nameSpace             namespace for instance to be deleted
        @param   currentUser           current user

        @throw   CIM_ERR_ACCESS_DENIED      if the user is not authorized to
                                            delete the instance
        @throw   CIM_ERR_FAILED             if the instance to be deleted is 
                                            referenced by a subscription

        @return  True if the instance can be deleted
                 Otherwise throws an exception
     */
    Boolean _canDelete (
        const CIMObjectPath & instanceReference,
        const String & nameSpace,
        const String & currentUser);

    /**
        Retrieves list of enabled subscription instances in all namespaces.

        @return   list of CIMInstance subscriptions
     */
    Array <CIMInstance> _getActiveSubscriptions () const;

    /**
        Retrieves list of enabled subscription instances in all namespaces,
        where the subscription indication class matches or is a superclass
        of the supported class, and the properties required to process the
        subscription are all contained in the list of supported properties.

        @param   supportedClass       the supported class
        @param   nameSpaces           the list of supported namespaces
        @param   supportedProperties  the list of supported properties

        @return   list of CIMInstance subscriptions
     */
    Array <CIMInstance> _getMatchingSubscriptions (
        const String & supportedClass,
        const Array <String> nameSpaces,
        const CIMPropertyList & supportedProperties);

    /**
        Retrieves lists of enabled subscription instances in all namespaces
        that are either newly supported or previously supported, based on the
        supported class, the supported namespaces before and after modification,
        and the supported properties before and after modification.  For 
        subscriptions based on the supported class, the newSubscriptions list 
        returned contains the subscriptions for which the properties required 
        to process the subscription are all contained in the new list of 
        supported properties, but are not all contained in the old list of 
        supported properties, and/or the filter source namespace is contained in
        the new list if supported namespaces, but is not contained in the old 
        list of supported namespaces.  The formerSubscriptions list returned 
        contains the subscriptions for which the properties required to process
        the subscription are not all contained in the new list of supported 
        properties, but are all contained in the old list of supported 
        properties, and/or the filter source namespace is not contained in the 
        new list if supported namespaces, but is contained in the old list of 
        supported namespaces.

        @param   supportedClass       the supported class
        @param   newNameSpaces        namespaces supported after modification
        @param   oldNameSpaces        namespaces supported before modification
        @param   newProperties        properties supported after modification
        @param   oldProperties        properties supported before modification
        @param   newSubscriptions     the list of newly supported subscriptions
        @param   formerSubscriptions  the list of previously supported
                                          subscriptions
     */
    void _getModifiedSubscriptions (
        const String & supportedClass,
        const Array <String> & newNameSpaces,
        const Array <String> & oldNameSpaces,
        const CIMPropertyList & newProperties,
        const CIMPropertyList & oldProperties,
        Array <CIMInstance> & newSubscriptions,
        Array <CIMInstance> & formerSubscriptions);

    /**
        Retrieves list of all namespaces from the repository.

        @return   List of all namespace names
     */
    Array <String> _getNameSpaceNames (void) const;

    /**
        Retrieves list of subscriptions in the specified namespace.

        @param   nameSpace             the namespace

        @return   List of subscription named instances
     */
    Array <CIMInstance> _getSubscriptions (
        const String & nameSpaceName) const;

    /**
        Determines if all of the required properties in the specified list
        are contained in the specified list of supported properties.

        @param   requiredProperties  the required properties
        @param   supportedProperties the supported properties

        @return   true if all required properties are supported
                  false otherwise
     */
    Boolean _inPropertyList (
        const CIMPropertyList & requiredProperties,
        const CIMPropertyList & supportedProperties);

    /**
        Retrieves list of enabled subscription instances in all namespaces,
        that are served by the specified provider.

        @param   provider          the provider instance

        @return   list of CIMInstance subscriptions
     */
    Array <CIMInstance> _getProviderSubscriptions (
        const CIMInstance & provider);

    /**
        Retrieves the values of the filter query, source namespace,
        and query language properties for the specified subscription instance.

        @param   subscription      Input subscription instance
        @param   nameSpaceName     Input namespace name
        @param   query             Output query for the filter
        @param   sourceNameSpace   Output source namespace for the filter
                                       subscription
        @param   queryLanguage     Output query language in which the filter
                                       query is expressed
     */
    void _getFilterProperties (
        const CIMInstance & subscription,
        const String & nameSpaceName,
        String & query,
        String & sourceNameSpace,
        String & queryLanguage);

    /**
        Retrieves the values of the filter query and source namespace
        properties for the specified subscription instance.

        @param   subscription      Input subscription instance
        @param   nameSpaceName     Input namespace name
        @param   query             Output query for the filter
        @param   sourceNameSpace   Output source namespace for the filter
                                       subscription
     */
    void _getFilterProperties (
        const CIMInstance & subscription,
        const String & nameSpaceName,
        String & query,
        String & sourceNameSpace);

    /**
        Retrieves the values of the filter query property 
        for the specified subscription instance.

        @param   subscription      Input subscription instance
        @param   nameSpaceName     Input namespace name
        @param   query             Output query for the filter
     */
    void _getFilterProperties (
        const CIMInstance & subscription,
        const String & nameSpaceName,
        String & query);

    /**
        Parses the filter query string, and returns the corresponding
        WQLSelectStatement object.

        @param   filterQuery           the filter query string

        @return  WQLSelectStatement representing the filter query
     */
    WQLSelectStatement _getSelectStatement (
        const String & filterQuery) const;

    /**
        Extracts the indication class name from the specified WQL select
        statement, and validates that the name represents a subclass of the
        Indication class.

        @param   selectStatement       the WQL select statement
        @param   nameSpaceName         the namespace

        @return  String containing the indication class name
     */
    String _getIndicationClassName (
        const WQLSelectStatement & selectStatement,
        const String & nameSpaceName) const;

    /**
        Enumerates the subclass names of the specified indication class.

        @param   nameSpace             the namespace
        @param   indicationClassName   the indication class name

        @return  List of indication subclass names
     */
    Array <String> _getIndicationSubclasses (
        const String & nameSpace,
        const String & indicationClassName) const;

    /**
        Retrieves the list of indication providers that serve the specified
        indication subclasses.

        @param   nameSpaceName         the namespace name
        @param   indicationClassName   the indication class name
        @param   indicationSubclasses  the list of indication subclass names
        @param   requiredPropertyList  the properties required

        @return  list of ProviderClassList structs
     */
    Array <ProviderClassList> _getIndicationProviders (
        const String & nameSpace,
        const String & indicationClassName,
        const Array <String> & indicationSubclasses,
        const CIMPropertyList & requiredPropertyList) const;

    /**
        Retrieves the list of properties referenced by the specified
        filter query select statement.

        @param   selectStatement       the WQL select statement
        @param   nameSpaceName         the namespace
        @param   indicationClassName   the indciation class name

        @return  CIMPropertyList of properties referenced by the filter query 
                 select statement
     */
    CIMPropertyList _getPropertyList (
        const WQLSelectStatement & selectStatement,
        const String & nameSpaceName,
        const String & indicationClassName) const;

    /**
        Checks if the property list includes all properties in the specified 
        class.  If so, a NULL CIMPropertyList is returned.  Otherwise, a
        CIMPropertyList containing all the properties is returned.

        @param   propertyList          the list of property names
        @param   nameSpaceName         the namespace
        @param   indicationClassName   the indciation class name

        @return  CIMPropertyList of properties referenced by the filter query 
                 select statement
     */
    CIMPropertyList _checkPropertyList (
        const Array <String> & propertyList,
        const String & nameSpaceName,
        const String & indicationClassName) const;

    /**
        Extracts the condition (WHERE Clause) from the specified filter query
        string.

        @param   filterQuery       the filter query

        @return  String containing the filter query condition
     */
    String _getCondition (
        const String & filterQuery) const;

    /**
        Retrieves the Handler CIMInstance representing the handler of the
        specified subscription.

        @param   subscription          the subscription

        @return  a Handler CIMInstance for the subscription's handler
     */
    CIMInstance _getHandler (
        const CIMInstance & subscription) const;

    /**
        Determines if specified handler is Transient.

        @param   nameSpace             the name space
        @param   handler               the handler reference

        @return  True if the Handler is Transient, 
                 False otherwise
     */
    Boolean _isTransient (
        const String & nameSpace,
        const CIMObjectPath & handler) const;

    /**
        Deletes subscriptions referencing the specified handler.

        @param   nameSpace             the name space
        @param   referenceProperty     the name of the reference property in the
                                           subscription instance
        @param   handler               the handler reference
     */
    void _deleteReferencingSubscriptions (
        const String & nameSpace,
        const String & referenceProperty,
        const CIMObjectPath & handler);

    /**
        Determines if specified Subscription has expired

        NOTE: It is assumed that the instance passed to this function is a
        Subscription instance, and that the Subscription Duration and
        Start Time properties exist

        @param   instance              the subscription instance

        @return  True if the Subscription has expired, 
                 False otherwise
     */
    Boolean _isExpired (
        const CIMInstance & instance) const;

    /**
        Deletes specified subscription 

        @param   subscription          the subscription reference
     */
    void _deleteExpiredSubscription (
        CIMObjectPath & subscription);

    /**
        Gets the Subscription Time Remaining property

        Calculates time remaining from Subscription Start Time, Subscription 
        Duration, and current date time.  If the subscription has a non-null
        Duration, the Time Remaining is set, and True is returned.  If the 
        subscription does not have a non-null Duration, it has no expiration 
        date, and the time remaining is unlimited.  In this case, the Time 
        Remaining is not set and False is returned.
      
        NOTE: It is assumed that the instance passed to this function is a
        Subscription instance, and that the Start Time property exists and 
        has a value

        @param   instance              Input the subscription instance
        @param   timeRemaining         Output the time remaining (seconds)

        @return  True if the subscription has a non-null Duration
                 False otherwise
     */
    Boolean _getTimeRemaining (
        const CIMInstance & instance,
        Uint64 & timeRemaining) const;

    /**
        Sets the Subscription Time Remaining property

        Calculates time remaining from Subscription Start Time, Subscription 
        Duration, and current date time
      
        NOTE: It is assumed that the instance passed to this function is a
        Subscription instance, and that the Subscription Duration and
        Start Time properties exist

        @param   instance              the subscription instance
     */
    void _setTimeRemaining (
        CIMInstance & instance);

    /**
        Gets the parameter values required to Create or Modify the subscription
        request.
        If no indication providers are found, condition and queryLanguage are 
        set to empty string.

        @param   nameSpace             Input namespace name (of subscription)
        @param   subscription          Input subscription instance
        @param   indicationProviders   Output list of providers with associated
                                           classes
        @param   propertyList          Output list of properties required by the
                                           subscription
        @param   sourceNameSpace       Output source namespace for filter query
        @param   condition             Output condition part of the filter query
        @param   queryLanguage         Output query language in which the filter
                                           query is expressed
     */
    void _getCreateParams (
        const String & nameSpaceName,
        const CIMInstance & subscriptionInstance,
        Array <ProviderClassList> & indicationProviders,
        CIMPropertyList & propertyList,
        String & sourceNameSpace,
        String & condition,
        String & queryLanguage);

    /**
        Gets the parameter values required to Create or Modify the subscription
        request.

        @param   nameSpace             Input namespace name (of subscription)
        @param   subscription          Input subscription instance
        @param   propertyList          Output list of properties required by the
                                           subscription
        @param   sourceNameSpace       Output source namespace for filter query
        @param   condition             Output condition part of the filter query
        @param   queryLanguage         Output query language in which the filter
                                           query is expressed
     */
    void _getCreateParams (
        const String & nameSpaceName,
        const CIMInstance & subscriptionInstance,
        CIMPropertyList & propertyList,
        String & sourceNameSpace,
        String & condition,
        String & queryLanguage);

    /**
        Gets the parameter values required to Delete the subscription request.

        @param   nameSpace             Input namespace name
        @param   subscription          Input subscription instance

        @return  List of providers with associated classes to Delete
     */
    Array <ProviderClassList> _getDeleteParams (
        const String & nameSpaceName,
        const CIMInstance & subscriptionInstance);


      /**
	 Asynchronous completion routine for _sendCreateRequests.
	 
	 @param  operation            shared data structure that controls msg 
                                      processing
	 @param  destination          target queue of completion callback
	 @param  parm                 user parameter for callback processing
      */

      static void _sendCreateRequestsCallBack(AsyncOpNode *operation, 
					      MessageQueue *destination, 
					      void *parm);
       

    /**
        Sends Create subscription request for the specified subscription
        to each provider in the list.

        @param   indicationProviders   list of providers with associated classes
        @param   nameSpace             the namespace name
        @param   propertyList          the properties referenced by the
                                           subscription
        @param   condition             the condition part of the filter query
        @param   queryLanguage         the query language in which the filter
                                           query is expressed
        @param   subscription          the subscription to be created
        @param   userName              the userName for authentication
        @param   authType              the authentication type

        @return  True if at least one provider accepted the subscription
                 False otherwise
     */
    Boolean _sendCreateRequests (
        const Array <ProviderClassList> & indicationProviders,
        const String & nameSpace,
        const CIMPropertyList & propertyList,
        const String & condition,
        const String & queryLanguage,
        const CIMInstance & subscription,
        const String & userName,
        const String & authType = String::EMPTY);


      /** 
	  Callback completion routine for _sendModifyRequests
	 
      */

      static void _sendModifyRequestsCallBack(AsyncOpNode *operation,
					      MessageQueue *destination,
					      void *parm);
      

    /**
        Sends Modify subscription request for the specified subscription
        to each provider in the list.

        @param   indicationProviders   list of providers with associated classes
        @param   nameSpace             the namespace name
        @param   propertyList          the properties referenced by the
                                           subscription
        @param   condition             the condition part of the filter query
        @param   queryLanguage         the query language in which the filter
                                           query is expressed
        @param   subscription          the subscription to be modified
        @param   userName              the userName for authentication
        @param   authType              the authentication type
     */
    void _sendModifyRequests (
        const Array <ProviderClassList> & indicationProviders,
        const String & nameSpace,
        const CIMPropertyList & propertyList,
        const String & condition,
        const String & queryLanguage,
        const CIMInstance & subscription,
        const String & userName,
        const String & authType = String::EMPTY);


      /** 
	  Asynchronous completion routine for _sendDeleteRequests. 
      */

      static void _sendDeleteRequestsCallBack (
          AsyncOpNode *operation, 
          MessageQueue *callback_destination,
          void *parameter);

    /**
        Sends Delete subscription request for the specified subscription
        to each provider in the list.

        @param   indicationProviders   list of providers with associated classes
        @param   nameSpace             the namespace name
        @param   subscription          the subscription to be modified
        @param   userName              the userName for authentication
        @param   authType              the authentication type
     */
    void _sendDeleteRequests (
        const Array <ProviderClassList> & indicationProviders,
        const String & nameSpace,
        const CIMInstance & subscription,
        const String & userName,
        const String & authType = String::EMPTY);

    /**
        Generates a unique String key from the subscription instance name and
        provider keys.

        @param   subscription          the subscription named instance
        @param   provider              the provider instance

        @return  the generated key
     */
    String _generateKey (
        const CIMInstance & subscription,
        const CIMInstance provider);

    /**
        Inserts an entry into the subscription table.

        @param   subscription          the subscription named instance
        @param   provider              the provider instance
        @param   classList             the list of class names
     */
    void _insertEntry (
        const CIMInstance & subscription,
        const CIMInstance & provider,
        const Array <String> classList);

    /**
        Creates an alert instance of the specified class.

        @param   alertClassName        the alert class name
        @param   subscriptions         subscriptions for which alert is to be
                                           created

        @return  the created alert instance
     */
    CIMInstance _createAlertInstance (
        const String & alertClassName,
        const Array <CIMInstance> & subscriptions);



      /** 
	  Asynchronous completion routine for _sendAlerts
      */

      static void _sendAlertsCallBack(AsyncOpNode *operation, 
				      MessageQueue *callback_destination, 
				      void *parameter);
      

    /**
        Sends specified alert to each unique handler instance for the
        specified subscriptions in the list.

        @param   subscriptions         subscriptions for which alert is to be
                                           sent
        @param   alertInstance         the alert to be sent
     */
    void _sendAlerts (
        const Array <CIMInstance> & subscriptions,
        /* const */ CIMInstance & alertInstance);
      

      /** Async completion routine for _sendEnable */

      static void _sendEnableCallBack(AsyncOpNode *operation, 
				     MessageQueue *callback_destination, 
				     void *parameter);
      
      
    /**
        Sends an Enable message to the specified provider.

        @param   enableProvider        the provider to be enabled
     */
    void _sendEnable (
        const ProviderClassList & enableProvider);

    WQLSimplePropertySource _getPropertySourceFromInstance(
        CIMInstance & indicationInstance);

    CIMRepository * _repository;

    /**
        Handle to Provider Registration Manager
     */
    ProviderRegistrationManager * _providerRegManager;

    /**
        Integer representing queue ID for accessing Provider Manager Service
     */
    Uint32 _providerManager;

    /**
        Integer representing queue ID for accessing Handler Manager Service
     */
    Uint32 _handlerService;

    /**
        Integer representing queue ID for accessing Repository Service
     */
    //Uint32 _repository;

    /**
        Subscription information table
     */
    SubscriptionTable _subscriptionTable;

    Array <Uint16> _validStates;
    Array <Uint16> _validRepeatPolicies;
    Array <Uint16> _validErrorPolicies;
    Array <Uint16> _validPersistenceTypes;
    
    /**
        Values for the Subscription State property of the Subscription class,
        as defined in the CIM Events MOF
     */
    enum SubscriptionState {_STATE_UNKNOWN = 0, _STATE_OTHER = 1, 
         _STATE_ENABLED = 2, _STATE_ENABLEDDEGRADED = 3, _STATE_DISABLED = 4};

    /**
        Values for the Repeat Notification Policy property of the Subscription 
        class, as defined in the CIM Events MOF
     */
    enum RepeatNotificationPolicy {_POLICY_UNKNOWN = 0, _POLICY_OTHER = 1,
         _POLICY_NONE = 2, _POLICY_SUPPRESS = 3, _POLICY_DELAY = 4};

    /**
        Values for the On Fatal Error Policy property of the Subscription 
        class, as defined in the CIM Events MOF
     */
    enum OnFatalErrorPolicy {_ERRORPOLICY_OTHER = 1, _ERRORPOLICY_IGNORE = 2, 
        _ERRORPOLICY_DISABLE = 3, _ERRORPOLICY_REMOVE = 4};

    /**
        Values for the Persistence Type property of the Handler class, 
        as defined in the CIM Events MOF
     */
    enum PersistenceType {_PERSISTENCE_OTHER = 1, _PERSISTENCE_PERMANENT = 2, 
        _PERSISTENCE_TRANSIENT = 3};

    /**
        Values for the Perceived Severity property of the Alert Indication 
        class, as defined in the CIM Events MOF
     */
    enum PerceivedSeverity {_SEVERITY_UNKNOWN = 0, _SEVERITY_OTHER = 1, 
         _SEVERITY_INFORMATION = 2, _SEVERITY_WARNING = 3, _SEVERITY_MINOR = 4,
         _SEVERITY_MAJOR = 5, _SEVERITY_CRITICAL = 6, _SEVERITY_FATAL = 7};

    /**
        Values for the Probable Cause property of the Alert Indication 
        class, as defined in the CIM Events MOF
        Note: not all possible values have been included
     */
    enum ProbableCause {_CAUSE_UNKNOWN = 0, _CAUSE_OTHER = 1};

    /**
        Values for the Alert Type property of the Alert Indication class, 
        as defined in the CIM Events MOF
     */
    enum AlertType {_TYPE_OTHER = 1, _TYPE_COMMUNICATIONS = 2, _TYPE_QOS = 3,
         _TYPE_PROCESSING = 4, _TYPE_DEVICE = 5, _TYPE_ENVIRONMENTAL = 6,
         _TYPE_MODELCHANGE = 7, _TYPE_SECURITY = 8};

    //
    //  Class names
    //

    /**
        The name of the CIMOM Shutdown alert indication class
     */
    static const char   _CLASS_CIMOM_SHUTDOWN_ALERT [];

    /**
        The name of the No Provider alert indication class
     */
    static const char   _CLASS_NO_PROVIDER_ALERT [];

    /**
        The name of the CIMOM shutdown alert indication class
     */
    static const char   _CLASS_PROVIDER_TERMINATED_ALERT [];


    //
    //  Property names
    //

    /**
        The name of the Subscription State property for Indication Subscription
        class
     */
    static const char   _PROPERTY_STATE [];

    /**
        The name of the Other Subscription State property for Indication
        Subscription class
     */
    static const char   _PROPERTY_OTHERSTATE [];

    /**
        The name of the repeat notification policy property for indication
        subscription class
     */
    static const char   _PROPERTY_REPEATNOTIFICATIONPOLICY [];

    /**
        The name of the other repeat notification policy property for
        indication subscription class
     */
    static const char   _PROPERTY_OTHERREPEATNOTIFICATIONPOLICY [];

    /**
        The name of the repeat notification interval property for indication
        subscription class
     */
    static const char   _PROPERTY_REPEATNOTIFICATIONINTERVAL [];

    /**
        The name of the repeat notification gap property for indication
        subscription class
     */
    static const char   _PROPERTY_REPEATNOTIFICATIONGAP [];

    /**
        The name of the repeat notification count property for indication
        subscription class
     */
    static const char   _PROPERTY_REPEATNOTIFICATIONCOUNT [];

    /**
        The name of the On Fatal Error Policy property for Indication 
        Subscription class
     */
    static const char   _PROPERTY_ONFATALERRORPOLICY [];

    /**
        The name of the Other On Fatal Error Policy property for Indication
        Subscription class
     */
    static const char   _PROPERTY_OTHERONFATALERRORPOLICY [];

    /**
        The name of the Time Of Last State Change property for Indication 
        Subscription class
     */
    static const char   _PROPERTY_LASTCHANGE [];

    /**
        The name of the Subscription Start Time property for Indication 
        Subscription class
     */
    static const char   _PROPERTY_STARTTIME [];

    /**
        The name of the Subscription Duration property for Indication 
        Subscription class
     */
    static const char   _PROPERTY_DURATION [];

    /**
        The name of the Subscription Time Remaining property for Indication 
        Subscription class
     */
    static const char   _PROPERTY_TIMEREMAINING [];

    /**
        The name of the filter reference property for indication subscription
        class
     */
    static const char   _PROPERTY_FILTER [];

    /**
        The name of the handler reference property for indication subscription
        class
     */
    static const char   _PROPERTY_HANDLER [];

    /**
        The name of the query property for indication filter class
     */
    static const char   _PROPERTY_QUERY [];

    /**
        The name of the query language property for indication filter class
     */
    static const char   _PROPERTY_QUERYLANGUAGE [];

    /**
        The name of the Source Namespace property for indication filter class
     */
    static const char   _PROPERTY_SOURCENAMESPACE [];

    /**
        The name of the name property for indication filter and indication
        handler classes
     */
    static const char   _PROPERTY_NAME [];

    /**
        The name of the creation class name property for indication filter and
        indication handler classes
     */
    static const char   _PROPERTY_CREATIONCLASSNAME [];

    /**
        The name of the system name property for indication filter and
        indication handler classes
     */
    static const char   _PROPERTY_SYSTEMNAME [];

    /**
        The name of the system creation class name property for indication
        filter and indication handler classes
     */
    static const char   _PROPERTY_SYSTEMCREATIONCLASSNAME [];

    /**
        The name of the Persistence Type property for Indication Handler class
     */
    static const char   _PROPERTY_PERSISTENCETYPE [];

    /**
        The name of the Other Persistence Type property for Indication Handler
        class
     */
    static const char   _PROPERTY_OTHERPERSISTENCETYPE [];

    /**
        The name of the Destination property for CIM XML Indication Handler 
        subclass
     */
    static const char   _PROPERTY_DESTINATION [];

    /**
        The name of the Trap Destination property for SNMP Mapper Indication
        Handler subclass
     */
    static const char   _PROPERTY_TRAPDESTINATION [];

    /**
        The name of the SNMP Type property for SNMP Indication Handler class
     */
    static const char   _PROPERTY_SNMPTYPE [];

    /**
        The name of the Alert Type property for Alert Indication class
     */
    static const char   _PROPERTY_ALERTTYPE [];

    /**
        The name of the Other Alert Type property for Alert Indication class
     */
    static const char   _PROPERTY_OTHERALERTTYPE [];

    /**
        The name of the Perceived Severity property for Alert Indication class
     */
    static const char   _PROPERTY_PERCEIVEDSEVERITY [];

    /**
        The name of the Probable Cause property for Alert Indication class
     */
    static const char   _PROPERTY_PROBABLECAUSE [];

    /**
        The name of the Provider Name property for Provider class
     */
    static const char   _PROPERTY_PROVIDERNAME [];

    /**
        The name of the Provider Module Name property for Provider class
     */
    static const char   _PROPERTY_PROVIDERMODULENAME [];


    //
    //  Qualifier names
    //

    /**
        The name of the Indication qualifier for classes
     */
    static const char   _QUALIFIER_INDICATION [];


    //
    //  Other literal values
    //

    /**
        The WHERE keyword in WQL
     */
    static const char   _QUERY_WHERE [];

    /**
        The string representing the asterisk all properties symbol in WQL
     */
    static const char   _QUERY_ALLPROPERTIES [];

    //
    //  Message substrings used in exception messages
    //

    static const char _MSG_MISSING_REQUIRED [];

    static const char _MSG_KEY_PROPERTY [];

    static const char _MSG_PROPERTY [];

    static const char _MSG_PROPERTY_PRESENT [];

    static const char _MSG_VALUE_NOT [];

    static const char _MSG_NO_PROVIDERS [];

    static const char _MSG_NOT_ACCEPTED [];

    static const char _MSG_INVALID_CLASSNAME [];

    static const char _MSG_IN_FROM [];

    static const char _MSG_EXPIRED [];

    static const char _MSG_REFERENCED [];

    static const char _MSG_INVALID_VALUE [];

    static const char _MSG_FOR_PROPERTY [];

    static const char _MSG_CLASS_NOT_SERVED [];
};

PEGASUS_NAMESPACE_END

#endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2