(file) Return to IPInfoException.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Clients / ipinfo

  1 martin 1.7 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.8 //
  3 martin 1.7 // 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.8 //
 10 martin 1.7 // 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.8 //
 17 martin 1.7 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.8 //
 20 martin 1.7 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.8 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.7 // 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.8 //
 28 martin 1.7 //////////////////////////////////////////////////////////////////////////
 29 kumpf  1.1 //
 30            //%/////////////////////////////////////////////////////////////////////////////
 31            
 32            #include <Pegasus/Common/Config.h>
 33            #include <Pegasus/Common/ExceptionRep.h>
 34            #include "IPInfoException.h"
 35            
 36            PEGASUS_NAMESPACE_BEGIN
 37            
 38            
 39            /**
 40 kumpf  1.9 
 41 kumpf  1.1     Default exception identifier.  This identifier is used if the specified
 42                identifier is out of range.  This identifier corresponds to a default
 43                (generic) message in the array of exception message strings.
 44 kumpf  1.9 
 45 kumpf  1.1  */
 46            const Uint32 IPInfoException::DEFAULT_ID = 0;
 47            
 48            /**
 49 kumpf  1.9 
 50 kumpf  1.1     Minimum valid exception identifier.
 51 kumpf  1.9 
 52 kumpf  1.1  */
 53            const Uint32 IPInfoException::MIN_ID = DEFAULT_ID;
 54            
 55            /**
 56 kumpf  1.9 
 57 kumpf  1.1    Exception identifier indicating a connection failure.
 58 kumpf  1.9 
 59 kumpf  1.1  */
 60            
 61            const Uint32 IPInfoException::CONNECT_FAIL = 1;
 62            
 63            /**
 64 kumpf  1.9 
 65 kumpf  1.1     Exception identifier indicating timed out waiting for response.
 66 kumpf  1.9 
 67 kumpf  1.1  */
 68            const Uint32 IPInfoException::TIMED_OUT = 2;
 69            
 70            /**
 71 kumpf  1.9 
 72 kumpf  1.1     Exception identifier indicating invalid input.
 73 kumpf  1.9 
 74 kumpf  1.1  */
 75            const Uint32 IPInfoException::INVALID_INPUT = 3;
 76            
 77            /**
 78 kumpf  1.9 
 79 kumpf  1.1     Maximum valid exception identifier.  This value must be updated when
 80                a new exception identifier and message are added.
 81 kumpf  1.9 
 82 kumpf  1.1  */
 83            const Uint32 IPInfoException::MAX_ID = IPInfoException::INVALID_INPUT;
 84            
 85            /**
 86            
 87                Exception message strings.  The exception identifier is used as an
 88                index into this array to retrieve the appropriate exception message
 89                string.  When a new identifier is added, this array must be updated
 90                appropriately.
 91            
 92             */
 93            const char*  IPInfoException::_messageStrings [] =
 94            {
 95                "Error in ipinfo command ",
 96                "Failed to connect to CIM server: ",
 97                "Timed out waiting for response ",
 98                "Invalid input"
 99            };
100            
101            /**
102 kumpf  1.9 
103 kumpf  1.1     Constructs a IPInfoException with a message corresponding to the
104                specified exception ID.
105 kumpf  1.9 
106 kumpf  1.1     @param  ID                the integer exception identifier
107 kumpf  1.9 
108 kumpf  1.1  */
109 kumpf  1.9 IPInfoException::IPInfoException (Uint32 ID) : CommandException
110 kumpf  1.1     (_messageStrings [(ID > MAX_ID) ? DEFAULT_ID : ID])
111            {
112            }
113            
114            /**
115 kumpf  1.9 
116 kumpf  1.1     Constructs a IPInfoException with a message corresponding to the
117                specified ID, appended with the specified String.
118 kumpf  1.9 
119 kumpf  1.1     @param  ID                the integer exception identifier
120                @param  appendString      the string to append to the exception message
121 kumpf  1.9 
122 kumpf  1.1  */
123 kumpf  1.9 IPInfoException::IPInfoException (Uint32 ID, const String& appendString) :
124                CommandException (_messageStrings
125 kumpf  1.1         [(ID > MAX_ID) ? DEFAULT_ID : ID])
126            {
127                _rep->message.append (appendString);
128            }
129            
130            /**
131 kumpf  1.9 
132 kumpf  1.1     Constructs a IPInfoException with the specified message.
133 kumpf  1.9 
134 kumpf  1.1     @param  exceptionMessage  a string containing the exception message
135 kumpf  1.9 
136 kumpf  1.1  */
137 kumpf  1.9 IPInfoException::IPInfoException (const String& exceptionMessage) :
138 kumpf  1.1     CommandException (exceptionMessage)
139            {
140            }
141            
142            PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2