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.Registry;
23 import org.apache.archiva.components.registry.RegistryException;
24 import org.apache.archiva.components.registry.RegistryListener;
26 import java.nio.file.Path;
27 import java.util.List;
28 import java.util.Locale;
31 * Configuration holder for the model read from the registry.
33 public interface ArchivaConfiguration
37 String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
38 String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
41 * Get the configuration.
43 * @return the configuration
45 Configuration getConfiguration();
48 * Save any updated configuration.
50 * @param configuration the configuration to save
51 * @throws org.apache.archiva.components.registry.RegistryException
52 * if there is a problem saving the registry data
53 * @throws IndeterminateConfigurationException
54 * if the configuration cannot be saved because it was read from two sources
56 void save( Configuration configuration )
57 throws RegistryException, IndeterminateConfigurationException;
60 * Save any updated configuration. This method allows to add a tag to the thrown event.
61 * This allows to verify the origin if the caller is the same as the listener.
63 * @param configuration the configuration to save
64 * @param eventTag the tag to add to the thrown event
65 * @throws org.apache.archiva.components.registry.RegistryException
66 * if there is a problem saving the registry data
67 * @throws IndeterminateConfigurationException
68 * if the configuration cannot be saved because it was read from two sources
70 void save( Configuration configuration, String eventTag )
71 throws RegistryException, IndeterminateConfigurationException;
74 * Determines if the configuration in use was as a result of a defaulted configuration.
76 * @return true if the configuration was created from the default-archiva.xml as opposed
77 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
78 * ${appserver.base}/conf/archiva.xml
80 boolean isDefaulted();
83 * Add a configuration listener to notify of changes to the configuration.
85 * @param listener the listener
87 void addListener( ConfigurationListener listener );
90 * Remove a configuration listener to stop notifications of changes to the configuration.
92 * @param listener the listener
94 void removeListener( ConfigurationListener listener );
97 * Add a registry listener to notify of events in spring-registry.
99 * @param listener the listener
100 * TODO: Remove in future.
102 void addChangeListener( RegistryListener listener );
104 void removeChangeListener( RegistryListener listener );
107 * reload configuration from file included registry
113 public Locale getDefaultLocale();
115 public List<Locale.LanguageRange> getLanguagePriorities();
117 public Path getAppServerBaseDir();
120 * Returns the base directory for repositories that have a relative location path set.
123 public Path getRepositoryBaseDir();
126 * Returns the base directory for remote repositories
129 public Path getRemoteRepositoryBaseDir();
132 * Returns the base directory for repository group files.
135 public Path getRepositoryGroupBaseDir();
138 * Returns the data directory where repositories and metadata reside
141 public Path getDataDirectory();
144 * Return the used configuration registry
147 Registry getRegistry( );