1 package org.apache.archiva.configuration;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 /**
23 *
24 * The redback runtime configuration.
25 *
26 *
27 * @version $Revision$ $Date$
28 */
29 @SuppressWarnings( "all" )
30 public class RedbackRuntimeConfiguration
31 implements java.io.Serializable
32 {
33
34 //--------------------------/
35 //- Class/Member Variables -/
36 //--------------------------/
37
38 /**
39 * flag to know if redback configuration has been
40 * checked/migrated.
41 */
42 private boolean migratedFromRedbackConfiguration = false;
43
44 /**
45 * Field userManagerImpls.
46 */
47 private java.util.List<String> userManagerImpls;
48
49 /**
50 * Field rbacManagerImpls.
51 */
52 private java.util.List<String> rbacManagerImpls;
53
54 /**
55 * the ldap configuration.
56 */
57 private LdapConfiguration ldapConfiguration;
58
59 /**
60 * Field ldapGroupMappings.
61 */
62 private java.util.List<LdapGroupMapping> ldapGroupMappings;
63
64 /**
65 * Field configurationProperties.
66 */
67 private java.util.Map configurationProperties;
68
69 /**
70 * flag to know if redback will use a cache to prevent
71 * searching users already found.
72 */
73 private boolean useUsersCache = true;
74
75 /**
76 * the users cache configuration.
77 */
78 private CacheConfiguration usersCacheConfiguration;
79
80
81 //-----------/
82 //- Methods -/
83 //-----------/
84
85 /**
86 * Method addConfigurationProperty.
87 *
88 * @param key
89 * @param value
90 */
91 public void addConfigurationProperty( Object key, String value )
92 {
93 getConfigurationProperties().put( key, value );
94 } //-- void addConfigurationProperty( Object, String )
95
96 /**
97 * Method addLdapGroupMapping.
98 *
99 * @param ldapGroupMapping
100 */
101 public void addLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
102 {
103 getLdapGroupMappings().add( ldapGroupMapping );
104 } //-- void addLdapGroupMapping( LdapGroupMapping )
105
106 /**
107 * Method addRbacManagerImpl.
108 *
109 * @param string
110 */
111 public void addRbacManagerImpl( String string )
112 {
113 getRbacManagerImpls().add( string );
114 } //-- void addRbacManagerImpl( String )
115
116 /**
117 * Method addUserManagerImpl.
118 *
119 * @param string
120 */
121 public void addUserManagerImpl( String string )
122 {
123 getUserManagerImpls().add( string );
124 } //-- void addUserManagerImpl( String )
125
126 /**
127 * Method getConfigurationProperties.
128 *
129 * @return Map
130 */
131 public java.util.Map getConfigurationProperties()
132 {
133 if ( this.configurationProperties == null )
134 {
135 this.configurationProperties = new java.util.HashMap();
136 }
137
138 return this.configurationProperties;
139 } //-- java.util.Map getConfigurationProperties()
140
141 /**
142 * Get the ldap configuration.
143 *
144 * @return LdapConfiguration
145 */
146 public LdapConfiguration getLdapConfiguration()
147 {
148 return this.ldapConfiguration;
149 } //-- LdapConfiguration getLdapConfiguration()
150
151 /**
152 * Method getLdapGroupMappings.
153 *
154 * @return List
155 */
156 public java.util.List<LdapGroupMapping> getLdapGroupMappings()
157 {
158 if ( this.ldapGroupMappings == null )
159 {
160 this.ldapGroupMappings = new java.util.ArrayList<LdapGroupMapping>();
161 }
162
163 return this.ldapGroupMappings;
164 } //-- java.util.List<LdapGroupMapping> getLdapGroupMappings()
165
166 /**
167 * Method getRbacManagerImpls.
168 *
169 * @return List
170 */
171 public java.util.List<String> getRbacManagerImpls()
172 {
173 if ( this.rbacManagerImpls == null )
174 {
175 this.rbacManagerImpls = new java.util.ArrayList<String>();
176 }
177
178 return this.rbacManagerImpls;
179 } //-- java.util.List<String> getRbacManagerImpls()
180
181 /**
182 * Method getUserManagerImpls.
183 *
184 * @return List
185 */
186 public java.util.List<String> getUserManagerImpls()
187 {
188 if ( this.userManagerImpls == null )
189 {
190 this.userManagerImpls = new java.util.ArrayList<String>();
191 }
192
193 return this.userManagerImpls;
194 } //-- java.util.List<String> getUserManagerImpls()
195
196 /**
197 * Get the users cache configuration.
198 *
199 * @return CacheConfiguration
200 */
201 public CacheConfiguration getUsersCacheConfiguration()
202 {
203 return this.usersCacheConfiguration;
204 } //-- CacheConfiguration getUsersCacheConfiguration()
205
206 /**
207 * Get flag to know if redback configuration has been
208 * checked/migrated.
209 *
210 * @return boolean
211 */
212 public boolean isMigratedFromRedbackConfiguration()
213 {
214 return this.migratedFromRedbackConfiguration;
215 } //-- boolean isMigratedFromRedbackConfiguration()
216
217 /**
218 * Get flag to know if redback will use a cache to prevent
219 * searching users already found.
220 *
221 * @return boolean
222 */
223 public boolean isUseUsersCache()
224 {
225 return this.useUsersCache;
226 } //-- boolean isUseUsersCache()
227
228 /**
229 * Method removeLdapGroupMapping.
230 *
231 * @param ldapGroupMapping
232 */
233 public void removeLdapGroupMapping( LdapGroupMapping ldapGroupMapping )
234 {
235 getLdapGroupMappings().remove( ldapGroupMapping );
236 } //-- void removeLdapGroupMapping( LdapGroupMapping )
237
238 /**
239 * Method removeRbacManagerImpl.
240 *
241 * @param string
242 */
243 public void removeRbacManagerImpl( String string )
244 {
245 getRbacManagerImpls().remove( string );
246 } //-- void removeRbacManagerImpl( String )
247
248 /**
249 * Method removeUserManagerImpl.
250 *
251 * @param string
252 */
253 public void removeUserManagerImpl( String string )
254 {
255 getUserManagerImpls().remove( string );
256 } //-- void removeUserManagerImpl( String )
257
258 /**
259 * Set extra properties for redback configuration.
260 * String/String.
261 *
262 * @param configurationProperties
263 */
264 public void setConfigurationProperties( java.util.Map configurationProperties )
265 {
266 this.configurationProperties = configurationProperties;
267 } //-- void setConfigurationProperties( java.util.Map )
268
269 /**
270 * Set the ldap configuration.
271 *
272 * @param ldapConfiguration
273 */
274 public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
275 {
276 this.ldapConfiguration = ldapConfiguration;
277 } //-- void setLdapConfiguration( LdapConfiguration )
278
279 /**
280 * Set ldapGroupMappings.
281 *
282 * @param ldapGroupMappings
283 */
284 public void setLdapGroupMappings( java.util.List<LdapGroupMapping> ldapGroupMappings )
285 {
286 this.ldapGroupMappings = ldapGroupMappings;
287 } //-- void setLdapGroupMappings( java.util.List )
288
289 /**
290 * Set flag to know if redback configuration has been
291 * checked/migrated.
292 *
293 * @param migratedFromRedbackConfiguration
294 */
295 public void setMigratedFromRedbackConfiguration( boolean migratedFromRedbackConfiguration )
296 {
297 this.migratedFromRedbackConfiguration = migratedFromRedbackConfiguration;
298 } //-- void setMigratedFromRedbackConfiguration( boolean )
299
300 /**
301 * Set the RBAC Manager impls to use.
302 *
303 * @param rbacManagerImpls
304 */
305 public void setRbacManagerImpls( java.util.List<String> rbacManagerImpls )
306 {
307 this.rbacManagerImpls = rbacManagerImpls;
308 } //-- void setRbacManagerImpls( java.util.List )
309
310 /**
311 * Set flag to know if redback will use a cache to prevent
312 * searching users already found.
313 *
314 * @param useUsersCache
315 */
316 public void setUseUsersCache( boolean useUsersCache )
317 {
318 this.useUsersCache = useUsersCache;
319 } //-- void setUseUsersCache( boolean )
320
321 /**
322 * Set the user manager impls to use.
323 *
324 * @param userManagerImpls
325 */
326 public void setUserManagerImpls( java.util.List<String> userManagerImpls )
327 {
328 this.userManagerImpls = userManagerImpls;
329 } //-- void setUserManagerImpls( java.util.List )
330
331 /**
332 * Set the users cache configuration.
333 *
334 * @param usersCacheConfiguration
335 */
336 public void setUsersCacheConfiguration( CacheConfiguration usersCacheConfiguration )
337 {
338 this.usersCacheConfiguration = usersCacheConfiguration;
339 } //-- void setUsersCacheConfiguration( CacheConfiguration )
340
341 }