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