(file) Return to CIMError.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.2 //%2006////////////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4           // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6           // IBM Corp.; EMC Corporation, The Open Group.
  7           // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9           // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11           // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12           // EMC Corporation; Symantec Corporation; The Open Group.
 13           //
 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 karl  1.2 // 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           //%/////////////////////////////////////////////////////////////////////////////
 33           
 34           #include <Pegasus/Common/MofWriter.h>
 35           #include "CIMError.h"
 36           #include "PropertyAccessor.h"
 37           
 38           PEGASUS_USING_STD;
 39           
 40           PEGASUS_NAMESPACE_BEGIN
 41           
 42           // Required property list.
 43 karl  1.2 
 44           static const char* _requiredProperties[] =
 45           {
 46               "OwningEntity",
 47               "MessageID",
 48               "Message",
 49               "PerceivedSeverity",
 50               "ProbableCause",
 51               "CIMStatusCode",
 52           };
 53           
 54 kumpf 1.3 static const size_t _numRequiredProperties =
 55 karl  1.2     sizeof(_requiredProperties) / sizeof(_requiredProperties[0]);
 56           
 57           /*
 58               Uint16 ErrorType;
 59               String OtherErrorType;
 60               String OwningEntity;
 61               String MessageID;
 62               String Message;
 63               Array<String> MessageArguments;
 64               Uint16 PerceivedSeverity;
 65               Uint16 ProbableCause;
 66               String ProbableCauseDescription;
 67               Array<String> RecommendedActions;
 68               String ErrorSource;
 69               Uint16 ErrorSourceFormat;
 70               String OtherErrorSourceFormat;
 71               Uint32 CIMStatusCode;
 72               String CIMStatusCodeDescription;
 73           */
 74           
 75           struct TableEntry
 76 karl  1.2 {
 77               int enumTag;
 78               const char* keyword;
 79           };
 80           
 81           static TableEntry _ErrorTypeTable[] =
 82           {
 83               { 0, "Unknown" },
 84               { 1, "Other" },
 85               { 2, "Communications Error" },
 86               { 3, "Quality of Service Error" },
 87               { 4, "Software Error" },
 88               { 5, "Hardware Error" },
 89               { 6, "Environmental Error" },
 90               { 7, "Security Error" },
 91               { 8, "Oversubscription Error" },
 92               { 9, "Unavailable Resource Error" },
 93               { 10, "Unsupported Operation Error" }
 94 kumpf 1.3 };
 95 karl  1.2 
 96           static TableEntry _PerceivedSeverityTable[] =
 97           {
 98               { 0, "Unknown" },
 99               { 1, "Unused 1" },
100               { 2, "Low" },
101               { 3, "Medium" },
102               { 4, "High" },
103               { 5, "Fatal" }
104           };
105           
106           static TableEntry _ProbableCauseTable[] =
107           {
108               { 0, "Unknown" },
109               { 1, "Other" },
110               { 2, "Adapter/Card Error" },
111               { 3, "Application Subsystem Failure" },
112               { 4, "Bandwidth Reduced" },
113               { 5, "Connection Establishment Error" },
114               { 6, "Communications Protocol Error" },
115               { 7, "Communications Subsystem Failure" },
116 karl  1.2     { 8, "Configuration/Customization Error" },
117               { 9, "Congestion" },
118               { 10, "Corrupt Data" },
119               { 11, "CPU Cycles Limit Exceeded" },
120               { 12, "Dataset/Modem Error" },
121               { 13, "Degraded Signal" },
122               { 14, "DTE-DCE Interface Error" },
123               { 15, "Enclosure Door Open" },
124               { 16, "Equipment Malfunction" },
125               { 17, "Excessive Vibration" },
126               { 18, "File Format Error" },
127               { 19, "Fire Detected" },
128               { 20, "Flood Detected" },
129               { 21, "Framing Error" },
130               { 22, "HVAC Problem" },
131               { 23, "Humidity Unacceptable" },
132               { 24, "I/O Device Error" },
133               { 25, "Input Device Error" },
134               { 26, "LAN Error" },
135               { 27, "Non-Toxic Leak Detected" },
136               { 28, "Local Node Transmission Error" },
137 karl  1.2     { 29, "Loss of Frame" },
138               { 30, "Loss of Signal" },
139               { 31, "Material Supply Exhausted" },
140               { 32, "Multiplexer Problem" },
141               { 33, "Out of Memory" },
142               { 34, "Output Device Error" },
143               { 35, "Performance Degraded" },
144               { 36, "Power Problem" },
145               { 37, "Pressure Unacceptable" },
146               { 38, "Processor Problem (Internal Machine Error)" },
147               { 39, "Pump Failure" },
148               { 40, "Queue Size Exceeded" },
149               { 41, "Receive Failure" },
150               { 42, "Receiver Failure" },
151               { 43, "Remote Node Transmission Error" },
152               { 44, "Resource at or Nearing Capacity" },
153               { 45, "Response Time Excessive" },
154               { 46, "Retransmission Rate Excessive" },
155               { 47, "Software Error" },
156               { 48, "Software Program Abnormally Terminated" },
157               { 49, "Software Program Error (Incorrect Results)" },
158 karl  1.2     { 50, "Storage Capacity Problem" },
159               { 51, "Temperature Unacceptable" },
160               { 52, "Threshold Crossed" },
161               { 53, "Timing Problem" },
162               { 54, "Toxic Leak Detected" },
163               { 55, "Transmit Failure" },
164               { 56, "Transmitter Failure" },
165               { 57, "Underlying Resource Unavailable" },
166               { 58, "Version Mismatch" },
167               { 59, "Previous Alert Cleared" },
168               { 60, "Login Attempts Failed" },
169               { 61, "Software Virus Detected" },
170               { 62, "Hardware Security Breached" },
171               { 63, "Denial of Service Detected" },
172               { 64, "Security Credential Mismatch" },
173               { 65, "Unauthorized Access" },
174               { 66, "Alarm Received" },
175               { 67, "Loss of Pointer" },
176               { 68, "Payload Mismatch" },
177               { 69, "Transmission Error" },
178               { 70, "Excessive Error Rate" },
179 karl  1.2     { 71, "Trace Problem" },
180               { 72, "Element Unavailable" },
181               { 73, "Element Missing" },
182               { 74, "Loss of Multi Frame" },
183               { 75, "Broadcast Channel Failure" },
184               { 76, "Invalid Message Received" },
185               { 77, "Routing Failure" },
186               { 78, "Backplane Failure" },
187               { 79, "Identifier Duplication" },
188               { 80, "Protection Path Failure" },
189               { 81, "Sync Loss or Mismatch" },
190               { 82, "Terminal Problem" },
191               { 83, "Real Time Clock Failure" },
192               { 84, "Antenna Failure" },
193               { 85, "Battery Charging Failure" },
194               { 86, "Disk Failure" },
195               { 87, "Frequency Hopping Failure" },
196               { 88, "Loss of Redundancy" },
197               { 89, "Power Supply Failure" },
198               { 90, "Signal Quality Problem" },
199               { 91, "Battery Discharging" },
200 karl  1.2     { 92, "Battery Failure" },
201               { 93, "Commercial Power Problem" },
202               { 94, "Fan Failure" },
203               { 95, "Engine Failure" },
204               { 96, "Sensor Failure" },
205               { 97, "Fuse Failure" },
206               { 98, "Generator Failure" },
207               { 99, "Low Battery" },
208               { 100, "Low Fuel" },
209               { 101, "Low Water" },
210               { 102, "Explosive Gas" },
211               { 103, "High Winds" },
212               { 104, "Ice Buildup" },
213               { 105, "Smoke" },
214               { 106, "Memory Mismatch" },
215               { 107, "Out of CPU Cycles" },
216               { 108, "Software Environment Problem" },
217               { 109, "Software Download Failure" },
218               { 110, "Element Reinitialized" },
219               { 111, "Timeout" },
220               { 112, "Logging Problems" },
221 karl  1.2     { 113, "Leak Detected" },
222               { 114, "Protection Mechanism Failure" },
223               { 115, "Protecting Resource Failure" },
224               { 116, "Database Inconsistency" },
225               { 117, "Authentication Failure" },
226               { 118, "Breach of Confidentiality" },
227               { 119, "Cable Tamper" },
228               { 120, "Delayed Information" },
229               { 121, "Duplicate Information" },
230               { 122, "Information Missing" },
231               { 123, "Information Modification" },
232               { 124, "Information Out of Sequence" },
233               { 125, "Key Expired" },
234               { 126, "Non-Repudiation Failure" },
235               { 127, "Out of Hours Activity" },
236               { 128, "Out of Service" },
237               { 129, "Procedural Error" },
238               { 130, "Unexpected Information" },
239           };
240           
241           static TableEntry _ErrorSourceFormatTable[] =
242 karl  1.2 {
243               { 0, "Unknown" },
244               { 1, "Other" },
245               { 2, "CIMObjectHandle" },
246           };
247           
248           static TableEntry _CIMStatusCodeTable[] =
249           {
250               { 1, "CIM_ERR_FAILED" },
251               { 2, "CIM_ERR_ACCESS_DENIED" },
252               { 3, "CIM_ERR_INVALID_NAMESPACE" },
253               { 4, "CIM_ERR_INVALID_PARAMETER" },
254               { 5, "CIM_ERR_INVALID_CLASS" },
255               { 6, "CIM_ERR_NOT_FOUND" },
256               { 7, "CIM_ERR_NOT_SUPPORTED" },
257               { 8, "CIM_ERR_CLASS_HAS_CHILDREN" },
258               { 9, "CIM_ERR_CLASS_HAS_INSTANCES" },
259               { 10, "CIM_ERR_INVALID_SUPERCLASS" },
260               { 11, "CIM_ERR_ALREADY_EXISTS" },
261               { 12, "CIM_ERR_NO_SUCH_PROPERTY" },
262               { 13, "CIM_ERR_TYPE_MISMATCH" },
263 karl  1.2     { 14, "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED" },
264               { 15, "CIM_ERR_INVALID_QUERY" },
265               { 16, "CIM_ERR_METHOD_NOT_AVAILABLE" },
266               { 17, "CIM_ERR_METHOD_NOT_FOUND" },
267               { 18, "CIM_ERR_UNEXPECTED_RESPONSE" },
268               { 19, "CIM_ERR_INVALID_RESPONSE_DESTINATION" },
269               { 20, "CIM_ERR_NAMESPACE_NOT_EMPTY" },
270           };
271           
272           CIMError::CIMError() : _inst("CIM_Error")
273           {
274               _inst.addProperty(CIMProperty(
275 kumpf 1.3         "ErrorType", CIMValue(CIMTYPE_UINT16, false)));
276 karl  1.2     _inst.addProperty(CIMProperty(
277 kumpf 1.3         "OtherErrorType", CIMValue(CIMTYPE_STRING, false)));
278 karl  1.2     _inst.addProperty(CIMProperty(
279 kumpf 1.3         "OwningEntity", CIMValue(CIMTYPE_STRING, false)));
280 karl  1.2     _inst.addProperty(CIMProperty(
281 kumpf 1.3         "MessageID", CIMValue(CIMTYPE_STRING, false)));
282 karl  1.2     _inst.addProperty(CIMProperty(
283 kumpf 1.3         "Message", CIMValue(CIMTYPE_STRING, false)));
284 karl  1.2     _inst.addProperty(CIMProperty(
285 kumpf 1.3         "MessageArguments", CIMValue(CIMTYPE_STRING, true)));
286 karl  1.2     _inst.addProperty(CIMProperty(
287 kumpf 1.3         "PerceivedSeverity", CIMValue(CIMTYPE_UINT16, false)));
288 karl  1.2     _inst.addProperty(CIMProperty(
289 kumpf 1.3         "ProbableCause", CIMValue(CIMTYPE_UINT16, false)));
290 karl  1.2     _inst.addProperty(CIMProperty(
291 kumpf 1.3         "ProbableCauseDescription", CIMValue(CIMTYPE_STRING, false)));
292 karl  1.2     _inst.addProperty(CIMProperty(
293 kumpf 1.3         "RecommendedActions", CIMValue(CIMTYPE_STRING, true)));
294 karl  1.2     _inst.addProperty(CIMProperty(
295 kumpf 1.3         "ErrorSource", CIMValue(CIMTYPE_STRING, false)));
296 karl  1.2     _inst.addProperty(CIMProperty(
297 kumpf 1.3         "ErrorSourceFormat", CIMValue(CIMTYPE_UINT16, false)));
298 karl  1.2     _inst.addProperty(CIMProperty(
299 kumpf 1.3         "OtherErrorSourceFormat", CIMValue(CIMTYPE_STRING, false)));
300 karl  1.2     _inst.addProperty(CIMProperty(
301 kumpf 1.3         "CIMStatusCode", CIMValue(CIMTYPE_UINT32, false)));
302 karl  1.2     _inst.addProperty(CIMProperty(
303 kumpf 1.3         "CIMStatusCodeDescription", CIMValue(CIMTYPE_STRING, false)));
304 karl  1.2 }
305           
306           CIMError::CIMError(const String& owningEntity,
307 kumpf 1.3                    const String& messageID,
308 karl  1.2                    const String& message,
309                              const PerceivedSeverityEnum& perceivedSeverity,
310                              const ProbableCauseEnum& probableCause,
311                              const CIMStatusCodeEnum& cimStatusCode)
312           : _inst("CIM_Error")
313           {
314               _inst.addProperty(CIMProperty(
315 kumpf 1.3         "ErrorType", CIMValue(CIMTYPE_UINT16, false)));
316 karl  1.2     _inst.addProperty(CIMProperty(
317 kumpf 1.3         "OtherErrorType", CIMValue(CIMTYPE_STRING, false)));
318 karl  1.2     _inst.addProperty(CIMProperty(
319 kumpf 1.3         "OwningEntity", CIMValue(owningEntity)));
320 karl  1.2     _inst.addProperty(CIMProperty(
321 kumpf 1.3         "MessageID", CIMValue(messageID)));
322 karl  1.2     _inst.addProperty(CIMProperty(
323 kumpf 1.3         "Message", CIMValue(message)));
324 karl  1.2     _inst.addProperty(CIMProperty(
325 kumpf 1.3         "MessageArguments", CIMValue(CIMTYPE_STRING, true)));
326 karl  1.2     _inst.addProperty(CIMProperty(
327 kumpf 1.3         "PerceivedSeverity", CIMValue(Uint16(perceivedSeverity))));
328 karl  1.2     _inst.addProperty(CIMProperty(
329 kumpf 1.3         "ProbableCause", CIMValue(Uint16(probableCause))));
330 karl  1.2     _inst.addProperty(CIMProperty(
331 kumpf 1.3         "ProbableCauseDescription", CIMValue(CIMTYPE_STRING, false)));
332 karl  1.2     _inst.addProperty(CIMProperty(
333 kumpf 1.3         "RecommendedActions", CIMValue(CIMTYPE_STRING, true)));
334 karl  1.2     _inst.addProperty(CIMProperty(
335 kumpf 1.3         "ErrorSource", CIMValue(CIMTYPE_STRING, false)));
336 karl  1.2     _inst.addProperty(CIMProperty(
337 kumpf 1.3         "ErrorSourceFormat", CIMValue(CIMTYPE_UINT16, false)));
338 karl  1.2     _inst.addProperty(CIMProperty(
339 kumpf 1.3         "OtherErrorSourceFormat", CIMValue(CIMTYPE_STRING, false)));
340 karl  1.2     _inst.addProperty(CIMProperty(
341 kumpf 1.3         "CIMStatusCode", CIMValue(Uint32(cimStatusCode))));
342 karl  1.2     _inst.addProperty(CIMProperty(
343 kumpf 1.3         "CIMStatusCodeDescription", CIMValue(CIMTYPE_STRING, false)));
344 karl  1.2 }
345           
346           CIMError::CIMError(const CIMError& x) : _inst(x._inst)
347           {
348           }
349           
350           CIMError::~CIMError()
351           {
352           }
353           
354           bool CIMError::getErrorType(ErrorTypeEnum& value) const
355           {
356               Uint16 t;
357               bool nullStat = Get(_inst, "ErrorType", t);
358               value = ErrorTypeEnum(t);
359               return nullStat;
360           }
361           
362           void CIMError::setErrorType(ErrorTypeEnum value, bool null)
363           {
364               Set(_inst, "ErrorType", Uint16(value), null);
365 karl  1.2 }
366           
367           bool CIMError::getOtherErrorType(String& value) const
368           {
369               return Get(_inst, "OtherErrorType", value);
370           }
371           
372           void CIMError::setOtherErrorType(const String& value, bool null)
373           {
374               Set(_inst, "OtherErrorType", value, null);
375           }
376           
377           bool CIMError::getOwningEntity(String& value) const
378           {
379               return Get(_inst, "OwningEntity", value);
380           }
381           
382           void CIMError::setOwningEntity(const String& value, bool null)
383           {
384               Set(_inst, "OwningEntity", value, null);
385           }
386 karl  1.2 
387           bool CIMError::getMessageID(String& value) const
388           {
389              return Get(_inst, "MessageID", value);
390           }
391           
392           void CIMError::setMessageID(const String& value, bool null)
393           {
394               Set(_inst, "MessageID", value, null);
395           }
396           
397           bool CIMError::getMessage(String& value) const
398           {
399               return Get(_inst, "Message", value);
400           }
401           
402           void CIMError::setMessage(const String& value, bool null)
403           {
404               Set(_inst, "Message", value, null);
405           }
406           
407 karl  1.2 bool CIMError::getMessageArguments(Array<String>&  value) const
408           {
409               return Get(_inst, "MessageArguments", value);
410           }
411           
412           void CIMError::setMessageArguments(const Array<String>& value, bool null)
413           {
414               Set(_inst, "MessageArguments", value, null);
415           }
416           
417           bool CIMError::getPerceivedSeverity(
418               PerceivedSeverityEnum& value) const
419           {
420               Uint16 t;
421               bool nullStat = Get(_inst, "PerceivedSeverity", t);
422               value = PerceivedSeverityEnum(t);
423               return nullStat;
424           }
425           
426           void CIMError::setPerceivedSeverity(
427               PerceivedSeverityEnum value, bool null)
428 karl  1.2 {
429               Set(_inst, "PerceivedSeverity", Uint16(value), null);
430           }
431           
432           bool CIMError::getProbableCause(ProbableCauseEnum& value) const
433           {
434               Uint16 t;
435               bool nullStat = Get(_inst, "ProbableCause", t);
436               value = ProbableCauseEnum(t);
437               return nullStat;
438           }
439           
440           void CIMError::setProbableCause(ProbableCauseEnum value, bool null)
441           {
442               Set(_inst, "ProbableCause", (Uint16)value, null);
443           }
444           
445           bool CIMError::getProbableCauseDescription(String& value) const
446           {
447               return Get(_inst, "ProbableCauseDescription", value);
448           }
449 karl  1.2 
450           void CIMError::setProbableCauseDescription(const String& value, bool null)
451           {
452               Set(_inst, "ProbableCauseDescription", value, null);
453           }
454           
455           bool CIMError::getRecommendedActions(Array<String>& value) const
456           {
457               return Get(_inst, "RecommendedActions", value);
458           }
459           
460           void CIMError::setRecommendedActions(const Array<String>& value, bool null)
461           {
462               Set(_inst, "RecommendedActions", value, null);
463           }
464           
465           bool CIMError::getErrorSource(String& value) const
466           {
467               return Get(_inst, "ErrorSource", value);
468           }
469           
470 karl  1.2 void CIMError::setErrorSource(const String& value, bool null)
471           {
472               Set(_inst, "ErrorSource", value, null);
473           }
474           
475           bool CIMError::getErrorSourceFormat(
476               ErrorSourceFormatEnum& value) const
477           {
478               Uint16 t;
479               bool nullStat = Get(_inst, "ErrorSourceFormat", t);
480               value = ErrorSourceFormatEnum(t);
481               return nullStat;
482           }
483           
484           void CIMError::setErrorSourceFormat(ErrorSourceFormatEnum value, bool null)
485           {
486               Set(_inst, "ErrorSourceFormat", Uint16(value), null);
487           }
488           
489           bool CIMError::getOtherErrorSourceFormat(String& value) const
490           {
491 karl  1.2     return Get(_inst, "OtherErrorSourceFormat", value);
492           }
493           
494           void CIMError::setOtherErrorSourceFormat(const String& value, bool null)
495           {
496               Set(_inst, "OtherErrorSourceFormat", value, null);
497           }
498           
499           bool CIMError::getCIMStatusCode(CIMStatusCodeEnum& value) const
500           {
501               Uint32 t;
502               bool nullStat = Get(_inst, "CIMStatusCode", t);
503               value = CIMStatusCodeEnum(t);
504               return nullStat;
505           }
506           
507           void CIMError::setCIMStatusCode(CIMStatusCodeEnum value, bool null)
508           {
509               Set(_inst, "CIMStatusCode", Uint32(value), null);
510           }
511           
512 karl  1.2 bool CIMError::getCIMStatusCodeDescription(String& value) const
513           {
514               return Get(_inst, "CIMStatusCodeDescription", value);
515           }
516           
517           void CIMError::setCIMStatusCodeDescription(const String& value, bool null)
518           {
519               Set(_inst, "CIMStatusCodeDescription", value, null);
520           }
521           
522           const CIMInstance& CIMError::getInstance() const
523           {
524               return _inst;
525           }
526           
527           template<class T>
528           void _Check(const String& name, CIMConstProperty& p, T* tag)
529           {
530               if (p.getName() == name)
531               {
532 kumpf 1.3         if (IsArray(tag) != p.isArray() || GetType(tag) != p.getType())
533                       throw CIMException(CIM_ERR_TYPE_MISMATCH, name);
534 karl  1.2     }
535           }
536           
537           const void CIMError::setInstance(const CIMInstance& instance)
538           {
539               for (Uint32 i = 0; i < instance.getPropertyCount(); i++)
540               {
541 kumpf 1.3         CIMConstProperty p = instance.getProperty(i);
542 karl  1.2 
543 kumpf 1.3         _Check("ErrorType", p, (Uint16*)0);
544                   _Check("OtherErrorType", p, (String*)0);
545                   _Check("OwningEntity", p, (String*)0);
546                   _Check("MessageID", p, (String*)0);
547                   _Check("Message", p, (String*)0);
548                   _Check("MessageArguments", p, (Array<String>*)0);
549                   _Check("PerceivedSeverity", p, (Uint16*)0);
550                   _Check("ProbableCause", p, (Uint16*)0);
551                   _Check("ProbableCauseDescription", p, (String*)0);
552                   _Check("RecommendedActions", p, (Array<String>*)0);
553                   _Check("ErrorSource", p, (String*)0);
554                   _Check("ErrorSourceFormat", p, (Uint16*)0);
555                   _Check("OtherErrorSourceFormat", p, (String*)0);
556                   _Check("CIMStatusCode", p, (Uint32*)0);
557                   _Check("CIMStatusCodeDescription", p, (String*)0);
558 karl  1.2     }
559           
560               // Verify that the instance contains all of the required properties.
561           
562               for (Uint32 i = 0; i < _numRequiredProperties; i++)
563               {
564 kumpf 1.3         // Does inst have this property?
565 karl  1.2 
566 kumpf 1.3         Uint32 pos = instance.findProperty(_requiredProperties[i]);
567 karl  1.2 
568 kumpf 1.3         if (pos == PEG_NOT_FOUND)
569                   {
570                       char buffer[80];
571                       sprintf(buffer, "required property does not exist: %s",
572                           _requiredProperties[i]);
573                       throw CIMException(CIM_ERR_NO_SUCH_PROPERTY, buffer);
574                   }
575 karl  1.2         // is required property non-null?
576                   CIMConstProperty p = instance.getProperty(pos);
577                   CIMValue v = p.getValue();
578                   if (v.isNull())
579                   {
580                       char buffer[80];
581 kumpf 1.3             sprintf(buffer, "required property MUST NOT be Null: %s",
582                           _requiredProperties[i]);
583                       throw CIMException(CIM_ERR_FAILED, buffer);
584 karl  1.2         }
585               }
586               _inst = instance;
587           }
588           
589           void CIMError::print() const
590           {
591               Buffer buf;
592               MofWriter::appendInstanceElement(buf, _inst);
593               printf("%.*s\n", int(buf.size()), buf.getData());
594           }
595           
596           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2