1 karl 1.8 //%2003////////////////////////////////////////////////////////////////////////
|
2 mike 1.1 //
|
3 karl 1.8 // 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 // IBM Corp.; EMC Corporation, The Open Group.
|
7 mike 1.1 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 kumpf 1.3 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
12 mike 1.1 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
|
15 kumpf 1.3 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
16 mike 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
18 kumpf 1.3 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
21 mike 1.1 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Mike Brasher (mbrasher@bmc.com)
27 //
|
28 kumpf 1.4 // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
29 // (carolann_graves@hp.com)
|
30 mike 1.1 //
31 //%/////////////////////////////////////////////////////////////////////////////
32
33 #include "CIMStatusCode.h"
34
35 PEGASUS_NAMESPACE_BEGIN
36
37 static const char* _cimMessages[] =
38 {
39 "CIM_ERR_SUCCESS: successful",
40
41 "CIM_ERR_FAILED: A general error occurred that is not covered by a more specific "
42 "error code",
43
44 "CIM_ERR_ACCESS_DENIED: Access to a CIM resource was not available to the client",
45
46 "CIM_ERR_INVALID_NAMESPACE: The target namespace does not exist",
47
48 "CIM_ERR_INVALID_PARAMETER: One or more parameter values passed to the method "
49 "were invalid",
50
51 mike 1.1 "CIM_ERR_INVALID_CLASS: The specified class does not exist",
52
53 "CIM_ERR_NOT_FOUND: The requested object could not be found",
54
55 "CIM_ERR_NOT_SUPPORTED: The requested operation is not supported",
56
57 "CIM_ERR_CLASS_HAS_CHILDREN: Operation cannot be carried out on this class since "
58 "it has subclasses",
59
60 "CIM_ERR_CLASS_HAS_INSTANCES: Operation cannot be carried out on this class since "
61 "it has instances",
62
63 "CIM_ERR_INVALID_SUPERCLASS: Operation cannot be carried out since the specified "
64 "superclass does not exist",
65
66 "CIM_ERR_ALREADY_EXISTS: Operation cannot be carried out because an object already "
67 "exists",
68
69 "CIM_ERR_NO_SUCH_PROPERTY: The specified property does not exist",
70
71 "CIM_ERR_TYPE_MISMATCH: The value supplied is incompatible with the type",
72 mike 1.1
73 "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED: The query language is not recognized or "
74 "supported",
75
76 "CIM_ERR_INVALID_QUERY: The query is not valid for the specified query language",
77
78 "CIM_ERR_METHOD_NOT_AVAILABLE: The extrinsic method could not be executed",
79
80 "CIM_ERR_METHOD_NOT_FOUND: The specified extrinsic method does not exist"
81 };
82
|
83 chuck 1.6 // l10n - keys for cimstatus messages
84 static const char* _cimMessageKeys[] =
85 {
86 "Common.CIMStatusCode.CIM_ERR_SUCCESS",
87
88 "Common.CIMStatusCode.CIM_ERR_FAILED",
89
90 "Common.CIMStatusCode.CIM_ERR_ACCESS_DENIED",
91
92 "Common.CIMStatusCode.CIM_ERR_INVALID_NAMESPACE",
93
94 "Common.CIMStatusCode.CIM_ERR_INVALID_PARAMETER",
95
96 "Common.CIMStatusCode.CIM_ERR_INVALID_CLASS",
97
98 "Common.CIMStatusCode.CIM_ERR_NOT_FOUND",
99
100 "Common.CIMStatusCode.CIM_ERR_NOT_SUPPORTED",
101
102 "Common.CIMStatusCode.CIM_ERR_CLASS_HAS_CHILDREN",
103
104 chuck 1.6 "Common.CIMStatusCode.CIM_ERR_CLASS_HAS_INSTANCES",
105
106 "Common.CIMStatusCode.CIM_ERR_INVALID_SUPERCLASS",
107
108 "Common.CIMStatusCode.CIM_ERR_ALREADY_EXISTS",
109
110 "Common.CIMStatusCode.CIM_ERR_NO_SUCH_PROPERTY",
111
112 "Common.CIMStatusCode.CIM_ERR_TYPE_MISMATCH",
113
114 "Common.CIMStatusCode.CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED",
115
116 "Common.CIMStatusCode.CIM_ERR_INVALID_QUERY",
117
118 "Common.CIMStatusCode.CIM_ERR_METHOD_NOT_AVAILABLE",
119
120 "Common.CIMStatusCode.CIM_ERR_METHOD_NOT_FOUND"
121 };
122
|
123 chuck 1.5 // l10n TOD0 - the first func should go away when all Pegasus is globalized
124
|
125 kumpf 1.4 const char* cimStatusCodeToString(CIMStatusCode code)
|
126 mike 1.1 {
127 if (Uint32(code) < CIM_ERR_METHOD_NOT_FOUND)
128 return _cimMessages[Uint32(code)];
129
|
130 kumpf 1.2 return "Unrecognized CIM status code";
|
131 chuck 1.5 }
132
133
134 String cimStatusCodeToString(CIMStatusCode code,
135 const ContentLanguages& contentLanguages)
136 {
137 AcceptLanguages acceptLanguages;
|
138 chuck 1.6 MessageLoaderParms parms(_cimMessageKeys[Uint32(code)], _cimMessages[Uint32(code)]);
139 if (contentLanguages.size() == 0) //use AcceptLanguages::EMPTY
|
140 chuck 1.5 {
|
141 chuck 1.6 return MessageLoader::getMessage(parms);
|
142 chuck 1.5 }
143 else
144 {
|
145 chuck 1.6 //build AcceptLanguages from contentLanguages, use in getMessage
146 parms.acceptlanguages = AcceptLanguages(contentLanguages.getLanguageElement(0).getTag());
147 return MessageLoader::getMessage(parms);
|
148 chuck 1.5 }
149 }
150
151 // l10n
152 ContentLanguages cimStatusCodeToString_Thread(String & message, CIMStatusCode code)
153 {
|
154 chuck 1.6 MessageLoaderParms parms(_cimMessageKeys[Uint32(code)], _cimMessages[Uint32(code)]);
155 //parms.useThreadLocale = true;
|
156 chuck 1.5 message = MessageLoader::getMessage(parms);
157 return parms.contentlanguages;
|
158 mike 1.1 }
159
160 PEGASUS_NAMESPACE_END
|