1 martin 1.22 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.23 //
|
3 martin 1.22 // 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.23 //
|
10 martin 1.22 // 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.23 //
|
17 martin 1.22 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.23 //
|
20 martin 1.22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.23 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.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.
|
27 martin 1.23 //
|
28 martin 1.22 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_CMPILocalProviderManager_h
33 #define Pegasus_CMPILocalProviderManager_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/String.h>
37 #include <Pegasus/Common/HashTable.h>
|
38 kumpf 1.16 #include <Pegasus/Common/ArrayInternal.h>
|
39 schuur 1.1
40 #include <Pegasus/ProviderManager2/CMPI/CMPIProvider.h>
41
|
42 schuur 1.4 #include <Pegasus/ProviderManager2/CMPI/Linkage.h>
|
43 schuur 1.1
44 PEGASUS_NAMESPACE_BEGIN
45
|
46 schuur 1.4 class PEGASUS_CMPIPM_LINKAGE CMPILocalProviderManager
|
47 schuur 1.1 {
48
49 public:
|
50 venkat.puvvada 1.17 CMPILocalProviderManager();
51 virtual ~CMPILocalProviderManager();
|
52 schuur 1.1
53 public:
|
54 venkat.puvvada 1.20 OpProviderHolder getProvider(
|
55 venkat.puvvada 1.17 const String & fileName,
56 const String & providerName);
57
|
58 venkat.puvvada 1.20 OpProviderHolder getRemoteProvider(
|
59 venkat.puvvada 1.17 const String & fileName,
60 const String & providerName);
|
61 schuur 1.1
|
62 venkat.puvvada 1.21 Boolean unloadProvider(
63 const String & fileName,
64 const String & providerName);
|
65 schuur 1.1
|
66 venkat.puvvada 1.17 void shutdownAllProviders();
|
67 schuur 1.1
|
68 kumpf 1.5 Boolean hasActiveProviders();
69 void unloadIdleProviders();
|
70 venkat.puvvada 1.19 Boolean isProviderActive(const String &providerName);
|
71 schuur 1.1
|
72 carolann.graves 1.9 /**
73 Gets list of indication providers to be enabled.
74 Once IndicationService initialization has been completed, the
75 enableIndications() method must be called on each indication provider
76 that has current subscriptions.
77
78 @return list of providers whose enableIndications() method must be
79 called
80 */
81 Array <CMPIProvider *> getIndicationProvidersToEnable ();
|
82 venkat.puvvada 1.17 static void cleanupThread(Thread *t, CMPIProvider *p);
|
83 carolann.graves 1.9
|
84 schuur 1.1 private:
85 enum CTRL
86 {
87 INSERT_PROVIDER,
88 INSERT_MODULE,
89 LOOKUP_PROVIDER,
90 LOOKUP_MODULE,
91 GET_PROVIDER,
92 UNLOAD_PROVIDER,
93 UNLOAD_ALL_PROVIDERS,
|
94 schuur 1.3 UNLOAD_IDLE_PROVIDERS
|
95 schuur 1.1 };
96
97 typedef HashTable<String, CMPIProvider *,
98 EqualFunc<String>, HashFunc<String> > ResolverTable;
99
100 typedef HashTable<String, CMPIProvider *,
101 EqualFunc<String>, HashFunc<String> > ProviderTable;
102
103 typedef HashTable<String, CMPIProviderModule *,
104 EqualFunc<String>, HashFunc<String> > ModuleTable;
105
106 typedef struct
107 {
108 const String *providerName;
109 const String *fileName;
|
110 schuur 1.6 const String *location;
|
111 schuur 1.1 } CTRL_STRINGS;
112
113 ResolverTable _resolvers;
114 ProviderTable _providers;
115 ModuleTable _modules;
116 Uint32 _idle_timeout;
117 Sint32 _provider_ctrl(CTRL code, void *parm, void *ret);
118
|
119 dj.gorey 1.2 CMPIProvider* _initProvider(CMPIProvider * provider,
|
120 venkat.puvvada 1.17 const String & moduleFileName);
|
121 dj.gorey 1.2
|
122 venkat.puvvada 1.21 void _unloadProvider(CMPIProvider * provider, Boolean forceUnload = false);
123
124 void _terminateUnloadPendingProviders(
125 Array<CMPIProvider*> &unloadPendingProviders);
|
126 dj.gorey 1.2
127 CMPIProvider * _lookupProvider(const String & providerName);
128
|
129 schuur 1.6 CMPIProviderModule * _lookupModule(const String & moduleFileName);
|
130 dj.gorey 1.2 Mutex _providerTableMutex;
|
131 venkat.puvvada 1.17
132 /*
133 * The cleaning functions for provider threads.
134 */
135
136 static ThreadReturnType PEGASUS_THREAD_CDECL _reaper(void *);
137
138 /*
139 * The data structures for holding the thread and the CMPIProvider
140 */
141
142 struct cleanupThreadRecord : public Linkable
143 {
144 cleanupThreadRecord(): thread(0), provider(0)
145 {
146 }
147 cleanupThreadRecord(Thread *t, CMPIProvider *p): thread(t), provider(p)
148 {
149 }
150 Thread *thread;
151 CMPIProvider *provider;
152 venkat.puvvada 1.17 };
153
154 static Thread* _reaperThread;
155 static Semaphore _pollingSem;
156 static AtomicInt _stopPolling;
157 static Mutex _reaperMutex;
158 static List<cleanupThreadRecord,Mutex> _finishedThreadList;
|
159 konrad.r 1.11
|
160 schuur 1.1 protected:
161
162 };
163
164 PEGASUS_NAMESPACE_END
165
166 #endif
167
|
168 venkat.puvvada 1.17
|