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 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. package org.apache.archiva.admin.model.beans;
  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. import javax.xml.bind.annotation.XmlRootElement;
  21. import java.io.Serializable;
  22. import java.util.ArrayList;
  23. import java.util.Collections;
  24. import java.util.HashMap;
  25. import java.util.List;
  26. import java.util.Map;
  27. /**
  28. * @author Olivier Lamy
  29. * @since 1.4-M4
  30. */
  31. @XmlRootElement(name = "redbackRuntimeConfiguration")
  32. public class RedbackRuntimeConfiguration
  33. implements Serializable
  34. {
  35. /**
  36. * Field userManagerImpls.
  37. */
  38. private List<String> userManagerImpls = new ArrayList<>();
  39. /**
  40. * Field rbacManagerImpls.
  41. */
  42. private java.util.List<String> rbacManagerImpls = new ArrayList<>();
  43. private LdapConfiguration ldapConfiguration;
  44. /**
  45. * flag to know if redback configuration has been checked/migrated.
  46. */
  47. private boolean migratedFromRedbackConfiguration = false;
  48. private Map<String, String> configurationProperties;
  49. /**
  50. * field to ease json mapping wrapper on <code>configurationProperties</code> field
  51. */
  52. private List<PropertyEntry> configurationPropertiesEntries;
  53. /**
  54. * flag to know if redback will use a cache to prevent
  55. * searching users already found.
  56. */
  57. private boolean useUsersCache = true;
  58. private CacheConfiguration usersCacheConfiguration;
  59. /**
  60. * Field ldapGroupMappings.
  61. */
  62. private List<LdapGroupMapping> ldapGroupMappings;
  63. public RedbackRuntimeConfiguration()
  64. {
  65. // no op
  66. }
  67. public List<String> getUserManagerImpls()
  68. {
  69. return userManagerImpls;
  70. }
  71. public void setUserManagerImpls( List<String> userManagerImpls )
  72. {
  73. this.userManagerImpls = userManagerImpls;
  74. }
  75. public LdapConfiguration getLdapConfiguration()
  76. {
  77. return ldapConfiguration;
  78. }
  79. public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
  80. {
  81. this.ldapConfiguration = ldapConfiguration;
  82. }
  83. public boolean isMigratedFromRedbackConfiguration()
  84. {
  85. return migratedFromRedbackConfiguration;
  86. }
  87. public void setMigratedFromRedbackConfiguration( boolean migratedFromRedbackConfiguration )
  88. {
  89. this.migratedFromRedbackConfiguration = migratedFromRedbackConfiguration;
  90. }
  91. public Map<String, String> getConfigurationProperties()
  92. {
  93. if ( this.configurationProperties == null )
  94. {
  95. this.configurationProperties = new HashMap<String, String>();
  96. }
  97. return configurationProperties;
  98. }
  99. public void setConfigurationProperties( Map<String, String> configurationProperties )
  100. {
  101. this.configurationProperties = configurationProperties;
  102. }
  103. public List<PropertyEntry> getConfigurationPropertiesEntries()
  104. {
  105. configurationPropertiesEntries = new ArrayList<PropertyEntry>( getConfigurationProperties().size() );
  106. for ( Map.Entry<String, String> entry : getConfigurationProperties().entrySet() )
  107. {
  108. configurationPropertiesEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
  109. }
  110. Collections.sort( configurationPropertiesEntries );
  111. return configurationPropertiesEntries;
  112. }
  113. public void setConfigurationPropertiesEntries( List<PropertyEntry> configurationPropertiesEntries )
  114. {
  115. this.configurationPropertiesEntries = configurationPropertiesEntries;
  116. if ( configurationPropertiesEntries != null )
  117. {
  118. this.configurationProperties = new HashMap<String, String>( configurationPropertiesEntries.size() );
  119. for ( PropertyEntry propertyEntry : configurationPropertiesEntries )
  120. {
  121. this.configurationProperties.put( propertyEntry.getKey(), propertyEntry.getValue() );
  122. }
  123. }
  124. }
  125. public boolean isUseUsersCache()
  126. {
  127. return useUsersCache;
  128. }
  129. public void setUseUsersCache( boolean useUsersCache )
  130. {
  131. this.useUsersCache = useUsersCache;
  132. }
  133. public CacheConfiguration getUsersCacheConfiguration()
  134. {
  135. return usersCacheConfiguration;
  136. }
  137. public void setUsersCacheConfiguration( CacheConfiguration usersCacheConfiguration )
  138. {
  139. this.usersCacheConfiguration = usersCacheConfiguration;
  140. }
  141. public List<String> getRbacManagerImpls()
  142. {
  143. return rbacManagerImpls;
  144. }
  145. public void setRbacManagerImpls( List<String> rbacManagerImpls )
  146. {
  147. this.rbacManagerImpls = rbacManagerImpls;
  148. }
  149. public List<LdapGroupMapping> getLdapGroupMappings()
  150. {
  151. return ldapGroupMappings;
  152. }
  153. public void setLdapGroupMappings( List<LdapGroupMapping> ldapGroupMappings )
  154. {
  155. this.ldapGroupMappings = ldapGroupMappings;
  156. }
  157. @Override
  158. public String toString()
  159. {
  160. final StringBuilder sb = new StringBuilder();
  161. sb.append( "RedbackRuntimeConfiguration" );
  162. sb.append( "{userManagerImpls=" ).append( userManagerImpls );
  163. sb.append( ", rbacManagerImpls=" ).append( rbacManagerImpls );
  164. sb.append( ", ldapConfiguration=" ).append( ldapConfiguration );
  165. sb.append( ", migratedFromRedbackConfiguration=" ).append( migratedFromRedbackConfiguration );
  166. sb.append( ", configurationProperties=" ).append( configurationProperties );
  167. sb.append( ", configurationPropertiesEntries=" ).append( configurationPropertiesEntries );
  168. sb.append( ", useUsersCache=" ).append( useUsersCache );
  169. sb.append( ", usersCacheConfiguration=" ).append( usersCacheConfiguration );
  170. sb.append( '}' );
  171. return sb.toString();
  172. }
  173. }