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 karl 1.25
56 struct configProperty;
57
|
58 chip 1.11 /**
59 This is an abstract class that the individual config property
60 owners will extend and provide implementation.
|
61 mike 1.2 */
62 class PEGASUS_CONFIG_LINKAGE ConfigPropertyOwner
63 {
64 public:
65
66 /** Constructors */
67 ConfigPropertyOwner() { }
68
69 /** Destructor */
70 virtual ~ConfigPropertyOwner() { }
71
72 /**
|
73 kumpf 1.17 Initialize the config properties.
|
74 mike 1.2
|
75 kumpf 1.17 This method is expected to be called only once at the start of the
76 CIMOM. It initializes the properties with the default values.
|
77 mike 1.2 */
78 virtual void initialize() = 0;
79
|
80 chip 1.11 /**
|
81 karl 1.25 Get information about the specified property. Note that this
82 is a pure virtual function and must be implemented in each
83 subclass. It gets the local config property config table and
84 builds the propertyInfo array. Note that it uses
85 buildPropertyInfo to to the build
|
86 mike 1.2
|
87 kumpf 1.17 @param name The name of the property.
88 @param propertyInfo List to store the property info.
89 @exception UnrecognizedConfigProperty if the property is not defined.
|
90 mike 1.2 */
|
91 chip 1.11 virtual void getPropertyInfo(const String& name,
|
92 karl 1.25 Array<String>& propertyInfo) const = 0;
93
94 /*
95 Build the standard data from the specified property into the
96 propertyInfo array. This is functions should be used only by
97 getPropertyInfo above. This inserts string translations of values
98 for defaultValue, etc. into the provided PropertyInfo Array
99 TODO: Should this be private???
100 */
101 void buildPropertyInfo(const String& name,
102 const struct ConfigProperty * configProperty,
103 Array<String>& propertyInfo)const ;
104
105 /**
106 Get help about the specified property. Generates String of
107 documentation about the property. Normally supplied by this
108 class and the ConfigPropertyHelpDescription table but may be
109 overridden in sublcasses if more specific help is to be
110 supplied.
111 @param name String with name of config property
112 @return String with help(i.e. description) information.
113 karl 1.25 */
114
115 String getPropertyHelp(const String& name) const;
116
117 /**
118 Supplemental help information above and beyond
119 getPropertyHelp. Normally this is the place that the
120 specific property owner overrides this method and supplies a
121 string of possible values (ex. the values for
122 traceComponents).
123 @param name String with name of config property
124 @return String with supplemental help info
125 */
126 virtual String getPropertyHelpSupplement(const String& name) const;
|
127 mike 1.2
|
128 chip 1.11 /**
|
129 kumpf 1.17 Get default value of the specified property.
|
130 mike 1.2
|
131 kumpf 1.17 @param name The name of the property.
132 @return string containing the default value of the property specified.
133 @exception UnrecognizedConfigProperty if the property is not defined.
|
134 mike 1.2 */
|
135 vijay.eli 1.15 virtual String getDefaultValue(const String& name) const = 0;
|
136 mike 1.2
|
137 chip 1.11 /**
|
138 kumpf 1.17 Get current value of the specified property.
|
139 mike 1.2
|
140 kumpf 1.17 @param name The name of the property.
141 @return string containing the current value of the property specified.
142 @exception UnrecognizedConfigProperty if the property is not defined.
|
143 mike 1.2 */
|
144 vijay.eli 1.15 virtual String getCurrentValue(const String& name) const = 0;
|
145 mike 1.2
|
146 chip 1.11 /**
|
147 kumpf 1.17 Get planned value of the specified property.
|
148 mike 1.2
|
149 kumpf 1.17 @param name The name of the property.
150 @return string containing the planned value of the property specified.
151 @exception UnrecognizedConfigProperty if the property is not defined.
|
152 mike 1.2 */
|
153 vijay.eli 1.15 virtual String getPlannedValue(const String& name) const = 0;
|
154 mike 1.2
|
155 chip 1.11 /**
|
156 kumpf 1.17 Init current value of the specified property to the specified value.
157 This method is expected to be called only once at the start of the
158 CIMOM. The property value will be initialized irrespective of whether
159 the property is dynamic or not.
160
161 @param name The name of the property.
162 @param value The current value of the property.
163 @exception UnrecognizedConfigProperty if the property is not defined.
|
164 dev.meetei 1.24 @exception InvalidPropertyValue if the property value is not valid.
|
165 mike 1.2 */
166 virtual void initCurrentValue(const String& name, const String& value) = 0;
167
|
168 chip 1.11 /**
|
169 kumpf 1.17 Init planned value of the specified property to the specified value.
170 This method is expected to be called only once at the start of the
171 CIMOM. The property value will be initialized irrespective of whether
172 the property is dynamic or not.
173
174 @param name The name of the property.
175 @param value The planned value of the property.
176 @exception UnrecognizedConfigProperty if the property is not defined.
177 @exception InvalidPropertyValue if the property value is not valid.
|
178 mike 1.2 */
179 virtual void initPlannedValue(const String& name, const String& value) = 0;
180
|
181 chip 1.11 /**
|
182 kumpf 1.17 Update current value of the specified property to the specified value.
183 The property value will be updated only if the property is dynamically
184 updatable.
185
186 @param name The name of the property.
187 @param value The current value of the property.
|
188 venkat.puvvada 1.23 @param userName User requesting the update.
189 @param timeoutSeconds Timeout in seconds to complete the update.
|
190 kumpf 1.17 @exception NonDynamicConfigProperty if the property is not dynamic.
191 @exception InvalidPropertyValue if the property value is not valid.
192 @exception UnrecognizedConfigProperty if the property is not defined.
|
193 mike 1.2 */
194 virtual void updateCurrentValue(
|
195 chip 1.11 const String& name,
|
196 venkat.puvvada 1.22 const String& value,
|
197 venkat.puvvada 1.23 const String& userName,
198 Uint32 timeoutSeconds) = 0;
|
199 mike 1.2 //throw (NonDynamicConfigProperty, InvalidPropertyValue,
200 // UnrecognizedConfigProperty) = 0;
201
|
202 chip 1.11 /**
|
203 kumpf 1.17 Update planned value of the specified property to the specified value.
|
204 mike 1.2
|
205 kumpf 1.17 @param name The name of the property.
206 @param value The planned value of the property.
207 @exception InvalidPropertyValue if the property value is not valid.
208 @exception UnrecognizedConfigProperty if the property is not defined.
|
209 mike 1.2 */
210 virtual void updatePlannedValue(
|
211 chip 1.11 const String& name,
212 const String& value) = 0;
|
213 mike 1.2
|
214 chip 1.11 /**
|
215 kumpf 1.17 Checks to see if the given value is valid or not.
|
216 mike 1.2
|
217 kumpf 1.17 @param name The name of the property.
218 @param value The value of the property to be validated.
219 @return true if the specified value for the property is valid.
220 @exception UnrecognizedConfigProperty if the property is not defined.
|
221 mike 1.2 */
|
222 kumpf 1.17 virtual Boolean isValid(const String& name, const String& value) const = 0;
|
223 mike 1.2
|
224 chip 1.11 /**
|
225 kumpf 1.17 Checks to see if the specified property is dynamic or not.
|
226 mike 1.2
|
227 kumpf 1.17 @param name The name of the property.
228 @return true if the specified property is dynamic.
229 @exception UnrecognizedConfigProperty if the property is not defined.
|
230 mike 1.2 */
|
231 vijay.eli 1.15 virtual Boolean isDynamic(const String& name) const = 0;
|
232 karl 1.26
233 /** Initialize and load the appropriate internationalized
234 message for the defined key. This function is limited to
235 fixed message output.
236 @param key String with key to message in message bundle
237 @param msg String containing message
238 */
239 static String loadMessage(const char* key, const char* msg);
|
240 mike 1.2 };
241
242
243 ///////////////////////////////////////////////////////////////////////////////
244 // ConfigProperty
245 ///////////////////////////////////////////////////////////////////////////////
|
246 chip 1.11 /**
|
247 mike 1.2 The ConfigProperty struct used for defining the config properties.
248
|
249 chip 1.11 This structure is used by property owners that implement the
250 ConfigPropertyOwner interface. Each config property they own will have
251 their attributes defined in a structure of the type ConfigProperty.
252 The structure members are initialized using the values defined in
253 ConfigPropertyRow or by the set methods.
|
254 mike 1.2 */
255 ///////////////////////////////////////////////////////////////////////////////
256
|
257 konrad.r 1.10 enum ConfigDynamic
258 {
|
259 kumpf 1.17 IS_DYNAMIC = 1,
260 IS_STATIC = 0
|
261 konrad.r 1.10 };
262
263 enum ConfigVisible
264 {
|
265 kumpf 1.17 IS_VISIBLE =1,
266 IS_HIDDEN = 0
|
267 konrad.r 1.10 };
268
|
269 mike 1.2 struct ConfigProperty
270 {
|
271 kumpf 1.17 String propertyName; // Name of a config property
272 String defaultValue; // Default value of a config property
273 String currentValue; // Current value of a config property
274 String plannedValue; // Planned of a config property
275 ConfigDynamic dynamic; // Dynamic or non dynamic property
276 // Determines whether a property wants to be externally visible or not.
277 // If a property chooses not to be externally visible, it is not listed
278 // as a configurable property but is still configurable.
279 ConfigVisible externallyVisible;
|
280 mike 1.2 };
281
282 ///////////////////////////////////////////////////////////////////////////////
|
283 chip 1.11 /**
284 The ConfigPropertyRow used for uniformly defining the values of
|
285 mike 1.2 the properties.
286
|
287 chip 1.11 This structure is intended to be used by property owners that implement
288 the ConfigPropertyOwner interface. Using this structure they can define
289 the in memory default values for each attributes of the properties
|
290 mike 1.2 that they own.
291 */
292 ///////////////////////////////////////////////////////////////////////////////
293
294 struct ConfigPropertyRow
295 {
296 const char* propertyName;
297 const char* defaultValue;
|
298 kumpf 1.17 ConfigDynamic dynamic;
299 ConfigVisible externallyVisible;
|
300 mike 1.2 };
301
302 ///////////////////////////////////////////////////////////////////////////////
303 /**
|
304 chip 1.11 Definition of commonly used constant string literals
|
305 mike 1.2 */
306 ///////////////////////////////////////////////////////////////////////////////
307
|
308 karl 1.25 /*
309 Internal definitions for constants "TRUE" and "FALSE"
310 */
|
311 kavita.gupta 1.21 PEGASUS_CONFIG_LINKAGE extern const String STRING_TRUE;
312 PEGASUS_CONFIG_LINKAGE extern const String STRING_FALSE;
|
313 mike 1.2
|
314 karl 1.25 /**
315 * The Server message resource name
316 */
317 PEGASUS_CONFIG_LINKAGE extern const char CONFIG_MSG_PATH[];
318
|
319 mike 1.2 PEGASUS_NAMESPACE_END
320
321 #endif /* Pegasus_ConfigPropertyOwner_h */
|