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