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 kumpf 1.62 // Sushma Fernandes , Hewlett-Packard Company
32 // (sushma_fernandes@hp.com)
|
33 mike 1.22 //
34 //%/////////////////////////////////////////////////////////////////////////////
35
36 #include <cstdio>
37 #include "Exception.h"
|
38 kumpf 1.59 #include <Pegasus/Common/ExceptionRep.h>
|
39 kumpf 1.53 #include <Pegasus/Common/CIMExceptionRep.h>
|
40 kumpf 1.33 #include "Tracer.h"
|
41 mike 1.22
42 PEGASUS_NAMESPACE_BEGIN
43
|
44 kumpf 1.59 Exception::Exception(const String& message)
45 {
46 _rep = new ExceptionRep();
47 _rep->message = message;
48 }
49
50 Exception::Exception(const Exception& exception)
51 {
52 _rep = new ExceptionRep();
53 _rep->message = exception._rep->message;
54 }
55
56 Exception::Exception()
|
57 chip 1.39 {
|
58 mike 1.22 }
59
|
60 kumpf 1.54 Exception::~Exception()
|
61 mike 1.22 {
|
62 kumpf 1.59 delete _rep;
|
63 mike 1.22 }
64
|
65 kumpf 1.54 const String& Exception::getMessage() const
|
66 mike 1.22 {
|
67 kumpf 1.59 return _rep->message;
|
68 mike 1.22 }
69
70
|
71 kumpf 1.55 IndexOutOfBoundsException::IndexOutOfBoundsException()
72 : Exception("index out of bounds")
|
73 kumpf 1.54 {
74 }
|
75 mike 1.22
|
76 kumpf 1.55 AlreadyExistsException::AlreadyExistsException(const String& message)
|
77 kumpf 1.54 : Exception("already exists: " + message)
78 {
79 }
|
80 mike 1.22
|
81 kumpf 1.54 InvalidNameException::InvalidNameException(const String& name)
82 : Exception("invalid CIM name: " + name)
83 {
84 }
|
85 mike 1.22
|
86 kumpf 1.54 InvalidNamespaceNameException::InvalidNamespaceNameException(const String& name)
87 : Exception("invalid CIM namespace name: " + name)
88 {
89 }
|
90 kumpf 1.44
|
91 kumpf 1.55 UninitializedObjectException::UninitializedObjectException()
|
92 kumpf 1.54 : Exception("uninitialized object")
93 {
94 }
|
95 mike 1.22
|
96 kumpf 1.55 TypeMismatchException::TypeMismatchException()
|
97 kumpf 1.54 : Exception("type mismatch")
98 {
99 }
|
100 mike 1.22
|
101 kumpf 1.55 DynamicCastFailedException::DynamicCastFailedException()
|
102 kumpf 1.54 : Exception("dynamic cast failed")
103 {
104 }
|
105 mike 1.24
|
106 kumpf 1.55 InvalidDateTimeFormatException::InvalidDateTimeFormatException()
107 : Exception("invalid datetime format")
|
108 kumpf 1.54 {
109 }
|
110 mike 1.22
|
111 kumpf 1.54 MalformedObjectNameException::MalformedObjectNameException(
112 const String& objectName)
113 : Exception("malformed object name: " + objectName)
114 {
115 }
|
116 mike 1.22
|
117 kumpf 1.54 BindFailedException::BindFailedException(const String& message)
118 : Exception("Bind failed: " + message)
119 {
120 }
|
121 mike 1.23
|
122 kumpf 1.54 InvalidLocatorException::InvalidLocatorException(const String& locator)
123 : Exception("Invalid locator: " + locator)
124 {
125 }
|
126 mike 1.23
|
127 kumpf 1.54 CannotCreateSocketException::CannotCreateSocketException()
128 : Exception("Cannot create socket")
129 {
130 }
|
131 mike 1.23
|
132 kumpf 1.54 CannotConnectException::CannotConnectException(const String& locator)
133 : Exception("Cannot connect to: " + locator)
134 {
135 }
|
136 mike 1.23
|
137 kumpf 1.54 AlreadyConnectedException::AlreadyConnectedException()
138 : Exception("already connected")
139 {
140 }
|
141 mike 1.23
|
142 kumpf 1.54 NotConnectedException::NotConnectedException()
143 : Exception("not connected")
144 {
145 }
|
146 mike 1.22
|
147 kumpf 1.54 ConnectionTimeoutException::ConnectionTimeoutException()
148 : Exception("connection timed out")
149 {
150 }
|
151 kumpf 1.26
|
152 kumpf 1.54 SSLException::SSLException(const String& message)
153 : Exception("SSL Exception: " + message)
154 {
155 }
|
156 kumpf 1.40
|
157 kumpf 1.62 DateTimeOutOfRangeException::DateTimeOutOfRangeException(const String& message)
158 : Exception("DateTime is out of range : " + message)
159 {
160 }
|
161 kumpf 1.26
|
162 mday 1.62.2.1
163 ObjectBusyException::ObjectBusyException(const String & message)
164 : Exception("Object is busy: " + message)
165 {
166 }
167
168
|
169 mike 1.22 ////////////////////////////////////////////////////////////////////////////////
170 //
171 // CIMException
172 //
173 ////////////////////////////////////////////////////////////////////////////////
174
|
175 kumpf 1.53 CIMException::CIMException(
|
176 kumpf 1.29 CIMStatusCode code,
|
177 kumpf 1.37 const String& message)
|
178 kumpf 1.61 : Exception()
|
179 kumpf 1.29 {
|
180 kumpf 1.59 CIMExceptionRep * tmp = new CIMExceptionRep ();
181 tmp->message = message;
182 tmp->code = code;
183 tmp->file = "";
184 tmp->line = 0;
185 _rep = tmp;
|
186 kumpf 1.29 }
187
|
188 kumpf 1.53 CIMException::CIMException(const CIMException & cimException)
|
189 kumpf 1.61 : Exception()
|
190 kumpf 1.53 {
|
191 kumpf 1.59 CIMExceptionRep * tmp = new CIMExceptionRep ();
192 CIMExceptionRep * rep;
193 rep = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
194 tmp->message = rep->message;
195 tmp->code = rep->code;
196 tmp->file = rep->file;
197 tmp->line = rep->line;
198 _rep = tmp;
|
199 mike 1.22 }
200
|
201 kumpf 1.53 CIMException& CIMException::operator=(const CIMException & cimException)
|
202 mike 1.22 {
|
203 kumpf 1.59 CIMExceptionRep* left;
204 CIMExceptionRep* right;
205 left = reinterpret_cast<CIMExceptionRep*>(this->_rep);
206 right = reinterpret_cast<CIMExceptionRep*>(cimException._rep);
207 left->message = right->message;
208 left->code = right->code;
209 left->file = right->file;
210 left->line = right->line;
|
211 kumpf 1.53 return *this;
|
212 kumpf 1.32 }
213
|
214 kumpf 1.53 CIMException::~CIMException()
|
215 kumpf 1.37 {
216 }
217
|
218 kumpf 1.53 CIMStatusCode CIMException::getCode() const
|
219 kumpf 1.37 {
|
220 kumpf 1.59 CIMExceptionRep* rep;
221 rep = reinterpret_cast<CIMExceptionRep*>(_rep);
222 return rep->code;
|
223 mike 1.22 }
224
225 PEGASUS_NAMESPACE_END
|