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 org.apache.archiva.redback.components.registry.RegistryException;
23 import org.apache.archiva.redback.components.registry.RegistryListener;
25 import java.nio.file.Path;
26 import java.util.List;
27 import java.util.Locale;
30 * Configuration holder for the model read from the registry.
32 public interface ArchivaConfiguration
36 String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
37 String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
40 * Get the configuration.
42 * @return the configuration
44 Configuration getConfiguration();
47 * Save any updated configuration.
49 * @param configuration the configuration to save
50 * @throws org.apache.archiva.redback.components.registry.RegistryException
51 * if there is a problem saving the registry data
52 * @throws IndeterminateConfigurationException
53 * if the configuration cannot be saved because it was read from two sources
55 void save( Configuration configuration )
56 throws RegistryException, IndeterminateConfigurationException;
59 * Determines if the configuration in use was as a result of a defaulted configuration.
61 * @return true if the configuration was created from the default-archiva.xml as opposed
62 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
63 * ${appserver.base}/conf/archiva.xml
65 boolean isDefaulted();
68 * Add a configuration listener to notify of changes to the configuration.
70 * @param listener the listener
72 void addListener( ConfigurationListener listener );
75 * Remove a configuration listener to stop notifications of changes to the configuration.
77 * @param listener the listener
79 void removeListener( ConfigurationListener listener );
82 * Add a registry listener to notify of events in spring-registry.
84 * @param listener the listener
85 * TODO: Remove in future.
87 void addChangeListener( RegistryListener listener );
89 void removeChangeListener( RegistryListener listener );
92 * reload configuration from file included registry
98 public Locale getDefaultLocale();
100 public List<Locale.LanguageRange> getLanguagePriorities();
102 public Path getAppServerBaseDir();
105 * Returns the base directory for repositories that have a relative location path set.
108 public Path getRepositoryBaseDir();
111 * Returns the base directory for remote repositories
114 public Path getRemoteRepositoryBaseDir();
117 * Returns the data directory where repositories and metadata reside
120 public Path getDataDirectory();