version 1.8, 2001/03/05 04:29:01
|
version 1.22.2.3, 2001/08/17 03:06:23
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// copy of this software and associated documentation files (the "Software"), |
// of this software and associated documentation files (the "Software"), to |
// to deal in the Software without restriction, including without limitation |
// deal in the Software without restriction, including without limitation the |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// and/or sell copies of the Software, and to permit persons to whom the |
// sell copies of the Software, and to permit persons to whom the Software is |
// Software is furnished to do so, subject to the following conditions: |
// furnished to do so, subject to the following conditions: |
// | // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// | // |
//END_LICENSE |
//============================================================================== |
//BEGIN_HISTORY |
|
// | // |
// Author: |
// Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// $Log$ |
// Modified By: Nag Boranna (nagaraja_boranna@hp.com) |
// Revision 1.8 2001/03/05 04:29:01 mike |
|
// renamed CimException to CIMException |
|
// | // |
// Revision 1.7 2001/02/16 02:06:06 mike |
// Modified By: |
// Renamed many classes and headers. |
|
// | // |
// Revision 1.6 2001/02/11 05:42:33 mike |
//%///////////////////////////////////////////////////////////////////////////// |
// new |
|
// |
|
// Revision 1.5 2001/01/29 02:23:44 mike |
|
// Added support for GetInstance operation |
|
// |
|
// Revision 1.4 2001/01/28 04:11:03 mike |
|
// fixed qualifier resolution |
|
// |
|
// Revision 1.3 2001/01/23 01:25:35 mike |
|
// Reworked resolve scheme. |
|
// |
|
// Revision 1.2 2001/01/22 00:45:47 mike |
|
// more work on resolve scheme |
|
// |
|
// Revision 1.1.1.1 2001/01/14 19:51:33 mike |
|
// Pegasus import |
|
// |
|
// |
|
//END_HISTORY |
|
| |
#include <cstdio> | #include <cstdio> |
#include "Exception.h" | #include "Exception.h" |
|
|
| |
const char NullPointer::MSG[] = "null pointer"; | const char NullPointer::MSG[] = "null pointer"; |
| |
const char UnitializedHandle::MSG[] = "unitialized reference"; |
const char UnitializedHandle::MSG[] = "unitialized handle"; |
| |
const char IllegalName::MSG[] = "illegal CIM name"; | const char IllegalName::MSG[] = "illegal CIM name"; |
| |
const char NoSuchSuperClass::MSG[] = "no such super class: "; |
|
|
|
const char NoSuchClass::MSG[] = "no such class: "; |
|
|
|
const char InvalidPropertyOverride::MSG[] = "invalid property override: "; | const char InvalidPropertyOverride::MSG[] = "invalid property override: "; |
| |
const char InvalidMethodOverride::MSG[] = "invalid method override: "; | const char InvalidMethodOverride::MSG[] = "invalid method override: "; |
|
|
| |
const char NoSuchFile::MSG[] = "no such file: "; | const char NoSuchFile::MSG[] = "no such file: "; |
| |
|
const char FileNotReadable::MSG[] = "file not readable: "; |
|
|
|
const char CannotBindToAddress::MSG[] = "cannot bind to address: "; |
|
|
const char NoSuchDirectory::MSG[] = "no such directory: "; | const char NoSuchDirectory::MSG[] = "no such directory: "; |
| |
const char ChangeDirectoryFailed::MSG[] = "failed to change directory: "; |
const char ChangeDirectoryFailed::MSG[] = "cannot change directory: "; |
| |
const char CannotCreateDirectory::MSG[] = "cannot create directory: "; | const char CannotCreateDirectory::MSG[] = "cannot create directory: "; |
| |
|
|
| |
const char NotImplemented::MSG[] = "not implemented: "; | const char NotImplemented::MSG[] = "not implemented: "; |
| |
const char FailedToRemoveDirectory::MSG[] = "failed to remove directory: "; |
const char CannotRemoveDirectory::MSG[] = "cannot remove directory: "; |
|
|
|
const char CannotRemoveFile::MSG[] = "cannot remove file: "; |
|
|
|
const char CannotRenameFile::MSG[] = "cannot rename file: "; |
| |
const char FailedToRemoveFile::MSG[] = "failed to remove file: "; |
const char StackUnderflow::MSG[] = "stack Underflow"; |
| |
const char StackUnderflow::MSG[] = "stack overflow"; |
const char QueueUnderflow::MSG[] = "queue Underflow"; |
| |
const char BadFormat::MSG[] = "bad format passed to Formatter::format()"; | const char BadFormat::MSG[] = "bad format passed to Formatter::format()"; |
| |
|
|
| |
const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string"; | const char BadlyFormedCGIQueryString::MSG[] = "badly formed CGI query string"; |
| |
const char BadInstanceName::MSG[] = "bad instance name: "; |
const char IllformedObjectName::MSG[] = "illformed object name: "; |
| |
const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: "; | const char DynamicLoadFailed::MSG[] = "load of dynamic library failed: "; |
| |
|
|
| |
const char CannotOpenDirectory::MSG[] = "cannot open directory: "; | const char CannotOpenDirectory::MSG[] = "cannot open directory: "; |
| |
//////////////////////////////////////////////////////////////////////////////// |
const char CorruptFile::MSG[] = "corrupt file: "; |
// |
|
// CIMException |
|
// |
|
//////////////////////////////////////////////////////////////////////////////// |
|
|
|
static char* _cimMessages[] = |
|
{ |
|
"successful", |
|
| |
"A general error occurred that is not covered by a more specific " |
const char BindFailed::MSG[] = "Bind failed: "; |
"error code.", |
|
| |
"Access to a CIM resource was not available to the client.", |
const char InvalidLocator::MSG[] = "Invalid locator: "; |
| |
"The target namespace does not exist.", |
const char CannotCreateSocket::MSG[] = "Cannot create socket"; |
| |
"One or more parameter values passed to the method were invalid.", |
const char CannotConnect::MSG[] = "Cannot connect to: "; |
| |
"The specified class does not exist.", |
const char UnexpectedFailure::MSG[] = "Unexpected failure"; |
| |
"The requested object could not be found.", |
//////////////////////////////////////////////////////////////////////////////// |
|
// |
"The requested operation is not supported.", |
// CIMException |
|
// |
"Operation cannot be carried out on this class since it has subclasses.", |
//////////////////////////////////////////////////////////////////////////////// |
|
|
"Operation cannot be carried out on this class since it has instances.", |
|
|
|
"Operation cannot be carried out since the specified " |
|
"superClass does not exist.", |
|
|
|
"Operation cannot be carried out because an object already exists.", |
|
|
|
"The specified property does not exist.", |
|
|
|
"The value supplied is incompatible with the type.", |
|
|
|
"The query language is not recognized or supported.", |
|
|
|
"The query is not valid for the specified query language.", |
|
|
|
"The extrinsic method could not be executed.", |
|
|
|
"The specified extrinsic method does not exist." |
|
}; |
|
| |
static String _makeCIMExceptionMessage( | static String _makeCIMExceptionMessage( |
CIMException::Code code, |
CIMStatusCode code, |
|
const char* file, |
|
Uint32 line, |
const String& extraMessage) | const String& extraMessage) |
{ | { |
String tmp = _cimMessages[Uint32(code)]; |
String tmp = file; |
tmp.append(": "); |
tmp.append("("); |
|
char buffer[32]; |
|
sprintf(buffer, "%d", line); |
|
tmp.append(buffer); |
|
tmp.append("): "); |
|
|
|
tmp.append(CIMStatusCodeToString(code)); |
|
tmp.append(": \""); |
tmp.append(extraMessage); | tmp.append(extraMessage); |
|
tmp.append("\""); |
return tmp; | return tmp; |
} | } |
| |
CIMException::CIMException( | CIMException::CIMException( |
CIMException::Code code, |
CIMStatusCode code, |
|
const char* file, |
|
Uint32 line, |
const String& extraMessage) | const String& extraMessage) |
: Exception(_makeCIMExceptionMessage(code, extraMessage)), _code(code) |
: Exception(_makeCIMExceptionMessage(code, file, line, extraMessage)), |
|
_code(code) |
{ | { |
| |
} | } |
| |
const char* CIMException::codeToString(CIMException::Code code) |
void ThrowUnitializedHandle() |
{ | { |
return _cimMessages[Uint32(code)]; |
throw UnitializedHandle(); |
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |