1 //%LICENSE////////////////////////////////////////////////////////////////
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //////////////////////////////////////////////////////////////////////////
30 //%/////////////////////////////////////////////////////////////////////////////
32 #ifndef Pegasus_OOPProviderManagerRouter_h
33 #define Pegasus_OOPProviderManagerRouter_h
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/String.h>
37 #include <Pegasus/Common/HashTable.h>
38 #include <Pegasus/Common/CIMMessage.h>
40 #include <Pegasus/ProviderManager2/ProviderManager.h>
41 #include <Pegasus/ProviderManagerService/ProviderManagerRouter.h>
42 #include <Pegasus/ProviderManagerService/Linkage.h>
45 <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
47 PEGASUS_NAMESPACE_BEGIN
49 typedef void (*PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T)(const String &,
50 const String &, Uint16);
52 class ProviderAgentContainer;
54 typedef HashTable<String, ProviderAgentContainer*, EqualFunc<String>,
55 HashFunc<String> > ProviderAgentTable;
57 class PEGASUS_PMS_LINKAGE OOPProviderManagerRouter
58 : public ProviderManagerRouter
61 OOPProviderManagerRouter(
62 ProviderRegistrationManager *providerRegistrationManager,
63 PEGASUS_INDICATION_CALLBACK_T indicationCallback,
64 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
65 PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback);
67 virtual ~OOPProviderManagerRouter();
69 virtual Message* processMessage(Message* message);
71 virtual void unloadIdleProviders();
73 static ProviderRegistrationManager* getProviderRegistrationManager();
80 /** determine moduleName from providerModule, function sets moduleName */
81 void _getProviderModuleName(
82 const CIMInstance & providerModule,
86 Determine groupName from the providerModule. Function sets
87 groupName. A type prefix(grp or mod) is added to distinguish
88 between group and module names.
89 If ModuleGroupName property value is not specified, moduleName is set
92 void _getGroupNameWithType(
93 const CIMInstance &providerModule,
94 String &groupNameWithType);
97 OOPProviderManagerRouter();
99 OOPProviderManagerRouter(const OOPProviderManagerRouter&);
101 OOPProviderManagerRouter& operator=(const OOPProviderManagerRouter&);
104 Return a pointer to the ProviderAgentContainer for the specified
105 module instance and requesting user. If no appropriate
106 ProviderAgentContainer exists, one is created in an uninitialized state.
108 ProviderAgentContainer* _lookupProviderAgent(
109 const CIMInstance& providerModule,
110 CIMRequestMessage* request);
113 Return an array of pointers to ProviderAgentContainers for the
114 specified moduleName.
116 Array<ProviderAgentContainer*> _lookupProviderAgents(
117 const String& moduleName);
120 Send the specified CIMRequestMessage to all initialized Provider
121 Agents in the _providerAgentTable.
123 CIMResponseMessage* _forwardRequestToAllAgents(CIMRequestMessage* request);
130 Callback function to which all generated indications are sent for
133 PEGASUS_INDICATION_CALLBACK_T _indicationCallback;
136 Callback function to which all response chunks are sent for processing.
138 PEGASUS_RESPONSE_CHUNK_CALLBACK_T _responseChunkCallback;
141 Callback function to be called upon detection of failure of a
144 PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T _providerModuleFailCallback;
147 The _providerAgentTable contains a ProviderAgentContainer entry for
148 each of the Provider Agent processes for which a request has been
149 processed. ProviderAgentContainer objects are persistent; once one
150 is created it is never deleted.
152 ProviderAgentTable _providerAgentTable;
154 The _providerAgentTableMutex must be locked whenever the
155 _providerAgentTable is accessed.
157 Mutex _providerAgentTableMutex;
159 static ProviderRegistrationManager *_providerRegistrationManager;
163 PEGASUS_NAMESPACE_END