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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2