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

  1 martin 1.12 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.13 //
  3 martin 1.12 // 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.13 //
 10 martin 1.12 // 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.13 //
 17 martin 1.12 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.13 //
 20 martin 1.12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.13 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.12 // 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.13 //
 28 martin 1.12 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32 marek  1.15 #include <Pegasus/Common/StringConversion.h>
 33 mike   1.2  #include "ConfigExceptions.h"
 34             
 35             PEGASUS_NAMESPACE_BEGIN
 36             
 37 marek  1.14 /**
 38                 UnrecognizedCommandLineOption Exception class
 39             */
 40             UnrecognizedCommandLineOption::UnrecognizedCommandLineOption()
 41                 :Exception(
 42                     MessageLoaderParms(
 43                         "Config.ConfigExceptions.UNRECOGNIZED_CMDLINE_OPTION",
 44                         "Unrecognized command line option. "))
 45             {
 46             }
 47             
 48             
 49             /**
 50                 InvalidPropertyValue Exception class
 51             */
 52             InvalidPropertyValue::InvalidPropertyValue(
 53                 const String& name,
 54                 const String& value)
 55                     :Exception(
 56                         MessageLoaderParms(
 57                             "Config.ConfigExceptions.INVALID_PROPERTY_VALUE",
 58 marek  1.14                 "Invalid property value: $0=$1",
 59                             name,
 60                             value))
 61             {
 62             }
 63             
 64             InvalidPropertyValue::InvalidPropertyValue(const MessageLoaderParms& theMessage)
 65                      :Exception(theMessage)
 66             {
 67             }
 68             
 69             
 70             /**
 71                 InvalidDirectoryPropertyValue Exception class
 72             */
 73             InvalidDirectoryPropertyValue::InvalidDirectoryPropertyValue(
 74                 const String& name,
 75                 const String& value)
 76                     :InvalidPropertyValue(
 77                         MessageLoaderParms(
 78                             "Config.ConfigExceptions.INVALID_DIRECTORY_PROPERTY_VALUE",
 79 marek  1.14                 "For property $0 specified value $1 is not a directory or "
 80                                 "the directory is not writeable.",
 81                             name,
 82                             value))
 83             {
 84             }
 85             
 86             /**
 87                 InvalidListenAddressPropertyValue Exception class
 88             */
 89             InvalidListenAddressPropertyValue::InvalidListenAddressPropertyValue(
 90                 const String& name,
 91                 const String& value)
 92                     :InvalidPropertyValue(
 93                         MessageLoaderParms(
 94                             "Config.ConfigExceptions.INVALID_LISTENADDRESS_PROPERTY_VALUE",
 95                             "For property $0 specified value $1 is not a valid interface "
 96                                 "address.",
 97                             name,
 98                             value))
 99             {
100 marek  1.14 }
101             
102             ConfigFileSyntaxError::ConfigFileSyntaxError(const String& file, Uint32 line)
103                 :Exception(_formatMessage(file, line))
104             {
105             }
106             
107 mike   1.2  String ConfigFileSyntaxError::_formatMessage(
108 kumpf  1.10     const String& file,
109                 Uint32 line)
110 mike   1.2  {
111 marek  1.15     char buffer[22];
112                 Uint32 n;
113                 const char * startNum=Uint32ToString(buffer,line,n);
114 mike   1.2  
115 kumpf  1.10     MessageLoaderParms parms(
116                     "Config.ConfigExceptions.CONFIG_FILE_SYNTAX_ERR",
117                     "Syntax error in configuration file: ");
118 humberto 1.5      String result = MessageLoader::getMessage(parms);
119 kumpf    1.4      result.append(file);
120                   result.append("(");
121 marek    1.15     result.append(startNum,n);
122 kumpf    1.4      result.append(")");
123 mike     1.2      return result;
124               }
125               
126 marek    1.14 
127               /**
128                   UnrecognizedConfigProperty Exception class
129               */
130               UnrecognizedConfigProperty::UnrecognizedConfigProperty(const String& name)
131                   :Exception(
132                       MessageLoaderParms(
133                           "Config.ConfigExceptions.UNRECOGNIZED_CONFIG_PROPERTY",
134                           "Unrecognized config property: $0",
135                           name))
136               {
137               }
138               
139               /**
140                   NonDynamicConfigProperty Exception class
141               */
142               NonDynamicConfigProperty::NonDynamicConfigProperty(const String& name)
143                   :Exception(
144                       MessageLoaderParms(
145                           "Config.ConfigExceptions.NONDYNAMIC_CONFIG_PROPERTY",
146                           "NonDynamic config property: $0",
147 marek    1.14             name))
148               {
149               }
150               
151               /**
152                   FailedSaveProperties Exception class
153               */
154               FailedSaveProperties::FailedSaveProperties(const String& reason)
155                   :Exception(
156                       MessageLoaderParms(
157                           "Config.ConfigExceptions.FAILED_SAVE_PROPERTIES",
158                           "Failed to save configuration properties to file: $0. "
159                               "Configuration property not set.",
160                           reason))
161               {
162               }
163               
164 mike     1.2  PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2