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.1 #include "CMPISCMOUtilities.h"
|
40 ms.aruran 1.24 #include <Pegasus/Common/Tracer.h>
|
41 schuur 1.1
42 PEGASUS_USING_STD;
43 PEGASUS_NAMESPACE_BEGIN
44
|
45 venkat.puvvada 1.23 extern "C"
46 {
47 static CMPIStatus refRelease(CMPIObjectPath* eRef)
48 {
|
49 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
50 //fprintf(stderr, "refRelease(%p)\n",ref);
|
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 reinterpret_cast<CMPIObjectPath *>(new CMPI_Object(nRef));
85 CMSetStatus(rc,CMPI_RC_OK);
86 return cmpiObjPath;
87 }
88 catch (const PEGASUS_STD(bad_alloc)&)
89 {
90 CMSetStatus(rc, CMPI_RC_ERROR_SYSTEM);
91 return NULL;
92 }
|
93 venkat.puvvada 1.23 }
94
95 static CMPIStatus refSetNameSpace(CMPIObjectPath* eRef, const char *ns)
96 {
|
97 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
98 venkat.puvvada 1.23 if (!ref)
99 {
|
100 ms.aruran 1.24 PEG_TRACE_CSTRING(
101 TRC_CMPIPROVIDERINTERFACE,
|
102 marek 1.26 Tracer::LEVEL1,
|
103 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetNameSpace");
|
104 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
105 }
|
106 r.kieninger 1.28.4.1
|
107 venkat.puvvada 1.23 if (!ns)
108 {
|
109 ms.aruran 1.24 PEG_TRACE_CSTRING(
110 TRC_CMPIPROVIDERINTERFACE,
|
111 marek 1.26 Tracer::LEVEL1,
|
112 ms.aruran 1.24 "Received invalid Parameter in \
113 CMPIObjectPath:refSetNameSpace");
|
114 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
115 }
|
116 r.kieninger 1.28.4.1
117 // --rk-->TBD: Implement this
118 /*const char* prevNamespace = ref->getNameSpace();
119 const char* className = ref->getClassName();
120
121 if (prevNamespace &&
122 0==strcasecmp(prevNamespace,ns)
123 {
124 }
125
126
127 ref->setNameSpace(String(ns));*/
|
128 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
129 }
130
131 static CMPIString* refGetNameSpace(
132 const CMPIObjectPath* eRef,
133 CMPIStatus* rc)
134 {
|
135 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
136 venkat.puvvada 1.23 if (!ref)
137 {
|
138 ms.aruran 1.24 PEG_TRACE_CSTRING(
139 TRC_CMPIPROVIDERINTERFACE,
|
140 marek 1.26 Tracer::LEVEL1,
|
141 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetNameSpace");
|
142 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
143 return NULL;
144 }
|
145 r.kieninger 1.28.4.1 const char *ns = ref->getNameSpace();
146 CMPIString *eNs = string2CMPIString(ns);
|
147 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
148 return eNs;
149 }
150
151 static CMPIStatus refSetHostname(CMPIObjectPath* eRef, const char *hn)
152 {
|
153 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
154 venkat.puvvada 1.23 if (!ref)
155 {
|
156 ms.aruran 1.24 PEG_TRACE_CSTRING(
157 TRC_CMPIPROVIDERINTERFACE,
|
158 marek 1.26 Tracer::LEVEL1,
|
159 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetHostName");
|
160 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
161 }
162 if (!hn)
163 {
|
164 ms.aruran 1.24 PEG_TRACE((
165 TRC_CMPIPROVIDERINTERFACE,
|
166 marek 1.26 Tracer::LEVEL1,
|
167 ms.aruran 1.24 "Received invalid parameter %s in \
|
168 kamal.locahana 1.25 CMPIObjectPath:refSetHostName", hn));
|
169 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
170 }
|
171 r.kieninger 1.28.4.1 ref->setHostName(hn);
|
172 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
173 }
174
175 static CMPIString* refGetHostname(
176 const CMPIObjectPath* eRef,
177 CMPIStatus* rc)
178 {
|
179 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
180 venkat.puvvada 1.23 if (!ref)
181 {
|
182 ms.aruran 1.24 PEG_TRACE_CSTRING(
183 TRC_CMPIPROVIDERINTERFACE,
|
184 marek 1.26 Tracer::LEVEL1,
|
185 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetHostName");
|
186 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
187 return NULL;
188 }
|
189 r.kieninger 1.28.4.1 const char* hn = ref->getHostName();
190 CMPIString *eHn = string2CMPIString(hn);
|
191 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
192 return eHn;
193 }
194
195 static CMPIStatus refSetClassName(CMPIObjectPath* eRef, const char *cn)
196 {
|
197 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
198 venkat.puvvada 1.23 if (!ref)
199 {
|
200 ms.aruran 1.24 PEG_TRACE_CSTRING(
201 TRC_CMPIPROVIDERINTERFACE,
|
202 marek 1.26 Tracer::LEVEL1,
|
203 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refSetClassName");
|
204 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
205 }
206 if (!cn)
207 {
|
208 ms.aruran 1.24 PEG_TRACE((
209 TRC_CMPIPROVIDERINTERFACE,
|
210 marek 1.26 Tracer::LEVEL1,
|
211 ms.aruran 1.24 "Received invalid parameter %s in \
|
212 kamal.locahana 1.25 CMPIObjectPath:refSetClassName", cn));
|
213 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
214 }
|
215 r.kieninger 1.28.4.1 // --rk-->TBD: Implement this
216 //ref->setClassName(String(cn));
|
217 venkat.puvvada 1.23 CMReturn(CMPI_RC_OK);
218 }
219
220 static CMPIString* refGetClassName(
221 const CMPIObjectPath* eRef,
222 CMPIStatus* rc)
223 {
|
224 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
225 venkat.puvvada 1.23 if (!ref)
226 {
|
227 ms.aruran 1.24 PEG_TRACE_CSTRING(
228 TRC_CMPIPROVIDERINTERFACE,
|
229 marek 1.26 Tracer::LEVEL1,
|
230 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetClassName");
|
231 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
232 return NULL;
233 }
|
234 r.kieninger 1.28.4.1 const char* cn = ref->getClassName();
235 CMPIString* eCn = string2CMPIString(cn);
|
236 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
237 return eCn;
238 }
239
240
241 static CMPIStatus refAddKey(
242 CMPIObjectPath* eRef,
243 const char *name,
244 const CMPIValue* data,
245 const CMPIType type)
246 {
|
247 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
248 venkat.puvvada 1.23 if (!ref)
249 {
|
250 ms.aruran 1.24 PEG_TRACE_CSTRING(
251 TRC_CMPIPROVIDERINTERFACE,
|
252 marek 1.26 Tracer::LEVEL1,
|
253 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refAddKey");
|
254 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
255 }
|
256 r.kieninger 1.28.4.1
|
257 venkat.puvvada 1.23 if (!name)
258 {
|
259 ms.aruran 1.24 PEG_TRACE((
260 TRC_CMPIPROVIDERINTERFACE,
|
261 marek 1.26 Tracer::LEVEL1,
|
262 ms.aruran 1.24 "Received invalid parameter %s in \
|
263 kamal.locahana 1.25 CMPIObjectPath:refAddKey", name));
|
264 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
265 }
266
|
267 r.kieninger 1.28.4.1
268 if ((type & CMPI_ARRAY) || (type == CMPI_instance))
|
269 venkat.puvvada 1.23 {
|
270 r.kieninger 1.28.4.1 PEG_TRACE((
271 TRC_CMPIPROVIDERINTERFACE,
272 Tracer::LEVEL1,
273 "Received invalid type %X for parameter %s in \
274 CMPIObjectPath:refAddKey", type, name));
275 CMReturn(CMPI_RC_ERR_INVALID_DATA_TYPE);
276 }
277
|
278 r.kieninger 1.28.4.2 CIMType cimType=type2CIMType(type);
279
280 CMPIrc cmpiRC = CMPI_RC_OK;
281 SCMBUnion scmoData = value2SCMOValue(data, type);
282 if (cmpiRC != CMPI_RC_OK)
|
283 r.kieninger 1.28.4.1 {
|
284 r.kieninger 1.28.4.2 PEG_TRACE((
285 TRC_CMPIPROVIDERINTERFACE,
286 Tracer::LEVEL1,
287 "Failed to convert CMPIData to SCMOValue in \
288 CMPIObjectPath:refAddKey(%d,%s)", type, name));
289 CMReturn(cmpiRC);
|
290 r.kieninger 1.28.4.1 }
291
292 SCMO_RC rc = ref->setKeyBinding(name,
293 cimType,
|
294 r.kieninger 1.28.4.2 &scmoData);
|
295 r.kieninger 1.28.4.1
296 switch (rc)
297 {
298 case SCMO_OK:
299 // Just fall through to the end
300 break;
301 case SCMO_TYPE_MISSMATCH:
302 PEG_TRACE((
303 TRC_CMPIPROVIDERINTERFACE,
304 Tracer::LEVEL1,
305 "Received invalid type %d in \
306 CMPIObjectPath:refAddKey", type));
307 CMReturn(CMPI_RC_ERR_INVALID_DATA_TYPE);
308 break;
309 case SCMO_NOT_FOUND:
310 PEG_TRACE((
311 TRC_CMPIPROVIDERINTERFACE,
312 Tracer::LEVEL1,
313 "Received invalid parameter %s in \
314 CMPIObjectPath:refAddKey", name));
315 CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
316 r.kieninger 1.28.4.1 break;
317 default:
318 PEG_TRACE((
319 TRC_CMPIPROVIDERINTERFACE,
320 Tracer::LEVEL1,
321 "Unknow error %d in \
322 CMPIObjectPath:refAddKey", rc));
323 CMReturn(CMPI_RC_ERR_FAILED);
324 break;
|
325 venkat.puvvada 1.23 }
326
327 CMReturn(CMPI_RC_OK);
328 }
329
330 static CMPIData refGetKey(
331 const CMPIObjectPath* eRef,
332 const char *name,
333 CMPIStatus* rc)
334 {
|
335 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
336 venkat.puvvada 1.23 CMPIData data = {0, CMPI_nullValue | CMPI_notFound, {0}};
337
338 if (!ref)
339 {
|
340 ms.aruran 1.24 PEG_TRACE_CSTRING(
341 TRC_CMPIPROVIDERINTERFACE,
|
342 marek 1.26 Tracer::LEVEL1,
|
343 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKey");
|
344 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
345 return data;
346 }
347 if (!name)
348 {
|
349 ms.aruran 1.24 PEG_TRACE((
350 TRC_CMPIPROVIDERINTERFACE,
|
351 marek 1.26 Tracer::LEVEL1,
|
352 ms.aruran 1.24 "Received invalid parameter %s in \
|
353 kamal.locahana 1.25 CMPIObjectPath:refGetKey", name));
|
354 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_PARAMETER);
355 return data;
356 }
357
|
358 r.kieninger 1.28.4.2
359 const SCMBUnion* keyValue=0;
360 CIMType type;
|
361 r.kieninger 1.28.4.1
362 SCMO_RC src = ref->getKeyBinding(name, type, &keyValue);
363 if (src == SCMO_OK)
|
364 venkat.puvvada 1.23 {
|
365 r.kieninger 1.28.4.2 CMPIType ct=type2CMPIType(type, false);
366 CMPISCMOUtilities::scmoValue2CMPIData( keyValue, ct, &data );
|
367 r.kieninger 1.28.4.3 if ((ct&~CMPI_ARRAY) == CMPI_string)
368 {
369 // We always receive strings as an array of pointers
370 // with at least one element, which needs to be released
371 // after it was converted to CMPIData
372 free((void*)keyValue);
373 }
|
374 r.kieninger 1.28.4.1 CMSetStatus(rc, CMPI_RC_OK);
375 }
376 else
377 {
378 // Either SCMO_NULL_VALUE or SCMO_NOT_FOUND
379 CMSetStatus(rc, CMPI_RC_ERR_NOT_FOUND);
|
380 venkat.puvvada 1.23 }
|
381 r.kieninger 1.28.4.1
|
382 venkat.puvvada 1.23 return data;
383 }
384
385 static CMPIData refGetKeyAt(
386 const CMPIObjectPath* eRef,
387 unsigned pos,
388 CMPIString** name,
389 CMPIStatus* rc)
390 {
|
391 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
392 venkat.puvvada 1.23 CMPIData data = {0, CMPI_nullValue | CMPI_notFound, {0}};
393
394 if (!ref)
395 {
|
396 ms.aruran 1.24 PEG_TRACE_CSTRING(
397 TRC_CMPIPROVIDERINTERFACE,
|
398 marek 1.26 Tracer::LEVEL1,
|
399 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKeyAt");
|
400 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
401 return data;
402 }
403
404
|
405 r.kieninger 1.28.4.2 const SCMBUnion* keyValue=0;
|
406 r.kieninger 1.28.4.1 const char* keyName=0;
|
407 r.kieninger 1.28.4.2 CIMType type;
|
408 r.kieninger 1.28.4.1
409 SCMO_RC src = ref->getKeyBindingAt(pos, &keyName, type, &keyValue);
410 if (src == SCMO_OK)
|
411 venkat.puvvada 1.23 {
|
412 r.kieninger 1.28.4.2 CMPIType ct=type2CMPIType(type, false);
413 CMPISCMOUtilities::scmoValue2CMPIData( keyValue, ct, &data );
|
414 r.kieninger 1.28.4.3 if ((ct&~CMPI_ARRAY) == CMPI_string)
415 {
416 // We always receive strings as an array of pointers
417 // with at least one element, which needs to be released
418 // after it was converted to CMPIData
419 free((void*)keyValue);
420 }
|
421 r.kieninger 1.28.4.1 CMSetStatus(rc, CMPI_RC_OK);
422 }
423 else
424 {
425 // Either SCMO_NULL_VALUE or SCMO_INDEX_OUT_OF_BOUND
|
426 ms.aruran 1.24 PEG_TRACE_CSTRING(
427 TRC_CMPIPROVIDERINTERFACE,
|
428 marek 1.26 Tracer::LEVEL1,
|
429 ms.aruran 1.24 "Property Not Found - CMPIObjectPath:refGetKeyAt");
|
430 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
431 }
432
|
433 r.kieninger 1.28.4.1 if (keyName)
|
434 venkat.puvvada 1.23 {
|
435 r.kieninger 1.28.4.1 *name = (CMPIString*)string2CMPIString(keyName);
|
436 venkat.puvvada 1.23 }
|
437 r.kieninger 1.28.4.1
|
438 venkat.puvvada 1.23 return data;
439 }
440
441 static CMPICount refGetKeyCount(const CMPIObjectPath* eRef, CMPIStatus* rc)
442 {
|
443 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
444 venkat.puvvada 1.23 if (!ref)
445 {
|
446 ms.aruran 1.24 PEG_TRACE_CSTRING(
447 TRC_CMPIPROVIDERINTERFACE,
|
448 marek 1.26 Tracer::LEVEL1,
|
449 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refGetKeyCount");
|
450 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
451 return 0;
452 }
453 CMSetStatus(rc, CMPI_RC_OK);
|
454 r.kieninger 1.28.4.1 return ref->getKeyBindingCount();
|
455 venkat.puvvada 1.23 }
456
457 static CMPIStatus refSetNameSpaceFromObjectPath(
458 CMPIObjectPath* eRef,
459 const CMPIObjectPath* eSrc)
460 {
461 CIMObjectPath* ref = (CIMObjectPath*)eRef->hdl;
462 CIMObjectPath* src = (CIMObjectPath*)eSrc->hdl;
463 if (!ref || !src)
464 {
|
465 ms.aruran 1.24 PEG_TRACE_CSTRING(
466 TRC_CMPIPROVIDERINTERFACE,
|
467 marek 1.26 Tracer::LEVEL1,
|
468 ms.aruran 1.24 "Received invalid handle in \
469 CMPIObjectPath:refSetNameSpaceFromObjectPath");
|
470 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
471 }
472 ref->setNameSpace(src->getNameSpace());
473 CMReturn(CMPI_RC_OK);
474 }
475
476 static CMPIStatus refSetHostAndNameSpaceFromObjectPath(
477 CMPIObjectPath* eRef,
478 const CMPIObjectPath* eSrc)
479 {
480 CIMObjectPath* ref = (CIMObjectPath*)eRef->hdl;
481 CIMObjectPath* src = (CIMObjectPath*)eSrc->hdl;
482 if (!ref || !src)
483 {
|
484 ms.aruran 1.24 PEG_TRACE_CSTRING(
485 TRC_CMPIPROVIDERINTERFACE,
|
486 marek 1.26 Tracer::LEVEL1,
|
487 ms.aruran 1.24 "Received invalid handle in \
488 CMPIObjectPath:refSetHostAndNameSpaceFromObjectPath");
|
489 venkat.puvvada 1.23 CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
490 }
491 ref->setNameSpace(src->getNameSpace());
492 ref->setHost(src->getHost());
493 CMReturn(CMPI_RC_OK);
494 }
495
496 static CMPIString *refToString(const CMPIObjectPath* eRef, CMPIStatus* rc)
497 {
|
498 r.kieninger 1.28.4.1 SCMOInstance* ref = (SCMOInstance*)eRef->hdl;
|
499 venkat.puvvada 1.23 if (!ref)
500 {
|
501 ms.aruran 1.24 PEG_TRACE_CSTRING(
502 TRC_CMPIPROVIDERINTERFACE,
|
503 marek 1.26 Tracer::LEVEL1,
|
504 ms.aruran 1.24 "Received invalid handle in CMPIObjectPath:refToString");
|
505 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
506 return NULL;
507 }
|
508 r.kieninger 1.28.4.1
509 // Convert to string using CIMObjectPath to guarantee same string
510 // represenation for ObjectPaths.
511 CIMObjectPath cimObjPath;
512 ref->getCIMObjectPath(cimObjPath);
513 String str = cimObjPath.toString();
514
|
515 venkat.puvvada 1.23 CMSetStatus(rc, CMPI_RC_OK);
|
516 r.kieninger 1.28.4.1 return string2CMPIString(str);
|
517 venkat.puvvada 1.23 }
|
518 schuur 1.1
519 }
520
|
521 venkat.puvvada 1.23 CMPIObjectPathFT objectPath_FT =
522 {
523 CMPICurrentVersion,
524 refRelease,
525 refClone,
526 refSetNameSpace,
527 refGetNameSpace,
528 refSetHostname,
529 refGetHostname,
530 refSetClassName,
531 refGetClassName,
532 refAddKey,
533 refGetKey,
534 refGetKeyAt,
535 refGetKeyCount,
536 refSetNameSpaceFromObjectPath,
537 refSetHostAndNameSpaceFromObjectPath,
538 NULL,
539 NULL,
540 NULL,
541 NULL,
542 venkat.puvvada 1.23 refToString
|
543 schuur 1.1 };
544
|
545 venkat.puvvada 1.23 CMPIObjectPathFT *CMPI_ObjectPath_Ftab = &objectPath_FT;
|
546 schuur 1.1
|
547 venkat.puvvada 1.23 CMPIObjectPathFT objectPathOnStack_FT =
548 {
549 CMPICurrentVersion,
550 refReleaseNop,
551 refClone,
552 refSetNameSpace,
553 refGetNameSpace,
554 refSetHostname,
555 refGetHostname,
556 refSetClassName,
557 refGetClassName,
558 refAddKey,
559 refGetKey,
560 refGetKeyAt,
561 refGetKeyCount,
562 refSetNameSpaceFromObjectPath,
563 refSetHostAndNameSpaceFromObjectPath,
564 NULL,
565 NULL,
566 NULL,
567 NULL,
568 venkat.puvvada 1.23 refToString
|
569 schuur 1.1 };
570
|
571 venkat.puvvada 1.23 CMPIObjectPathFT *CMPI_ObjectPathOnStack_Ftab = &objectPathOnStack_FT;
|
572 schuur 1.1
573
|
574 r.kieninger 1.28.4.1 CMPI_ObjectPathOnStack::CMPI_ObjectPathOnStack(const SCMOInstance& cop)
575 {
576 hdl = (void*)&cop;
577 ft = CMPI_ObjectPathOnStack_Ftab;
578 }
579
|
580 venkat.puvvada 1.23 CMPI_ObjectPathOnStack::CMPI_ObjectPathOnStack(const CIMObjectPath& cop)
581 {
|
582 r.kieninger 1.28.4.1 fprintf(stderr,"Using non SCMO CMPI_ObjectPathOnStack!!!!\n");
|
583 venkat.puvvada 1.23 hdl = (void*)&cop;
584 ft = CMPI_ObjectPathOnStack_Ftab;
585 }
|
586 schuur 1.1
587
588 PEGASUS_NAMESPACE_END
589
|