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

File: [Pegasus] / pegasus / src / Pegasus / IndicationService / Attic / eServer_IndicationService.h (download)
Revision: 1.1.2.1, Thu Feb 6 20:47:03 2003 UTC (21 years, 4 months ago) by mday
Branch: mday-2-0-patches
Changes since 1.1: +275 -0 lines
merged IBM Director updates

//%///////////////////////-*-c++-*-/////////////////////////////////////////////
//
// 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: Mike Day (mdday@us.ibm.com)
//
// based on the HP Indication Service. Simplified and stripped down to be as 
// small as possible with the fewest moving parts. Places the burden advanced
// handling and error recovery on the indication consumer (handler). Uses a 
// less sophisticated event schema 
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef eServer_IndicationService_h
#define eServer_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>
#include <Pegasus/Server/Linkage.h>

PEGASUS_NAMESPACE_BEGIN

/**
   Entry for list of indication providers
*/
struct providerClassList
{
      CIMInstance provider;
      CIMInstance providerModule;
      Array <CIMName> 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 <CIMName> classList;
};

/**
   Table for subscription information.
   The table keys are generated by concatenating the Subscription namespace 
   name, Indication 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;




class PEGASUS_SERVER_LINKAGE eServerIndicationService : public MessageQueueService
{
   public:

      typedef MessageQueueService Base;
      
      eServerIndicationService (
	 CIMRepository *repository,
	 ProviderRegistrationManager *providerRegManager);
      
      ~eServerIndicationService(void);
      
      virtual void handleEnqueue(void); 
      virtual void handleEnqueue(Message *);
      virtual void _handle_async_request(AsyncRequest *req);

      AtomicInt dienow;
      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);

      void _getActiveSubscriptions (Array<CIMInstance> &) const;

      void _getNameSpaceNames (Array<CIMNamespaceName> & ) const;
      
      void _getMatchingSubscriptions(const CIMInstance &, Array<CIMInstance> & ) const;

      void _getMatchingSubscriptions(const String &, 
				     const CIMInstance &,
				     Array<CIMInstance> &) const;
      
      void _getSubscriptions (const String &, Array <CIMInstance> &) const;
      
      void _getIndicationSubclasses (const CIMNamespaceName &, 
				     const CIMName &, 
				     Array<CIMName> & ) const;
      
      void _getIndicationProviders (const CIMNamespaceName &,
				    const CIMName & ,
				    const Array<CIMName> &,
				    const CIMPropertyList &, 
				    Array <ProviderClassList> &) const;
      
      void _generateKey (const CIMInstance &,
			 const CIMInstance &,
			 String &) const;
      

      void _insertEntry ( const CIMInstance &,
			  const CIMInstance &,
			  const Array <CIMName> &);
      
      static void _delete_subscription_cb (AsyncOpNode *, 
					   MessageQueue *, 
					   void *);
      
      void _send_delete_subscription(const Array <ProviderClassList> & ,
				     const CIMNamespaceName &,
				     const CIMInstance &,
				     const String &,
				     const String &);
      
      static void _create_subscription_cb(AsyncOpNode *, 
					  MessageQueue *, 
					  void *);


      Boolean _send_create_subscription(const Array <ProviderClassList> &,
					const String &,
					const CIMPropertyList &,
					const String &,
					const String &,
					const CIMInstance &,
					const String &,
					const String &);
      
      static void _send_enable_indication_cb(AsyncOpNode *,
					     MessageQueue *,
					     void *);
      void _send_enable_indication (const ProviderClassList &);

      static void _send_modify_subscription_callback(AsyncOpNode *,
						     MessageQueue *,
						     void *);
      
      void _send_modify_subscription(const Array <ProviderClassList> &,
				     const String &,
				     const CIMPropertyList &,
				     const String &,
				     const String &,
				     const CIMInstance &,
				     const String &,
				     const String &);
      
      void _get_provider_class_list(const CIMInstance & ,
				    Array<ProviderClassList> & ) const;
      
      void _create_enable_subscription(const Array<CIMInstance> &);
      
      Boolean _get_object_path_from_association(const String &,
						const CIMInstance &, 
						CIMObjectPath &) const ;
      
      Boolean _deliverIndication(const Array<CIMInstance> &, 
				 const CIMInstance &,
				 Array<CIMObjectPath> &);
      
      

      CIMRepository * _repository;

      ProviderRegistrationManager * _providerRegManager;
      // qid of provider manager service 
      Uint32 _providerManager;

      SubscriptionTable _subscriptionTable;

};





PEGASUS_NAMESPACE_END

#endif // eServer_IndicationService_h

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2