1 martin 1.27 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.28 //
|
3 martin 1.27 // 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.28 //
|
10 martin 1.27 // 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.28 //
|
17 martin 1.27 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.28 //
|
20 martin 1.27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.28 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.27 // 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.28 //
|
28 martin 1.27 //////////////////////////////////////////////////////////////////////////
|
29 schuur 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
|
32 schuur 1.5 #include "CMPI_Version.h"
|
33 schuur 1.3
|
34 schuur 1.1 #include "CMPI_ObjectPath.h"
35
36 #include "CMPI_Ftabs.h"
37 #include "CMPI_Value.h"
38 #include "CMPI_String.h"
|
39 r.kieninger 1.28.4.4 #include "CMPI_Broker.h"
|
40 r.kieninger 1.28.4.1 #include "CMPISCMOUtilities.h"
|
41 ms.aruran 1.24 #include <Pegasus/Common/Tracer.h>
|
42 schuur 1.1
43 PEGASUS_USING_STD;
44 PEGASUS_NAMESPACE_BEGIN
45
|
46 venkat.puvvada 1.23 extern "C"
47 {
48 static CMPIStatus refRelease(CMPIObjectPath* eRef)
49 {
|
50 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
51 venkat.puvvada 1.23 if (ref)
52 {
53 delete ref;
54 (reinterpret_cast<CMPI_Object*>(eRef))->unlinkAndDelete();
55 CMReturn(CMPI_RC_OK);
56 }
57 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
58 }
59
60 static CMPIStatus refReleaseNop(CMPIObjectPath* eRef)
61 {
62 CMReturn(CMPI_RC_OK);
63 }
64
65 static CMPIObjectPath* refClone(const CMPIObjectPath* eRef, CMPIStatus* rc)
66 {
|
67 r.kieninger 1.28.4.1 SCMOInstance *ref=(SCMOInstance*)eRef->hdl;
|
68 venkat.puvvada 1.23 if (!ref)
69 {
|
70 ms.aruran 1.24 PEG_TRACE_CSTRING(
71 TRC_CMPIPROVIDERINTERFACE,
72 Tracer::LEVEL2,
73 "Received invalid handle in CMPIObjectPath:refClone");
|
74 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
75 return NULL;
76 }
|
77 r.kieninger 1.28.4.1
78 try
79 {
80 // Since we make no difference between ObjectPath and Instance,
81 // we simply clone using the ObjectPathOnly option.
82 SCMOInstance* nRef = new SCMOInstance(ref->clone(true));
83 CMPIObjectPath* cmpiObjPath =
|
84 r.kieninger 1.28.4.8 reinterpret_cast<CMPIObjectPath *>
85 (new CMPI_Object(nRef,CMPI_Object::ObjectTypeObjectPath));
|
86 r.kieninger 1.28.4.1 CMSetStatus(rc,CMPI_RC_OK);
87 return cmpiObjPath;
88 }
89 catch (const PEGASUS_STD(bad_alloc)&)
90 {
91 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
92 return NULL;
93 }
|
94 venkat.puvvada 1.23 }
95
96 static CMPIStatus refSetNameSpace(CMPIObjectPath* eRef, const char *ns)
97 {
|
98 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
99 venkat.puvvada 1.23 if (!ref)
100 {
|
101 ms.aruran 1.24 PEG_TRACE_CSTRING(
102 TRC_CMPIPROVIDERINTERFACE,
|
103 marek 1.26 Tracer::LEVEL1,
|
104 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetNameSpace");
|
105 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
106 }
|
107 r.kieninger 1.28.4.1
|
108 venkat.puvvada 1.23 if (!ns)
109 {
|
110 ms.aruran 1.24 PEG_TRACE_CSTRING(
111 TRC_CMPIPROVIDERINTERFACE,
|
112 marek 1.26 Tracer::LEVEL1,
|
113 ms.aruran 1.24 "Received invalid Parameter in \
114 CMPIObjectPath:refSetNameSpace");
|
115 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
116 }
|
117 r.kieninger 1.28.4.1
118
|
119 r.kieninger 1.28.4.4 // Check if the namespace is at all different from the one already set
|
120 marek 1.28.4.10 Uint64 prevNamespaceL;
121 const char* prevNamespace = ref->getNameSpace_l(prevNamespaceL);
122 Uint64 nsL=strlen(ns);
123
124 if (prevNamespace &&
125 System::strncasecmp(prevNamespace,prevNamespaceL,ns,nsL))
|
126 r.kieninger 1.28.4.1 {
|
127 r.kieninger 1.28.4.4 CMReturn(CMPI_RC_OK);
|
128 r.kieninger 1.28.4.1 }
|
129 marek 1.28.4.10 ref->setNameSpace_l(ns,nsL);
|
130 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
131 }
132
133 static CMPIString* refGetNameSpace(
134 const CMPIObjectPath* eRef,
135 CMPIStatus* rc)
136 {
|
137 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
138 venkat.puvvada 1.23 if (!ref)
139 {
|
140 ms.aruran 1.24 PEG_TRACE_CSTRING(
141 TRC_CMPIPROVIDERINTERFACE,
|
142 marek 1.26 Tracer::LEVEL1,
|
143 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetNameSpace");
|
144 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
145 return NULL;
146 }
|
147 r.kieninger 1.28.4.1 const char *ns = ref->getNameSpace();
148 CMPIString *eNs = string2CMPIString(ns);
|
149 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
150 return eNs;
151 }
152
153 static CMPIStatus refSetHostname(CMPIObjectPath* eRef, const char *hn)
154 {
|
155 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
156 venkat.puvvada 1.23 if (!ref)
157 {
|
158 ms.aruran 1.24 PEG_TRACE_CSTRING(
159 TRC_CMPIPROVIDERINTERFACE,
|
160 marek 1.26 Tracer::LEVEL1,
|
161 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetHostName");
|
162 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
163 }
164 if (!hn)
165 {
|
166 ms.aruran 1.24 PEG_TRACE((
167 TRC_CMPIPROVIDERINTERFACE,
|
168 marek 1.26 Tracer::LEVEL1,
|
169 ms.aruran 1.24 "Received invalid parameter %s in \
|
170 kamal.locahana 1.25 CMPIObjectPath:refSetHostName", hn));
|
171 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
172 }
|
173 r.kieninger 1.28.4.1 ref->setHostName(hn);
|
174 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
175 }
176
177 static CMPIString* refGetHostname(
178 const CMPIObjectPath* eRef,
179 CMPIStatus* rc)
180 {
|
181 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
182 venkat.puvvada 1.23 if (!ref)
183 {
|
184 ms.aruran 1.24 PEG_TRACE_CSTRING(
185 TRC_CMPIPROVIDERINTERFACE,
|
186 marek 1.26 Tracer::LEVEL1,
|
187 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetHostName");
|
188 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
189 return NULL;
190 }
|
191 r.kieninger 1.28.4.1 const char* hn = ref->getHostName();
|
192 marek 1.28.4.10 CMPIString *eHn = string2CMPIString(hn);
|
193 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
194 return eHn;
195 }
196
197 static CMPIStatus refSetClassName(CMPIObjectPath* eRef, const char *cn)
198 {
|
199 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
200 venkat.puvvada 1.23 if (!ref)
201 {
|
202 ms.aruran 1.24 PEG_TRACE_CSTRING(
203 TRC_CMPIPROVIDERINTERFACE,
|
204 marek 1.26 Tracer::LEVEL1,
|
205 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetClassName");
|
206 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
207 }
208 if (!cn)
209 {
|
210 ms.aruran 1.24 PEG_TRACE((
211 TRC_CMPIPROVIDERINTERFACE,
|
212 marek 1.26 Tracer::LEVEL1,
|
213 ms.aruran 1.24 "Received invalid parameter %s in \
|
214 kamal.locahana 1.25 CMPIObjectPath:refSetClassName", cn));
|
215 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
216 }
|
217 r.kieninger 1.28.4.4
218 // Check if the classname is at all different from the one already set
|
219 marek 1.28.4.10 Uint64 prevClsL;
220 const char* prevCls = ref->getClassName_l(prevClsL);
221 Uint64 cnL=strlen(cn);
222
223 if (prevCls && System::strncasecmp(prevCls,prevClsL,cn,cnL))
|
224 r.kieninger 1.28.4.4 {
225 CMReturn(CMPI_RC_OK);
226 }
|
227 marek 1.28.4.10 ref->setClassName_l(cn,cnL);
|
228 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
229 }
230
231 static CMPIString* refGetClassName(
232 const CMPIObjectPath* eRef,
233 CMPIStatus* rc)
234 {
|
235 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
236 venkat.puvvada 1.23 if (!ref)
237 {
|
238 ms.aruran 1.24 PEG_TRACE_CSTRING(
239 TRC_CMPIPROVIDERINTERFACE,
|
240 marek 1.26 Tracer::LEVEL1,
|
241 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetClassName");
|
242 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
243 return NULL;
244 }
|
245 r.kieninger 1.28.4.1 const char* cn = ref->getClassName();
|
246 marek 1.28.4.10 CMPIString* eCn = string2CMPIString(cn);
|
247 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
248 return eCn;
249 }
250
251
252 static CMPIStatus refAddKey(
253 CMPIObjectPath* eRef,
254 const char *name,
255 const CMPIValue* data,
256 const CMPIType type)
257 {
|
258 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
259 venkat.puvvada 1.23 if (!ref)
260 {
|
261 ms.aruran 1.24 PEG_TRACE_CSTRING(
262 TRC_CMPIPROVIDERINTERFACE,
|
263 marek 1.26 Tracer::LEVEL1,
|
264 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refAddKey");
|
265 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
266 }
|
267 r.kieninger 1.28.4.1
|
268 venkat.puvvada 1.23 if (!name)
269 {
|
270 ms.aruran 1.24 PEG_TRACE((
271 TRC_CMPIPROVIDERINTERFACE,
|
272 marek 1.26 Tracer::LEVEL1,
|
273 ms.aruran 1.24 "Received invalid parameter %s in \
|
274 kamal.locahana 1.25 CMPIObjectPath:refAddKey", name));
|
275 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
276 }
277
|
278 r.kieninger 1.28.4.1
279 if ((type & CMPI_ARRAY) || (type == CMPI_instance))
|
280 venkat.puvvada 1.23 {
|
281 r.kieninger 1.28.4.1 PEG_TRACE((
282 TRC_CMPIPROVIDERINTERFACE,
283 Tracer::LEVEL1,
284 "Received invalid type %X for parameter %s in \
285 CMPIObjectPath:refAddKey", type, name));
286 CMReturn(CMPI_RC_ERR_INVALID_DATA_TYPE);
287 }
288
|
289 r.kieninger 1.28.4.2 CIMType cimType=type2CIMType(type);
290
291 CMPIrc cmpiRC = CMPI_RC_OK;
292 SCMBUnion scmoData = value2SCMOValue(data, type);
293 if (cmpiRC != CMPI_RC_OK)
|
294 r.kieninger 1.28.4.1 {
|
295 r.kieninger 1.28.4.2 PEG_TRACE((
296 TRC_CMPIPROVIDERINTERFACE,
297 Tracer::LEVEL1,
298 "Failed to convert CMPIData to SCMOValue in \
299 CMPIObjectPath:refAddKey(%d,%s)", type, name));
300 CMReturn(cmpiRC);
|
301 r.kieninger 1.28.4.1 }
302
|
303 marek 1.28.4.10 SCMO_RC rc = ref->setKeyBinding(name,
304 cimType,
|
305 r.kieninger 1.28.4.2 &scmoData);
|
306 r.kieninger 1.28.4.1
307 switch (rc)
308 {
309 case SCMO_OK:
310 // Just fall through to the end
311 break;
312 case SCMO_TYPE_MISSMATCH:
313 PEG_TRACE((
314 TRC_CMPIPROVIDERINTERFACE,
315 Tracer::LEVEL1,
316 "Received invalid type %d in \
317 CMPIObjectPath:refAddKey", type));
318 CMReturn(CMPI_RC_ERR_INVALID_DATA_TYPE);
319 break;
320 case SCMO_NOT_FOUND:
321 PEG_TRACE((
322 TRC_CMPIPROVIDERINTERFACE,
323 Tracer::LEVEL1,
324 "Received invalid parameter %s in \
325 CMPIObjectPath:refAddKey", name));
326 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
327 r.kieninger 1.28.4.1 break;
328 default:
329 PEG_TRACE((
330 TRC_CMPIPROVIDERINTERFACE,
331 Tracer::LEVEL1,
332 "Unknow error %d in \
333 CMPIObjectPath:refAddKey", rc));
334 CMReturn(CMPI_RC_ERR_FAILED);
335 break;
|
336 venkat.puvvada 1.23 }
337
338 CMReturn(CMPI_RC_OK);
339 }
340
341 static CMPIData refGetKey(
342 const CMPIObjectPath* eRef,
343 const char *name,
344 CMPIStatus* rc)
345 {
|
346 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
347 r.kieninger 1.28.4.7 // Attn: According to CMPI 2.0 specification CMPIData.state
348 // shall be set to CMPI_noValue in case of an error.
349 // But this is not yet defined in cmpidt.h
|
350 venkat.puvvada 1.23 CMPIData data = {0, CMPI_nullValue | CMPI_notFound, {0}};
351
352 if (!ref)
353 {
|
354 ms.aruran 1.24 PEG_TRACE_CSTRING(
355 TRC_CMPIPROVIDERINTERFACE,
|
356 marek 1.26 Tracer::LEVEL1,
|
357 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKey");
|
358 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
359 return data;
360 }
361 if (!name)
362 {
|
363 ms.aruran 1.24 PEG_TRACE((
364 TRC_CMPIPROVIDERINTERFACE,
|
365 marek 1.26 Tracer::LEVEL1,
|
366 ms.aruran 1.24 "Received invalid parameter %s in \
|
367 kamal.locahana 1.25 CMPIObjectPath:refGetKey", name));
|
368 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
369 return data;
370 }
371
|
372 r.kieninger 1.28.4.2
373 const SCMBUnion* keyValue=0;
374 CIMType type;
|
375 r.kieninger 1.28.4.1
376 SCMO_RC src = ref->getKeyBinding(name, type, &keyValue);
377 if (src == SCMO_OK)
|
378 venkat.puvvada 1.23 {
|
379 r.kieninger 1.28.4.2 CMPIType ct=type2CMPIType(type, false);
380 CMPISCMOUtilities::scmoValue2CMPIData( keyValue, ct, &data );
|
381 r.kieninger 1.28.4.7
|
382 r.kieninger 1.28.4.3 if ((ct&~CMPI_ARRAY) == CMPI_string)
383 {
384 // We always receive strings as an array of pointers
385 // with at least one element, which needs to be released
386 // after it was converted to CMPIData
387 free((void*)keyValue);
388 }
|
389 r.kieninger 1.28.4.7
390 data.state |= CMPI_keyValue;
391
392 //TODO: Convert all types to keytypes
393 // datetime->string
394 // real->string
|
395 marek 1.28.4.10 switch (ct)
|
396 r.kieninger 1.28.4.7 {
397 case CMPI_uint8:
398 data.value.uint64=(CMPIUint64)data.value.uint8;
399 break;
400 case CMPI_uint16:
401 data.value.uint64=(CMPIUint64)data.value.uint16;
402 break;
403 case CMPI_uint32:
404 data.value.uint64=(CMPIUint64)data.value.uint32;
405 break;
406 case CMPI_sint8:
407 data.value.sint64=(CMPISint64)data.value.sint8;
408 break;
409 case CMPI_sint16:
410 data.value.sint64=(CMPISint64)data.value.sint16;
411 break;
412 case CMPI_sint32:
413 data.value.sint64=(CMPISint64)data.value.sint32;
414 break;
415 }
416
|
417 r.kieninger 1.28.4.1 CMSetStatus(rc, CMPI_RC_OK);
418 }
419 else
420 {
421 // Either SCMO_NULL_VALUE or SCMO_NOT_FOUND
422 CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND);
|
423 r.kieninger 1.28.4.7 // TODO: According to the CMPI Specification this should be
424 // really CMPI_RC_ERR_NO_SUCH_PROPERTY
|
425 venkat.puvvada 1.23 }
|
426 r.kieninger 1.28.4.1
|
427 venkat.puvvada 1.23 return data;
428 }
429
430 static CMPIData refGetKeyAt(
431 const CMPIObjectPath* eRef,
432 unsigned pos,
433 CMPIString** name,
434 CMPIStatus* rc)
435 {
|
436 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
437 venkat.puvvada 1.23 CMPIData data = {0, CMPI_nullValue | CMPI_notFound, {0}};
438
439 if (!ref)
440 {
|
441 ms.aruran 1.24 PEG_TRACE_CSTRING(
442 TRC_CMPIPROVIDERINTERFACE,
|
443 marek 1.26 Tracer::LEVEL1,
|
444 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKeyAt");
|
445 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
446 return data;
447 }
448
449
|
450 r.kieninger 1.28.4.2 const SCMBUnion* keyValue=0;
|
451 r.kieninger 1.28.4.1 const char* keyName=0;
|
452 r.kieninger 1.28.4.2 CIMType type;
|
453 r.kieninger 1.28.4.1
454 SCMO_RC src = ref->getKeyBindingAt(pos, &keyName, type, &keyValue);
455 if (src == SCMO_OK)
|
456 venkat.puvvada 1.23 {
|
457 r.kieninger 1.28.4.2 CMPIType ct=type2CMPIType(type, false);
458 CMPISCMOUtilities::scmoValue2CMPIData( keyValue, ct, &data );
|
459 r.kieninger 1.28.4.3 if ((ct&~CMPI_ARRAY) == CMPI_string)
460 {
461 // We always receive strings as an array of pointers
462 // with at least one element, which needs to be released
463 // after it was converted to CMPIData
464 free((void*)keyValue);
465 }
|
466 r.kieninger 1.28.4.1 CMSetStatus(rc, CMPI_RC_OK);
467 }
468 else
469 {
470 // Either SCMO_NULL_VALUE or SCMO_INDEX_OUT_OF_BOUND
|
471 ms.aruran 1.24 PEG_TRACE_CSTRING(
472 TRC_CMPIPROVIDERINTERFACE,
|
473 marek 1.26 Tracer::LEVEL1,
|
474 ms.aruran 1.24 "Property Not Found - CMPIObjectPath:refGetKeyAt");
|
475 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
476 }
477
|
478 r.kieninger 1.28.4.5 if (keyName && name)
|
479 venkat.puvvada 1.23 {
|
480 r.kieninger 1.28.4.1 *name = (CMPIString*)string2CMPIString(keyName);
|
481 venkat.puvvada 1.23 }
|
482 r.kieninger 1.28.4.1
|
483 venkat.puvvada 1.23 return data;
484 }
485
486 static CMPICount refGetKeyCount(const CMPIObjectPath* eRef, CMPIStatus* rc)
487 {
|
488 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
489 venkat.puvvada 1.23 if (!ref)
490 {
|
491 ms.aruran 1.24 PEG_TRACE_CSTRING(
492 TRC_CMPIPROVIDERINTERFACE,
|
493 marek 1.26 Tracer::LEVEL1,
|
494 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKeyCount");
|
495 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
496 return 0;
497 }
498 CMSetStatus(rc, CMPI_RC_OK);
|
499 r.kieninger 1.28.4.1 return ref->getKeyBindingCount();
|
500 venkat.puvvada 1.23 }
501
502 static CMPIStatus refSetNameSpaceFromObjectPath(
503 CMPIObjectPath* eRef,
504 const CMPIObjectPath* eSrc)
505 {
|
506 r.kieninger 1.28.4.4 SCMOInstance* src = (SCMOInstance*)eSrc->hdl;
507 if (!src)
|
508 venkat.puvvada 1.23 {
|
509 ms.aruran 1.24 PEG_TRACE_CSTRING(
510 TRC_CMPIPROVIDERINTERFACE,
|
511 marek 1.26 Tracer::LEVEL1,
|
512 ms.aruran 1.24 "Received invalid handle in \
513 CMPIObjectPath:refSetNameSpaceFromObjectPath");
|
514 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
515 }
|
516 r.kieninger 1.28.4.6
517 return refSetNameSpace(eRef, src->getNameSpace());
|
518 venkat.puvvada 1.23 }
519
520 static CMPIStatus refSetHostAndNameSpaceFromObjectPath(
521 CMPIObjectPath* eRef,
522 const CMPIObjectPath* eSrc)
523 {
|
524 r.kieninger 1.28.4.4 SCMOInstance* src = (SCMOInstance*)eSrc->hdl;
525 if (!src)
|
526 venkat.puvvada 1.23 {
|
527 ms.aruran 1.24 PEG_TRACE_CSTRING(
528 TRC_CMPIPROVIDERINTERFACE,
|
529 marek 1.26 Tracer::LEVEL1,
|
530 ms.aruran 1.24 "Received invalid handle in \
531 CMPIObjectPath:refSetHostAndNameSpaceFromObjectPath");
|
532 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
533 }
|
534 r.kieninger 1.28.4.4
|
535 r.kieninger 1.28.4.6 CMPIStatus rc = refSetNameSpace(eRef, src->getNameSpace());
|
536 r.kieninger 1.28.4.4
537 if (rc.rc != CMPI_RC_OK)
538 {
539 return rc;
540 }
541
542 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
543 if (ref)
544 {
545 ref->setHostName(src->getHostName());
546 }
547
|
548 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
549 }
550
551 static CMPIString *refToString(const CMPIObjectPath* eRef, CMPIStatus* rc)
552 {
|
553 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
554 venkat.puvvada 1.23 if (!ref)
555 {
|
556 ms.aruran 1.24 PEG_TRACE_CSTRING(
557 TRC_CMPIPROVIDERINTERFACE,
|
558 marek 1.26 Tracer::LEVEL1,
|
559 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refToString");
|
560 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
561 return NULL;
562 }
|
563 r.kieninger 1.28.4.1
564 // Convert to string using CIMObjectPath to guarantee same string
565 // represenation for ObjectPaths.
566 CIMObjectPath cimObjPath;
567 ref->getCIMObjectPath(cimObjPath);
568 String str = cimObjPath.toString();
569
|
570 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
|
571 r.kieninger 1.28.4.1 return string2CMPIString(str);
|
572 venkat.puvvada 1.23 }
|
573 schuur 1.1
574 }
575
|
576 venkat.puvvada 1.23 CMPIObjectPathFT objectPath_FT =
577 {
578 CMPICurrentVersion,
579 refRelease,
580 refClone,
581 refSetNameSpace,
582 refGetNameSpace,
583 refSetHostname,
584 refGetHostname,
585 refSetClassName,
586 refGetClassName,
587 refAddKey,
588 refGetKey,
589 refGetKeyAt,
590 refGetKeyCount,
591 refSetNameSpaceFromObjectPath,
592 refSetHostAndNameSpaceFromObjectPath,
593 NULL,
594 NULL,
595 NULL,
596 NULL,
597 venkat.puvvada 1.23 refToString
|
598 schuur 1.1 };
599
|
600 venkat.puvvada 1.23 CMPIObjectPathFT *CMPI_ObjectPath_Ftab = &objectPath_FT;
|
601 schuur 1.1
|
602 venkat.puvvada 1.23 CMPIObjectPathFT objectPathOnStack_FT =
603 {
604 CMPICurrentVersion,
605 refReleaseNop,
606 refClone,
607 refSetNameSpace,
608 refGetNameSpace,
609 refSetHostname,
610 refGetHostname,
611 refSetClassName,
612 refGetClassName,
613 refAddKey,
614 refGetKey,
615 refGetKeyAt,
616 refGetKeyCount,
617 refSetNameSpaceFromObjectPath,
618 refSetHostAndNameSpaceFromObjectPath,
619 NULL,
620 NULL,
621 NULL,
622 NULL,
623 venkat.puvvada 1.23 refToString
|
624 schuur 1.1 };
625
|
626 venkat.puvvada 1.23 CMPIObjectPathFT *CMPI_ObjectPathOnStack_Ftab = &objectPathOnStack_FT;
|
627 schuur 1.1
628
|
629 r.kieninger 1.28.4.1 CMPI_ObjectPathOnStack::CMPI_ObjectPathOnStack(const SCMOInstance& cop)
630 {
631 hdl = (void*)&cop;
632 ft = CMPI_ObjectPathOnStack_Ftab;
633 }
634
|
635 schuur 1.1
636 PEGASUS_NAMESPACE_END
637
|