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