(file) Return to StressTestControllerException.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / test / StressTestController

  1 j.alex 1.1.2.1 //%2006////////////////////////////////////////////////////////////////////////
  2                //
  3                // 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                // IBM Corp.; EMC Corporation, The Open Group.
  7                // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8                // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9                // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10                // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11                // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12                // EMC Corporation; Symantec Corporation; The Open Group.
 13                //
 14                // Permission is hereby granted, free of charge, to any person obtaining a copy
 15                // 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                // 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                // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 j.alex 1.1.2.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                // 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                // 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                // Author: John Alex, IBM         (johnalex@us.ibm.com)
 33                //
 34                //
 35                //%/////////////////////////////////////////////////////////////////////////////
 36                
 37                #include <Pegasus/Common/Config.h>
 38                #include <Pegasus/Common/ExceptionRep.h>
 39                #include "StressTestControllerException.h"
 40                
 41                PEGASUS_NAMESPACE_BEGIN
 42                
 43 j.alex 1.1.2.1 
 44                /**
 45                  
 46                    Default exception identifier.  This identifier is used if the specified
 47                    identifier is out of range.  This identifier corresponds to a default
 48                    (generic) message in the array of exception message strings.
 49                  
 50                 */
 51                const Uint32 StressTestControllerException::DEFAULT_ID = 0;
 52                
 53                /**
 54                  
 55                    Minimum valid exception identifier.
 56                  
 57                 */
 58                const Uint32 StressTestControllerException::MIN_ID = DEFAULT_ID;
 59                
 60                /**
 61                  
 62                   Exception identifier indicating a connection failure.
 63                  
 64 j.alex 1.1.2.1  */
 65                
 66                const Uint32 StressTestControllerException::CONNECT_FAIL = 1;
 67                
 68                /**
 69                  
 70                    Exception identifier indicating timed out waiting for response.
 71                  
 72                 */
 73                const Uint32 StressTestControllerException::TIMED_OUT = 2;
 74                
 75                /**
 76                  
 77                    Exception identifier indicating invalid input.
 78                  
 79                 */
 80                const Uint32 StressTestControllerException::INVALID_INPUT = 3;
 81                
 82                /**
 83                  
 84                    Maximum valid exception identifier.  This value must be updated when
 85 j.alex 1.1.2.1     a new exception identifier and message are added.
 86                  
 87                 */
 88                const Uint32 StressTestControllerException::MAX_ID = StressTestControllerException::INVALID_INPUT;
 89                
 90                /**
 91                
 92                    Exception message strings.  The exception identifier is used as an
 93                    index into this array to retrieve the appropriate exception message
 94                    string.  When a new identifier is added, this array must be updated
 95                    appropriately.
 96                
 97                 */
 98                const char*  StressTestControllerException::_messageStrings [] =
 99                {
100                    "Error in TestStressTestController command ",
101                    "Failed to connect to CIM server: ",
102                    "Timed out waiting for response ",
103                    "Invalid input"
104                };
105                
106 j.alex 1.1.2.1 /**
107                  
108                    Constructs a StressTestControllerException with a message corresponding to the
109                    specified exception ID.
110                  
111                    @param  ID                the integer exception identifier
112                  
113                 */
114                StressTestControllerException::StressTestControllerException (Uint32 ID) : CommandException 
115                    (_messageStrings [(ID > MAX_ID) ? DEFAULT_ID : ID])
116                {
117                }
118                
119                /**
120                  
121                    Constructs a StressTestControllerException with a message corresponding to the
122                    specified ID, appended with the specified String.
123                  
124                    @param  ID                the integer exception identifier
125                    @param  appendString      the string to append to the exception message
126                  
127 j.alex 1.1.2.1  */
128                StressTestControllerException::StressTestControllerException (Uint32 ID, const String& appendString) : 
129                    CommandException (_messageStrings 
130                        [(ID > MAX_ID) ? DEFAULT_ID : ID])
131                {
132                    _rep->message.append (appendString);
133                }
134                
135                /**
136                  
137                    Constructs a StressTestControllerException with the specified message.
138                  
139                    @param  exceptionMessage  a string containing the exception message
140                  
141                 */
142                StressTestControllerException::StressTestControllerException (const String& exceptionMessage) : 
143                    CommandException (exceptionMessage)
144                {
145                }
146                
147                String ConfigFileSyntaxError::_formatMessage(
148 j.alex 1.1.2.1     const String& file, Uint32 line)
149                {
150                    char buffer[32];
151                    sprintf(buffer, "%d", line);
152                
153                //l10n
154                    //String result = "Syntax error in configuration file: ";
155                    MessageLoaderParms parms("Config.ConfigExceptions.CONFIG_FILE_SYNTAX_ERR","Syntax error in configuration file: ");
156                    String result = MessageLoader::getMessage(parms);
157                //l10n end
158                    result.append(file);
159                    result.append("( Line number# ");
160                    result.append(buffer);
161                    result.append(")");
162                    return result;
163                }
164                
165                PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2