You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RedbackRuntimeConfiguration.java 8.9KB

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