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

  1 martin 1.21 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.22 //
  3 martin 1.21 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.22 //
 10 martin 1.21 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.22 //
 17 martin 1.21 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.22 //
 20 martin 1.21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.22 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.22 //
 28 martin 1.21 //////////////////////////////////////////////////////////////////////////
 29 mike   1.1  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 kumpf  1.16 #include <Pegasus/Common/MessageLoader.h>
 33 mike   1.1  #include "CIMStatusCode.h"
 34             
 35             PEGASUS_NAMESPACE_BEGIN
 36             
 37             static const char* _cimMessages[] =
 38             {
 39 kumpf  1.19     "CIM_ERR_SUCCESS",
 40                 "CIM_ERR_FAILED",
 41                 "CIM_ERR_ACCESS_DENIED",
 42                 "CIM_ERR_INVALID_NAMESPACE",
 43                 "CIM_ERR_INVALID_PARAMETER",
 44                 "CIM_ERR_INVALID_CLASS",
 45                 "CIM_ERR_NOT_FOUND",
 46                 "CIM_ERR_NOT_SUPPORTED",
 47                 "CIM_ERR_CLASS_HAS_CHILDREN",
 48                 "CIM_ERR_CLASS_HAS_INSTANCES",
 49                 "CIM_ERR_INVALID_SUPERCLASS",
 50                 "CIM_ERR_ALREADY_EXISTS",
 51                 "CIM_ERR_NO_SUCH_PROPERTY",
 52                 "CIM_ERR_TYPE_MISMATCH",
 53                 "CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED",
 54                 "CIM_ERR_INVALID_QUERY",
 55                 "CIM_ERR_METHOD_NOT_AVAILABLE",
 56 karl   1.23     "CIM_ERR_METHOD_NOT_FOUND",
 57             //EXP_PULL_BEGIN     The DMTF DSP0200 v 1.4 spec added the following
 58                 "empty",
 59                 "empty",
 60                 "CIM_ERR_NAMESPACE_NOT_EMPTY",
 61                 "CIM_ERR_INVALID_ENUMERATION_CONTEXT",
 62                 "CIM_ERR_INVALID_OPERATION_TIMEOUT",
 63                 "CIM_ERR_PULL_HAS_BEEN_ABANDONED",
 64                 "CIM_ERR_PULL_CANNOT_BE_ABANDONED",
 65                 "CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED",
 66                 "CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED",
 67                 "CIM_ERR_SERVER_LIMITS_EXCEEDED",
 68                 "CIM_ERR_SERVER_IS_SHUTTING_DOWN"
 69             //EXP_PULL_END
 70 chuck  1.6  };
 71             
 72 kumpf  1.10 // l10n TODO - the first func should go away when all Pegasus is globalized
 73 chuck  1.5  
 74 kumpf  1.4  const char* cimStatusCodeToString(CIMStatusCode code)
 75 mike   1.1  {
 76 kumpf  1.19     if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
 77                 {
 78 kumpf  1.17         return _cimMessages[Uint32(code)];
 79 kumpf  1.19     }
 80 mike   1.1  
 81 kumpf  1.2      return "Unrecognized CIM status code";
 82 chuck  1.5  }
 83             
 84             
 85 kumpf  1.17 String cimStatusCodeToString(
 86                 CIMStatusCode code,
 87                 const ContentLanguageList& contentLanguages)
 88 chuck  1.5  {
 89 kumpf  1.19     if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
 90 kumpf  1.10     {
 91 kumpf  1.19         return _cimMessages[Uint32(code)];
 92 kumpf  1.10     }
 93 kumpf  1.19 
 94                 MessageLoaderParms parms(
 95                     "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
 96 kumpf  1.20         "Unrecognized CIM status code \"$0\"", (Uint32)code);
 97 kumpf  1.10 
 98                 if (contentLanguages.size() > 0)
 99                 {
100 kumpf  1.14         //build AcceptLanguageList from contentLanguages, use in getMessage
101 kumpf  1.13         parms.acceptlanguages.clear();
102                     parms.acceptlanguages.insert(contentLanguages.getLanguageTag(0), 1.0);
103 kumpf  1.10     }
104 chuck  1.9  
105                 return MessageLoader::getMessage(parms);
106 chuck  1.5  }
107             
108 kumpf  1.14 ContentLanguageList cimStatusCodeToString_Thread(
109                 String & message,
110                 CIMStatusCode code)
111 chuck  1.5  {
112 kumpf  1.19     if (Uint32(code) < (sizeof(_cimMessages)/sizeof(_cimMessages[0])))
113 kumpf  1.10     {
114 kumpf  1.19         message = _cimMessages[Uint32(code)];
115                     return ContentLanguageList();
116 kumpf  1.10     }
117 kumpf  1.19 
118                 MessageLoaderParms parms(
119                     "Common.CIMStatusCode.UNRECOGNIZED_STATUS_CODE",
120 kumpf  1.20         "Unrecognized CIM status code \"$0\"", (Uint32)code);
121 kumpf  1.10 
122                 //parms.useThreadLocale = true;
123                 message = MessageLoader::getMessage(parms);
124                 return parms.contentlanguages;
125 mike   1.1  }
126             
127             PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2