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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2