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

  1 mike  1.2 //%///////-*-c++-*-/////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,
  4           // The Open Group, Tivoli Systems
  5           //
  6           // Permission is hereby granted, free of charge, to any person obtaining a copy
  7           // of this software and associated documentation files (the "Software"), to
  8           // deal in the Software without restriction, including without limitation the
  9           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10           // sell copies of the Software, and to permit persons to whom the Software is
 11           // furnished to do so, subject to the following conditions:
 12           //
 13           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21           //
 22 mike  1.2 //==============================================================================
 23           //
 24           // Author: Mike Brasher (mbrasher@bmc.com)
 25           //
 26           // Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 27           //            : Mike Day (mdday@us.ibm.com)
 28           //            : Yi Zhou (yi_zhou@hp.com)
 29           //            : Carol Ann Krug Graves, Hewlett-Packard Company
 30           //              (carolann_graves@hp.com)
 31           //
 32           //
 33           //%/////////////////////////////////////////////////////////////////////////////
 34           
 35           #ifndef PegasusDispatcher_Dispatcher_h
 36           #define PegasusDispatcher_Dispatcher_h
 37           
 38           #include <Pegasus/Common/Config.h>
 39           #include <Pegasus/Common/IPC.h>
 40           #include <Pegasus/Common/DQueue.h>
 41           #include <Pegasus/Common/Thread.h>
 42           #include <Pegasus/Common/MessageQueue.h>
 43 mike  1.2 #include <Pegasus/Common/CIMMessage.h>
 44           #include <Pegasus/Common/CIMObject.h>
 45           #include <Pegasus/Common/AsyncOpNode.h>
 46 kumpf 1.3 #include <Pegasus/Provider2/AsyncResponseHandler.h>
 47 mike  1.2 #include <Pegasus/Common/OperationContext.h>
 48           #include <Pegasus/Server/ProviderManager.h>
 49           
 50           
 51           PEGASUS_NAMESPACE_BEGIN
 52           
 53           class CIMRepository;
 54           
 55           class PEGASUS_SERVER_LINKAGE CIMOperationRequestDispatcher : public MessageQueue
 56           {
 57           public:
 58                 typedef void (CIMOperationRequestDispatcher::*p_handler)(AsyncOpNode *);
 59                 typedef struct op_async
 60                 {
 61           	    CIMOperationRequestDispatcher *dispatcher;
 62           	    p_handler top_half;
 63           	    p_handler bottom_half;
 64           	    AsyncOpNode *work;
 65           	    op_async(CIMOperationRequestDispatcher *d, 
 66           			       p_handler top, 
 67           			       p_handler bottom,
 68 mike  1.2 			       AsyncOpNode *op)
 69           	    {
 70           	       dispatcher = d;
 71           	       top_half = top;
 72           	       bottom_half = bottom;
 73           	       work = op;
 74           	    }
 75           	    
 76           	    inline Boolean operator==(const void *key) const 
 77           	    { 
 78           	       if ( this == key) 
 79           		  return(true); 
 80           	       return(false);
 81           	    } 
 82           	    inline Boolean operator==(const struct op_async & b) const
 83           	    {
 84           	       return(operator==((const void *)this));
 85           	    }
 86           // call (dispatcher->*top)(work_node);
 87           //	(dispatcher->*bottom)(work_node);    
 88           
 89 mike  1.2       }CIMOperation_async;
 90                 
 91                 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL async_dispatcher(void *parm);
 92                 
 93                 CIMOperationRequestDispatcher(CIMRepository* repository, CIMServer* server);
 94                 
 95                 virtual ~CIMOperationRequestDispatcher();
 96                 
 97                 virtual void handleEnqueue();
 98                 
 99                 virtual const char* getQueueName() const;
100                 
101                 void handleGetClassRequest(
102           	 CIMGetClassRequestMessage* request);
103                 
104                 void handleGetInstanceRequest(
105           	 CIMGetInstanceRequestMessage* request);
106                 
107                 void handleDeleteClassRequest(
108           	 CIMDeleteClassRequestMessage* request);
109                 
110 mike  1.2       void handleDeleteInstanceRequest(
111           	 CIMDeleteInstanceRequestMessage* request);
112                 
113                 void handleCreateClassRequest(
114           	 CIMCreateClassRequestMessage* request);
115                 
116                 void handleCreateInstanceRequest(
117           	 CIMCreateInstanceRequestMessage* request);
118                 
119                 void handleModifyClassRequest(
120           	 
121           	CIMModifyClassRequestMessage* request);
122           
123               void handleModifyInstanceRequest(
124           	CIMModifyInstanceRequestMessage* request);
125           
126               void handleEnumerateClassesRequest(
127           	CIMEnumerateClassesRequestMessage* request);
128           
129               void handleEnumerateClassNamesRequest(
130           	CIMEnumerateClassNamesRequestMessage* request);
131 mike  1.2 
132               void handleEnumerateInstancesRequest(
133           	CIMEnumerateInstancesRequestMessage* request);
134           
135               void handleEnumerateInstanceNamesRequest(
136           	CIMEnumerateInstanceNamesRequestMessage* request);
137           
138               void handleAssociatorsRequest(
139           	CIMAssociatorsRequestMessage* request);
140           
141               void handleAssociatorNamesRequest(
142           	CIMAssociatorNamesRequestMessage* request);
143           
144               void handleReferencesRequest(
145           	CIMReferencesRequestMessage* request);
146           
147               void handleReferenceNamesRequest(
148           	CIMReferenceNamesRequestMessage* request);
149           
150               void handleGetPropertyRequest(
151           	CIMGetPropertyRequestMessage* request);
152 mike  1.2 
153               void handleSetPropertyRequest(
154           	CIMSetPropertyRequestMessage* request);
155           
156               void handleGetQualifierRequest(
157           	CIMGetQualifierRequestMessage* request);
158           
159               void handleSetQualifierRequest(
160           	CIMSetQualifierRequestMessage* request);
161           
162               void handleDeleteQualifierRequest(
163           	CIMDeleteQualifierRequestMessage* request);
164           
165               void handleEnumerateQualifiersRequest(
166           	CIMEnumerateQualifiersRequestMessage* request);
167           
168               void handleInvokeMethodRequest(
169           	CIMInvokeMethodRequestMessage* request);
170           
171               void handleEnableIndicationSubscriptionRequest(
172                   CIMEnableIndicationSubscriptionRequestMessage* request);
173 mike  1.2 
174               void handleModifyIndicationSubscriptionRequest(
175                   CIMModifyIndicationSubscriptionRequestMessage* request);
176           
177               void handleDisableIndicationSubscriptionRequest(
178                   CIMDisableIndicationSubscriptionRequestMessage* request);
179           
180               ProviderManager* getProviderManager(void);
181           
182               void loadRegisteredProviders(void);
183           
184           protected:
185           
186               void _enqueueResponse(
187           	CIMRequestMessage* request,
188           	CIMResponseMessage* response);
189           
190               String _lookupProviderForClass(
191           	const String& nameSpace,
192           	const String& className);
193           
194 mike  1.2       CIMRepository* _repository;
195                 ProviderManager _providerManager;
196                 
197                 Thread _dispatch_thread;
198                 ThreadPool _dispatch_pool; 
199                 
200                 static  PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _qthread (void *);
201                      
202                 DQueue<AsyncOpNode> _opnode_cache;
203                 AsyncDQueue<AsyncOpNode> _waiting_ops;
204                 AsyncDQueue<AsyncOpNode> _started_ops;
205                 AsyncDQueue<AsyncOpNode> _completed_ops;
206                 
207                 AtomicInt _dying ;
208                 friend void async_operation_dispatch(CIMOperationRequestDispatcher *d, 
209           					   void (CIMOperationRequestDispatcher::*top)(AsyncOpNode *),
210           					   void (CIMOperationRequestDispatcher::*bottom)(AsyncOpNode *),
211           					   int rh_type,
212           					   Message *request) 
213           	 throw(IPCException) ;
214           };
215 mike  1.2 
216           PEGASUS_NAMESPACE_END
217           
218           #endif /* PegasusDispatcher_Dispatcher_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2