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

  1 karl  1.81 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.22 //
  3 karl  1.78 // 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 karl  1.73 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.78 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.79 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.81 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.22 //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 chip  1.40 // 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 mike  1.22 // 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 kumpf 1.43 // 
 21 chip  1.40 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.22 // 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 chip  1.40 // 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 mike  1.22 // 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            #ifndef Pegasus_Exception_h
 35            #define Pegasus_Exception_h
 36            
 37            #include <Pegasus/Common/Config.h>
 38            #include <Pegasus/Common/String.h>
 39            #include <Pegasus/Common/CIMStatusCode.h>
 40 kumpf 1.46 #include <Pegasus/Common/Linkage.h>
 41 kumpf 1.80 #include <Pegasus/Common/ContentLanguageList.h>
 42 karl  1.84 #include <Pegasus/Common/Array.h>
 43 mike  1.22 
 44 kumpf 1.83 #ifdef PEGASUS_INTERNALONLY
 45 kumpf 1.82 # include <Pegasus/Common/MessageLoader.h>
 46            #endif
 47            
 48 mike  1.22 PEGASUS_NAMESPACE_BEGIN
 49 kumpf 1.68 class ExceptionRep;
 50 karl  1.84 class CIMInstance;
 51            class CIMConstInstance;
 52            
 53 kumpf 1.44 
 54 kumpf 1.85 /**
 55 kumpf 1.44 <p>The <tt>Exception</tt> class is the parent class for all
 56            exceptions that can be generated by any component of the
 57            Pegasus infrastructure. It includes not only the CIM exceptions
 58            that are defined by the DMTF, but also various exceptions that
 59            may occur during the processing of functions called by clients
 60            and providers.</p>
 61 mike  1.22 */
 62            class PEGASUS_COMMON_LINKAGE Exception
 63            {
 64            public:
 65            
 66 kumpf 1.68     ///
 67 mike  1.22     Exception(const String& message);
 68            
 69 kumpf 1.68     ///
 70 kumpf 1.65     Exception(const Exception& exception);
 71            
 72 kumpf 1.83 #ifdef PEGASUS_INTERNALONLY
 73 chuck 1.69     Exception(const MessageLoaderParms& msgParms);
 74 chuck 1.72 #endif
 75 chuck 1.69 
 76 kumpf 1.68     ///
 77 kumpf 1.58     virtual ~Exception();
 78 mike  1.22 
 79 kumpf 1.68     ///
 80 kumpf 1.62     virtual const String& getMessage() const;
 81 kumpf 1.85 
 82 kumpf 1.83 #ifdef PEGASUS_INTERNALONLY
 83                // Note: Not virtual to preserve binary compatibility.
 84 kumpf 1.80     const ContentLanguageList& getContentLanguages() const;
 85 kumpf 1.85 
 86 kumpf 1.83     // Not virtual to preserve binary compatibility.
 87 kumpf 1.85     void setContentLanguages(const ContentLanguageList& langs);
 88            #endif
 89 mike  1.22 
 90            protected:
 91            
 92 kumpf 1.65     Exception();
 93            
 94                ExceptionRep * _rep;
 95 mike  1.22 };
 96            
 97 kumpf 1.68 ///
 98 kumpf 1.60 class PEGASUS_COMMON_LINKAGE IndexOutOfBoundsException : public Exception
 99 mike  1.22 {
100            public:
101 kumpf 1.68     ///
102 kumpf 1.60     IndexOutOfBoundsException();
103 mike  1.22 };
104            
105 kumpf 1.68 ///
106 kumpf 1.60 class PEGASUS_COMMON_LINKAGE AlreadyExistsException : public Exception
107 mike  1.22 {
108            public:
109 kumpf 1.68     ///
110 kumpf 1.60     AlreadyExistsException(const String& message);
111 kumpf 1.83 
112            #ifdef PEGASUS_INTERNALONLY
113 chuck 1.70     AlreadyExistsException(MessageLoaderParms& msgParms);
114 chuck 1.72 #endif
115 mike  1.22 };
116            
117 kumpf 1.68 ///
118 kumpf 1.58 class PEGASUS_COMMON_LINKAGE InvalidNameException : public Exception
119 mike  1.22 {
120            public:
121 kumpf 1.68     ///
122 kumpf 1.58     InvalidNameException(const String& name);
123 kumpf 1.83 
124            #ifdef PEGASUS_INTERNALONLY
125 kumpf 1.85     InvalidNameException(MessageLoaderParms& msgParms);
126            #endif
127 kumpf 1.47 };
128            
129 kumpf 1.68 ///
130 kumpf 1.58 class PEGASUS_COMMON_LINKAGE InvalidNamespaceNameException : public Exception
131 kumpf 1.47 {
132            public:
133 kumpf 1.68     ///
134 kumpf 1.58     InvalidNamespaceNameException(const String& name);
135 kumpf 1.83 
136            #ifdef PEGASUS_INTERNALONLY
137 chuck 1.72     InvalidNamespaceNameException(MessageLoaderParms& msgParms);
138 kumpf 1.85 #endif
139 mike  1.22 };
140            
141 kumpf 1.68 ///
142 kumpf 1.60 class PEGASUS_COMMON_LINKAGE UninitializedObjectException : public Exception
143 mike  1.22 {
144            public:
145 kumpf 1.68     ///
146 kumpf 1.60     UninitializedObjectException();
147 mike  1.22 };
148            
149 kumpf 1.68 ///
150 kumpf 1.60 class PEGASUS_COMMON_LINKAGE TypeMismatchException : public Exception
151 mike  1.22 {
152            public:
153 kumpf 1.68     ///
154 kumpf 1.60     TypeMismatchException();
155 marek 1.75     TypeMismatchException(const String& message);
156 kumpf 1.83 
157            #ifdef PEGASUS_INTERNALONLY
158 marek 1.75     TypeMismatchException(MessageLoaderParms& msgParms);
159 kumpf 1.85 #endif
160 marek 1.75 
161 mike  1.22 };
162 karl  1.26 
163 kumpf 1.68 ///
164 kumpf 1.60 class PEGASUS_COMMON_LINKAGE DynamicCastFailedException : public Exception
165 mike  1.24 {
166            public:
167 kumpf 1.68     ///
168 kumpf 1.60     DynamicCastFailedException();
169 mike  1.24 };
170            
171 kumpf 1.68 ///
172 kumpf 1.60 class PEGASUS_COMMON_LINKAGE InvalidDateTimeFormatException : public Exception
173 mike  1.22 {
174            public:
175 kumpf 1.68     ///
176 kumpf 1.60     InvalidDateTimeFormatException();
177 mike  1.23 };
178            
179 kumpf 1.68 ///
180 kumpf 1.58 class PEGASUS_COMMON_LINKAGE MalformedObjectNameException : public Exception
181 mike  1.22 {
182            public:
183 kumpf 1.68     ///
184 kumpf 1.58     MalformedObjectNameException(const String& objectName);
185 kumpf 1.83 
186            #ifdef PEGASUS_INTERNALONLY
187 kumpf 1.85     MalformedObjectNameException(MessageLoaderParms& msgParms);
188            #endif
189 mike  1.22 };
190            
191 kumpf 1.68 ///
192 kumpf 1.54 class PEGASUS_COMMON_LINKAGE BindFailedException : public Exception
193 mike  1.22 {
194            public:
195 kumpf 1.68     ///
196 kumpf 1.58     BindFailedException(const String& message);
197 kumpf 1.83 
198            #ifdef PEGASUS_INTERNALONLY
199 chuck 1.72     BindFailedException(MessageLoaderParms& msgParms);
200 kumpf 1.85 #endif
201 mike  1.22 };
202            
203 kumpf 1.68 ///
204 kumpf 1.54 class PEGASUS_COMMON_LINKAGE InvalidLocatorException : public Exception
205 mike  1.22 {
206            public:
207 kumpf 1.68     ///
208 kumpf 1.58     InvalidLocatorException(const String& locator);
209 kumpf 1.83 
210            #ifdef PEGASUS_INTERNALONLY
211 kumpf 1.85     InvalidLocatorException(MessageLoaderParms& msgParms);
212            #endif
213 mike  1.22 };
214            
215 kumpf 1.68 ///
216 kumpf 1.54 class PEGASUS_COMMON_LINKAGE CannotCreateSocketException : public Exception
217 mike  1.22 {
218            public:
219 kumpf 1.68     ///
220 kumpf 1.58     CannotCreateSocketException();
221 mike  1.22 };
222            
223 kumpf 1.68 ///
224 kumpf 1.54 class PEGASUS_COMMON_LINKAGE CannotConnectException : public Exception
225 mike  1.22 {
226            public:
227 kumpf 1.68     ///
228                CannotConnectException(const String& message);
229 kumpf 1.83 
230            #ifdef PEGASUS_INTERNALONLY
231 kumpf 1.85     CannotConnectException(MessageLoaderParms& msgParms);
232            #endif
233 mike  1.22 };
234            
235 kumpf 1.68 ///
236 kumpf 1.54 class PEGASUS_COMMON_LINKAGE AlreadyConnectedException: public Exception
237 mike  1.22 {
238            public:
239 kumpf 1.68     ///
240 kumpf 1.58     AlreadyConnectedException();
241 mike  1.22 };
242            
243 kumpf 1.68 ///
244 kumpf 1.54 class PEGASUS_COMMON_LINKAGE NotConnectedException: public Exception
245 mike  1.22 {
246            public:
247 kumpf 1.68     ///
248 kumpf 1.58     NotConnectedException();
249 mike  1.22 };
250            
251 kumpf 1.68 ///
252 kumpf 1.54 class PEGASUS_COMMON_LINKAGE ConnectionTimeoutException: public Exception
253 mike  1.22 {
254            public:
255 kumpf 1.68     ///
256 kumpf 1.58     ConnectionTimeoutException();
257 mike  1.22 };
258            
259 kumpf 1.68 ///
260 kumpf 1.54 class PEGASUS_COMMON_LINKAGE SSLException: public Exception
261 mike  1.22 {
262            public:
263 kumpf 1.68     ///
264 kumpf 1.58     SSLException(const String& message);
265 kumpf 1.83 
266            #ifdef PEGASUS_INTERNALONLY
267 kumpf 1.85     SSLException(MessageLoaderParms& msgParms);
268            #endif
269 mike  1.22 };
270            
271 kumpf 1.68 ///
272 kumpf 1.67 class PEGASUS_COMMON_LINKAGE DateTimeOutOfRangeException : public Exception
273            {
274            public:
275 kumpf 1.68     ///
276 chuck 1.69     DateTimeOutOfRangeException(const String& message);
277 kumpf 1.83 
278            #ifdef PEGASUS_INTERNALONLY
279 chuck 1.72     DateTimeOutOfRangeException(MessageLoaderParms& msgParms);
280 kumpf 1.85 #endif
281            };
282 kumpf 1.54 
283 chip  1.40 /** The CIMException defines the CIM exceptions that are formally defined in
284 mike  1.22     the CIM Operations over HTTP specification.
285            */
286            class PEGASUS_COMMON_LINKAGE CIMException : public Exception
287            {
288            public:
289            
290 karl  1.84     /**  Construct a CIMException with status code and Error description
291                     message.
292                     @param code CIMStatus code defining the error
293                     @param message String defining the message text
294                     @param instance CIMInstance containing the CIM_Error
295                     instance
296 kumpf 1.85     */
297 mike  1.22     CIMException(
298 kumpf 1.85         CIMStatusCode code = CIM_ERR_SUCCESS,
299                    const String& message = String::EMPTY);
300            
301 karl  1.84     /**  Construct a CIMException with status code, message
302                     and a CIM_Error instance attached to the exception. Note that
303                     this allows the CIMStatusCode and Description in the CIMError
304                     to be different than those attached to the call.
305                     @param code CIMStatus code defining the error
306                     @param message String defining the message text
307                     @param instance CIMInstance containing the CIM_Error
308                     instance.
309 kumpf 1.85     */
310 karl  1.84     CIMException(
311 kumpf 1.85         CIMStatusCode code,
312                    const String& message,
313 karl  1.84         const CIMInstance& instance);
314            
315                /**  Construct a CIMException with status code, message
316                     and an Array of CIM_Error instances attached to the exception.
317                     Note that this allows the CIMStatusCode and Description in the
318                     CIMErrors to be different than those attached to the call.
319                     @param code CIMStatus code defining the error
320                     @param message String defining the message text
321                     @param instances Array<CIMInstance> containing  CIM_Error
322                     instances.
323                */
324            
325                CIMException(
326 kumpf 1.85         CIMStatusCode code,
327                    const String& message,
328 karl  1.84         const Array<CIMInstance>& instances);
329            
330 kumpf 1.83 #ifdef PEGASUS_INTERNALONLY
331 chuck 1.69     CIMException(
332 kumpf 1.85         CIMStatusCode code,
333                    const MessageLoaderParms& msgParms);
334 karl  1.84 
335                CIMException(
336 kumpf 1.85         CIMStatusCode code,
337                    const MessageLoaderParms& msgParms,
338 karl  1.84         const CIMInstance& instance);
339                CIMException(
340 kumpf 1.85         CIMStatusCode code,
341                    const MessageLoaderParms& msgParms,
342 karl  1.84         const Array<CIMInstance>& instances);
343 kumpf 1.85 #endif
344 kumpf 1.56 
345 kumpf 1.68     ///
346 kumpf 1.56     CIMException(const CIMException & cimException);
347            
348 kumpf 1.68     ///
349 kumpf 1.65     CIMException& operator=(const CIMException & cimException);
350            
351 kumpf 1.68     ///
352 kumpf 1.56     virtual ~CIMException();
353            
354 karl  1.84     /** gets the CIMStatusCode for the current CIMException. This is the
355                    code that defines the ERROR that was executed and transmitted
356                    to the Client.
357                    @return a single CIMStatusCode
358                    @SeeAlso CIMStatusCode
359                    EXAMPLE
360                        try
361                        { .. Execute CIM Operation
362                        }
363 kumpf 1.86             catch (CIMExcepton e)
364 karl  1.84             {
365                            if (e.getCode() == CIM_ERR_ACCESS_DENIED )
366                                ....
367                        }
368 kumpf 1.85      */
369 karl  1.84      CIMStatusCode getCode() const;
370            
371            #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
372            
373                /* get the count of CIM_Error instances attached to the CIMException.
374                   Normally this method is used by the client to determine if any
375 kumpf 1.85        CIM_Error instances are attached to a CIMException and as the
376 karl  1.84        end test if the user decides to get the exception instances.
377                   @return Uint32 count of CIM_Error instances attached to a CIMException.
378                   0 indicates that there are no instances attached.
379                */
380                Uint32 getErrorCount() const;
381            
382                /* get a single CIM_Error instance that is attached to a CIMException.
383                   @param Uint32 index that defines the index to a particular CIMInstance
384                   attached to the CIMException. The index must be less than the value of
385                   the return from getErrorCount()
386                   Return CIMInstance the instance defined by the index.
387                   exception: returns out-of-range exception if the index is outside the
388                   range of the array of CIM_Instances attached to the CIMExcepton.
389                   EXAMPLE
390                        try
391                        { .. Execute CIM Operation
392                        }
393 kumpf 1.86             catch (CIMExcepton e)
394 karl  1.84             {
395                            if (e.getErrorCount() > 0 )
396                            {
397                                for (Uint32 i = 0 ; i < getErrorCount() ; i++)
398                                   ... get and process each CIM_Error instance
399                            }
400                        }
401                */
402            
403                CIMConstInstance getError(Uint32 index) const;
404            
405                //CIMInstance getError(Uint32 index);
406            
407                /* Adds a single error instance to a CIMException
408                   @param instance CIMInstance is the instance of CIM_Error
409                   that is to be added to the CIMException. This instance is
410                   NOT checked by the infrastructure for correct type.
411                */
412                void addError(const CIMInstance& instance);
413            
414            #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
415 mike  1.22 };
416            
417            
418 kumpf 1.55 PEGASUS_NAMESPACE_END
419            
420 mike  1.22 #endif /* Pegasus_Exception_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2