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