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