1 package org.apache.archiva.configuration;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.List;
28 * The runtime configuration.
31 * @version $Revision$ $Date$
33 @SuppressWarnings( "all" )
34 public class ArchivaRuntimeConfiguration
35 implements java.io.Serializable
38 //--------------------------/
39 //- Class/Member Variables -/
40 //--------------------------/
43 * the url failure cache configuration.
45 private CacheConfiguration urlFailureCacheConfiguration;
48 * the FileLocking configuration.
50 private FileLockConfiguration fileLockConfiguration;
53 * The base directory where the archiva data is stored. If not
54 * set, the appserver.base is used.
56 private String dataDirectory;
59 * The base directory for local storage of repository data. If
60 * not set, it's ${dataDirectory}/repositories.
62 private String repositoryBaseDirectory;
65 * The base directory for local storage of remote repository
66 * data. If not set, it's ${dataDirectory}/remotes.
68 private String remoteRepositoryBaseDirectory;
71 * The base directory for local storage of repository group files.
72 * If not set, it's ${dataDirectory}/groups
74 private String repositoryGroupBaseDirectory;
77 * The default language used for setting internationalized
80 private String defaultLanguage = "en-US";
83 * Comma separated list of language patterns. Sorted by
84 * priority descending. Used for display of internationalized
87 private String languageRange = "en,fr,de";
90 * List of checksum types (algorithms) that should be applied to repository artifacts.
92 private List<String> checksumTypes = new ArrayList(Arrays.asList("MD5","SHA1","SHA256"));
100 * Get the base directory where the archiva data is stored. If
101 * not set, the appserver.base is used.
105 public String getDataDirectory()
107 return this.dataDirectory;
108 } //-- String getDataDirectory()
111 * Get the default language used for setting internationalized
116 public String getDefaultLanguage()
118 return this.defaultLanguage;
119 } //-- String getDefaultLanguage()
122 * Get the FileLocking configuration.
124 * @return FileLockConfiguration
126 public FileLockConfiguration getFileLockConfiguration()
128 return this.fileLockConfiguration;
129 } //-- FileLockConfiguration getFileLockConfiguration()
132 * Get comma separated list of language patterns. Sorted by
133 * priority descending. Used for display of internationalized
138 public String getLanguageRange()
140 return this.languageRange;
141 } //-- String getLanguageRange()
144 * Get the base directory for local storage of remote
145 * repository data. If not set, it's ${dataDirectory}/remotes.
149 public String getRemoteRepositoryBaseDirectory()
151 return this.remoteRepositoryBaseDirectory;
152 } //-- String getRemoteRepositoryBaseDirectory()
155 * Get the base directory for local storage of repository data.
156 * If not set, it's ${dataDirectory}/repositories.
160 public String getRepositoryBaseDirectory()
162 return this.repositoryBaseDirectory;
163 } //-- String getRepositoryBaseDirectory()
166 * Get the base directory for local storage of repository group data.
167 * If not set it's ${dataDirectory}/groups
169 * @return The path to the directory. Either a absolute path, or a path
170 * relative to ${dataDirectory}
172 public String getRepositoryGroupBaseDirectory() {
173 return this.repositoryGroupBaseDirectory;
177 * Get the url failure cache configuration.
179 * @return CacheConfiguration
181 public CacheConfiguration getUrlFailureCacheConfiguration()
183 return this.urlFailureCacheConfiguration;
184 } //-- CacheConfiguration getUrlFailureCacheConfiguration()
187 * Set the base directory where the archiva data is stored. If
188 * not set, the appserver.base is used.
190 * @param dataDirectory
192 public void setDataDirectory( String dataDirectory )
194 this.dataDirectory = dataDirectory;
195 } //-- void setDataDirectory( String )
198 * Set the default language used for setting internationalized
201 * @param defaultLanguage
203 public void setDefaultLanguage( String defaultLanguage )
205 this.defaultLanguage = defaultLanguage;
206 } //-- void setDefaultLanguage( String )
209 * Set the FileLocking configuration.
211 * @param fileLockConfiguration
213 public void setFileLockConfiguration( FileLockConfiguration fileLockConfiguration )
215 this.fileLockConfiguration = fileLockConfiguration;
216 } //-- void setFileLockConfiguration( FileLockConfiguration )
219 * Set comma separated list of language patterns. Sorted by
220 * priority descending. Used for display of internationalized
223 * @param languageRange
225 public void setLanguageRange( String languageRange )
227 this.languageRange = languageRange;
228 } //-- void setLanguageRange( String )
231 * Set the base directory for local storage of remote
232 * repository data. If not set, it's ${dataDirectory}/remotes.
234 * @param remoteRepositoryBaseDirectory
236 public void setRemoteRepositoryBaseDirectory( String remoteRepositoryBaseDirectory )
238 this.remoteRepositoryBaseDirectory = remoteRepositoryBaseDirectory;
239 } //-- void setRemoteRepositoryBaseDirectory( String )
242 * Set the base directory for local storage of repository data.
243 * If not set, it's ${dataDirectory}/repositories.
245 * @param repositoryBaseDirectory
247 public void setRepositoryBaseDirectory( String repositoryBaseDirectory )
249 this.repositoryBaseDirectory = repositoryBaseDirectory;
250 } //-- void setRepositoryBaseDirectory( String )
253 public void setRepositoryGroupBaseDirectory(String repositoryGroupBaseDirectory) {
254 this.repositoryGroupBaseDirectory = repositoryGroupBaseDirectory;
258 * Set the url failure cache configuration.
260 * @param urlFailureCacheConfiguration
262 public void setUrlFailureCacheConfiguration( CacheConfiguration urlFailureCacheConfiguration )
264 this.urlFailureCacheConfiguration = urlFailureCacheConfiguration;
265 } //-- void setUrlFailureCacheConfiguration( CacheConfiguration )
269 * Returns the list of checksum types to generate
272 public List<String> getChecksumTypes()
274 if ( this.checksumTypes == null )
276 this.checksumTypes = new java.util.ArrayList<String>();
279 return this.checksumTypes;
283 * Adds a checksum type
286 public void addChecksumType(String type) {
288 if (!getChecksumTypes().contains(type)) {
289 getChecksumTypes().add(type);
294 * Removes a checksum type
297 public void removeChecksumType(String type) {
298 getChecksumTypes().remove(type);
302 * Set all checksum types
303 * @param checksumTypes
305 public void setChecksumTypes(List<String> checksumTypes) {
306 if (checksumTypes!=null) {
307 getChecksumTypes().clear();
308 getChecksumTypes().addAll(checksumTypes);