1 mike 1.22 //%/////////////////////////////////////////////////////////////////////////////
2 //
|
3 kumpf 1.42 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 mike 1.22 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 chip 1.39 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10 mike 1.22 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
|
12 kumpf 1.42 //
|
13 chip 1.39 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
14 mike 1.22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
16 chip 1.39 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19 mike 1.22 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Mike Brasher (mbrasher@bmc.com)
25 //
|
26 kumpf 1.52 // Modified By: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
27 // Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com)
|
28 kumpf 1.43 // Carol Ann Krug Graves, Hewlett-Packard Company
29 // (carolann_graves@hp.com)
|
30 kumpf 1.52 // Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
31 mike 1.22 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #include <cstdio>
35 #include "Exception.h"
|
36 kumpf 1.59 #include <Pegasus/Common/ExceptionRep.h>
|
37 kumpf 1.53 #include <Pegasus/Common/CIMExceptionRep.h>
|
38 kumpf 1.33 #include "Tracer.h"
|
39 mike 1.22
40 PEGASUS_NAMESPACE_BEGIN
41
|
42 kumpf 1.59 Exception::Exception(const String& message)
43 {
44 _rep = new ExceptionRep();
45 _rep->message = message;
46 }
47
48 Exception::Exception(const Exception& exception)
49 {
50 _rep = new ExceptionRep();
51 _rep->message = exception._rep->message;
52 }
53
54 Exception::Exception()
|
55 chip 1.39 {
|
56 mike 1.22 }
57
|
58 kumpf 1.54 Exception::~Exception()
|
59 mike 1.22 {
|
60 kumpf 1.59 delete _rep;
|
61 mike 1.22 }
62
|
63 kumpf 1.54 const String& Exception::getMessage() const
|
64 mike 1.22 {
|
65 kumpf 1.59 return _rep->message;
|
66 mike 1.22 }
67
68
|
69 kumpf 1.55 IndexOutOfBoundsException::IndexOutOfBoundsException()
70 : Exception("index out of bounds")
|
71 kumpf 1.54 {
72 }
|
73 mike 1.22
|
74 kumpf 1.55 AlreadyExistsException::AlreadyExistsException(const String& message)
|
75 kumpf 1.54 : Exception("already exists: " + message)
76 {
77 }
|
78 mike 1.22
|
79 kumpf 1.54 InvalidNameException::InvalidNameException(const String& name)
80 : Exception("invalid CIM name: " + name)
81 {
82 }
|
83 mike 1.22
|
84 kumpf 1.54 InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name)
85 : Exception("invalid CIM namespace name: " + name)
86 {
87 }
|
88 kumpf 1.44
|
89 kumpf 1.55 UninitializedObjectException::UninitializedObjectException()
|
90 kumpf 1.54 : Exception("uninitialized object")
91 {
92 }
|
93 mike 1.22
|
94 kumpf 1.55 TypeMismatchException::TypeMismatchException()
|
95 kumpf 1.54 : Exception("type mismatch")
96 {
97 }
|
98 mike 1.22
|
99 kumpf 1.55 DynamicCastFailedException::DynamicCastFailedException()
|
100 kumpf 1.54 : Exception("dynamic cast failed")
101 {
102 }
|
103 mike 1.24
|
104 kumpf 1.55 InvalidDateTimeFormatException::InvalidDateTimeFormatException()
105 : Exception("invalid datetime format")
|
106 kumpf 1.54 {
107 }
|
108 mike 1.22
|
109 kumpf 1.54 MalformedObjectNameException::MalformedObjectNameException(
110 const String& objectName)
111 : Exception("malformed object name: " + objectName)
112 {
113 }
|
114 mike 1.22
|
115 kumpf 1.54 BindFailedException::BindFailedException(const String& message)
116 : Exception("Bind failed: " + message)
117 {
118 }
|
119 mike 1.23
|
120 kumpf 1.54 InvalidLocatorException::InvalidLocatorException(const String& locator)
121 : Exception("Invalid locator: " + locator)
122 {
123 }
|
124 mike 1.23
|
125 kumpf 1.54 CannotCreateSocketException::CannotCreateSocketException()
126 : Exception("Cannot create socket")
127 {
128 }
|
129 mike 1.23
|
130 kumpf 1.54 CannotConnectException::CannotConnectException(const String& locator)
131 : Exception("Cannot connect to: " + locator)
132 {
133 }
|
134 mike 1.23
|
135 kumpf 1.54 AlreadyConnectedException::AlreadyConnectedException()
136 : Exception("already connected")
137 {
138 }
|
139 mike 1.23
|
140 kumpf 1.54 NotConnectedException::NotConnectedException()
141 : Exception("not connected")
142 {
143 }
|
144 mike 1.22
|
145 kumpf 1.54 ConnectionTimeoutException::ConnectionTimeoutException()
146 : Exception("connection timed out")
147 {
148 }
|
149 kumpf 1.26
|
150 kumpf 1.54 SSLException::SSLException(const String& message)
151 : Exception("SSL Exception: " + message)
152 {
153 }
|
154 kumpf 1.40
|
155 kumpf 1.26
|
156 mike 1.22 ////////////////////////////////////////////////////////////////////////////////
157 //
158 // CIMException
159 //
160 ////////////////////////////////////////////////////////////////////////////////
161
|
162 kumpf 1.53 CIMException::CIMException(
|
163 kumpf 1.29 CIMStatusCode code,
|
164 kumpf 1.37 const String& message)
|
165 kumpf 1.61 : Exception()
|
166 kumpf 1.29 {
|
167 kumpf 1.59 CIMExceptionRep * tmp = new CIMExceptionRep ();
168 tmp->message = message;
169 tmp->code = code;
170 tmp->file = "";
171 tmp->line = 0;
172 _rep = tmp;
|
173 kumpf 1.29 }
174
|
175 kumpf 1.53 CIMException::CIMException(const CIMException & cimException)
|
176 kumpf 1.61 : Exception()
|
177 kumpf 1.53 {
|
178 kumpf 1.59 CIMExceptionRep * tmp = new CIMExceptionRep ();
179 CIMExceptionRep * rep;
180 rep = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
181 tmp->message = rep->message;
182 tmp->code = rep->code;
183 tmp->file = rep->file;
184 tmp->line = rep->line;
185 _rep = tmp;
|
186 mike 1.22 }
187
|
188 kumpf 1.53 CIMException& CIMException::operator=(const CIMException & cimException)
|
189 mike 1.22 {
|
190 kumpf 1.59 CIMExceptionRep* left;
191 CIMExceptionRep* right;
192 left = reinterpret_cast<CIMExceptionRep*>(this->_rep);
193 right = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
194 left->message = right->message;
195 left->code = right->code;
196 left->file = right->file;
197 left->line = right->line;
|
198 kumpf 1.53 return *this;
|
199 kumpf 1.32 }
200
|
201 kumpf 1.53 CIMException::~CIMException()
|
202 kumpf 1.37 {
203 }
204
|
205 kumpf 1.53 CIMStatusCode CIMException::getCode() const
|
206 kumpf 1.37 {
|
207 kumpf 1.59 CIMExceptionRep* rep;
208 rep = reinterpret_cast<CIMExceptionRep*>(_rep);
209 return rep->code;
|
210 mike 1.22 }
211
212 PEGASUS_NAMESPACE_END
|