• Main Page
  • Classes
  • Files
  • File List

/usr/src/startcom/BUILD/pegasus/src/Pegasus/Common/Exception.h

00001 //%LICENSE////////////////////////////////////////////////////////////////
00002 //
00003 // Licensed to The Open Group (TOG) under one or more contributor license
00004 // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
00005 // this work for additional information regarding copyright ownership.
00006 // Each contributor licenses this file to you under the OpenPegasus Open
00007 // Source License; you may not use this file except in compliance with the
00008 // License.
00009 //
00010 // Permission is hereby granted, free of charge, to any person obtaining a
00011 // copy of this software and associated documentation files (the "Software"),
00012 // to deal in the Software without restriction, including without limitation
00013 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00014 // and/or sell copies of the Software, and to permit persons to whom the
00015 // Software is furnished to do so, subject to the following conditions:
00016 //
00017 // The above copyright notice and this permission notice shall be included
00018 // in all copies or substantial portions of the Software.
00019 //
00020 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00021 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00024 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00025 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00026 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00027 //
00029 //
00030 //%/////////////////////////////////////////////////////////////////////////////
00031 
00032 #ifndef Pegasus_Exception_h
00033 #define Pegasus_Exception_h
00034 
00035 #include <Pegasus/Common/Config.h>
00036 #include <Pegasus/Common/String.h>
00037 #include <Pegasus/Common/CIMStatusCode.h>
00038 #include <Pegasus/Common/Linkage.h>
00039 #include <Pegasus/Common/ContentLanguageList.h>
00040 #include <Pegasus/Common/Array.h>
00041 
00042 #ifdef PEGASUS_INTERNALONLY
00043 # include <Pegasus/Common/MessageLoader.h>
00044 #endif
00045 
00046 PEGASUS_NAMESPACE_BEGIN
00047 
00048 class ExceptionRep;
00049 class CIMInstance;
00050 class CIMConstInstance;
00051 
00052 
00057 class PEGASUS_COMMON_LINKAGE Exception
00058 {
00059 public:
00060 
00065     Exception(const String& message);
00066 
00071     Exception(const Exception& exception);
00072 
00073 #ifdef PEGASUS_INTERNALONLY
00074     Exception(const MessageLoaderParms& msgParms);
00075 #endif
00076 
00080     virtual ~Exception();
00081 
00087     Exception& operator=(const Exception& exception);
00088 
00093     virtual const String& getMessage() const;
00094 
00095 #ifdef PEGASUS_INTERNALONLY
00096     // Note: Not virtual to preserve binary compatibility.
00097     const ContentLanguageList& getContentLanguages() const;
00098 
00099     // Not virtual to preserve binary compatibility.
00100     void setContentLanguages(const ContentLanguageList& langs);
00101 #endif
00102 
00103 protected:
00104 
00108     Exception();
00109 
00113     ExceptionRep * _rep;
00114 };
00115 
00120 class PEGASUS_COMMON_LINKAGE IndexOutOfBoundsException : public Exception
00121 {
00122 public:
00126     IndexOutOfBoundsException();
00127 };
00128 
00133 class PEGASUS_COMMON_LINKAGE AlreadyExistsException : public Exception
00134 {
00135 public:
00140     AlreadyExistsException(const String& message);
00141 
00142 #ifdef PEGASUS_INTERNALONLY
00143     AlreadyExistsException(MessageLoaderParms& msgParms);
00144 #endif
00145 };
00146 
00151 class PEGASUS_COMMON_LINKAGE InvalidNameException : public Exception
00152 {
00153 public:
00158     InvalidNameException(const String& name);
00159 
00160 #ifdef PEGASUS_INTERNALONLY
00161     InvalidNameException(MessageLoaderParms& msgParms);
00162 #endif
00163 };
00164 
00169 class PEGASUS_COMMON_LINKAGE InvalidNamespaceNameException : public Exception
00170 {
00171 public:
00177     InvalidNamespaceNameException(const String& name);
00178 
00179 #ifdef PEGASUS_INTERNALONLY
00180     InvalidNamespaceNameException(MessageLoaderParms& msgParms);
00181 #endif
00182 };
00183 
00188 class PEGASUS_COMMON_LINKAGE UninitializedObjectException : public Exception
00189 {
00190 public:
00194     UninitializedObjectException();
00195 };
00196 
00201 class PEGASUS_COMMON_LINKAGE TypeMismatchException : public Exception
00202 {
00203 public:
00207     TypeMismatchException();
00208 
00213     TypeMismatchException(const String& message);
00214 
00215 #ifdef PEGASUS_INTERNALONLY
00216     TypeMismatchException(MessageLoaderParms& msgParms);
00217 #endif
00218 
00219 };
00220 
00225 class PEGASUS_COMMON_LINKAGE DynamicCastFailedException : public Exception
00226 {
00227 public:
00231     DynamicCastFailedException();
00232 };
00233 
00238 class PEGASUS_COMMON_LINKAGE InvalidDateTimeFormatException : public Exception
00239 {
00240 public:
00245     InvalidDateTimeFormatException();
00246 };
00247 
00252 class PEGASUS_COMMON_LINKAGE DateTimeOutOfRangeException : public Exception
00253 {
00254 public:
00260     DateTimeOutOfRangeException(const String& message);
00261 
00262 #ifdef PEGASUS_INTERNALONLY
00263     DateTimeOutOfRangeException(MessageLoaderParms& msgParms);
00264 #endif
00265 };
00266 
00271 class PEGASUS_COMMON_LINKAGE MalformedObjectNameException : public Exception
00272 {
00273 public:
00278     MalformedObjectNameException(const String& objectName);
00279 
00280 #ifdef PEGASUS_INTERNALONLY
00281     MalformedObjectNameException(MessageLoaderParms& msgParms);
00282 #endif
00283 };
00284 
00289 class PEGASUS_COMMON_LINKAGE BindFailedException : public Exception
00290 {
00291 public:
00296     BindFailedException(const String& message);
00297 
00298 #ifdef PEGASUS_INTERNALONLY
00299     BindFailedException(MessageLoaderParms& msgParms);
00300 #endif
00301 };
00302 
00307 class PEGASUS_COMMON_LINKAGE InvalidLocatorException : public Exception
00308 {
00309 public:
00314     InvalidLocatorException(const String& locator);
00315 
00316 #ifdef PEGASUS_INTERNALONLY
00317     InvalidLocatorException(MessageLoaderParms& msgParms);
00318 #endif
00319 };
00320 
00324 class PEGASUS_COMMON_LINKAGE CannotCreateSocketException : public Exception
00325 {
00326 public:
00330     CannotCreateSocketException();
00331 };
00332 
00336 class PEGASUS_COMMON_LINKAGE CannotConnectException : public Exception
00337 {
00338 public:
00343     CannotConnectException(const String& message);
00344 
00345 #ifdef PEGASUS_INTERNALONLY
00346     CannotConnectException(MessageLoaderParms& msgParms);
00347 #endif
00348 };
00349 
00354 class PEGASUS_COMMON_LINKAGE AlreadyConnectedException: public Exception
00355 {
00356 public:
00360     AlreadyConnectedException();
00361 };
00362 
00367 class PEGASUS_COMMON_LINKAGE NotConnectedException: public Exception
00368 {
00369 public:
00373     NotConnectedException();
00374 };
00375 
00380 class PEGASUS_COMMON_LINKAGE ConnectionTimeoutException: public Exception
00381 {
00382 public:
00386     ConnectionTimeoutException();
00387 };
00388 
00393 class PEGASUS_COMMON_LINKAGE SSLException: public Exception
00394 {
00395 public:
00400     SSLException(const String& message);
00401 
00402 #ifdef PEGASUS_INTERNALONLY
00403     SSLException(MessageLoaderParms& msgParms);
00404 #endif
00405 };
00406 
00410 class PEGASUS_COMMON_LINKAGE CIMException : public Exception
00411 {
00412 public:
00413 
00422     CIMException(
00423         CIMStatusCode code = CIM_ERR_SUCCESS,
00424         const String& message = String::EMPTY);
00425 
00438     CIMException(
00439         CIMStatusCode code,
00440         const String& message,
00441         const CIMInstance& instance);
00442 
00455     CIMException(
00456         CIMStatusCode code,
00457         const String& message,
00458         const Array<CIMInstance>& instances);
00459 
00460 #ifdef PEGASUS_INTERNALONLY
00461     CIMException(
00462         CIMStatusCode code,
00463         const MessageLoaderParms& msgParms);
00464 
00465     CIMException(
00466         CIMStatusCode code,
00467         const MessageLoaderParms& msgParms,
00468         const CIMInstance& instance);
00469     CIMException(
00470         CIMStatusCode code,
00471         const MessageLoaderParms& msgParms,
00472         const Array<CIMInstance>& instances);
00473 #endif
00474 
00479     CIMException(const CIMException& cimException);
00480 
00486     CIMException& operator=(const CIMException& cimException);
00487 
00491     virtual ~CIMException();
00492 
00499     CIMStatusCode getCode() const;
00500 
00501 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
00502 
00510     Uint32 getErrorCount() const;
00511 
00535     CIMConstInstance getError(Uint32 index) const;
00536 
00544     void addError(const CIMInstance& instance);
00545 
00546 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
00547 };
00548 
00549 
00550 PEGASUS_NAMESPACE_END
00551 
00552 #endif /* Pegasus_Exception_h */