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 default language used for setting internationalized
74 private String defaultLanguage = "en-US";
77 * Comma separated list of language patterns. Sorted by
78 * priority descending. Used for display of internationalized
81 private String languageRange = "en,fr,de";
84 * List of checksum types (algorithms) that should be applied to repository artifacts.
86 private List<String> checksumTypes = new ArrayList(Arrays.asList("MD5","SHA1","SHA256"));
94 * Get the base directory where the archiva data is stored. If
95 * not set, the appserver.base is used.
99 public String getDataDirectory()
101 return this.dataDirectory;
102 } //-- String getDataDirectory()
105 * Get the default language used for setting internationalized
110 public String getDefaultLanguage()
112 return this.defaultLanguage;
113 } //-- String getDefaultLanguage()
116 * Get the FileLocking configuration.
118 * @return FileLockConfiguration
120 public FileLockConfiguration getFileLockConfiguration()
122 return this.fileLockConfiguration;
123 } //-- FileLockConfiguration getFileLockConfiguration()
126 * Get comma separated list of language patterns. Sorted by
127 * priority descending. Used for display of internationalized
132 public String getLanguageRange()
134 return this.languageRange;
135 } //-- String getLanguageRange()
138 * Get the base directory for local storage of remote
139 * repository data. If not set, it's ${dataDirectory}/remotes.
143 public String getRemoteRepositoryBaseDirectory()
145 return this.remoteRepositoryBaseDirectory;
146 } //-- String getRemoteRepositoryBaseDirectory()
149 * Get the base directory for local storage of repository data.
150 * If not set, it's ${dataDirectory}/repositories.
154 public String getRepositoryBaseDirectory()
156 return this.repositoryBaseDirectory;
157 } //-- String getRepositoryBaseDirectory()
160 * Get the url failure cache configuration.
162 * @return CacheConfiguration
164 public CacheConfiguration getUrlFailureCacheConfiguration()
166 return this.urlFailureCacheConfiguration;
167 } //-- CacheConfiguration getUrlFailureCacheConfiguration()
170 * Set the base directory where the archiva data is stored. If
171 * not set, the appserver.base is used.
173 * @param dataDirectory
175 public void setDataDirectory( String dataDirectory )
177 this.dataDirectory = dataDirectory;
178 } //-- void setDataDirectory( String )
181 * Set the default language used for setting internationalized
184 * @param defaultLanguage
186 public void setDefaultLanguage( String defaultLanguage )
188 this.defaultLanguage = defaultLanguage;
189 } //-- void setDefaultLanguage( String )
192 * Set the FileLocking configuration.
194 * @param fileLockConfiguration
196 public void setFileLockConfiguration( FileLockConfiguration fileLockConfiguration )
198 this.fileLockConfiguration = fileLockConfiguration;
199 } //-- void setFileLockConfiguration( FileLockConfiguration )
202 * Set comma separated list of language patterns. Sorted by
203 * priority descending. Used for display of internationalized
206 * @param languageRange
208 public void setLanguageRange( String languageRange )
210 this.languageRange = languageRange;
211 } //-- void setLanguageRange( String )
214 * Set the base directory for local storage of remote
215 * repository data. If not set, it's ${dataDirectory}/remotes.
217 * @param remoteRepositoryBaseDirectory
219 public void setRemoteRepositoryBaseDirectory( String remoteRepositoryBaseDirectory )
221 this.remoteRepositoryBaseDirectory = remoteRepositoryBaseDirectory;
222 } //-- void setRemoteRepositoryBaseDirectory( String )
225 * Set the base directory for local storage of repository data.
226 * If not set, it's ${dataDirectory}/repositories.
228 * @param repositoryBaseDirectory
230 public void setRepositoryBaseDirectory( String repositoryBaseDirectory )
232 this.repositoryBaseDirectory = repositoryBaseDirectory;
233 } //-- void setRepositoryBaseDirectory( String )
236 * Set the url failure cache configuration.
238 * @param urlFailureCacheConfiguration
240 public void setUrlFailureCacheConfiguration( CacheConfiguration urlFailureCacheConfiguration )
242 this.urlFailureCacheConfiguration = urlFailureCacheConfiguration;
243 } //-- void setUrlFailureCacheConfiguration( CacheConfiguration )
247 * Returns the list of checksum types to generate
250 public List<String> getChecksumTypes()
252 if ( this.checksumTypes == null )
254 this.checksumTypes = new java.util.ArrayList<String>();
257 return this.checksumTypes;
261 * Adds a checksum type
264 public void addChecksumType(String type) {
266 if (!getChecksumTypes().contains(type)) {
267 getChecksumTypes().add(type);
272 * Removes a checksum type
275 public void removeChecksumType(String type) {
276 getChecksumTypes().remove(type);
280 * Set all checksum types
281 * @param checksumTypes
283 public void setChecksumTypes(List<String> checksumTypes) {
284 if (checksumTypes!=null) {
285 getChecksumTypes().clear();
286 getChecksumTypes().addAll(checksumTypes);