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

  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           // $Log$
 26           //
 27           //END_HISTORY
 28           
 29           ////////////////////////////////////////////////////////////////////////////////
 30           //
 31           // Exception.h
 32           //
 33           //	This file defines all exceptions used by the Pegasus library.
 34           //
 35           ////////////////////////////////////////////////////////////////////////////////
 36           
 37           #ifndef Pegasus_Exception_h
 38           #define Pegasus_Exception_h
 39           
 40           #include <cstring>
 41           #include <Pegasus/Common/Config.h>
 42           #include <Pegasus/Common/String.h>
 43 mike  1.1 
 44           PEGASUS_NAMESPACE_BEGIN
 45           
 46           class PEGASUS_COMMON_LINKAGE Exception
 47           {
 48           public:
 49           
 50               Exception(const String& message);
 51           
 52               Exception(const char* message);
 53           
 54               ~Exception();
 55           
 56               const String& getMessage() const { return _message; }
 57           
 58           protected:
 59           
 60               String _message;
 61           };
 62           
 63           class PEGASUS_COMMON_LINKAGE AssertionFailureException : public Exception
 64 mike  1.1 {
 65           public:
 66           
 67               AssertionFailureException(
 68           	const char* file, 
 69           	size_t line,
 70           	const String& message);
 71           };
 72           
 73           #define PEGASUS_ASSERT(COND) \
 74               do \
 75               { \
 76           	if (!(COND)) \
 77           	{ \
 78           	    throw AssertionFailureException(__FILE__, __LINE__, #COND); \
 79           	} \
 80               } while (0)
 81           
 82           class PEGASUS_COMMON_LINKAGE BadReference : public Exception
 83           {
 84           public:
 85 mike  1.1 
 86               BadReference(const String& message) : Exception(message) { }
 87           };
 88           
 89           class PEGASUS_COMMON_LINKAGE OutOfBounds : public Exception
 90           {
 91           public:
 92           
 93               static const char MSG[];
 94           
 95               OutOfBounds() : Exception(MSG) { }
 96           };
 97           
 98           class PEGASUS_COMMON_LINKAGE AlreadyExists : public Exception
 99           {
100           public:
101           
102               static const char MSG[];
103           
104               AlreadyExists(const String& x = String()) : Exception(MSG + x) { }
105           };
106 mike  1.1 
107           class PEGASUS_COMMON_LINKAGE NullPointer : public Exception
108           {
109           public:
110           
111               static const char MSG[];
112           
113               NullPointer() : Exception(MSG) { }
114           };
115           
116           class PEGASUS_COMMON_LINKAGE IllegalName : public Exception
117           {
118           public:
119           
120               static const char MSG[];
121           
122               IllegalName() : Exception(MSG) { }
123           };
124           
125           class PEGASUS_COMMON_LINKAGE UnitializedHandle : public Exception
126           {
127 mike  1.1 public:
128           
129               static const char MSG[];
130           
131               UnitializedHandle() : Exception(MSG) { }
132           };
133           
134           class PEGASUS_COMMON_LINKAGE NoSuchSuperClass : public Exception
135           {
136           public:
137           
138               static const char MSG[];
139           
140               NoSuchSuperClass(const String& className) : Exception(MSG + className) { }
141           };
142           
143           class PEGASUS_COMMON_LINKAGE InvalidPropertyOverride : public Exception
144           {
145           public:
146           
147               static const char MSG[];
148 mike  1.1 
149               InvalidPropertyOverride(const String& message)
150           	: Exception(MSG + message) { }
151           };
152           
153           class PEGASUS_COMMON_LINKAGE InvalidMethodOverride : public Exception
154           {
155           public:
156           
157               static const char MSG[];
158           
159               InvalidMethodOverride(const String& message)
160           	: Exception(MSG + message) { }
161           };
162           
163           class PEGASUS_COMMON_LINKAGE UndeclaredQualifier : public Exception
164           {
165           public:
166           
167               static const char MSG[];
168           
169 mike  1.1     UndeclaredQualifier(const String& qualifierName)
170           	: Exception(MSG + qualifierName) { }
171           };
172           
173           class PEGASUS_COMMON_LINKAGE BadQualifierType : public Exception
174           {
175           public:
176           
177               static const char MSG[];
178           
179               BadQualifierType(const String& qualifierName)
180           	: Exception(MSG + qualifierName) { }
181           };
182           
183           class PEGASUS_COMMON_LINKAGE BadQualifierScope : public Exception
184           {
185           public:
186           
187               static const char MSG[];
188           
189               BadQualifierScope(const String& qualifierName) 
190 mike  1.1 	: Exception(MSG + qualifierName) { }
191           };
192           
193           class PEGASUS_COMMON_LINKAGE BadQualifierOverride : public Exception
194           {
195           public:
196           
197               static const char MSG[];
198           
199               BadQualifierOverride(const String& qualifierName) 
200           	: Exception(MSG + qualifierName) { }
201           };
202           
203           class PEGASUS_COMMON_LINKAGE NullType : public Exception
204           {
205           public:
206           
207               static const char MSG[];
208           
209               NullType() : Exception(MSG) { }
210           };
211 mike  1.1 
212           class PEGASUS_COMMON_LINKAGE AddedReferenceToClass : public Exception
213           {
214           public:
215           
216               static const char MSG[];
217           
218               AddedReferenceToClass(const String& className) 
219           	: Exception(MSG + className) { }
220           };
221           
222           class PEGASUS_COMMON_LINKAGE ClassAlreadyResolved : public Exception
223           {
224           public:
225           
226               static const char MSG[];
227           
228               ClassAlreadyResolved(const String& className) 
229           	: Exception(MSG + className) { }
230           };
231           
232 mike  1.1 class PEGASUS_COMMON_LINKAGE ClassNotResolved : public Exception
233           {
234           public:
235           
236               static const char MSG[];
237           
238               ClassNotResolved(const String& className) 
239           	: Exception(MSG + className) { }
240           };
241           
242           class PEGASUS_COMMON_LINKAGE InstanceAlreadyResolved : public Exception
243           {
244           public:
245           
246               static const char MSG[];
247           
248               InstanceAlreadyResolved() : Exception(MSG) { }
249           };
250           
251           class PEGASUS_COMMON_LINKAGE InstantiatedAbstractClass : public Exception
252           {
253 mike  1.1 public:
254           
255               static const char MSG[];
256           
257               InstantiatedAbstractClass() : Exception(MSG) { }
258           };
259           
260           class PEGASUS_COMMON_LINKAGE NoSuchProperty : public Exception
261           {
262           public:
263           
264               static const char MSG[];
265           
266               NoSuchProperty(const String& propertyName) 
267           	: Exception(MSG + propertyName) { }
268           };
269           
270           class PEGASUS_COMMON_LINKAGE TruncatedCharacter : public Exception
271           {
272           public:
273           
274 mike  1.1     static const char MSG[];
275           
276               TruncatedCharacter() : Exception(MSG) { }
277           };
278           
279           class PEGASUS_COMMON_LINKAGE ExpectedReferenceValue : public Exception
280           {
281           public:
282           
283               static const char MSG[];
284           
285               ExpectedReferenceValue() : Exception(MSG) { }
286           };
287           
288           class PEGASUS_COMMON_LINKAGE MissingReferenceClassName : public Exception
289           {
290           public:
291           
292               static const char MSG[];
293           
294               MissingReferenceClassName() : Exception(MSG) { }
295 mike  1.1 };
296           
297           class PEGASUS_COMMON_LINKAGE IllegalTypeTag : public Exception
298           {
299           public:
300           
301               static const char MSG[];
302           
303               IllegalTypeTag() : Exception(MSG) { }
304           };
305           
306           class PEGASUS_COMMON_LINKAGE TypeMismatch : public Exception
307           {
308           public:
309           
310               static const char MSG[];
311           
312               TypeMismatch() : Exception(MSG) { }
313           };
314           
315           class PEGASUS_COMMON_LINKAGE NoSuchFile : public Exception
316 mike  1.1 {
317           public:
318           
319               static const char MSG[];
320           
321               NoSuchFile(const String& fileName) : Exception(MSG + fileName) { }
322           };
323           
324           class PEGASUS_COMMON_LINKAGE FailedToRemoveDirectory : public Exception
325           {
326           public:
327           
328               static const char MSG[];
329           
330               FailedToRemoveDirectory(const String& path) : Exception(MSG + path) { }
331           };
332           
333           class PEGASUS_COMMON_LINKAGE FailedToRemoveFile : public Exception
334           {
335           public:
336           
337 mike  1.1     static const char MSG[];
338           
339               FailedToRemoveFile(const String& path) : Exception(MSG + path) { }
340           };
341           
342           class PEGASUS_COMMON_LINKAGE NoSuchDirectory : public Exception
343           {
344           public:
345           
346               static const char MSG[];
347           
348               NoSuchDirectory(const String& directoryName) 
349           	: Exception(MSG + directoryName) { }
350           };
351           
352           class PEGASUS_COMMON_LINKAGE ChangeDirectoryFailed : public Exception
353           {
354           public:
355           
356               static const char MSG[];
357           
358 mike  1.1     ChangeDirectoryFailed(const String& directoryName) 
359           	: Exception(MSG + directoryName) { }
360           };
361           
362           class PEGASUS_COMMON_LINKAGE CannotCreateDirectory : public Exception
363           {
364           public:
365           
366               static const char MSG[];
367           
368               CannotCreateDirectory(const String& path) 
369           	: Exception(MSG + path) { }
370           };
371           
372           class PEGASUS_COMMON_LINKAGE NoSuchNameSpace : public Exception
373           {
374           public:
375           
376               static const char MSG[];
377           
378               NoSuchNameSpace(const String& directoryName) 
379 mike  1.1 	: Exception(MSG + directoryName) { }
380           };
381           
382           class PEGASUS_COMMON_LINKAGE CannotOpenFile : public Exception
383           {
384           public:
385           
386               static const char MSG[];
387           
388               CannotOpenFile(const String& path) 
389           	: Exception(MSG + path) { }
390           };
391           
392           class PEGASUS_COMMON_LINKAGE NotImplemented : public Exception
393           {
394           public:
395           
396               static const char MSG[];
397           
398               NotImplemented(const String& method) : Exception(MSG + method) { }
399           };
400 mike  1.1 
401           class PEGASUS_COMMON_LINKAGE CimException : public Exception
402           {
403           public:
404           
405               enum Code
406               {
407           	SUCCESS = 0,
408           
409           	// A general error occurred that is not covered by a more
410           	// specific error code.
411           
412           	FAILED = 1,
413           
414           	// Access to a CIM resource was not available to the client.
415           
416           	ACCESS_DENIED = 2,
417           
418           	// The target namespace does not exist.
419           
420           	INVALID_NAMESPACE = 3,
421 mike  1.1 
422           	// One or more parameter values passed to the method were invalid.
423           
424           	INVALID_PARAMETER = 4,
425           
426           	// The specified class does not exist.
427           
428           	INVALID_CLASS = 5,
429           
430           	// The requested object could not be found.
431           
432           	NOT_FOUND = 6,
433           
434           	// The requested operation is not supported. 
435           
436           	NOT_SUPPORTED = 7,
437           
438           	// Operation cannot be carried out on this class since it has
439           	// subclasses.
440           
441           	CLASS_HAS_CHILDREN = 8,
442 mike  1.1 
443           	// Operation cannot be carried out on this class since it has
444           	// instances.
445           
446           	CLASS_HAS_INSTANCES = 9,
447           
448           	// Operation cannot be carried out since the specified superClass
449           	// does not exist.
450           
451           	INVALID_SUPERCLASS = 10,
452           
453           	// Operation cannot be carried out because an object already exists.
454           
455           	ALREADY_EXISTS = 11,
456           
457           	// The specified property does not exist:
458           
459           	NO_SUCH_PROPERTY = 12,
460           
461           	// The value supplied is incompatible with the type.
462           
463 mike  1.1 	TYPE_MISMATCH = 13,
464           
465           	// The query language is not recognized or supported.
466           
467           	QUERY_LANGUAGE_NOT_SUPPORTED = 14,
468           
469           	// The query is not valid for the specified query language.
470           
471           	INVALID_QUERY = 15,
472           
473           	// The extrinsic method could not be executed.
474           
475           	METHOD_NOT_AVAILABLE = 16,
476           
477           	// The specified extrinsic method does not exist.
478           
479           	METHOD_NOT_FOUND = 17
480               };
481           
482               CimException(Code code);
483           
484 mike  1.1     CimException::Code getCode() const { return _code; }
485           
486               static const char* codeToString(Code code);
487           
488           private:
489           
490               Code _code;
491           };
492           
493           class PEGASUS_COMMON_LINKAGE StackUnderflow : public Exception
494           {
495           public:
496           
497               static const char MSG[];
498           
499               StackUnderflow() : Exception(MSG) { }
500           };
501           
502           class PEGASUS_COMMON_LINKAGE BadFormat : public Exception
503           {
504           public:
505 mike  1.1 
506               static const char MSG[];
507           
508               BadFormat() : Exception(MSG) { }
509           };
510           
511           class PEGASUS_COMMON_LINKAGE BadDateTimeFormat : public Exception
512           {
513           public:
514           
515               static const char MSG[];
516           
517               BadDateTimeFormat() : Exception(MSG) { }
518           };
519           
520           class PEGASUS_COMMON_LINKAGE IncompatibleTypes : public Exception
521           {
522           public:
523           
524               static const char MSG[];
525           
526 mike  1.1     IncompatibleTypes() : Exception(MSG) { }
527           };
528           
529           class PEGASUS_COMMON_LINKAGE BadlyFormedCGIQueryString : public Exception
530           {
531           public:
532           
533               static const char MSG[];
534           
535               BadlyFormedCGIQueryString() : Exception(MSG) { }
536           };
537           
538           PEGASUS_NAMESPACE_END
539           
540           #endif /* Pegasus_Exception_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2