13 kumpf 1.1 //
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 // 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 // Author: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
33 //
34 kumpf 1.1 // Modified By:
35 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38
39 #ifndef Pegasus_CIMOMHandleRep_h
40 #define Pegasus_CIMOMHandleRep_h
41
42 #include <Pegasus/Common/Config.h>
43 #include <Pegasus/Common/OperationContext.h>
44 #include <Pegasus/Common/CIMObject.h>
45 #include <Pegasus/Common/CIMObjectPath.h>
46 #include <Pegasus/Common/CIMClass.h>
47 #include <Pegasus/Common/CIMInstance.h>
48 #include <Pegasus/Common/CIMPropertyList.h>
49 #include <Pegasus/Common/CIMParamValue.h>
50 #include <Pegasus/Common/Sharable.h>
51 #include <Pegasus/Common/IPC.h>
52 #include <Pegasus/Common/InternalException.h>
53 #include <Pegasus/Provider/Linkage.h>
54
55 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
56
57 class ProviderManager;
58 class Provider;
59
60 class CIMOMHandleOpSemaphore;
61
62 class PEGASUS_PROVIDER_LINKAGE CIMOMHandleRep : public Sharable
63 {
64 public:
65 /** */
66 CIMOMHandleRep();
67
68 /** */
69 virtual ~CIMOMHandleRep();
70
71 virtual CIMClass getClass(
72 const OperationContext & context,
73 const CIMNamespaceName& nameSpace,
74 const CIMName& className,
75 Boolean localOnly,
76 kumpf 1.1 Boolean includeQualifiers,
77 Boolean includeClassOrigin,
78 const CIMPropertyList& propertyList) = 0;
79
80 virtual Array<CIMClass> enumerateClasses(
81 const OperationContext & context,
82 const CIMNamespaceName& nameSpace,
83 const CIMName& className,
84 Boolean deepInheritance,
85 Boolean localOnly,
86 Boolean includeQualifiers,
87 Boolean includeClassOrigin) = 0;
88
89 virtual Array<CIMName> enumerateClassNames(
90 const OperationContext & context,
91 const CIMNamespaceName& nameSpace,
92 const CIMName& className,
93 Boolean deepInheritance) = 0;
94
95 virtual void createClass(
96 const OperationContext & context,
97 kumpf 1.1 const CIMNamespaceName& nameSpace,
98 const CIMClass& newClass) = 0;
99
100 virtual void modifyClass(
101 const OperationContext & context,
102 const CIMNamespaceName& nameSpace,
103 const CIMClass& modifiedClass) = 0;
104
105 virtual void deleteClass(
106 const OperationContext & context,
107 const CIMNamespaceName& nameSpace,
108 const CIMName& className) = 0;
109
110 virtual CIMInstance getInstance(
111 const OperationContext & context,
112 const CIMNamespaceName& nameSpace,
113 const CIMObjectPath& instanceName,
114 Boolean localOnly,
115 Boolean includeQualifiers,
116 Boolean includeClassOrigin,
117 const CIMPropertyList& propertyList) = 0;
118 kumpf 1.1
119 virtual Array<CIMInstance> enumerateInstances(
120 const OperationContext & context,
121 const CIMNamespaceName& nameSpace,
122 const CIMName& className,
123 Boolean deepInheritance,
124 Boolean localOnly,
125 Boolean includeQualifiers,
126 Boolean includeClassOrigin,
127 const CIMPropertyList& propertyList) = 0;
128
129 virtual Array<CIMObjectPath> enumerateInstanceNames(
130 const OperationContext & context,
131 const CIMNamespaceName& nameSpace,
132 const CIMName& className) = 0;
133
134 virtual CIMObjectPath createInstance(
135 const OperationContext & context,
136 const CIMNamespaceName& nameSpace,
137 const CIMInstance& newInstance) = 0;
138
139 kumpf 1.1 virtual void modifyInstance(
140 const OperationContext & context,
141 const CIMNamespaceName& nameSpace,
142 const CIMInstance& modifiedInstance,
143 Boolean includeQualifiers,
144 const CIMPropertyList& propertyList) = 0;
145
146 virtual void deleteInstance(
147 const OperationContext & context,
148 const CIMNamespaceName& nameSpace,
149 const CIMObjectPath& instanceName) = 0;
150
151 virtual Array<CIMObject> execQuery(
152 const OperationContext & context,
153 const CIMNamespaceName& nameSpace,
154 const String& queryLanguage,
155 const String& query) = 0;
156
157 virtual Array<CIMObject> associators(
158 const OperationContext & context,
159 const CIMNamespaceName& nameSpace,
160 kumpf 1.1 const CIMObjectPath& objectName,
161 const CIMName& assocClass,
162 const CIMName& resultClass,
163 const String& role,
164 const String& resultRole,
165 Boolean includeQualifiers,
166 Boolean includeClassOrigin,
167 const CIMPropertyList& propertyList) = 0;
168
169 virtual Array<CIMObjectPath> associatorNames(
170 const OperationContext & context,
171 const CIMNamespaceName& nameSpace,
172 const CIMObjectPath& objectName,
173 const CIMName& assocClass,
174 const CIMName& resultClass,
175 const String& role,
176 const String& resultRole) = 0;
177
178 virtual Array<CIMObject> references(
179 const OperationContext & context,
180 const CIMNamespaceName& nameSpace,
181 kumpf 1.1 const CIMObjectPath& objectName,
182 const CIMName& resultClass,
183 const String& role,
184 Boolean includeQualifiers,
185 Boolean includeClassOrigin,
186 const CIMPropertyList& propertyList) = 0;
187
188 virtual Array<CIMObjectPath> referenceNames(
189 const OperationContext & context,
190 const CIMNamespaceName& nameSpace,
191 const CIMObjectPath& objectName,
192 const CIMName& resultClass,
193 const String& role) = 0;
194
195 // property operations
196 virtual CIMValue getProperty(
197 const OperationContext & context,
198 const CIMNamespaceName& nameSpace,
199 const CIMObjectPath& instanceName,
200 const CIMName& propertyName) = 0;
201
202 kumpf 1.1 virtual void setProperty(
203 const OperationContext & context,
204 const CIMNamespaceName& nameSpace,
205 const CIMObjectPath& instanceName,
206 const CIMName& propertyName,
207 const CIMValue& newValue) = 0;
208
209 virtual CIMValue invokeMethod(
210 const OperationContext & context,
211 const CIMNamespaceName& nameSpace,
212 const CIMObjectPath& instanceName,
213 const CIMName& methodName,
214 const Array<CIMParamValue>& inParameters,
215 Array<CIMParamValue>& outParameters) = 0;
216
217 /**
218 Provides a hint to the CIM Server that the provider calling this
219 method prefers not to be unloaded. This hint applies in
220 situations where a provider unload is not necessary, such as
221 when the CIM Server unloads idle providers for efficiency reasons.
222 A provider may rescind this hint by using the allowProviderUnload
223 kumpf 1.1 method. Note that disallowProviderUnload is cumulative, such that
224 each call to disallowProviderUnload must be matched with a call to
225 allowProviderUnload.
226 */
227 virtual void disallowProviderUnload();
228
229 /**
230 Provides a hint to the CIM Server that the provider calling this
231 method no longer prefers not to be unloaded. This hint applies in
232 situations where a provider unload is not necessary, such as
233 when the CIM Server unloads idle providers for efficiency reasons.
234 This method is used to rescind a hint that was given using the
235 disallowProviderUnload method. Note that each allowProviderUnload
236 call should be preceded by a disallowProviderUnload call.
237 */
238 virtual void allowProviderUnload();
239
240 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
241 /**
242 Returns the context of the response to the last request.
243 Currently, the context only contains the ContentLanguageListContainer
244 kumpf 1.1 from the response.
245 Note: this method should be called directly after the call to the
246 CIM request method (getClass, etc), and can only be called once
247 per request.
248 */
249 virtual OperationContext getResponseContext() = 0;
250 #endif
251
252 #ifdef PEGASUS_OS_OS400
253 virtual void setOS400ProfileHandle(const char* profileHandle) = 0;
254 #endif
255
256 virtual void get_idle_timer(struct timeval*);
257 virtual void update_idle_timer();
258 virtual Boolean pending_operation();
259 virtual Boolean unload_ok();
260
261 private:
262 AtomicInt _pendingOperations;
263 struct timeval _idleTime;
264 Mutex _idleTimeMutex;
265 kumpf 1.1 Uint32 _providerUnloadProtect;
266 Mutex _providerUnloadProtectMutex;
267
268 friend class CIMOMHandleOpSemaphore;
269 };
270
271 class PEGASUS_PROVIDER_LINKAGE CIMOMHandleOpSemaphore
272 {
273 public:
274 CIMOMHandleOpSemaphore(CIMOMHandleRep *rep)
275 : _rep(rep)
276 {
277 _rep->update_idle_timer();
278 (_rep->_pendingOperations)++;
279 }
280
281 ~CIMOMHandleOpSemaphore()
282 {
283 _rep->update_idle_timer();
284 (_rep->_pendingOperations)--;
285 }
286 kumpf 1.1
287 private:
288 // Unimplemented
|