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

  1 kumpf 1.1.2.1 //%/////////////////////////////////////////////////////////////////////////////
  2               //
  3               // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM,
  4               // The Open Group, Tivoli Systems
  5               //
  6               // Permission is hereby granted, free of charge, to any person obtaining a copy
  7               // of this software and associated documentation files (the "Software"), to
  8               // deal in the Software without restriction, including without limitation the
  9               // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10               // sell copies of the Software, and to permit persons to whom the Software is
 11               // furnished to do so, subject to the following conditions:
 12               //
 13               // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14               // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15               // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16               // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17               // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18               // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19               // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20               // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21               //
 22 kumpf 1.1.2.1 //==============================================================================
 23               //
 24               // Author: Nag Boranna (nagaraja_boranna@hp.com)
 25               //
 26               // Modified By:
 27               //
 28               //%/////////////////////////////////////////////////////////////////////////////
 29               
 30               
 31               ///////////////////////////////////////////////////////////////////////////////
 32               // 
 33               // This file defines the configuration property owner class.
 34               //
 35               ///////////////////////////////////////////////////////////////////////////////
 36               
 37               
 38               #ifndef Pegasus_ConfigPropertyOwner_h
 39               #define Pegasus_ConfigPropertyOwner_h
 40               
 41 kumpf 1.1.2.6 #define EMPTY_VALUE "set_empty"
 42               
 43 kumpf 1.1.2.1 #include <Pegasus/Common/String.h>
 44               #include <Pegasus/Common/Config.h>
 45               #include <Pegasus/Config/ConfigExceptions.h>
 46 mike  1.1.2.2 #include <Pegasus/Config/Linkage.h>
 47 kumpf 1.1.2.1 
 48               PEGASUS_NAMESPACE_BEGIN
 49               
 50               ///////////////////////////////////////////////////////////////////////////////
 51               //  ConfigPropertyOwner Class
 52               ///////////////////////////////////////////////////////////////////////////////
 53               
 54               /** 
 55                   This is an abstract class that the individual config property 
 56                   owners will extend and provide implementation. 
 57               */
 58 mike  1.1.2.2 class PEGASUS_CONFIG_LINKAGE ConfigPropertyOwner
 59 kumpf 1.1.2.1 {
 60               public:
 61               
 62                   /** Constructors  */
 63                   ConfigPropertyOwner() { }
 64               
 65               
 66                   /** Destructor  */
 67                   virtual ~ConfigPropertyOwner() { }
 68               
 69 kumpf 1.1.2.4     /**
 70                   Initialize the config properties.
 71               
 72                   This method is expected to be called only once at the start of the
 73                   CIMOM. It initializes the properties with the default values.
 74                   */
 75                   virtual void initialize() = 0;
 76               
 77 kumpf 1.1.2.1 
 78                   /** 
 79                   Get information about the specified property.
 80               
 81                   @param name           The name of the property.
 82                   @param propertyInfo   List to store the property info.
 83                   @exception UnrecognizedConfigProperty  if the property is not defined.
 84                   */
 85                   virtual void getPropertyInfo(const String& name, 
 86 kumpf 1.1.2.4         Array<String>& propertyInfo) = 0;
 87                       //throw (UnrecognizedConfigProperty) = 0;
 88 kumpf 1.1.2.1 
 89               
 90                   /** 
 91                   Get default value of the specified property.
 92               
 93                   @param  name         The name of the property.
 94                   @return string containing the default value of the property specified.
 95                   @exception UnrecognizedConfigProperty  if the property is not defined.
 96                   */
 97 kumpf 1.1.2.4     virtual const String getDefaultValue(const String& name) = 0;
 98                       //throw (UnrecognizedConfigProperty) = 0;
 99 kumpf 1.1.2.1 
100               
101                   /** 
102                   Get current value of the specified property.
103               
104                   @param  name         The name of the property.
105                   @return string containing the currnet value of the property specified.
106                   @exception UnrecognizedConfigProperty  if the property is not defined.
107                   */
108 kumpf 1.1.2.4     virtual const String getCurrentValue(const String& name) = 0;
109                       //throw (UnrecognizedConfigProperty) = 0;
110 kumpf 1.1.2.1 
111               
112                   /** 
113                   Get planned value of the specified property.
114               
115                   @param  name         The name of the property.
116                   @return string containing the planned value of the property specified.
117                   @exception UnrecognizedConfigProperty  if the property is not defined.
118                   */
119 kumpf 1.1.2.4     virtual const String getPlannedValue(const String& name) = 0;
120                       //throw (UnrecognizedConfigProperty) = 0;
121 kumpf 1.1.2.1 
122               
123                   /** 
124                   Init current value of the specified property to the specified value.
125 kumpf 1.1.2.4     This method is expected to be called only once at the start of the
126 kumpf 1.1.2.1     CIMOM. The property value will be initialized irrespective of whether
127                   the property is dynamic or not.
128               
129 kumpf 1.1.2.4     @param  name   The name of the property.
130                   @param  value  The current value of the property. 
131 kumpf 1.1.2.1     @exception     UnrecognizedConfigProperty  if the property is not defined.
132                   @exception     InvalidPropertyValue  if the property value is not valid.
133                   */
134 kumpf 1.1.2.4     virtual void initCurrentValue(const String& name, const String& value) = 0;
135                       //throw (UnrecognizedConfigProperty, InvalidPropertyValue) = 0;
136 kumpf 1.1.2.1 
137               
138                   /** 
139                   Init planned value of the specified property to the specified value.
140 kumpf 1.1.2.4     This method is expected to be called only once at the start of the
141 kumpf 1.1.2.1     CIMOM. The property value will be initialized irrespective of whether
142                   the property is dynamic or not.
143               
144 kumpf 1.1.2.4     @param  name   The name of the property.
145                   @param  value  The planned value of the property. 
146 kumpf 1.1.2.1     @exception     UnrecognizedConfigProperty  if the property is not defined.
147                   @exception     InvalidPropertyValue  if the property value is not valid.
148                   */
149 kumpf 1.1.2.4     virtual void initPlannedValue(const String& name, const String& value) = 0;
150                       //throw (UnrecognizedConfigProperty, InvalidPropertyValue) = 0;
151 kumpf 1.1.2.1 
152               
153                   /** 
154                   Update current value of the specified property to the specified value.
155                   The property value will be updated only if the property is dynamically
156                   updatable.
157               
158 kumpf 1.1.2.4     @param  name   The name of the property.
159                   @param  value  The current value of the property. 
160 kumpf 1.1.2.1     @exception     NonDynamicConfigProperty  if the property is not dynamic.
161                   @exception     InvalidPropertyValue  if the property value is not valid.
162                   @exception     UnrecognizedConfigProperty  if the property is not defined.
163                   */
164                   virtual void updateCurrentValue(
165                       const String& name, 
166 kumpf 1.1.2.4         const String& value) = 0;
167                       //throw (NonDynamicConfigProperty, InvalidPropertyValue,
168                       //    UnrecognizedConfigProperty) = 0;
169 kumpf 1.1.2.1 
170               
171                   /** 
172                   Update planned value of the specified property to the specified value.
173               
174 kumpf 1.1.2.4     @param  name   The name of the property.
175                   @param  value  The planned value of the property. 
176 kumpf 1.1.2.1     @exception     InvalidPropertyValue  if the property value is not valid.
177                   @exception     UnrecognizedConfigProperty  if the property is not defined.
178                   */
179                   virtual void updatePlannedValue(
180                       const String& name, 
181 kumpf 1.1.2.4         const String& value) = 0; 
182                       //throw (InvalidPropertyValue, UnrecognizedConfigProperty) = 0;
183 kumpf 1.1.2.1 
184               
185                   /** 
186                   Checks to see if the given value is valid or not.
187               
188 kumpf 1.1.2.4     @param  name   The name of the property.
189                   @param  value  The value of the property to be validated. 
190 kumpf 1.1.2.1     @return true if the specified value for the property is valid.
191                   @exception UnrecognizedConfigProperty  if the property is not defined.
192                   */
193 kumpf 1.1.2.4     virtual Boolean isValid(const String& name, const String& value) = 0;
194                       //throw (UnrecognizedConfigProperty) = 0;
195 kumpf 1.1.2.1 
196               
197                   /** 
198                   Checks to see if the specified property is dynamic or not.
199               
200 kumpf 1.1.2.4     @param  name   The name of the property.
201 kumpf 1.1.2.1     @return true if the specified property is dynamic.
202                   @exception UnrecognizedConfigProperty  if the property is not defined.
203                   */
204 kumpf 1.1.2.4     virtual Boolean isDynamic(const String& name) = 0;
205                       //throw (UnrecognizedConfigProperty) = 0;
206 kumpf 1.1.2.1 
207               };
208               
209               
210               ///////////////////////////////////////////////////////////////////////////////
211               //  ConfigProperty
212               ///////////////////////////////////////////////////////////////////////////////
213               /** 
214                   The ConfigProperty struct used for defining the config properties.
215               
216                   This structure is used by property owners that implement the 
217                   ConfigPropertyOwner interface. Each config property they own will have 
218                   their attributes defined in a structure of the type ConfigProperty. 
219                   The structure members are initialized using the values defined in 
220                   ConfigPropertyRow or by the set methods. 
221               */
222               ///////////////////////////////////////////////////////////////////////////////
223               
224               struct ConfigProperty
225               {
226                   String     propertyName;    // Name of a config property
227 kumpf 1.1.2.1     String     defaultValue;    // Default value of a config property
228                   String     currentValue;    // Current value of a config property
229                   String     plannedValue;    // Planned of a config property
230                   Boolean    dynamic;            // Dynamic or non dynamic property
231                   char**     domain;            // List of valid values of a config property
232                   Uint32     domainSize;        // Size of the domain
233               };
234               
235               
236               
237               ///////////////////////////////////////////////////////////////////////////////
238               /** 
239                   The ConfigPropertyRow used for uniformly defining the values of 
240                   the properties.
241               
242                   This structure is intended to be used by property owners that implement 
243                   the ConfigPropertyOwner interface. Using this structure they can define 
244                   the in memory default values for each attributes of the properties 
245                   that they own.
246               */
247               ///////////////////////////////////////////////////////////////////////////////
248 kumpf 1.1.2.1 
249 sage  1.1.2.5 #ifndef PEGASUS_HAVE_BOOLEAN
250               struct ConfigPropertyRow
251               {
252                   const char* propertyName;
253                   const char* defaultValue;
254                   int         dynamic;
255                   char**      domain;
256                   Uint32      domainSize;
257               };
258               #else
259 kumpf 1.1.2.1 struct ConfigPropertyRow
260               {
261                   const char* propertyName;
262                   const char* defaultValue;
263                   Boolean     dynamic;
264                   char**      domain;
265                   Uint32      domainSize;
266               };
267 sage  1.1.2.5 #endif
268 kumpf 1.1.2.1 
269               
270               ///////////////////////////////////////////////////////////////////////////////
271               /**
272                   Definition of commonly use constant string literals 
273               */
274               ///////////////////////////////////////////////////////////////////////////////
275               
276               const static char* STRING_TRUE = "true";
277               
278               const static char* STRING_FALSE = "false";
279               
280               
281               PEGASUS_NAMESPACE_END
282               
283               #endif /* Pegasus_ConfigPropertyOwner_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2