001package org.apache.archiva.configuration; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.archiva.components.registry.RegistryException; 023import org.apache.archiva.components.registry.RegistryListener; 024 025import java.nio.file.Path; 026import java.util.List; 027import java.util.Locale; 028 029/** 030 * Configuration holder for the model read from the registry. 031 */ 032public interface ArchivaConfiguration 033{ 034 035 036 String USER_CONFIG_PROPERTY = "archiva.user.configFileName"; 037 String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE"; 038 039 /** 040 * Get the configuration. 041 * 042 * @return the configuration 043 */ 044 Configuration getConfiguration(); 045 046 /** 047 * Save any updated configuration. 048 * 049 * @param configuration the configuration to save 050 * @throws org.apache.archiva.components.registry.RegistryException 051 * if there is a problem saving the registry data 052 * @throws IndeterminateConfigurationException 053 * if the configuration cannot be saved because it was read from two sources 054 */ 055 void save( Configuration configuration ) 056 throws RegistryException, IndeterminateConfigurationException; 057 058 /** 059 * Determines if the configuration in use was as a result of a defaulted configuration. 060 * 061 * @return true if the configuration was created from the default-archiva.xml as opposed 062 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or 063 * ${appserver.base}/conf/archiva.xml 064 */ 065 boolean isDefaulted(); 066 067 /** 068 * Add a configuration listener to notify of changes to the configuration. 069 * 070 * @param listener the listener 071 */ 072 void addListener( ConfigurationListener listener ); 073 074 /** 075 * Remove a configuration listener to stop notifications of changes to the configuration. 076 * 077 * @param listener the listener 078 */ 079 void removeListener( ConfigurationListener listener ); 080 081 /** 082 * Add a registry listener to notify of events in spring-registry. 083 * 084 * @param listener the listener 085 * TODO: Remove in future. 086 */ 087 void addChangeListener( RegistryListener listener ); 088 089 void removeChangeListener( RegistryListener listener ); 090 091 /** 092 * reload configuration from file included registry 093 * 094 * @since 1.4-M1 095 */ 096 void reload(); 097 098 public Locale getDefaultLocale(); 099 100 public List<Locale.LanguageRange> getLanguagePriorities(); 101 102 public Path getAppServerBaseDir(); 103 104 /** 105 * Returns the base directory for repositories that have a relative location path set. 106 * @return 107 */ 108 public Path getRepositoryBaseDir(); 109 110 /** 111 * Returns the base directory for remote repositories 112 * @return 113 */ 114 public Path getRemoteRepositoryBaseDir(); 115 116 /** 117 * Returns the base directory for repository group files. 118 * @return 119 */ 120 public Path getRepositoryGroupBaseDir(); 121 122 /** 123 * Returns the data directory where repositories and metadata reside 124 * @return 125 */ 126 public Path getDataDirectory(); 127} 128