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