1 karl 1.18 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.12 // 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.12 // 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.14 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.18 // 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 kumpf 1.6 //
|
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 kumpf 1.20 //
|
37 mike 1.2 // This file has implementation for the repository property owner class.
38 //
39 ///////////////////////////////////////////////////////////////////////////////
40
41 #include "RepositoryPropertyOwner.h"
42
43 PEGASUS_USING_STD;
44
45 PEGASUS_NAMESPACE_BEGIN
46
47 ///////////////////////////////////////////////////////////////////////////////
48 // RepositoryPropertyOwner
49 ///////////////////////////////////////////////////////////////////////////////
50
51 static struct ConfigPropertyRow properties[] =
52 {
|
53 denise.eckstein 1.11 #if defined(PEGASUS_OS_LINUX)
54 # ifdef PEGASUS_USE_RELEASE_CONFIG_OPTIONS
|
55 kumpf 1.20 {"repositoryIsDefaultInstanceProvider",
56 "false", IS_STATIC, 0, 0, IS_HIDDEN},
|
57 denise.eckstein 1.11 # else
|
58 kumpf 1.20 {"repositoryIsDefaultInstanceProvider",
59 "true", IS_STATIC, 0, 0, IS_VISIBLE},
|
60 denise.eckstein 1.11 # endif
61 #else
|
62 kumpf 1.20 {"repositoryIsDefaultInstanceProvider",
63 "true", IS_STATIC, 0, 0, IS_VISIBLE},
|
64 denise.eckstein 1.11 #endif
|
65 marek 1.19 #ifndef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM
|
66 kumpf 1.20 {"enableBinaryRepository", "false", IS_STATIC, 0, 0, IS_VISIBLE}
|
67 marek 1.19 #else
|
68 kumpf 1.20 {"enableBinaryRepository", "true", IS_STATIC, 0, 0, IS_VISIBLE}
|
69 marek 1.19 #endif
|
70 mike 1.2 };
71
72 const Uint32 NUM_PROPERTIES = sizeof(properties) / sizeof(properties[0]);
73
74
|
75 kumpf 1.20 /** Constructors */
|
76 mike 1.2 RepositoryPropertyOwner::RepositoryPropertyOwner()
77 {
78 _repositoryIsDefaultInstanceProvider = new ConfigProperty;
|
79 kumpf 1.20 _enableBinaryRepository = new ConfigProperty;
|
80 mike 1.2 }
81
|
82 kumpf 1.20 /** Destructor */
|
83 mike 1.2 RepositoryPropertyOwner::~RepositoryPropertyOwner()
84 {
85 delete _repositoryIsDefaultInstanceProvider;
|
86 kumpf 1.20 delete _enableBinaryRepository;
|
87 mike 1.2 }
88
89
90 /**
|
91 kumpf 1.20 Initialize the config properties.
|
92 mike 1.2 */
93 void RepositoryPropertyOwner::initialize()
94 {
95 for (Uint32 i = 0; i < NUM_PROPERTIES; i++)
96 {
97 //
98 // Initialize the properties with default values
99 //
|
100 kumpf 1.20 if (String::equalNoCase(properties[i].propertyName,
101 "repositoryIsDefaultInstanceProvider"))
|
102 mike 1.2 {
|
103 kumpf 1.20 _repositoryIsDefaultInstanceProvider->propertyName =
104 properties[i].propertyName;
105 _repositoryIsDefaultInstanceProvider->defaultValue =
106 properties[i].defaultValue;
107 _repositoryIsDefaultInstanceProvider->currentValue =
108 properties[i].defaultValue;
109 _repositoryIsDefaultInstanceProvider->plannedValue =
110 properties[i].defaultValue;
111 _repositoryIsDefaultInstanceProvider->dynamic =
112 properties[i].dynamic;
113 _repositoryIsDefaultInstanceProvider->domain =
114 properties[i].domain;
115 _repositoryIsDefaultInstanceProvider->domainSize =
116 properties[i].domainSize;
117 _repositoryIsDefaultInstanceProvider->externallyVisible =
118 properties[i].externallyVisible;
|
119 mike 1.2 }
|
120 dave.sudlik 1.9 else if (String::equalNoCase(
|
121 kumpf 1.20 properties[i].propertyName, "enableBinaryRepository"))
|
122 dave.sudlik 1.9 {
123 _enableBinaryRepository->propertyName = properties[i].propertyName;
124 _enableBinaryRepository->defaultValue = properties[i].defaultValue;
125 _enableBinaryRepository->currentValue = properties[i].defaultValue;
126 _enableBinaryRepository->plannedValue = properties[i].defaultValue;
127 _enableBinaryRepository->dynamic = properties[i].dynamic;
128 _enableBinaryRepository->domain = properties[i].domain;
129 _enableBinaryRepository->domainSize = properties[i].domainSize;
|
130 kumpf 1.20 _enableBinaryRepository->externallyVisible =
131 properties[i].externallyVisible;
|
132 dave.sudlik 1.9 }
|
133 mike 1.2 }
134 }
135
|
136 kumpf 1.5 struct ConfigProperty* RepositoryPropertyOwner::_lookupConfigProperty(
|
137 aruran.ms 1.17 const String& name) const
|
138 kumpf 1.5 {
139 if (String::equalNoCase(
140 _repositoryIsDefaultInstanceProvider->propertyName, name))
141 {
142 return _repositoryIsDefaultInstanceProvider;
143 }
|
144 dave.sudlik 1.9 else if (String::equalNoCase(
|
145 kumpf 1.20 _enableBinaryRepository->propertyName, name))
|
146 dave.sudlik 1.9 {
147 return _enableBinaryRepository;
148 }
|
149 kumpf 1.5 else
150 {
151 throw UnrecognizedConfigProperty(name);
152 }
153 }
154
|
155 kumpf 1.20 /**
156 Get information about the specified property.
|
157 mike 1.2 */
158 void RepositoryPropertyOwner::getPropertyInfo(
|
159 kumpf 1.20 const String& name,
|
160 vijay.eli 1.16 Array<String>& propertyInfo) const
|
161 mike 1.2 {
162 propertyInfo.clear();
|
163 aruran.ms 1.17 struct ConfigProperty * configProperty = _lookupConfigProperty(name);
|
164 kumpf 1.5
165 propertyInfo.append(configProperty->propertyName);
166 propertyInfo.append(configProperty->defaultValue);
167 propertyInfo.append(configProperty->currentValue);
168 propertyInfo.append(configProperty->plannedValue);
169 if (configProperty->dynamic)
|
170 kumpf 1.7 {
171 propertyInfo.append(STRING_TRUE);
172 }
173 else
174 {
175 propertyInfo.append(STRING_FALSE);
176 }
177 if (configProperty->externallyVisible)
|
178 mike 1.2 {
|
179 kumpf 1.5 propertyInfo.append(STRING_TRUE);
|
180 mike 1.2 }
181 else
182 {
|
183 kumpf 1.5 propertyInfo.append(STRING_FALSE);
|
184 mike 1.2 }
185 }
186
|
187 kumpf 1.20 /**
188 Get default value of the specified property.
|
189 mike 1.2 */
|
190 vijay.eli 1.16 String RepositoryPropertyOwner::getDefaultValue(const String& name) const
|
191 mike 1.2 {
|
192 aruran.ms 1.17 struct ConfigProperty * configProperty = _lookupConfigProperty(name);
|
193 vijay.eli 1.16
|
194 kumpf 1.5 return configProperty->defaultValue;
|
195 mike 1.2 }
196
|
197 kumpf 1.20 /**
198 Get current value of the specified property.
|
199 mike 1.2 */
|
200 vijay.eli 1.16 String RepositoryPropertyOwner::getCurrentValue(const String& name) const
|
201 mike 1.2 {
|
202 aruran.ms 1.17 struct ConfigProperty * configProperty = _lookupConfigProperty(name);
|
203 vijay.eli 1.16
|
204 kumpf 1.5 return configProperty->currentValue;
|
205 mike 1.2 }
206
|
207 kumpf 1.20 /**
208 Get planned value of the specified property.
|
209 mike 1.2 */
|
210 vijay.eli 1.16 String RepositoryPropertyOwner::getPlannedValue(const String& name) const
|
211 mike 1.2 {
|
212 aruran.ms 1.17 struct ConfigProperty * configProperty = _lookupConfigProperty(name);
|
213 vijay.eli 1.16
|
214 kumpf 1.5 return configProperty->plannedValue;
|
215 mike 1.2 }
216
217
|
218 kumpf 1.20 /**
219 Init current value of the specified property to the specified value.
|
220 mike 1.2 */
221 void RepositoryPropertyOwner::initCurrentValue(
|
222 kumpf 1.20 const String& name,
|
223 mike 1.2 const String& value)
224 {
|
225 kumpf 1.5 struct ConfigProperty* configProperty = _lookupConfigProperty(name);
226 configProperty->currentValue = value;
|
227 mike 1.2 }
228
229
|
230 kumpf 1.20 /**
231 Init planned value of the specified property to the specified value.
|
232 mike 1.2 */
233 void RepositoryPropertyOwner::initPlannedValue(
|
234 kumpf 1.20 const String& name,
|
235 mike 1.2 const String& value)
236 {
|
237 kumpf 1.5 struct ConfigProperty* configProperty = _lookupConfigProperty(name);
238 configProperty->plannedValue = value;
|
239 mike 1.2 }
240
|
241 kumpf 1.20 /**
242 Update current value of the specified property to the specified value.
|
243 mike 1.2 */
244 void RepositoryPropertyOwner::updateCurrentValue(
|
245 kumpf 1.20 const String& name,
246 const String& value)
|
247 mike 1.2 {
248 //
249 // make sure the property is dynamic before updating the value.
250 //
251 if (!isDynamic(name))
252 {
|
253 kumpf 1.20 throw NonDynamicConfigProperty(name);
|
254 mike 1.2 }
255
256 //
|
257 kumpf 1.5 // Update does the same thing as initialization
|
258 mike 1.2 //
|
259 kumpf 1.5 initCurrentValue(name, value);
|
260 mike 1.2 }
261
262
|
263 kumpf 1.20 /**
264 Update planned value of the specified property to the specified value.
|
265 mike 1.2 */
266 void RepositoryPropertyOwner::updatePlannedValue(
|
267 kumpf 1.20 const String& name,
|
268 mike 1.2 const String& value)
269 {
270 //
|
271 kumpf 1.5 // Update does the same thing as initialization
|
272 mike 1.2 //
|
273 kumpf 1.5 initPlannedValue(name, value);
|
274 mike 1.2 }
275
|
276 kumpf 1.20 /**
277 Checks to see if the given value is valid or not.
|
278 mike 1.2 */
|
279 kumpf 1.20 Boolean RepositoryPropertyOwner::isValid(
280 const String& name,
281 const String& value) const
|
282 mike 1.2 {
283 Boolean retVal = false;
284
285 //
286 // Validate the specified value
287 //
|
288 kumpf 1.20 if (String::equalNoCase(
289 _repositoryIsDefaultInstanceProvider->propertyName, name))
|
290 mike 1.2 {
|
291 kumpf 1.20 if (String::equal(value, "true") || String::equal(value, "false"))
|
292 mike 1.2 {
293 retVal = true;
294 }
295 }
|
296 kumpf 1.20 else if (String::equalNoCase(_enableBinaryRepository->propertyName, name))
|
297 dave.sudlik 1.9 {
|
298 kumpf 1.20 if (String::equal(value, "true") || String::equal(value, "false"))
|
299 dave.sudlik 1.9 {
300 retVal = true;
301 }
302 }
|
303 mike 1.2 else
304 {
305 throw UnrecognizedConfigProperty(name);
306 }
307 return retVal;
308 }
309
|
310 kumpf 1.20 /**
311 Checks to see if the specified property is dynamic or not.
|
312 mike 1.2 */
|
313 vijay.eli 1.16 Boolean RepositoryPropertyOwner::isDynamic(const String& name) const
|
314 mike 1.2 {
|
315 aruran.ms 1.17 struct ConfigProperty * configProperty = _lookupConfigProperty(name);
|
316 vijay.eli 1.16
|
317 kumpf 1.20 return (configProperty->dynamic == IS_DYNAMIC);
|
318 mike 1.2 }
319
320 PEGASUS_NAMESPACE_END
|