1 martin 1.7 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.8 //
|
3 martin 1.7 // 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
8 // License.
|
9 martin 1.8 //
|
10 martin 1.7 // 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:
|
16 martin 1.8 //
|
17 martin 1.7 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.8 //
|
20 martin 1.7 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.8 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.7 // 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.
|
27 martin 1.8 //
|
28 martin 1.7 //////////////////////////////////////////////////////////////////////////
|
29 h.sterling 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_ConsumerManager_h
33 #define Pegasus_ConsumerManager_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/HashTable.h>
37 #include <Pegasus/Common/ArrayInternal.h>
38 #include <Pegasus/Common/CIMInstance.h>
39 #include <Pegasus/Consumer/CIMIndicationConsumer.h>
40 #include <Pegasus/Common/System.h>
|
41 thilo.boehm 1.10
42 #include <Pegasus/General/OptionManager.h>
43
|
44 h.sterling 1.1 #include <Pegasus/DynListener/Linkage.h>
45
46 #include "ConsumerModule.h"
47 #include "DynamicConsumer.h"
48
49 PEGASUS_NAMESPACE_BEGIN
50
|
51 marek 1.6 /** The ConsumerManager class is responsible for managing all of the consumers.
52 * It is also responsible for synchronizing consumer operations.
|
53 h.sterling 1.1 */
54
55 class PEGASUS_DYNLISTENER_LINKAGE ConsumerManager
56 {
57 public:
58
|
59 marek 1.6 ConsumerManager(
60 const String& consumerDir,
61 const String& consumerConfigDir,
62 Boolean enableConsumerUnload,
63 Uint32 idleTimeout);
|
64 h.sterling 1.1
65 virtual ~ConsumerManager();
66
67 String getConsumerDir();
68
69 String getConsumerConfigDir();
70
71 Boolean getEnableConsumerUnload();
72
73 Uint32 getIdleTimeout();
74
75 Boolean hasLoadedConsumers();
76
77 Boolean hasActiveConsumers();
78
79 DynamicConsumer* getConsumer(const String& consumerName);
80
81 void unloadConsumer(const String& consumerName);
82
83 void unloadAllConsumers();
84
85 h.sterling 1.1 void unloadIdleConsumers();
86
87 private:
88
|
89 marek 1.6 typedef HashTable<
90 String,
|
91 kumpf 1.9 DynamicConsumer *,
|
92 marek 1.6 EqualFunc<String>,
93 HashFunc<String> > ConsumerTable;
94
95 typedef HashTable<
96 String,
97 ConsumerModule *,
98 EqualFunc<String>,
99 HashFunc<String> > ModuleTable;
|
100 h.sterling 1.1
101 //consumer queue
102 ConsumerTable _consumers;
103 Mutex _consumerTableMutex;
104
105 //consumer module queue
106 ModuleTable _modules;
107 Mutex _moduleTableMutex;
108
109 //config properties
110 String _consumerDir;
111 String _consumerConfigDir;
112 Boolean _enableConsumerUnload;
113 Uint32 _idleTimeout; //ms
114 Boolean _forceShutdown;
115
|
116 marek 1.6 //ATTN: Bugzilla 3765 - Uncomment when OptionManager has a reset capability
117 //OptionManager _optionMgr;
|
118 h.sterling 1.2
|
119 h.sterling 1.1 //global thread pool
120 ThreadPool* _thread_pool;
121
122 //worker thread
|
123 mike 1.5 static ThreadReturnType PEGASUS_THREAD_CDECL _worker_routine(void *param);
|
124 h.sterling 1.1
125
126 //methods
127
128 ConsumerModule* _lookupModule(const String & moduleFileName);
|
129 kumpf 1.9
|
130 h.sterling 1.1 String _getConsumerLibraryName(const String & consumerName);
131
132 void _initConsumer(const String& consumerName, DynamicConsumer* consumer);
133
134 void _unloadConsumers(Array<DynamicConsumer*> consumersToUnload);
135
136 void _init();
137
|
138 marek 1.6 Array<IndicationDispatchEvent> _deserializeOutstandingIndications(
139 const String& consumerName);
|
140 h.sterling 1.1
|
141 marek 1.6 void _serializeOutstandingIndications(
142 const String& consumerName,
143 Array<IndicationDispatchEvent> indications);
|
144 h.sterling 1.1
145 };
146
147 PEGASUS_NAMESPACE_END
148
149 #endif /* Pegasus_ConsumerManager_h */
150
151
152
|