001package org.apache.archiva.configuration; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022/** 023 * 024 * The redback runtime configuration. 025 * 026 * 027 * @version $Revision$ $Date$ 028 */ 029@SuppressWarnings( "all" ) 030public class RedbackRuntimeConfiguration 031 implements java.io.Serializable 032{ 033 034 //--------------------------/ 035 //- Class/Member Variables -/ 036 //--------------------------/ 037 038 /** 039 * flag to know if redback configuration has been 040 * checked/migrated. 041 */ 042 private boolean migratedFromRedbackConfiguration = false; 043 044 /** 045 * Field userManagerImpls. 046 */ 047 private java.util.List<String> userManagerImpls; 048 049 /** 050 * Field rbacManagerImpls. 051 */ 052 private java.util.List<String> rbacManagerImpls; 053 054 /** 055 * the ldap configuration. 056 */ 057 private LdapConfiguration ldapConfiguration; 058 059 /** 060 * Field ldapGroupMappings. 061 */ 062 private java.util.List<LdapGroupMapping> ldapGroupMappings; 063 064 /** 065 * Field configurationProperties. 066 */ 067 private java.util.Map configurationProperties; 068 069 /** 070 * flag to know if redback will use a cache to prevent 071 * searching users already found. 072 */ 073 private boolean useUsersCache = true; 074 075 /** 076 * the users cache configuration. 077 */ 078 private CacheConfiguration usersCacheConfiguration; 079 080 081 //-----------/ 082 //- Methods -/ 083 //-----------/ 084 085 /** 086 * Method addConfigurationProperty. 087 * 088 * @param key 089 * @param value 090 */ 091 public void addConfigurationProperty( Object key, String value ) 092 { 093 getConfigurationProperties().put( key, value ); 094 } //-- void addConfigurationProperty( Object, String ) 095 096 /** 097 * Method addLdapGroupMapping. 098 * 099 * @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}