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