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 kumpf 1.19 "CIM_ERR_SUCCESS",
42 "CIM_ERR_FAILED",
43 "CIM_ERR_ACCESS_DENIED",
44 "CIM_ERR_INVALID_NAMESPACE",
45 "CIM_ERR_INVALID_PARAMETER",
46 "CIM_ERR_INVALID_CLASS",
47 "CIM_ERR_NOT_FOUND",
48 "CIM_ERR_NOT_SUPPORTED",
49 "CIM_ERR_CLASS_HAS_CHILDREN",
50 "CIM_ERR_CLASS_HAS_INSTANCES",
51 "CIM_ERR_INVALID_SUPERCLASS",
52 "CIM_ERR_ALREADY_EXISTS",
53 "CIM_ERR_NO_SUCH_PROPERTY",
54 "CIM_ERR_TYPE_MISMATCH",
55 "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED",
56 "CIM_ERR_INVALID_QUERY",
57 "CIM_ERR_METHOD_NOT_AVAILABLE",
58 "CIM_ERR_METHOD_NOT_FOUND"
|
59 chuck 1.6 };
60
|
61 kumpf 1.10 // l10n TODO - the first func should go away when all Pegasus is globalized
|
62 chuck 1.5
|
63 kumpf 1.4 const char* cimStatusCodeToString(CIMStatusCode code)
|
64 mike 1.1 {
|
65 kumpf 1.19 if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
66 {
|
67 kumpf 1.17 return _cimMessages[Uint32(code)];
|
68 kumpf 1.19 }
|
69 mike 1.1
|
70 kumpf 1.2 return "Unrecognized CIM status code";
|
71 chuck 1.5 }
72
73
|
74 kumpf 1.17 String cimStatusCodeToString(
75 CIMStatusCode code,
76 const ContentLanguageList& contentLanguages)
|
77 chuck 1.5 {
|
78 kumpf 1.19 if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
|
79 kumpf 1.10 {
|
80 kumpf 1.19 return _cimMessages[Uint32(code)];
|
81 kumpf 1.10 }
|
82 kumpf 1.19
83 MessageLoaderParms parms(
84 "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
|
85 kumpf 1.20 "Unrecognized CIM status code \"$0\"", (Uint32)code);
|
86 kumpf 1.10
87 if (contentLanguages.size() > 0)
88 {
|
89 kumpf 1.14 //build AcceptLanguageList from contentLanguages, use in getMessage
|
90 kumpf 1.13 parms.acceptlanguages.clear();
91 parms.acceptlanguages.insert(contentLanguages.getLanguageTag(0), 1.0);
|
92 kumpf 1.10 }
|
93 chuck 1.9
94 return MessageLoader::getMessage(parms);
|
95 chuck 1.5 }
96
|
97 kumpf 1.14 ContentLanguageList cimStatusCodeToString_Thread(
98 String & message,
99 CIMStatusCode code)
|
100 chuck 1.5 {
|
101 kumpf 1.19 if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
|
102 kumpf 1.10 {
|
103 kumpf 1.19 message = _cimMessages[Uint32(code)];
104 return ContentLanguageList();
|
105 kumpf 1.10 }
|
106 kumpf 1.19
107 MessageLoaderParms parms(
108 "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
|
109 kumpf 1.20 "Unrecognized CIM status code \"$0\"", (Uint32)code);
|
110 kumpf 1.10
111 //parms.useThreadLocale = true;
112 message = MessageLoader::getMessage(parms);
113 return parms.contentlanguages;
|
114 mike 1.1 }
115
116 PEGASUS_NAMESPACE_END
|