1 mike 1.1 //BEGIN_LICENSE
2 //
3 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 // DEALINGS IN THE SOFTWARE.
19 //
20 //END_LICENSE
21 //BEGIN_HISTORY
22 mike 1.1 //
23 // Author:
24 //
|
25 mike 1.2 // $Log: Exception.h,v $
|
26 mike 1.8 // Revision 1.7 2001/02/21 01:50:30 karl
27 // comments
28 //
|
29 karl 1.7 // Revision 1.6 2001/02/11 05:42:33 mike
30 // new
31 //
|
32 mike 1.6 // Revision 1.5 2001/01/29 02:23:44 mike
33 // Added support for GetInstance operation
34 //
|
35 mike 1.5 // Revision 1.4 2001/01/28 04:11:03 mike
36 // fixed qualifier resolution
37 //
|
38 mike 1.4 // Revision 1.3 2001/01/23 01:25:35 mike
39 // Reworked resolve scheme.
40 //
|
41 mike 1.3 // Revision 1.2 2001/01/22 00:45:47 mike
42 // more work on resolve scheme
43 //
|
44 mike 1.2 // Revision 1.1.1.1 2001/01/14 19:51:34 mike
45 // Pegasus import
46 //
|
47 mike 1.1 //
48 //END_HISTORY
49
50 ////////////////////////////////////////////////////////////////////////////////
51 //
52 // Exception.h
53 //
54 // This file defines all exceptions used by the Pegasus library.
55 //
56 ////////////////////////////////////////////////////////////////////////////////
57
58 #ifndef Pegasus_Exception_h
59 #define Pegasus_Exception_h
60
61 #include <cstring>
62 #include <Pegasus/Common/Config.h>
63 #include <Pegasus/Common/String.h>
64
65 PEGASUS_NAMESPACE_BEGIN
|
66 karl 1.7 /** Class Exception
67 */
|
68 mike 1.1 class PEGASUS_COMMON_LINKAGE Exception
69 {
70 public:
71
72 Exception(const String& message);
73
74 Exception(const char* message);
75
76 ~Exception();
77
78 const String& getMessage() const { return _message; }
79
80 protected:
81
82 String _message;
83 };
|
84 karl 1.7 /** Class AssertionFailureException
85 This is an Exception class tied to the definiton of an assert named
86 PEGASUS_ASSERT. This assertion can be included at any point in Pegasus
87 code
88 */
|
89 mike 1.1 class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
90 {
91 public:
92
93 AssertionFailureException(
|
94 karl 1.7 const char* file,
|
95 mike 1.1 size_t line,
96 const String& message);
97 };
|
98 karl 1.7 /** define PEGASUS_ASSERT assertion statement. This statement
99 tests the condition defined by the parameters and if not True
100 executes a
101
102 <PRE>
103 throw AssertionFailureException
104 </PRE>
105 defining the file, line and condition that was tested.
106 */
|
107 mike 1.1 #define PEGASUS_ASSERT(COND) \
108 do \
109 { \
110 if (!(COND)) \
111 { \
112 throw AssertionFailureException(__FILE__, __LINE__, #COND); \
113 } \
114 } while (0)
115
|
116 karl 1.7 /// ATTN:
|
117 mike 1.1 class PEGASUS_COMMON_LINKAGE BadReference : public Exception
118 {
119 public:
120
121 BadReference(const String& message) : Exception(message) { }
122 };
123
|
124 karl 1.7 /// ATTN:
|
125 mike 1.1 class PEGASUS_COMMON_LINKAGE OutOfBounds : public Exception
126 {
127 public:
128
129 static const char MSG[];
130
131 OutOfBounds() : Exception(MSG) { }
132 };
133
|
134 karl 1.7 /// ATTN:
|
135 mike 1.1 class PEGASUS_COMMON_LINKAGE AlreadyExists : public Exception
136 {
137 public:
138
139 static const char MSG[];
140
141 AlreadyExists(const String& x = String()) : Exception(MSG + x) { }
142 };
143
|
144 karl 1.7 /// ATTN:
|
145 mike 1.1 class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
146 {
147 public:
148
149 static const char MSG[];
150
151 NullPointer() : Exception(MSG) { }
152 };
153
|
154 karl 1.7 /// ATTN:
|
155 mike 1.1 class PEGASUS_COMMON_LINKAGE IllegalName : public Exception
156 {
157 public:
158
159 static const char MSG[];
160
161 IllegalName() : Exception(MSG) { }
162 };
163
|
164 karl 1.7 /// ATTN:
|
165 mike 1.1 class PEGASUS_COMMON_LINKAGE UnitializedHandle : public Exception
166 {
167 public:
168
169 static const char MSG[];
170
171 UnitializedHandle() : Exception(MSG) { }
172 };
173
|
174 karl 1.7 /// ATTN:
|
175 mike 1.1 class PEGASUS_COMMON_LINKAGE NoSuchSuperClass : public Exception
176 {
177 public:
178
179 static const char MSG[];
180
181 NoSuchSuperClass(const String& className) : Exception(MSG + className) { }
|
182 mike 1.2 };
183
|
184 karl 1.7 /// ATTN:
|
185 mike 1.2 class PEGASUS_COMMON_LINKAGE NoSuchClass : public Exception
186 {
187 public:
188
189 static const char MSG[];
190
191 NoSuchClass(const String& className) : Exception(MSG + className) { }
|
192 mike 1.1 };
193
|
194 karl 1.7 /// ATTN:
|
195 mike 1.1 class PEGASUS_COMMON_LINKAGE InvalidPropertyOverride : public Exception
196 {
197 public:
198
199 static const char MSG[];
200
201 InvalidPropertyOverride(const String& message)
202 : Exception(MSG + message) { }
203 };
204
|
205 karl 1.7 /// ATTN:
|
206 mike 1.1 class PEGASUS_COMMON_LINKAGE InvalidMethodOverride : public Exception
207 {
208 public:
209
210 static const char MSG[];
211
212 InvalidMethodOverride(const String& message)
213 : Exception(MSG + message) { }
214 };
215
|
216 karl 1.7 /// ATTN:
|
217 mike 1.1 class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
218 {
219 public:
220
221 static const char MSG[];
222
223 UndeclaredQualifier(const String& qualifierName)
224 : Exception(MSG + qualifierName) { }
225 };
226
|
227 karl 1.7 /// ATTN:
|
228 mike 1.1 class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
229 {
230 public:
231
232 static const char MSG[];
233
|
234 karl 1.7 BadQualifierScope(const String& qualifierName, const String& scopeString)
|
235 mike 1.4 : Exception(MSG + qualifierName + String(" scope=") + scopeString) { }
|
236 mike 1.1 };
237
|
238 karl 1.7 /// ATTN:
|
239 mike 1.1 class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
240 {
241 public:
242
243 static const char MSG[];
244
|
245 karl 1.7 BadQualifierOverride(const String& qualifierName)
|
246 mike 1.1 : Exception(MSG + qualifierName) { }
247 };
248
|
249 mike 1.4 class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
250 {
251 public:
252
253 static const char MSG[];
254
|
255 karl 1.7 BadQualifierType(const String& qualifierName)
|
256 mike 1.4 : Exception(MSG + qualifierName) { }
257 };
258
|
259 karl 1.7 /// ATTN:
|
260 mike 1.1 class PEGASUS_COMMON_LINKAGE NullType : public Exception
261 {
262 public:
263
264 static const char MSG[];
265
266 NullType() : Exception(MSG) { }
267 };
268
|
269 karl 1.7 /// ATTN:
|
270 mike 1.1 class PEGASUS_COMMON_LINKAGE AddedReferenceToClass : public Exception
271 {
272 public:
273
274 static const char MSG[];
275
|
276 karl 1.7 AddedReferenceToClass(const String& className)
|
277 mike 1.1 : Exception(MSG + className) { }
278 };
279
|
280 karl 1.7 /// ATTN:
|
281 mike 1.1 class PEGASUS_COMMON_LINKAGE ClassAlreadyResolved : public Exception
282 {
283 public:
284
285 static const char MSG[];
286
|
287 karl 1.7 ClassAlreadyResolved(const String& className)
|
288 mike 1.1 : Exception(MSG + className) { }
289 };
290
|
291 karl 1.7 /// ATTN:
|
292 mike 1.1 class PEGASUS_COMMON_LINKAGE ClassNotResolved : public Exception
293 {
294 public:
295
296 static const char MSG[];
297
|
298 karl 1.7 ClassNotResolved(const String& className)
|
299 mike 1.1 : Exception(MSG + className) { }
300 };
301
|
302 karl 1.7 /// ATTN:
|
303 mike 1.1 class PEGASUS_COMMON_LINKAGE InstanceAlreadyResolved : public Exception
304 {
305 public:
306
307 static const char MSG[];
308
309 InstanceAlreadyResolved() : Exception(MSG) { }
310 };
311
|
312 karl 1.7 /// ATTN:
|
313 mike 1.1 class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
314 {
315 public:
316
317 static const char MSG[];
318
319 InstantiatedAbstractClass() : Exception(MSG) { }
320 };
|
321 karl 1.7 /// ATTN:
|
322 mike 1.1 class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
323 {
324 public:
325
326 static const char MSG[];
327
|
328 karl 1.7 NoSuchProperty(const String& propertyName)
|
329 mike 1.1 : Exception(MSG + propertyName) { }
330 };
|
331 karl 1.7 /// ATTN:
|
332 mike 1.1 class PEGASUS_COMMON_LINKAGE TruncatedCharacter : public Exception
333 {
334 public:
335
336 static const char MSG[];
337
338 TruncatedCharacter() : Exception(MSG) { }
339 };
|
340 karl 1.7 /// ATTN:
|
341 mike 1.1 class PEGASUS_COMMON_LINKAGE ExpectedReferenceValue : public Exception
342 {
343 public:
344
345 static const char MSG[];
346
347 ExpectedReferenceValue() : Exception(MSG) { }
348 };
|
349 karl 1.7 /// ATTN:
|
350 mike 1.1 class PEGASUS_COMMON_LINKAGE MissingReferenceClassName : public Exception
351 {
352 public:
353
354 static const char MSG[];
355
356 MissingReferenceClassName() : Exception(MSG) { }
357 };
|
358 karl 1.7 /// ATTN:
|
359 mike 1.1 class PEGASUS_COMMON_LINKAGE IllegalTypeTag : public Exception
360 {
361 public:
362
363 static const char MSG[];
364
365 IllegalTypeTag() : Exception(MSG) { }
366 };
|
367 karl 1.7 /// ATTN:
|
368 mike 1.1 class PEGASUS_COMMON_LINKAGE TypeMismatch : public Exception
369 {
370 public:
371
372 static const char MSG[];
373
374 TypeMismatch() : Exception(MSG) { }
375 };
|
376 karl 1.7 /// ATTN:
|
377 mike 1.1 class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
378 {
379 public:
380
381 static const char MSG[];
382
383 NoSuchFile(const String& fileName) : Exception(MSG + fileName) { }
384 };
|
385 karl 1.7 /// ATTN:
|
386 mike 1.1 class PEGASUS_COMMON_LINKAGE FailedToRemoveDirectory : public Exception
387 {
388 public:
389
390 static const char MSG[];
391
392 FailedToRemoveDirectory(const String& path) : Exception(MSG + path) { }
393 };
|
394 karl 1.7 /// ATTN:
|
395 mike 1.1 class PEGASUS_COMMON_LINKAGE FailedToRemoveFile : public Exception
396 {
397 public:
398
399 static const char MSG[];
400
401 FailedToRemoveFile(const String& path) : Exception(MSG + path) { }
402 };
|
403 karl 1.7 /// ATTN:
|
404 mike 1.1 class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
405 {
406 public:
407
408 static const char MSG[];
409
|
410 karl 1.7 NoSuchDirectory(const String& directoryName)
|
411 mike 1.1 : Exception(MSG + directoryName) { }
412 };
413
414 class PEGASUS_COMMON_LINKAGE ChangeDirectoryFailed : public Exception
415 {
416 public:
417
418 static const char MSG[];
419
|
420 karl 1.7 ChangeDirectoryFailed(const String& directoryName)
|
421 mike 1.1 : Exception(MSG + directoryName) { }
422 };
|
423 karl 1.7 /// ATTN:
|
424 mike 1.1 class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
425 {
426 public:
427
428 static const char MSG[];
429
|
430 karl 1.7 CannotCreateDirectory(const String& path)
|
431 mike 1.1 : Exception(MSG + path) { }
432 };
|
433 karl 1.7 /// ATTN:
|
434 mike 1.1 class PEGASUS_COMMON_LINKAGE NoSuchNameSpace : public Exception
435 {
436 public:
437
438 static const char MSG[];
439
|
440 karl 1.7 NoSuchNameSpace(const String& directoryName)
|
441 mike 1.1 : Exception(MSG + directoryName) { }
442 };
|
443 mike 1.8
|
444 karl 1.7 /// ATTN:
|
445 mike 1.1 class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
446 {
447 public:
448
449 static const char MSG[];
450
|
451 karl 1.7 CannotOpenFile(const String& path)
|
452 mike 1.1 : Exception(MSG + path) { }
453 };
|
454 mike 1.8
|
455 karl 1.7 /// ATTN:
|
456 mike 1.1 class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
457 {
458 public:
459
460 static const char MSG[];
461
462 NotImplemented(const String& method) : Exception(MSG + method) { }
463 };
464
|
465 mike 1.8 /* Class CIMException - Defines the CIM exceptions that are formally
466 defined in the CIM Operations over HTTP specification.
467 @example
468 <PRE>
469 throw CIMException(CIMException::NOT_SUPPORTED);
470 </PRE>
|
471 karl 1.7 */
|
472 mike 1.8 class PEGASUS_COMMON_LINKAGE CIMException : public Exception
|
473 mike 1.1 {
474 public:
475
476 enum Code
477 {
478 SUCCESS = 0,
479
480 // A general error occurred that is not covered by a more
481 // specific error code.
482
483 FAILED = 1,
484
485 // Access to a CIM resource was not available to the client.
486
487 ACCESS_DENIED = 2,
488
489 // The target namespace does not exist.
490
491 INVALID_NAMESPACE = 3,
492
493 // One or more parameter values passed to the method were invalid.
494 mike 1.1
495 INVALID_PARAMETER = 4,
496
497 // The specified class does not exist.
498
499 INVALID_CLASS = 5,
500
501 // The requested object could not be found.
502
503 NOT_FOUND = 6,
504
|
505 karl 1.7 // The requested operation is not supported.
|
506 mike 1.1
507 NOT_SUPPORTED = 7,
508
509 // Operation cannot be carried out on this class since it has
510 // subclasses.
511
512 CLASS_HAS_CHILDREN = 8,
513
514 // Operation cannot be carried out on this class since it has
515 // instances.
516
517 CLASS_HAS_INSTANCES = 9,
518
519 // Operation cannot be carried out since the specified superClass
520 // does not exist.
521
522 INVALID_SUPERCLASS = 10,
523
524 // Operation cannot be carried out because an object already exists.
525
526 ALREADY_EXISTS = 11,
527 mike 1.1
528 // The specified property does not exist:
529
530 NO_SUCH_PROPERTY = 12,
531
532 // The value supplied is incompatible with the type.
533
534 TYPE_MISMATCH = 13,
535
536 // The query language is not recognized or supported.
537
538 QUERY_LANGUAGE_NOT_SUPPORTED = 14,
539
540 // The query is not valid for the specified query language.
541
542 INVALID_QUERY = 15,
543
544 // The extrinsic method could not be executed.
545
546 METHOD_NOT_AVAILABLE = 16,
547
548 mike 1.1 // The specified extrinsic method does not exist.
549
550 METHOD_NOT_FOUND = 17
551 };
552
|
553 mike 1.8 CIMException(Code code, const String& extraMessage);
|
554 mike 1.1
|
555 mike 1.8 CIMException::Code getCode() const { return _code; }
|
556 mike 1.1
557 static const char* codeToString(Code code);
558
559 private:
560
561 Code _code;
562 };
563
564 class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
565 {
566 public:
567
568 static const char MSG[];
569
570 StackUnderflow() : Exception(MSG) { }
571 };
572
573 class PEGASUS_COMMON_LINKAGE BadFormat : public Exception
574 {
575 public:
576
577 mike 1.1 static const char MSG[];
578
579 BadFormat() : Exception(MSG) { }
580 };
581
582 class PEGASUS_COMMON_LINKAGE BadDateTimeFormat : public Exception
583 {
584 public:
585
586 static const char MSG[];
587
588 BadDateTimeFormat() : Exception(MSG) { }
589 };
590
591 class PEGASUS_COMMON_LINKAGE IncompatibleTypes : public Exception
592 {
593 public:
594
595 static const char MSG[];
596
597 IncompatibleTypes() : Exception(MSG) { }
598 mike 1.1 };
599
600 class PEGASUS_COMMON_LINKAGE BadlyFormedCGIQueryString : public Exception
601 {
602 public:
603
604 static const char MSG[];
605
606 BadlyFormedCGIQueryString() : Exception(MSG) { }
|
607 mike 1.4 };
608
609 class PEGASUS_COMMON_LINKAGE BadInstanceName : public Exception
610 {
611 public:
612
613 static const char MSG[];
614
|
615 karl 1.7 BadInstanceName(const String& instanceName)
|
616 mike 1.4 : Exception(MSG + instanceName) { }
|
617 mike 1.5 };
618
619 class PEGASUS_COMMON_LINKAGE DynamicLoadFailed : public Exception
620 {
621 public:
622
623 static const char MSG[];
624
|
625 karl 1.7 DynamicLoadFailed(const String& libraryName)
|
626 mike 1.5 : Exception(MSG + libraryName) { }
627 };
628
629 class PEGASUS_COMMON_LINKAGE DynamicLookupFailed : public Exception
630 {
631 public:
632
633 static const char MSG[];
634
|
635 karl 1.7 DynamicLookupFailed(const String& symbolName)
|
636 mike 1.5 : Exception(MSG + symbolName) { }
|
637 mike 1.6 };
638
639 class PEGASUS_COMMON_LINKAGE CannotOpenDirectory : public Exception
640 {
641 public:
642
643 static const char MSG[];
644
645 CannotOpenDirectory(const String& path) : Exception(MSG + path) { }
|
646 mike 1.1 };
647
648 PEGASUS_NAMESPACE_END
649
650 #endif /* Pegasus_Exception_h */
|