1 package org.apache.archiva.admin.model.beans;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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
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;
30 * @author Olivier Lamy
33 @XmlRootElement(name = "redbackRuntimeConfiguration")
34 public class RedbackRuntimeConfiguration
35 implements Serializable
39 * Field userManagerImpls.
41 private List<String> userManagerImpls = new ArrayList<String>();
44 * Field rbacManagerImpls.
46 private java.util.List<String> rbacManagerImpls = new ArrayList<String>();
48 private LdapConfiguration ldapConfiguration;
51 * flag to know if redback configuration has been checked/migrated.
53 private boolean migratedFromRedbackConfiguration = false;
55 private Map<String, String> configurationProperties;
58 * field to ease json mapping wrapper on <code>configurationProperties</code> field
60 private List<PropertyEntry> configurationPropertiesEntries;
63 * flag to know if redback will use a cache to prevent
64 * searching users already found.
66 private boolean useUsersCache = true;
68 private CacheConfiguration usersCacheConfiguration;
70 public RedbackRuntimeConfiguration()
75 public List<String> getUserManagerImpls()
77 return userManagerImpls;
80 public void setUserManagerImpls( List<String> userManagerImpls )
82 this.userManagerImpls = userManagerImpls;
85 public LdapConfiguration getLdapConfiguration()
87 return ldapConfiguration;
90 public void setLdapConfiguration( LdapConfiguration ldapConfiguration )
92 this.ldapConfiguration = ldapConfiguration;
95 public boolean isMigratedFromRedbackConfiguration()
97 return migratedFromRedbackConfiguration;
100 public void setMigratedFromRedbackConfiguration( boolean migratedFromRedbackConfiguration )
102 this.migratedFromRedbackConfiguration = migratedFromRedbackConfiguration;
105 public Map<String, String> getConfigurationProperties()
107 if ( this.configurationProperties == null )
109 this.configurationProperties = new HashMap<String, String>();
111 return configurationProperties;
114 public void setConfigurationProperties( Map<String, String> configurationProperties )
116 this.configurationProperties = configurationProperties;
119 public List<PropertyEntry> getConfigurationPropertiesEntries()
121 configurationPropertiesEntries = new ArrayList<PropertyEntry>( getConfigurationProperties().size() );
122 for ( Map.Entry<String, String> entry : getConfigurationProperties().entrySet() )
124 configurationPropertiesEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
126 Collections.sort( configurationPropertiesEntries );
127 return configurationPropertiesEntries;
130 public void setConfigurationPropertiesEntries( List<PropertyEntry> configurationPropertiesEntries )
132 this.configurationPropertiesEntries = configurationPropertiesEntries;
133 if ( configurationPropertiesEntries != null )
135 this.configurationProperties = new HashMap<String, String>( configurationPropertiesEntries.size() );
136 for ( PropertyEntry propertyEntry : configurationPropertiesEntries )
138 this.configurationProperties.put( propertyEntry.getKey(), propertyEntry.getValue() );
143 public boolean isUseUsersCache()
145 return useUsersCache;
148 public void setUseUsersCache( boolean useUsersCache )
150 this.useUsersCache = useUsersCache;
153 public CacheConfiguration getUsersCacheConfiguration()
155 return usersCacheConfiguration;
158 public void setUsersCacheConfiguration( CacheConfiguration usersCacheConfiguration )
160 this.usersCacheConfiguration = usersCacheConfiguration;
163 public List<String> getRbacManagerImpls()
165 return rbacManagerImpls;
168 public void setRbacManagerImpls( List<String> rbacManagerImpls )
170 this.rbacManagerImpls = rbacManagerImpls;
174 public String toString()
176 final StringBuilder sb = new StringBuilder();
177 sb.append( "RedbackRuntimeConfiguration" );
178 sb.append( "{userManagerImpls=" ).append( userManagerImpls );
179 sb.append( ", rbacManagerImpls=" ).append( rbacManagerImpls );
180 sb.append( ", ldapConfiguration=" ).append( ldapConfiguration );
181 sb.append( ", migratedFromRedbackConfiguration=" ).append( migratedFromRedbackConfiguration );
182 sb.append( ", configurationProperties=" ).append( configurationProperties );
183 sb.append( ", configurationPropertiesEntries=" ).append( configurationPropertiesEntries );
184 sb.append( ", useUsersCache=" ).append( useUsersCache );
185 sb.append( ", usersCacheConfiguration=" ).append( usersCacheConfiguration );
187 return sb.toString();