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

  1 martin 1.28 //%LICENSE////////////////////////////////////////////////////////////////
  2             // 
  3             // 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             // 
 10             // 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             // 
 17             // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19             // 
 20             // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21             // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 22 martin 1.28 // 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             // 
 28             //////////////////////////////////////////////////////////////////////////
 29 mike   1.10 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             //
 33             // implementation of cimmofMessages class
 34             
 35             #include "cimmofMessages.h"
 36             #include <cstdio>
 37             #include <iostream> // for debug only
 38 kumpf  1.22 #include <Pegasus/Common/MessageLoader.h>
 39 mike   1.10 
 40             PEGASUS_NAMESPACE_BEGIN
 41             PEGASUS_USING_STD;
 42             
 43             const cimmofMessages::arglist cimmofMessages::EMPTYLIST;
 44             
 45 kumpf  1.27 static const char* _cimmofMessages[] =
 46 karl   1.23 {
 47                 "OK", //CIM_ERR_SUCCESS
 48                 "$0:$1: $2 before '$3'", //PARSER_SYNTAX_ERROR
 49                 "Error applying parameter $0 to method $1: $2", //APPLY_PARAMETER_ERROR
 50                 "Error creating new CIMParameter object $0: $1", //NEW_PARAMETER_ERROR
 51                 //UNINTIALIZED_PARAMETER_ERROR
 52                 "Internal Error: Uninitialized parameter handle $0 in class $1",
 53                 //METHOD_ALREADY_EXISTS_WARNING
 54                 "Warning: CIMMethod $0 already exists for CIMClass $1",
 55                 "Error applying method $0 to CIMClass $1: $2:", //APPLY_METHOD_ERROR
 56                 "Error creating new CIMMethod $0: $1", //NEW_METHOD_ERROR
 57                 "ADD QUALIFIER: ", //ADD_QUALIFIER
 58                 "[Trace]", //TRACE
 59                 "Error adding qualifier declaration $0: $1", //ADD_QUALIFIER_DECL_ERROR
 60                 "\tOK", //TAB_OK
 61                 "Error creating new Qualifier $0: $1", //NEW_QUALIFIER_ERROR
 62                 "Error adding new Qualifier $0: $1", //ADD_QUALIFIER_ERROR
 63                 //NEW_QUALIFIER_DECLARATION_ERROR
 64                 "Error creating new Qualifier Declaration $0: $1",
 65                 // GET_QUALIFIER_DECL_ERROR
 66                 "Could not find declaration for Qualifier named $0",
 67 karl   1.23     "ADD INSTANCE: ",  //ADD_INSTANCE
 68                 //UNINITIALIZED_PROPERTY_ERROR
 69                 "Internal Error: Uninitialized parameter $1 in class $0",
 70                 //PROPERTY_ALREADY_EXISTS_WARNING
 71                 "Warning:  Property $1 already exists in class $0",
 72                 "Error applying property $1 to class $0: $2", //APPLYING_PROPERTY_ERROR
 73                 "Error creating new Property $0: $1", //NEW_PROPERTY_ERROR
 74                 "Error creating new Class Declaration $0: $1", //NEW_CLASS_ERROR
 75                 "ADD CLASS: ", //ADD_CLASS
 76                 "Warning:  Class $0 already exists in the repository",//CLASS_EXISTS_WARNING
 77                 "Error adding class $0 to the repository: $1", //ADD_CLASS_ERROR
 78                 //SETREPOSITORY_NO_COMPILER_OPTIONS
 79                 "Internal Error: Compiler options not set before setting repository",
 80                 //SETREPOSITORY_BLANK_NAME
 81                 "Internal Error: No repository name was specified to setRepository",
 82                 //NAMESPACE_CREATE_ERROR
 83                 "Error trying to create repository name space $0: $1",
 84                 // REPOSITORY_CREATE_ERROR
 85                 "Error trying to create Repository in path $0: $1",
 86                 // NEW_REFERENCE_ERROR
 87                 "Error trying to create a reference to object $0: $1",
 88 karl   1.23     //FIND_CLASS_OF_INSTANCE_ERROR
 89                 "Error looking for class of current instance while looking up property"
 90                     " $0: $1",
 91                 // FIND_PROPERTY_VALUE_ERROR
 92                 "Error looking up value of property $2 in class $1 (namespace $0): $3",
 93                 "Error cloning property $0: $1",            // CLONING_PROPERTY_ERROR
 94                 // APPLY_INSTANCE_PROPERTY_ERROR
 95                 "Error applying property $0 to an instance of class $1: $2",
 96                 // GET_INSTANCE_PROPERTY_ERROR
 97                 "Error getting property $0 from an instance: $1",
 98 runfang.zhou 1.24     "Error getting class $0 from namespace $1: $2", //GET_CLASS_ERROR
 99 karl         1.23     "Error getting value of property $0: $1", //GET_PROPERTY_VALUE_ERROR
100                       "Error creating new instance of class $0: $1", // NEW_INSTANCE_ERROR
101                       // INSTANCE_PROPERTY_EXISTS_WARNING
102                       "Warning: property $1 already exists for this instance of class $0",
103                       // INSTANCE_EXISTS_WARNING
104                       "Warning: the instance already exists.\nIn this"
105                           " implementation, that means it cannot be changed.",
106                       "Error adding an instance: $0", // ADD_INSTANCE_ERROR
107                       "Error: $0", // GENERAL_ERROR
108                       "Warning:  Class $0 was not added or updated: $1",     //CLASS_NOT_UPDATED
109                       "Class has the same version",                          //SAME_VERSION
110                       // NO_EXPERIMENTAL_UPDATE
111                       "Experimental update not allowed (set appropriate compiler option)",
112                       //NO_VERSION_UPDATE
113                       "Version update not allowed (set appropriate compiler option)",
114                       //NO_CLASS_UPDATE
115                       "Class update not allowed (set appropriate compiler option)",
116                       //INVALID_VERSION_FORMAT
117                       "Invalid version format in mof class or repository class"
118                           " (valid format is m.n.u)", //INVALID_VERSION_FORMAT
119 kumpf        1.25     "Invalid $0 value: $1",    // INVALID_LITERAL_VALUE
120 karl         1.23     ""
121 mike         1.10 };
122 kumpf        1.27 
123                   static const char* _cimmofMessagesKeys [] =
124 kumpf        1.22 {
125 humberto     1.16     "Compiler.cimmofMessages.CIM_ERR_SUCCESS",
126                       "Compiler.cimmofMessages.PARSER_SYNTAX_ERROR",
127                       "Compiler.cimmofMessages.APPLY_PARAMETER_ERROR",
128                       "Compiler.cimmofMessages.NEW_PARAMETER_ERROR",
129                       "Compiler.cimmofMessages.UNINITIALIZED_PARAMETER_ERROR",
130                       "Compiler.cimmofMessages.METHOD_ALREADY_EXISTS_WARNING",
131                       "Compiler.cimmofMessages.APPLY_METHOD_ERROR",
132                       "Compiler.cimmofMessages.NEW_METHOD_ERROR",
133                       "Compiler.cimmofMessages.ADD_QUALIFIER",
134                       "Compiler.cimmofMessages.TRACE",
135                       "Compiler.cimmofMessages.ADD_QUALIFIER_DECL_ERROR",
136                       "Compiler.cimmofMessages.TAB_OK",
137                       "Compiler.cimmofMessages.NEW_QUALIFIER_ERROR",
138                       "Compiler.cimmofMessages.ADD_QUALIFIER_ERROR",
139                       "Compiler.cimmofMessages.NEW_QUALIFIER_DECLARATION_ERROR",
140                       "Compiler.cimmofMessages.GET_QUALIFIER_DECL_ERROR",
141                       "Compiler.cimmofMessages.ADD_INSTANCE",
142                       "Compiler.cimmofMessages.UNINITIALIZED_PROPERTY_ERROR",
143                       "Compiler.cimmofMessages.PROPERTY_ALREADY_EXISTS_WARNING",
144                       "Compiler.cimmofMessages.APPLYING_PROPERTY_ERROR",
145                       "Compiler.cimmofMessages.NEW_PROPERTY_ERROR",
146 humberto     1.16     "Compiler.cimmofMessages.NEW_CLASS_ERROR",
147                       "Compiler.cimmofMessages.ADD_CLASS",
148                       "Compiler.cimmofMessages.CLASS_EXISTS_WARNING",
149                       "Compiler.cimmofMessages.ADD_CLASS_ERROR",
150                       "Compiler.cimmofMessages.SETREPOSITORY_NO_COMPILER_OPTIONS",
151                       "Compiler.cimmofMessages.SETREPOSITORY_BLANK_NAME",
152                       "Compiler.cimmofMessages.NAMESPACE_CREATE_ERROR",
153                       "Compiler.cimmofMessages.REPOSITORY_CREATE_ERROR",
154                       "Compiler.cimmofMessages.NEW_REFERENCE_ERROR",
155                       "Compiler.cimmofMessages.FIND_CLASS_OF_INSTANCE_ERROR",
156                       "Compiler.cimmofMessages.FIND_PROPERTY_VALUE_ERROR",
157                       "Compiler.cimmofMessages.CLONING_PROPERTY_ERROR",
158                       "Compiler.cimmofMessages.APPLY_INSTANCE_PROPERTY_ERROR",
159                       "Compiler.cimmofMessages.GET_INSTANCE_PROPERTY_ERROR",
160 chuck        1.18     "Compiler.cimmofMessages.GET_CLASS_ERROR",
161 humberto     1.16     "Compiler.cimmofMessages.GET_PROPERTY_VALUE_ERROR",
162                       "Compiler.cimmofMessages.NEW_INSTANCE_ERROR",
163                       "Compiler.cimmofMessages.INSTANCE_PROPERTY_EXISTS_WARNING",
164                       "Compiler.cimmofMessages.INSTANCE_EXISTS_WARNING",
165                       "Compiler.cimmofMessages.ADD_INSTANCE_ERROR",
166                       "Compiler.cimmofMessages.GENERAL_ERROR",
167                       "Compiler.cimmofMessages.CLASS_NOT_UPDATED",
168                       "Compiler.cimmofMessages.SAME_VERSION",
169                       "Compiler.cimmofMessages.NO_EXPERIMENTAL_UPDATE",
170                       "Compiler.cimmofMessages.NO_VERSION_UPDATE",
171                       "Compiler.cimmofMessages.NO_CLASS_UPDATE",
172                       "Compiler.cimmofMessages.INVALID_VERSION_FORMAT",
173 kumpf        1.25     "Compiler.cimmofMessages.INVALID_LITERAL_VALUE",
174 karl         1.23     "Compiler.cimmofMessages.END"
175 humberto     1.16 };
176                   
177 mike         1.10 
178 kumpf        1.27 const char* cimmofMessages::msgCodeToString(MsgCode code)
179 karl         1.23 {
180                       return _cimmofMessages[(unsigned int)code];
181 mike         1.10 }
182                   
183 karl         1.23 void cimmofMessages::getMessage(String &out, MsgCode code, const arglist &args)
184 mike         1.10 {
185 karl         1.23     Array<String> _args;
186                       for (unsigned int i = 0; i < 10; i++)
187                       {
188                           if(i < args.size())
189                               _args.append(args[i]);
190                           else
191                               _args.append("");
192                       }
193                   
194                       MessageLoaderParms parms(_cimmofMessagesKeys[(unsigned int)code],
195                           _cimmofMessages[(unsigned int)code],
196                           _args[0],_args[1],_args[2],_args[3],_args[4],
197                           _args[5],_args[6],_args[7],_args[8],_args[9]);
198                   
199                       out = MessageLoader::getMessage(parms);
200 mike         1.10 }
201                   
202                   PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2