1 karl 1.15 //%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 karl 1.15 // 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 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 kumpf 1.16 #include <Pegasus/Common/MessageLoader.h>
|
35 mike 1.1 #include "CIMStatusCode.h"
36
37 PEGASUS_NAMESPACE_BEGIN
38
39 static const char* _cimMessages[] =
40 {
41 "CIM_ERR_SUCCESS: successful",
42
|
43 kumpf 1.17 "CIM_ERR_FAILED: A general error occurred that is not covered by a more "
44 "specific error code",
|
45 mike 1.1
|
46 kumpf 1.17 "CIM_ERR_ACCESS_DENIED: Access to a CIM resource was not available to the "
47 "client",
|
48 mike 1.1
49 "CIM_ERR_INVALID_NAMESPACE: The target namespace does not exist",
50
|
51 kumpf 1.17 "CIM_ERR_INVALID_PARAMETER: One or more parameter values passed to the "
52 "method were invalid",
|
53 mike 1.1
54 "CIM_ERR_INVALID_CLASS: The specified class does not exist",
55
56 "CIM_ERR_NOT_FOUND: The requested object could not be found",
57
58 "CIM_ERR_NOT_SUPPORTED: The requested operation is not supported",
59
|
60 kumpf 1.17 "CIM_ERR_CLASS_HAS_CHILDREN: Operation cannot be carried out on this "
61 "class since it has subclasses",
|
62 mike 1.1
|
63 kumpf 1.17 "CIM_ERR_CLASS_HAS_INSTANCES: Operation cannot be carried out on this "
64 "class since it has instances",
|
65 mike 1.1
|
66 kumpf 1.17 "CIM_ERR_INVALID_SUPERCLASS: Operation cannot be carried out since the "
67 "specified superclass does not exist",
|
68 mike 1.1
|
69 kumpf 1.17 "CIM_ERR_ALREADY_EXISTS: Operation cannot be carried out because an "
70 "object already exists",
|
71 mike 1.1
72 "CIM_ERR_NO_SUCH_PROPERTY: The specified property does not exist",
73
74 "CIM_ERR_TYPE_MISMATCH: The value supplied is incompatible with the type",
75
|
76 kumpf 1.17 "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED: The query language is not "
77 "recognized or supported",
|
78 mike 1.1
|
79 kumpf 1.17 "CIM_ERR_INVALID_QUERY: The query is not valid for the specified query "
80 "language",
|
81 mike 1.1
82 "CIM_ERR_METHOD_NOT_AVAILABLE: The extrinsic method could not be executed",
83
|
84 kumpf 1.10 "CIM_ERR_METHOD_NOT_FOUND: The specified extrinsic method does not exist"
|
85 mike 1.1 };
86
|
87 chuck 1.6 // l10n - keys for cimstatus messages
88 static const char* _cimMessageKeys[] =
89 {
90 "Common.CIMStatusCode.CIM_ERR_SUCCESS",
91
92 "Common.CIMStatusCode.CIM_ERR_FAILED",
93
94 "Common.CIMStatusCode.CIM_ERR_ACCESS_DENIED",
95
96 "Common.CIMStatusCode.CIM_ERR_INVALID_NAMESPACE",
97
98 "Common.CIMStatusCode.CIM_ERR_INVALID_PARAMETER",
99
100 "Common.CIMStatusCode.CIM_ERR_INVALID_CLASS",
101
102 "Common.CIMStatusCode.CIM_ERR_NOT_FOUND",
103
104 "Common.CIMStatusCode.CIM_ERR_NOT_SUPPORTED",
105
106 "Common.CIMStatusCode.CIM_ERR_CLASS_HAS_CHILDREN",
107
108 chuck 1.6 "Common.CIMStatusCode.CIM_ERR_CLASS_HAS_INSTANCES",
109
110 "Common.CIMStatusCode.CIM_ERR_INVALID_SUPERCLASS",
111
112 "Common.CIMStatusCode.CIM_ERR_ALREADY_EXISTS",
113
114 "Common.CIMStatusCode.CIM_ERR_NO_SUCH_PROPERTY",
115
116 "Common.CIMStatusCode.CIM_ERR_TYPE_MISMATCH",
117
118 "Common.CIMStatusCode.CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED",
119
120 "Common.CIMStatusCode.CIM_ERR_INVALID_QUERY",
121
122 "Common.CIMStatusCode.CIM_ERR_METHOD_NOT_AVAILABLE",
123
|
124 kumpf 1.10 "Common.CIMStatusCode.CIM_ERR_METHOD_NOT_FOUND"
|
125 chuck 1.6 };
126
|
127 kumpf 1.10 // l10n TODO - the first func should go away when all Pegasus is globalized
|
128 chuck 1.5
|
129 kumpf 1.4 const char* cimStatusCodeToString(CIMStatusCode code)
|
130 mike 1.1 {
|
131 kumpf 1.10 if (Uint32(code) < (sizeof(_cimMessageKeys)/sizeof(_cimMessageKeys[0])))
|
132 kumpf 1.17 return _cimMessages[Uint32(code)];
|
133 mike 1.1
|
134 kumpf 1.2 return "Unrecognized CIM status code";
|
135 chuck 1.5 }
136
137
|
138 kumpf 1.17 String cimStatusCodeToString(
139 CIMStatusCode code,
140 const ContentLanguageList& contentLanguages)
|
141 chuck 1.5 {
|
142 kumpf 1.10 MessageLoaderParms parms;
|
143 chuck 1.9
|
144 kumpf 1.10 if (Uint32(code) < (sizeof(_cimMessageKeys)/sizeof(_cimMessageKeys[0])))
145 {
146 parms = MessageLoaderParms(
147 _cimMessageKeys[Uint32(code)], _cimMessages[Uint32(code)]);
148 }
149 else
150 {
151 parms = MessageLoaderParms(
152 "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
153 "Unrecognized CIM status code \"$0\"", Uint32(code));
154 }
155
156 if (contentLanguages.size() > 0)
157 {
|
158 kumpf 1.14 //build AcceptLanguageList from contentLanguages, use in getMessage
|
159 kumpf 1.13 parms.acceptlanguages.clear();
160 parms.acceptlanguages.insert(contentLanguages.getLanguageTag(0), 1.0);
|
161 kumpf 1.10 }
|
162 chuck 1.9
163 return MessageLoader::getMessage(parms);
|
164 chuck 1.5 }
165
|
166 kumpf 1.14 ContentLanguageList cimStatusCodeToString_Thread(
167 String & message,
168 CIMStatusCode code)
|
169 chuck 1.5 {
|
170 kumpf 1.10 MessageLoaderParms parms;
|
171 chuck 1.9
|
172 kumpf 1.10 if (Uint32(code) < (sizeof(_cimMessageKeys)/sizeof(_cimMessageKeys[0])))
173 {
174 parms = MessageLoaderParms(
175 _cimMessageKeys[Uint32(code)], _cimMessages[Uint32(code)]);
176 }
177 else
178 {
179 parms = MessageLoaderParms(
180 "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
181 "Unrecognized CIM status code \"$0\"", Uint32(code));
182 }
183
184 //parms.useThreadLocale = true;
185 message = MessageLoader::getMessage(parms);
186 return parms.contentlanguages;
|
187 mike 1.1 }
188
189 PEGASUS_NAMESPACE_END
|