1 kumpf 1.1 //%2006////////////////////////////////////////////////////////////////////////
2 //
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 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
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 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 kumpf 1.1 // 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 Pegasus_OOPProviderManagerRouter_h
35 #define Pegasus_OOPProviderManagerRouter_h
36
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/String.h>
39 #include <Pegasus/Common/HashTable.h>
40 #include <Pegasus/Common/CIMMessage.h>
41
42 #include <Pegasus/ProviderManager2/ProviderManager.h>
43 kumpf 1.1 #include <Pegasus/ProviderManagerService/ProviderManagerRouter.h>
44 #include <Pegasus/ProviderManagerService/Linkage.h>
45
46 PEGASUS_NAMESPACE_BEGIN
47
48 typedef void (*PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T)(const String &,
49 const String &, Uint16);
50
51 class ProviderAgentContainer;
52
53 typedef HashTable<String, ProviderAgentContainer*, EqualFunc<String>,
54 HashFunc<String> > ProviderAgentTable;
55
56 class PEGASUS_PMS_LINKAGE OOPProviderManagerRouter
57 : public ProviderManagerRouter
58 {
59 public:
60 OOPProviderManagerRouter(
61 PEGASUS_INDICATION_CALLBACK_T indicationCallback,
62 PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
63 PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback);
64 kumpf 1.1
65 virtual ~OOPProviderManagerRouter();
66
67 virtual Message* processMessage(Message* message);
68
69 virtual Boolean hasActiveProviders();
70 virtual void unloadIdleProviders();
71
72 private:
73 //
74 // Private methods
75 //
76
77 /** Unimplemented */
78 OOPProviderManagerRouter();
79 /** Unimplemented */
80 OOPProviderManagerRouter(const OOPProviderManagerRouter&);
81 /** Unimplemented */
82 OOPProviderManagerRouter& operator=(const OOPProviderManagerRouter&);
83
84 /**
85 kumpf 1.1 Return a pointer to the ProviderAgentContainer for the specified
86 module instance and requesting user. If no appropriate
87 ProviderAgentContainer exists, one is created in an uninitialized state.
88 */
89 ProviderAgentContainer* _lookupProviderAgent(
90 const CIMInstance& providerModule,
91 CIMRequestMessage* request);
92
93 /**
94 Return an array of pointers to ProviderAgentContainers for the
95 specified moduleName.
96 */
97 Array<ProviderAgentContainer*> _lookupProviderAgents(
98 const String& moduleName);
99
100 /**
101 Send the specified CIMRequestMessage to all initialized Provider
102 Agents in the _providerAgentTable.
103 */
104 CIMResponseMessage* _forwardRequestToAllAgents(CIMRequestMessage* request);
105
106 kumpf 1.1 //
107 // Private data
108 //
109
110 /**
111 Callback function to which all generated indications are sent for
112 processing.
113 */
114 PEGASUS_INDICATION_CALLBACK_T _indicationCallback;
115
116 /**
117 Callback function to which all response chunks are sent for processing.
118 */
119 PEGASUS_RESPONSE_CHUNK_CALLBACK_T _responseChunkCallback;
120
121 /**
122 Callback function to be called upon detection of failure of a
123 provider module.
124 */
125 PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T _providerModuleFailCallback;
126
127 kumpf 1.1 /**
128 The _providerAgentTable contains a ProviderAgentContainer entry for
129 each of the Provider Agent processes for which a request has been
130 processed. ProviderAgentContainer objects are persistent; once one
131 is created it is never deleted.
132 */
133 ProviderAgentTable _providerAgentTable;
134 /**
135 The _providerAgentTableMutex must be locked whenever the
136 _providerAgentTable is accessed.
137 */
138 Mutex _providerAgentTableMutex;
139 };
140
141 PEGASUS_NAMESPACE_END
142
143 #endif
|