(file) Return to CIMStatusCode.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2