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

  1 martin 1.18 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.19 //
  3 martin 1.18 // 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.19 //
 10 martin 1.18 // 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.19 //
 17 martin 1.18 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.19 //
 20 martin 1.18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.19 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.18 // 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.19 //
 28 martin 1.18 //////////////////////////////////////////////////////////////////////////
 29 mike   1.2  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             
 33             ///////////////////////////////////////////////////////////////////////////////
 34 chip   1.11 //
 35 mike   1.2  // This file defines the configuration property owner class.
 36             //
 37             ///////////////////////////////////////////////////////////////////////////////
 38             
 39             
 40             #ifndef Pegasus_ConfigPropertyOwner_h
 41             #define Pegasus_ConfigPropertyOwner_h
 42             
 43 kumpf  1.6  #include <Pegasus/Common/ArrayInternal.h>
 44 mike   1.2  #include <Pegasus/Common/String.h>
 45             #include <Pegasus/Common/Config.h>
 46             #include <Pegasus/Config/ConfigExceptions.h>
 47             #include <Pegasus/Config/Linkage.h>
 48             
 49             PEGASUS_NAMESPACE_BEGIN
 50             
 51             ///////////////////////////////////////////////////////////////////////////////
 52             //  ConfigPropertyOwner Class
 53             ///////////////////////////////////////////////////////////////////////////////
 54             
 55 chip   1.11 /**
 56                 This is an abstract class that the individual config property
 57                 owners will extend and provide implementation.
 58 mike   1.2  */
 59             class PEGASUS_CONFIG_LINKAGE ConfigPropertyOwner
 60             {
 61             public:
 62             
 63                 /** Constructors  */
 64                 ConfigPropertyOwner() { }
 65             
 66                 /** Destructor  */
 67                 virtual ~ConfigPropertyOwner() { }
 68             
 69                 /**
 70 kumpf  1.17         Initialize the config properties.
 71 mike   1.2  
 72 kumpf  1.17         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 mike   1.2      */
 75                 virtual void initialize() = 0;
 76             
 77 chip   1.11     /**
 78 kumpf  1.17         Get information about the specified property.
 79 mike   1.2  
 80 kumpf  1.17         @param name The name of the property.
 81                     @param propertyInfo List to store the property info.
 82                     @exception UnrecognizedConfigProperty  if the property is not defined.
 83 mike   1.2      */
 84 chip   1.11     virtual void getPropertyInfo(const String& name,
 85 vijay.eli 1.15                          Array<String>& propertyInfo) const = 0;
 86 mike      1.2  
 87 chip      1.11     /**
 88 kumpf     1.17         Get default value of the specified property.
 89 mike      1.2  
 90 kumpf     1.17         @param name The name of the property.
 91                        @return string containing the default value of the property specified.
 92                        @exception UnrecognizedConfigProperty if the property is not defined.
 93 mike      1.2      */
 94 vijay.eli 1.15     virtual String getDefaultValue(const String& name) const = 0;
 95 mike      1.2  
 96 chip      1.11     /**
 97 kumpf     1.17         Get current value of the specified property.
 98 mike      1.2  
 99 kumpf     1.17         @param name The name of the property.
100                        @return string containing the current value of the property specified.
101                        @exception UnrecognizedConfigProperty  if the property is not defined.
102 mike      1.2      */
103 vijay.eli 1.15     virtual String getCurrentValue(const String& name) const = 0;
104 mike      1.2  
105 chip      1.11     /**
106 kumpf     1.17         Get planned value of the specified property.
107 mike      1.2  
108 kumpf     1.17         @param name The name of the property.
109                        @return string containing the planned value of the property specified.
110                        @exception UnrecognizedConfigProperty if the property is not defined.
111 mike      1.2      */
112 vijay.eli 1.15     virtual String getPlannedValue(const String& name) const = 0;
113 mike      1.2  
114 chip      1.11     /**
115 kumpf     1.17         Init current value of the specified property to the specified value.
116                        This method is expected to be called only once at the start of the
117                        CIMOM. The property value will be initialized irrespective of whether
118                        the property is dynamic or not.
119                
120                        @param name The name of the property.
121                        @param value The current value of the property.
122                        @exception UnrecognizedConfigProperty if the property is not defined.
123                        @exception InvalidPropertyValue if the property value is not valid.
124 mike      1.2      */
125                    virtual void initCurrentValue(const String& name, const String& value) = 0;
126                
127 chip      1.11     /**
128 kumpf     1.17         Init planned value of the specified property to the specified value.
129                        This method is expected to be called only once at the start of the
130                        CIMOM. The property value will be initialized irrespective of whether
131                        the property is dynamic or not.
132                
133                        @param name The name of the property.
134                        @param value The planned value of the property.
135                        @exception UnrecognizedConfigProperty  if the property is not defined.
136                        @exception InvalidPropertyValue  if the property value is not valid.
137 mike      1.2      */
138                    virtual void initPlannedValue(const String& name, const String& value) = 0;
139                
140 chip      1.11     /**
141 kumpf     1.17         Update current value of the specified property to the specified value.
142                        The property value will be updated only if the property is dynamically
143                        updatable.
144                
145                        @param name The name of the property.
146                        @param value The current value of the property.
147                        @exception NonDynamicConfigProperty if the property is not dynamic.
148                        @exception InvalidPropertyValue if the property value is not valid.
149                        @exception UnrecognizedConfigProperty if the property is not defined.
150 mike      1.2      */
151                    virtual void updateCurrentValue(
152 chip      1.11         const String& name,
153 mike      1.2          const String& value) = 0;
154                        //throw (NonDynamicConfigProperty, InvalidPropertyValue,
155                        //    UnrecognizedConfigProperty) = 0;
156                
157 chip      1.11     /**
158 kumpf     1.17         Update planned value of the specified property to the specified value.
159 mike      1.2  
160 kumpf     1.17         @param name The name of the property.
161                        @param value The planned value of the property.
162                        @exception InvalidPropertyValue  if the property value is not valid.
163                        @exception UnrecognizedConfigProperty  if the property is not defined.
164 mike      1.2      */
165                    virtual void updatePlannedValue(
166 chip      1.11         const String& name,
167                        const String& value) = 0;
168 mike      1.2  
169 chip      1.11     /**
170 kumpf     1.17         Checks to see if the given value is valid or not.
171 mike      1.2  
172 kumpf     1.17         @param name The name of the property.
173                        @param value The value of the property to be validated.
174                        @return true if the specified value for the property is valid.
175                        @exception UnrecognizedConfigProperty if the property is not defined.
176 mike      1.2      */
177 kumpf     1.17     virtual Boolean isValid(const String& name, const String& value) const = 0;
178 mike      1.2  
179 chip      1.11     /**
180 kumpf     1.17         Checks to see if the specified property is dynamic or not.
181 mike      1.2  
182 kumpf     1.17         @param name The name of the property.
183                        @return true if the specified property is dynamic.
184                        @exception UnrecognizedConfigProperty if the property is not defined.
185 mike      1.2      */
186 vijay.eli 1.15     virtual Boolean isDynamic(const String& name) const = 0;
187 mike      1.2  };
188                
189                
190                ///////////////////////////////////////////////////////////////////////////////
191                //  ConfigProperty
192                ///////////////////////////////////////////////////////////////////////////////
193 chip      1.11 /**
194 mike      1.2      The ConfigProperty struct used for defining the config properties.
195                
196 chip      1.11     This structure is used by property owners that implement the
197                    ConfigPropertyOwner interface. Each config property they own will have
198                    their attributes defined in a structure of the type ConfigProperty.
199                    The structure members are initialized using the values defined in
200                    ConfigPropertyRow or by the set methods.
201 mike      1.2  */
202                ///////////////////////////////////////////////////////////////////////////////
203                
204 konrad.r  1.10 enum ConfigDynamic
205                {
206 kumpf     1.17     IS_DYNAMIC = 1,
207                    IS_STATIC = 0
208 konrad.r  1.10 };
209                
210                enum ConfigVisible
211                {
212 kumpf     1.17     IS_VISIBLE =1,
213                    IS_HIDDEN = 0
214 konrad.r  1.10 };
215                
216 mike      1.2  struct ConfigProperty
217                {
218 kumpf     1.17     String propertyName;    // Name of a config property
219                    String defaultValue;    // Default value of a config property
220                    String currentValue;    // Current value of a config property
221                    String plannedValue;    // Planned of a config property
222                    ConfigDynamic dynamic;  // Dynamic or non dynamic property
223                    // Determines whether a property wants to be externally visible or not.
224                    // If a property chooses not to be externally visible, it is not listed
225                    // as a configurable property but is still configurable.
226                    ConfigVisible externallyVisible;
227 mike      1.2  };
228                
229                ///////////////////////////////////////////////////////////////////////////////
230 chip      1.11 /**
231                    The ConfigPropertyRow used for uniformly defining the values of
232 mike      1.2      the properties.
233                
234 chip      1.11     This structure is intended to be used by property owners that implement
235                    the ConfigPropertyOwner interface. Using this structure they can define
236                    the in memory default values for each attributes of the properties
237 mike      1.2      that they own.
238                */
239                ///////////////////////////////////////////////////////////////////////////////
240                
241                struct ConfigPropertyRow
242                {
243                    const char* propertyName;
244                    const char* defaultValue;
245 kumpf     1.17     ConfigDynamic dynamic;
246                    ConfigVisible externallyVisible;
247 mike      1.2  };
248                
249                ///////////////////////////////////////////////////////////////////////////////
250                /**
251 chip      1.11     Definition of commonly used constant string literals
252 mike      1.2  */
253                ///////////////////////////////////////////////////////////////////////////////
254                
255 kavita.gupta 1.21 PEGASUS_CONFIG_LINKAGE extern const String STRING_TRUE;
256                   PEGASUS_CONFIG_LINKAGE extern const String STRING_FALSE;
257 mike         1.2  
258                   PEGASUS_NAMESPACE_END
259                   
260                   #endif /* Pegasus_ConfigPropertyOwner_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2