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

  1 karl  1.76 //%2006////////////////////////////////////////////////////////////////////////
  2 brian.campbell 1.67 //
  3                     // 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                     // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8                     // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl           1.70 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10                     // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl           1.76 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12                     // EMC Corporation; Symantec Corporation; The Open Group.
 13 brian.campbell 1.67 //
 14                     // Permission is hereby granted, free of charge, to any person obtaining a copy
 15                     // of this software and associated documentation files (the "Software"), to
 16                     // deal in the Software without restriction, including without limitation the
 17                     // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18                     // sell copies of the Software, and to permit persons to whom the Software is
 19                     // furnished to do so, subject to the following conditions:
 20 karl           1.76 // 
 21 brian.campbell 1.67 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22                     // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23                     // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24                     // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25                     // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26                     // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27                     // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28                     // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29                     //
 30                     //==============================================================================
 31                     //
 32                     //%/////////////////////////////////////////////////////////////////////////////
 33                     
 34                     #ifndef PegasusDispatcher_Dispatcher_h
 35                     #define PegasusDispatcher_Dispatcher_h
 36                     
 37                     #include <Pegasus/Common/Config.h>
 38                     #include <Pegasus/Common/Thread.h>
 39                     #include <Pegasus/Common/MessageQueue.h>
 40                     #include <Pegasus/Common/CIMMessage.h>
 41                     #include <Pegasus/Common/CIMObject.h>
 42 brian.campbell 1.67 #include <Pegasus/Common/OperationContextInternal.h>
 43                     #include <Pegasus/Common/QueryExpressionRep.h>
 44                     #include <Pegasus/Common/AutoPtr.h>
 45                     
 46                     #include <Pegasus/Repository/CIMRepository.h>
 47                     
 48                     #include <Pegasus/Server/CIMServer.h>
 49 kumpf          1.82 #include \
 50                         <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
 51 brian.campbell 1.67 #include <Pegasus/Server/Linkage.h>
 52                     
 53                     #include <Pegasus/Common/QueryExpressionRep.h>
 54                     
 55                     PEGASUS_NAMESPACE_BEGIN
 56                     
 57                     // Class to aggregate and manage the information about classes and providers
 58                     // this simply masks some of the confusion of control providers, etc. today.
 59                     
 60                     class PEGASUS_SERVER_LINKAGE ProviderInfo
 61                     {
 62                     public:
 63 kumpf          1.82     ProviderInfo(const CIMName& className)
 64 chip           1.72         : className(className),
 65 kumpf          1.82           hasProvider(false),
 66                               hasProviderNormalization(false),
 67                               hasNoQuery(true)
 68 brian.campbell 1.67     {
 69                         }
 70 chip           1.72 
 71                         ProviderInfo(
 72 kumpf          1.82         const CIMName& className,
 73                             const String& serviceName,
 74                             const String& controlProviderName)
 75 chip           1.72         : className(className),
 76 kumpf          1.82           serviceName(serviceName),
 77                               controlProviderName(controlProviderName),
 78                               hasProvider(false),
 79                               hasProviderNormalization(false),
 80                               hasNoQuery(true)
 81 brian.campbell 1.67     {
 82                         }
 83 chip           1.72 
 84 kumpf          1.82     ProviderInfo(const ProviderInfo& providerInfo)
 85 chip           1.72         : className(providerInfo.className),
 86 kumpf          1.82           serviceName(providerInfo.serviceName),
 87                               controlProviderName(providerInfo.controlProviderName),
 88                               hasProvider(providerInfo.hasProvider),
 89                               hasProviderNormalization(false),
 90                               hasNoQuery(providerInfo.hasNoQuery)
 91 brian.campbell 1.67     {
 92                             if (providerInfo.providerIdContainer.get() != 0)
 93                             {
 94                                 providerIdContainer.reset(
 95                                     new ProviderIdContainer(*providerInfo.providerIdContainer));
 96                             }
 97                         }
 98                     
 99 kumpf          1.82     ProviderInfo& operator=(const ProviderInfo& providerInfo)
100 brian.campbell 1.67     {
101                             if (&providerInfo != this)
102                             {
103                                 className = providerInfo.className;
104                                 serviceName = providerInfo.serviceName;
105                                 controlProviderName = providerInfo.controlProviderName;
106                                 hasProvider = providerInfo.hasProvider;
107 chip           1.72             hasProviderNormalization = providerInfo.hasProviderNormalization;
108 brian.campbell 1.67             hasNoQuery = providerInfo.hasNoQuery;
109 chip           1.72 
110 brian.campbell 1.67             providerIdContainer.reset();
111 chip           1.72 
112 brian.campbell 1.67             if (providerInfo.providerIdContainer.get() != 0)
113                                 {
114 kumpf          1.82                 providerIdContainer.reset(new ProviderIdContainer(
115                                         *providerInfo.providerIdContainer.get()));
116 brian.campbell 1.67             }
117                             }
118 chip           1.72 
119 kumpf          1.82         return *this;
120 brian.campbell 1.67     }
121                     
122 chip           1.72     CIMName className;
123                         String serviceName;
124                         String controlProviderName;
125                         Boolean hasProvider;
126                         Boolean hasProviderNormalization;
127                         Boolean hasNoQuery;
128 brian.campbell 1.67     AutoPtr<ProviderIdContainer> providerIdContainer;
129                     
130                     private:
131 kumpf          1.82     ProviderInfo()
132 chip           1.72     {
133                         }
134 brian.campbell 1.67 };
135                     
136                     /* Class to manage the aggregation of data required by post processors. This
137                         class is private to the dispatcher. An instance is created by the operation
138                         dispatcher to aggregate request and response information and used by the
139                         post processor to aggregate responses together.
140                     */
141                     class PEGASUS_SERVER_LINKAGE OperationAggregate
142                     {
143 dave.sudlik    1.78     friend class CIMOperationRequestDispatcher;
144 brian.campbell 1.67 public:
145 kumpf          1.82     /** Operation Aggregate constructor.  Builds an aggregate
146 brian.campbell 1.67         object.
147                             @param request
148                             @param msgRequestType
149                             @param messageId
150                             @param dest
151 kumpf          1.82         @param className
152 brian.campbell 1.67     */
153                         OperationAggregate(CIMRequestMessage* request,
154 kumpf          1.82         Uint32 msgRequestType,
155                             String messageId,
156                             Uint32 dest,
157                             CIMName className,
158                             CIMNamespaceName nameSpace = CIMNamespaceName(),
159                             QueryExpressionRep* query = 0,
160                             String queryLanguage = String::EMPTY);
161 brian.campbell 1.67 
162                         virtual ~OperationAggregate();
163 chip           1.69 
164 brian.campbell 1.67     // Tests validity by checking the magic number we put into the
165                         // packet.
166                     
167                         Boolean valid() const;
168                     
169 kumpf          1.82     // Sets the total issued to the input parameter
170 brian.campbell 1.67 
171                         void setTotalIssued(Uint32 i);
172                     
173                         // Append a new entry to the response list.  Return value indicates
174                         // whether this response is the last one expected
175                     
176                         Boolean appendResponse(CIMResponseMessage* response);
177 chip           1.69 
178 brian.campbell 1.67     Uint32 numberResponses() const;
179                     
180                         CIMRequestMessage* getRequest();
181                     
182                         CIMResponseMessage* getResponse(const Uint32& pos);
183                     
184                         // allow dispatcher to remove the response so it doesn't become
185                         // destroyed when the poA is destroyed.
186                     
187                         CIMResponseMessage* removeResponse(const Uint32& pos);
188                     
189                         void deleteResponse(const Uint32&pos);
190                     
191                         Uint32 getRequestType() const;
192                     
193 kumpf          1.82     void resequenceResponse(CIMResponseMessage& response);
194 brian.campbell 1.67 
195                         String _messageId;
196                         Uint32 _msgRequestType;
197                         Uint32 _dest;
198                         CIMNamespaceName _nameSpace;
199                         CIMName _className;
200                         Array<String> propertyList;
201                         Uint64 _aggregationSN;
202                         QueryExpressionRep* _query;
203                         String _queryLanguage;
204                     
205                     private:
206                         /** Hidden (unimplemented) copy constructor */
207 kumpf          1.77     OperationAggregate(const OperationAggregate& x);
208 brian.campbell 1.67 
209                         Array<CIMResponseMessage*> _responseList;
210                         Mutex _appendResponseMutex;
211 dave.sudlik    1.78     Mutex _enqueueResponseMutex;
212 brian.campbell 1.67     CIMRequestMessage* _request;
213                         Uint32 _totalIssued;
214                         Uint32 _magicNumber;
215 kumpf          1.82     Uint32 _totalReceived;
216                         Uint32 _totalReceivedComplete;
217                         Uint32 _totalReceivedExpected;
218                         Uint32 _totalReceivedErrors;
219 a.dunfey       1.75     Uint32 _totalReceivedNotSupported;
220 brian.campbell 1.67 };
221                     
222 kumpf          1.82 class PEGASUS_SERVER_LINKAGE CIMOperationRequestDispatcher :
223                         public MessageQueueService
224 brian.campbell 1.67 {
225 kumpf          1.82     friend class QuerySupportRouter;
226                     public:
227 brian.campbell 1.67 
228 kumpf          1.82     typedef MessageQueueService Base;
229 brian.campbell 1.67 
230 kumpf          1.82     CIMOperationRequestDispatcher(
231                             CIMRepository* repository,
232                             ProviderRegistrationManager* providerRegistrationManager);
233 brian.campbell 1.67 
234 kumpf          1.82     virtual ~CIMOperationRequestDispatcher();
235 brian.campbell 1.67 
236 kumpf          1.82     virtual void handleEnqueue(Message*);
237 brian.campbell 1.67 
238 kumpf          1.82     virtual void handleEnqueue();
239 brian.campbell 1.67 
240 kumpf          1.82     void handleGetClassRequest(
241                             CIMGetClassRequestMessage* request);
242 brian.campbell 1.67 
243 kumpf          1.82     void handleGetInstanceRequest(
244                             CIMGetInstanceRequestMessage* request);
245 brian.campbell 1.67 
246 kumpf          1.82     void handleDeleteClassRequest(
247                             CIMDeleteClassRequestMessage* request);
248 brian.campbell 1.67 
249 kumpf          1.82     void handleDeleteInstanceRequest(
250                             CIMDeleteInstanceRequestMessage* request);
251 brian.campbell 1.67 
252 kumpf          1.82     void handleCreateClassRequest(
253                             CIMCreateClassRequestMessage* request);
254 brian.campbell 1.67 
255 kumpf          1.82     void handleCreateInstanceRequest(
256                             CIMCreateInstanceRequestMessage* request);
257 brian.campbell 1.67 
258 kumpf          1.82     void handleModifyClassRequest(
259                             CIMModifyClassRequestMessage* request);
260 brian.campbell 1.67 
261 kumpf          1.82     void handleModifyInstanceRequest(
262                             CIMModifyInstanceRequestMessage* request);
263 brian.campbell 1.67 
264 kumpf          1.82     void handleEnumerateClassesRequest(
265                             CIMEnumerateClassesRequestMessage* request);
266 brian.campbell 1.67 
267 kumpf          1.82     void handleEnumerateClassNamesRequest(
268                             CIMEnumerateClassNamesRequestMessage* request);
269 brian.campbell 1.67 
270 kumpf          1.82     void handleEnumerateInstancesRequest(
271                             CIMEnumerateInstancesRequestMessage* request);
272 brian.campbell 1.67 
273 kumpf          1.82     void handleEnumerateInstanceNamesRequest(
274                             CIMEnumerateInstanceNamesRequestMessage* request);
275 brian.campbell 1.67 
276 kumpf          1.82     void handleAssociatorsRequest(
277                             CIMAssociatorsRequestMessage* request);
278 brian.campbell 1.67 
279 kumpf          1.82     void handleAssociatorNamesRequest(
280                             CIMAssociatorNamesRequestMessage* request);
281 brian.campbell 1.67 
282 kumpf          1.82     void handleReferencesRequest(
283                             CIMReferencesRequestMessage* request);
284 brian.campbell 1.67 
285 kumpf          1.82     void handleReferenceNamesRequest(
286                             CIMReferenceNamesRequestMessage* request);
287 brian.campbell 1.67 
288 kumpf          1.82     void handleGetPropertyRequest(
289                             CIMGetPropertyRequestMessage* request);
290 brian.campbell 1.67 
291 kumpf          1.82     void handleSetPropertyRequest(
292                             CIMSetPropertyRequestMessage* request);
293 brian.campbell 1.67 
294 kumpf          1.82     void handleGetQualifierRequest(
295                             CIMGetQualifierRequestMessage* request);
296 brian.campbell 1.67 
297 kumpf          1.82     void handleSetQualifierRequest(
298                             CIMSetQualifierRequestMessage* request);
299 brian.campbell 1.67 
300 kumpf          1.82     void handleDeleteQualifierRequest(
301                             CIMDeleteQualifierRequestMessage* request);
302 brian.campbell 1.67 
303 kumpf          1.82     void handleEnumerateQualifiersRequest(
304                             CIMEnumerateQualifiersRequestMessage* request);
305 brian.campbell 1.67 
306 kumpf          1.82     void handleExecQueryRequest(
307                             CIMExecQueryRequestMessage* request);
308 brian.campbell 1.67 
309 kumpf          1.82     void handleInvokeMethodRequest(
310                             CIMInvokeMethodRequestMessage* request);
311 brian.campbell 1.67 
312 kumpf          1.82     static void _forwardForAggregationCallback(
313                             AsyncOpNode*,
314                             MessageQueue*,
315                             void*);
316 brian.campbell 1.67 
317 kumpf          1.82     static void _forwardRequestCallback(
318                             AsyncOpNode*,
319                             MessageQueue*,
320                             void*);
321 brian.campbell 1.67 
322 kumpf          1.82     // Response Handler functions
323 brian.campbell 1.67 
324 kumpf          1.82     void handleOperationResponseAggregation(OperationAggregate* poA);
325 brian.campbell 1.67 
326 kumpf          1.82     void handleReferencesResponseAggregation(OperationAggregate* poA);
327 brian.campbell 1.67 
328 kumpf          1.82     void handleReferenceNamesResponseAggregation(OperationAggregate* poA);
329 brian.campbell 1.67 
330 kumpf          1.82     void handleAssociatorsResponseAggregation(OperationAggregate* poA);
331 brian.campbell 1.67 
332 kumpf          1.82     void handleAssociatorNamesResponseAggregation(OperationAggregate* poA);
333 brian.campbell 1.67 
334 kumpf          1.82     void handleEnumerateInstancesResponseAggregation(OperationAggregate* poA);
335 brian.campbell 1.67 
336 kumpf          1.82     void handleEnumerateInstanceNamesResponseAggregation(
337                             OperationAggregate* poA);
338 brian.campbell 1.67 
339 kumpf          1.82     void handleExecQueryResponseAggregation(OperationAggregate* poA);
340 brian.campbell 1.67 
341 kumpf          1.82 protected:
342                     
343                         /** _getSubClassNames - Gets the names of all subclasses of the defined
344                             class (including the class) and returns it in an array of strings. Uses
345                             a similar function in the repository class to get the names.
346                             @param namespace
347                             @param className
348                             @return Array of strings with class names.  Note that there should be
349                             at least one classname in the array (the input name)
350                             Note that there is a special exception to this function, the __namespace
351                             class which does not have any representation in the class repository.
352                             @exception CIMException(CIM_ERR_INVALID_CLASS)
353                         */
354 brian.campbell 1.67     Array<CIMName> _getSubClassNames(
355                             const CIMNamespaceName& nameSpace,
356 david.dillard  1.73         const CIMName& className);
357 brian.campbell 1.67 
358                         Boolean _lookupInternalProvider(
359                             const CIMNamespaceName& nameSpace,
360                             const CIMName& className,
361                             String& service,
362                             String& provider);
363                     
364 kumpf          1.82     /* Boolean _lookupNewQueryProvider(
365 brian.campbell 1.67         const CIMNamespaceName& nameSpace,
366                             const CIMName& className,
367                             String& serviceName,
368                             String& controlProviderName,
369 kumpf          1.82         Boolean* notQueryProvider); */
370 brian.campbell 1.67 
371 chip           1.72     ProviderInfo _lookupNewInstanceProvider(
372 brian.campbell 1.67         const CIMNamespaceName& nameSpace,
373 chip           1.72         const CIMName& className);
374 brian.campbell 1.67 
375 kumpf          1.82     /* String _lookupQueryProvider(
376 brian.campbell 1.67         const CIMNamespaceName& nameSpace,
377                             const CIMName& className,
378 kumpf          1.82         Boolean* notQueryProvider); */
379 brian.campbell 1.67 
380 chip           1.72     ProviderInfo _lookupInstanceProvider(
381 brian.campbell 1.67         const CIMNamespaceName& nameSpace,
382 chip           1.72         const CIMName& className);
383 brian.campbell 1.67 
384 kumpf          1.82     /* Array<ProviderInfo> _lookupAllQueryProviders(
385 brian.campbell 1.67         const CIMNamespaceName& nameSpace,
386                             const CIMName& className,
387 david.dillard  1.73         Uint32& providerCount); */
388 brian.campbell 1.67 
389 david.dillard  1.73     // @exception CIMException
390 brian.campbell 1.67     Array<ProviderInfo> _lookupAllInstanceProviders(
391                             const CIMNamespaceName& nameSpace,
392                             const CIMName& className,
393 david.dillard  1.73         Uint32& providerCount);
394 brian.campbell 1.67 
395                         Array<ProviderInfo> _lookupAllAssociationProviders(
396                             const CIMNamespaceName& nameSpace,
397                             const CIMObjectPath& objectName,
398                             const CIMName& assocClass,
399                             const String& role,
400                             Uint32& providerCount);
401                     
402                         Boolean _lookupNewAssociationProvider(
403                             const CIMNamespaceName& nameSpace,
404                             const CIMName& assocClass,
405                             String& serviceName,
406                             String& controlProviderName,
407 kumpf          1.82         ProviderIdContainer** container);
408 brian.campbell 1.67 
409                         Array<String> _lookupAssociationProvider(
410                             const CIMNamespaceName& nameSpace,
411                             const CIMName& assocClass,
412 kumpf          1.82         ProviderIdContainer** container);
413 brian.campbell 1.67 
414 kumpf          1.82     String _lookupMethodProvider(
415                             const CIMNamespaceName& nameSpace,
416                             const CIMName& className,
417                             const CIMName& methodName,
418                             ProviderIdContainer** providerIdContainer);
419 brian.campbell 1.67 
420 kumpf          1.82     void _forwardRequestToService(
421 brian.campbell 1.67         const String& serviceName,
422                             CIMRequestMessage* request,
423 kumpf          1.81         CIMRequestMessage* requestCopy);
424 brian.campbell 1.67 
425 kumpf          1.82     void _forwardRequestForAggregation(
426 brian.campbell 1.67         const String& serviceName,
427                             const String& controlProviderName,
428                             CIMRequestMessage* request,
429                             OperationAggregate* poA,
430 kumpf          1.82         CIMResponseMessage* response = 0);
431 brian.campbell 1.67 
432 kumpf          1.82     void _forwardRequestToProviderManager(
433 brian.campbell 1.67         const CIMName& className,
434                             const String& serviceName,
435                             const String& controlProviderName,
436 kumpf          1.81         CIMRequestMessage* request,
437                             CIMRequestMessage* requestCopy);
438 brian.campbell 1.67 
439 kumpf          1.82     void _getProviderName(
440 kumpf          1.81           const OperationContext& context,
441                               String& moduleName,
442                               String& providerName);
443                     
444 kumpf          1.82     void _logOperation(
445                             const CIMRequestMessage* request,
446                             const CIMResponseMessage* response);
447                     
448                         Boolean _enqueueResponse(
449                             OperationAggregate*& poA,
450                             CIMResponseMessage*& response);
451 kumpf          1.81 
452 kumpf          1.82     void _enqueueResponse(
453                             CIMRequestMessage* request,
454                             CIMResponseMessage* response);
455 brian.campbell 1.67 
456 kumpf          1.82     CIMValue _convertValueType(const CIMValue& value, CIMType type);
457 brian.campbell 1.67 
458 kumpf          1.82     void _fixInvokeMethodParameterTypes(CIMInvokeMethodRequestMessage* request);
459 brian.campbell 1.67 
460 kumpf          1.82     void _fixSetPropertyValueType(CIMSetPropertyRequestMessage* request);
461 brian.campbell 1.67 
462 kumpf          1.82     void _checkExistenceOfClass(
463                             const CIMNamespaceName& nameSpace,
464                             const CIMName& className,
465                             CIMException& cimException);
466 brian.campbell 1.67 
467 kumpf          1.82     CIMClass _getClass(
468                             const CIMNamespaceName& nameSpace,
469                             const CIMName& className,
470                             CIMException& cimException);
471 chip           1.69 
472 kumpf          1.82     CIMRepository* _repository;
473 brian.campbell 1.67 
474 kumpf          1.82     ProviderRegistrationManager* _providerRegistrationManager;
475 brian.campbell 1.67 
476 kumpf          1.82     Boolean _enableAssociationTraversal;
477                         Boolean _enableIndicationService;
478                         Uint32 _maximumEnumerateBreadth;
479                         static Uint64 cimOperationAggregationSN;
480 brian.campbell 1.67 
481 kumpf          1.82 #ifdef PEGASUS_ENABLE_OBJECT_NORMALIZATION
482                         Boolean _enableNormalization;
483                         Array<String> _excludeModulesFromNormalization;
484                     #endif
485 brian.campbell 1.67 
486 kumpf          1.82     // << Tue Feb 12 08:48:09 2002 mdd >> meta dispatcher integration
487                         virtual void _handle_async_request(AsyncRequest* req);
488 brian.campbell 1.67 
489 kumpf          1.82     // the following two methods enable specific query language implementations
490 brian.campbell 1.67 
491 kumpf          1.82     /* void handleQueryRequest(
492                             CIMExecQueryRequestMessage* request);
493 chip           1.71 
494 kumpf          1.82     void handleQueryResponseAggregation(
495                             OperationAggregate* poA);
496 brian.campbell 1.67 
497 kumpf          1.82     void applyQueryToEnumeration(CIMResponseMessage* msg,
498                             QueryExpressionRep* query);
499                         */
500 brian.campbell 1.67 
501 kumpf          1.82 private:
502                         static void _handle_enqueue_callback(AsyncOpNode*, MessageQueue*, void*);
503 brian.campbell 1.67 
504                     };
505                     
506                     PEGASUS_NAMESPACE_END
507                     
508                     #endif /* PegasusDispatcher_Dispatcher_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2