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.components.registry.RegistryException;
23 import org.apache.archiva.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.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 * Save any updated configuration. This method allows to add a tag to the thrown event.
60 * This allows to verify the origin if the caller is the same as the listener.
62 * @param configuration the configuration to save
63 * @param eventTag the tag to add to the thrown event
64 * @throws org.apache.archiva.components.registry.RegistryException
65 * if there is a problem saving the registry data
66 * @throws IndeterminateConfigurationException
67 * if the configuration cannot be saved because it was read from two sources
69 void save( Configuration configuration, String eventTag )
70 throws RegistryException, IndeterminateConfigurationException;
73 * Determines if the configuration in use was as a result of a defaulted configuration.
75 * @return true if the configuration was created from the default-archiva.xml as opposed
76 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
77 * ${appserver.base}/conf/archiva.xml
79 boolean isDefaulted();
82 * Add a configuration listener to notify of changes to the configuration.
84 * @param listener the listener
86 void addListener( ConfigurationListener listener );
89 * Remove a configuration listener to stop notifications of changes to the configuration.
91 * @param listener the listener
93 void removeListener( ConfigurationListener listener );
96 * Add a registry listener to notify of events in spring-registry.
98 * @param listener the listener
99 * TODO: Remove in future.
101 void addChangeListener( RegistryListener listener );
103 void removeChangeListener( RegistryListener listener );
106 * reload configuration from file included registry
112 public Locale getDefaultLocale();
114 public List<Locale.LanguageRange> getLanguagePriorities();
116 public Path getAppServerBaseDir();
119 * Returns the base directory for repositories that have a relative location path set.
122 public Path getRepositoryBaseDir();
125 * Returns the base directory for remote repositories
128 public Path getRemoteRepositoryBaseDir();
131 * Returns the base directory for repository group files.
134 public Path getRepositoryGroupBaseDir();
137 * Returns the data directory where repositories and metadata reside
140 public Path getDataDirectory();