Exception.h
1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // 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 //
10 // 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 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // 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 //
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31 
32 #ifndef Pegasus_Exception_h
33 #define Pegasus_Exception_h
34 
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/String.h>
37 #include <Pegasus/Common/CIMStatusCode.h>
38 #include <Pegasus/Common/Linkage.h>
39 #include <Pegasus/Common/ContentLanguageList.h>
40 #include <Pegasus/Common/Array.h>
41 
42 #ifdef PEGASUS_INTERNALONLY
43 # include <Pegasus/Common/MessageLoader.h>
44 #endif
45 
46 PEGASUS_NAMESPACE_BEGIN
47 
48 class ExceptionRep;
49 class CIMInstance;
50 class CIMConstInstance;
51 
52 
57 class PEGASUS_COMMON_LINKAGE Exception
58 {
59 public:
60 
65  Exception(const String& message);
66 
71  Exception(const Exception& exception);
72 
73 #ifdef PEGASUS_INTERNALONLY
74  Exception(const MessageLoaderParms& msgParms);
75 #endif
76 
80  virtual ~Exception();
81 
87  Exception& operator=(const Exception& exception);
88 
93  virtual const String& getMessage() const;
94 
95 #ifdef PEGASUS_INTERNALONLY
96  // Note: Not virtual to preserve binary compatibility.
97  const ContentLanguageList& getContentLanguages() const;
98 
99  // Not virtual to preserve binary compatibility.
100  void setContentLanguages(const ContentLanguageList& langs);
101 #endif
102 
103 protected:
104 
108  Exception();
109 
113  ExceptionRep * _rep;
114 };
115 
120 class PEGASUS_COMMON_LINKAGE IndexOutOfBoundsException : public Exception
121 {
122 public:
127 };
128 
133 class PEGASUS_COMMON_LINKAGE AlreadyExistsException : public Exception
134 {
135 public:
140  AlreadyExistsException(const String& message);
141 
142 #ifdef PEGASUS_INTERNALONLY
143  AlreadyExistsException(MessageLoaderParms& msgParms);
144 #endif
145 };
146 
151 class PEGASUS_COMMON_LINKAGE InvalidNameException : public Exception
152 {
153 public:
158  InvalidNameException(const String& name);
159 
160 #ifdef PEGASUS_INTERNALONLY
161  InvalidNameException(MessageLoaderParms& msgParms);
162 #endif
163 };
164 
169 class PEGASUS_COMMON_LINKAGE InvalidNamespaceNameException : public Exception
170 {
171 public:
178 
179 #ifdef PEGASUS_INTERNALONLY
180  InvalidNamespaceNameException(MessageLoaderParms& msgParms);
181 #endif
182 };
183 
188 class PEGASUS_COMMON_LINKAGE UninitializedObjectException : public Exception
189 {
190 public:
195 };
196 
201 class PEGASUS_COMMON_LINKAGE TypeMismatchException : public Exception
202 {
203 public:
208 
213  TypeMismatchException(const String& message);
214 
215 #ifdef PEGASUS_INTERNALONLY
216  TypeMismatchException(MessageLoaderParms& msgParms);
217 #endif
218 
219 };
220 
225 class PEGASUS_COMMON_LINKAGE DynamicCastFailedException : public Exception
226 {
227 public:
232 };
233 
238 class PEGASUS_COMMON_LINKAGE InvalidDateTimeFormatException : public Exception
239 {
240 public:
246 };
247 
252 class PEGASUS_COMMON_LINKAGE DateTimeOutOfRangeException : public Exception
253 {
254 public:
260  DateTimeOutOfRangeException(const String& message);
261 
262 #ifdef PEGASUS_INTERNALONLY
263  DateTimeOutOfRangeException(MessageLoaderParms& msgParms);
264 #endif
265 };
266 
271 class PEGASUS_COMMON_LINKAGE MalformedObjectNameException : public Exception
272 {
273 public:
278  MalformedObjectNameException(const String& objectName);
279 
280 #ifdef PEGASUS_INTERNALONLY
281  MalformedObjectNameException(MessageLoaderParms& msgParms);
282 #endif
283 };
284 
289 class PEGASUS_COMMON_LINKAGE BindFailedException : public Exception
290 {
291 public:
296  BindFailedException(const String& message);
297 
298 #ifdef PEGASUS_INTERNALONLY
299  BindFailedException(MessageLoaderParms& msgParms);
300 #endif
301 };
302 
307 class PEGASUS_COMMON_LINKAGE InvalidLocatorException : public Exception
308 {
309 public:
314  InvalidLocatorException(const String& locator);
315 
316 #ifdef PEGASUS_INTERNALONLY
317  InvalidLocatorException(MessageLoaderParms& msgParms);
318 #endif
319 };
320 
324 class PEGASUS_COMMON_LINKAGE CannotCreateSocketException : public Exception
325 {
326 public:
331 };
332 
336 class PEGASUS_COMMON_LINKAGE CannotConnectException : public Exception
337 {
338 public:
343  CannotConnectException(const String& message);
344 
345 #ifdef PEGASUS_INTERNALONLY
346  CannotConnectException(MessageLoaderParms& msgParms);
347 #endif
348 };
349 
354 class PEGASUS_COMMON_LINKAGE AlreadyConnectedException: public Exception
355 {
356 public:
361 };
362 
367 class PEGASUS_COMMON_LINKAGE NotConnectedException: public Exception
368 {
369 public:
374 };
375 
380 class PEGASUS_COMMON_LINKAGE ConnectionTimeoutException: public Exception
381 {
382 public:
387 };
388 
389 // EXP_PULL_BEGIN
390 
391 class PEGASUS_COMMON_LINKAGE InvalidEnumerationContextException:
392  public Exception
393 {
394 public:
397 };
398 
399 // EXP_PULL_END
400 
405 class PEGASUS_COMMON_LINKAGE SSLException: public Exception
406 {
407 public:
412  SSLException(const String& message);
413 
414 #ifdef PEGASUS_INTERNALONLY
415  SSLException(MessageLoaderParms& msgParms);
416 #endif
417 };
418 
422 class PEGASUS_COMMON_LINKAGE CIMException : public Exception
423 {
424 public:
425 
434  CIMException(
435  CIMStatusCode code = CIM_ERR_SUCCESS,
436  const String& message = String::EMPTY);
437 
450  CIMException(
451  CIMStatusCode code,
452  const String& message,
453  const CIMInstance& instance);
454 
467  CIMException(
468  CIMStatusCode code,
469  const String& message,
470  const Array<CIMInstance>& instances);
471 
472 #ifdef PEGASUS_INTERNALONLY
473  CIMException(
474  CIMStatusCode code,
475  const MessageLoaderParms& msgParms);
476 
477  CIMException(
478  CIMStatusCode code,
479  const MessageLoaderParms& msgParms,
480  const CIMInstance& instance);
481  CIMException(
482  CIMStatusCode code,
483  const MessageLoaderParms& msgParms,
484  const Array<CIMInstance>& instances);
485 #endif
486 
491  CIMException(const CIMException& cimException);
492 
498  CIMException& operator=(const CIMException& cimException);
499 
503  virtual ~CIMException();
504 
511  CIMStatusCode getCode() const;
512 
513 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
514 
522  Uint32 getErrorCount() const;
523 
547  CIMConstInstance getError(Uint32 index) const;
548 
556  void addError(const CIMInstance& instance);
557 
558 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
559 };
560 
561 
562 PEGASUS_NAMESPACE_END
563 
564 #endif /* Pegasus_Exception_h */
Definition: Exception.h:289
Definition: Exception.h:151
Exception & operator=(const Exception &exception)
Definition: Exception.h:133
Definition: Exception.h:367
Definition: CIMInstance.h:64
Definition: Exception.h:169
Definition: String.h:119
Definition: Exception.h:307
Definition: Exception.h:201
Definition: Exception.h:391
Definition: Exception.h:225
Definition: Exception.h:238
Definition: Exception.h:380
Definition: Exception.h:324
Definition: Exception.h:336
Definition: Exception.h:354
Definition: Exception.h:120
Definition: Exception.h:252
Definition: Exception.h:188
Definition: Exception.h:422
static const String EMPTY
Definition: String.h:127
Definition: ArrayInter.h:44
Definition: CIMInstance.h:368
Definition: Exception.h:57
Definition: Exception.h:405
Definition: ContentLanguageList.h:53
ExceptionRep * _rep
Definition: Exception.h:113
Definition: Exception.h:271