-
Notifications
You must be signed in to change notification settings - Fork 188
/
DummyConfiguration.java
325 lines (272 loc) · 10.5 KB
/
DummyConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
* Copyright (c) 2010-2015 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.icf.dummy.connector;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.spi.AbstractConfiguration;
import org.identityconnectors.framework.spi.ConfigurationProperty;
/**
* Extends the {@link AbstractConfiguration} class to provide all the necessary
* parameters to initialize the Test Connector.
*
* @author $author$
* @version $Revision$ $Date$
*/
public class DummyConfiguration extends AbstractConfiguration {
public static String UID_MODE_NAME = "name";
public static String UID_MODE_UUID = "uuid";
private static final Log log = Log.getLog(DummyConfiguration.class);
private String instanceId;
private boolean supportSchema = true;
private boolean supportActivation = true;
private boolean supportValidity = false;
private String uidMode = UID_MODE_NAME;
private boolean enforceUniqueName = true;
private boolean readablePassword = false;
private boolean requireExplicitEnable = false;
private boolean caseIgnoreId = false;
private boolean caseIgnoreValues = false;
private boolean upCaseName = false;
private boolean generateDefaultValues = false;
private boolean tolerateDuplicateValues = true;
private boolean varyLetterCase = false;
private boolean referentialIntegrity = false;
private String uselessString;
private GuardedString uselessGuardedString;
private boolean generateAccountDescriptionOnCreate = false; // simulates volatile behavior (on create)
private boolean generateAccountDescriptionOnUpdate = false; // simulates volatile behavior (on update)
private String[] forbiddenNames = new String[0];
private boolean useLegacySchema = true;
/**
* Defines name of the dummy resource instance. There may be several dummy resource running in
* parallel. This ID selects one of them. If not set a default instance will be selected.
*/
@ConfigurationProperty(displayMessageKey = "UI_INSTANCE_ID",
helpMessageKey = "UI_INSTANCE_ID_HELP")
public String getInstanceId() {
return instanceId;
}
public void setInstanceId(String config) {
this.instanceId = config;
}
/**
* If set to false the connector will return UnsupportedOperationException when trying to
* get the schema.
*/
@ConfigurationProperty(displayMessageKey = "UI_SUPPORT_SCHEMA",
helpMessageKey = "UI_SUPPORT_SCHEMA_HELP")
public boolean getSupportSchema() {
return supportSchema;
}
public void setSupportSchema(boolean supportSchema) {
this.supportSchema = supportSchema;
}
/**
* If set to true the connector will expose activation special attribute (ENABLED). True is the default.
*/
@ConfigurationProperty(displayMessageKey = "UI_SUPPORT_ACTIVATION",
helpMessageKey = "UI_SUPPORT_ACTIVATION_HELP")
public boolean getSupportActivation() {
return supportActivation;
}
public void setSupportActivation(boolean supportActivation) {
this.supportActivation = supportActivation;
}
/**
* If set to true the connector will expose the validity ICF special attributes.
*/
@ConfigurationProperty(displayMessageKey = "UI_SUPPORT_VALIDITY",
helpMessageKey = "UI_SUPPORT_VALIDITY_HELP")
public boolean getSupportValidity() {
return supportValidity;
}
public void setSupportValidity(boolean supportValidity) {
this.supportValidity = supportValidity;
}
@ConfigurationProperty(displayMessageKey = "UI_UID_MODE",
helpMessageKey = "UI_UID_MODE_HELP")
public String getUidMode() {
return uidMode;
}
public void setUidMode(String uidMode) {
this.uidMode = uidMode;
}
@ConfigurationProperty(displayMessageKey = "UI_ENFORCE_UNIQUE_NAME",
helpMessageKey = "UI_ENFORCE_UNIQUE_NAME")
public boolean isEnforceUniqueName() {
return enforceUniqueName;
}
public void setEnforceUniqueName(boolean enforceUniqueName) {
this.enforceUniqueName = enforceUniqueName;
}
/**
* If set to true then the password can be read from the resource.
*/
@ConfigurationProperty(displayMessageKey = "UI_INSTANCE_READABLE_PASSWORD",
helpMessageKey = "UI_INSTANCE_READABLE_PASSWORD_HELP")
public boolean getReadablePassword() {
return readablePassword;
}
public void setReadablePassword(boolean readablePassword) {
this.readablePassword = readablePassword;
}
/**
* If set to true then explicit value for ENABLE attribute must be provided to create an account.
*/
@ConfigurationProperty(displayMessageKey = "UI_INSTANCE_REQUIRE_EXPLICIT_ENABLE",
helpMessageKey = "UI_INSTANCE_REQUIRE_EXPLICIT_ENABLE")
public boolean getRequireExplicitEnable() {
return requireExplicitEnable;
}
public void setRequireExplicitEnable(boolean requireExplicitEnable) {
this.requireExplicitEnable = requireExplicitEnable;
}
/**
* If set to true then the identifiers will be considered case-insensitive
*/
@ConfigurationProperty(displayMessageKey = "UI_CASE_IGNORE_ID",
helpMessageKey = "UI_CASE_IGNORE_ID")
public boolean getCaseIgnoreId() {
return caseIgnoreId;
}
public void setCaseIgnoreId(boolean caseIgnoreId) {
this.caseIgnoreId = caseIgnoreId;
}
/**
* If set to true then the "home dir" will be generated
*/
@ConfigurationProperty(displayMessageKey = "UI_GENERATE_DEFAULT_VALUES",
helpMessageKey = "UI_GENERATE_DEFAULT_VALUES_HELP")
public boolean isGenerateDefaultValues() {
return generateDefaultValues;
}
public void setGenerateDefaultValues(boolean generateDefaultValues) {
this.generateDefaultValues = generateDefaultValues;
}
/**
* If set to true then the attribute values will be considered case-insensitive
*/
@ConfigurationProperty(displayMessageKey = "UI_CASE_IGNORE_VALUES",
helpMessageKey = "UI_CASE_IGNORE_VALUES_HELP")
public boolean getCaseIgnoreValues() {
return caseIgnoreValues;
}
public void setCaseIgnoreValues(boolean caseIgnoreValues) {
this.caseIgnoreValues = caseIgnoreValues;
}
/**
* If set to true then the connector will convert names of all objects to upper case.
*/
@ConfigurationProperty(displayMessageKey = "UI_UPCASE_NAME",
helpMessageKey = "UI_UPCASE_NAME_HELP")
public boolean getUpCaseName() {
return upCaseName;
}
public void setUpCaseName(boolean upCaseName) {
this.upCaseName = upCaseName;
}
@ConfigurationProperty(displayMessageKey = "UI_TOLERATE_DUPLICATE_VALUES",
helpMessageKey = "UI_TOLERATE_DUPLICATE_VALUES_HELP")
public boolean getTolerateDuplicateValues() {
return tolerateDuplicateValues;
}
public void setTolerateDuplicateValues(boolean tolerateDuplicateValues) {
this.tolerateDuplicateValues = tolerateDuplicateValues;
}
/**
* Useless string-value configuration variable. It is used for testing the configuration schema
* and things like that.
*/
@ConfigurationProperty(displayMessageKey = "UI_INSTANCE_USELESS_STRING",
helpMessageKey = "UI_INSTANCE_USELESS_STRING_HELP")
public String getUselessString() {
return uselessString;
}
public void setUselessString(String uselessString) {
this.uselessString = uselessString;
}
/**
* Useless GuardedString-value configuration variable. It is used for testing the configuration schema
* and things like that.
*/
@ConfigurationProperty(displayMessageKey = "UI_INSTANCE_USELESS_GUARDED_STRING",
helpMessageKey = "UI_INSTANCE_USELESS_GUARDED_STRING_HELP")
public GuardedString getUselessGuardedString() {
return uselessGuardedString;
}
public void setUselessGuardedString(GuardedString uselessGuardedString) {
this.uselessGuardedString = uselessGuardedString;
}
@ConfigurationProperty(displayMessageKey = "UI_VARY_LETTER_CASE",
helpMessageKey = "UI_VARY_LETTER_CASE_HELP")
public boolean isVaryLetterCase() {
return varyLetterCase;
}
public void setVaryLetterCase(boolean value) {
this.varyLetterCase = value;
}
@ConfigurationProperty(displayMessageKey = "UI_REFERENTIAL_INTEGRITY",
helpMessageKey = "UI_REFERENTIAL_INTEGRITY_HELP")
public boolean isReferentialIntegrity() {
return referentialIntegrity;
}
public void setReferentialIntegrity(boolean referentialIntegrity) {
this.referentialIntegrity = referentialIntegrity;
}
@ConfigurationProperty(displayMessageKey = "UI_GENERATE_ACCOUNT_DESCRIPTION_ON_CREATE",
helpMessageKey = "UI_GENERATE_ACCOUNT_DESCRIPTION_ON_CREATE_HELP")
public boolean getGenerateAccountDescriptionOnCreate() {
return generateAccountDescriptionOnCreate;
}
public void setGenerateAccountDescriptionOnCreate(boolean generateAccountDescriptionOnCreate) {
this.generateAccountDescriptionOnCreate = generateAccountDescriptionOnCreate;
}
@ConfigurationProperty(displayMessageKey = "UI_GENERATE_ACCOUNT_DESCRIPTION_ON_UPDATE",
helpMessageKey = "UI_GENERATE_ACCOUNT_DESCRIPTION_ON_UPDATE_HELP")
public boolean getGenerateAccountDescriptionOnUpdate() {
return generateAccountDescriptionOnUpdate;
}
public void setGenerateAccountDescriptionOnUpdate(boolean generateAccountDescriptionOnUpdate) {
this.generateAccountDescriptionOnUpdate = generateAccountDescriptionOnUpdate;
}
@ConfigurationProperty(displayMessageKey = "UI_FORBIDDEN_NAMES",
helpMessageKey = "UI_FORBIDDEN_NAMES_HELP")
public String[] getForbiddenNames() {
return forbiddenNames.clone();
}
public void setForbiddenNames(String[] forbiddenNames) {
this.forbiddenNames = forbiddenNames.clone();
}
@ConfigurationProperty(displayMessageKey = "UI_USE_LEGACY_SCHEMA",
helpMessageKey = "UI_USE_LEGACY_SCHEMA_HELP")
public boolean getUseLegacySchema() {
return useLegacySchema;
}
public void setUseLegacySchema(boolean useLegacySchema) {
this.useLegacySchema = useLegacySchema;
}
/**
* {@inheritDoc}
*/
@Override
public void validate() {
log.info("begin");
if (uidMode.equals(UID_MODE_NAME) && !enforceUniqueName) {
throw new IllegalArgumentException("Cannot use name UID mode without enforceUniqueName");
}
log.info("end");
}
}