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.redback.components.registry.RegistryException; 023import org.apache.archiva.redback.components.registry.RegistryListener; 024 025/** 026 * Configuration holder for the model read from the registry. 027 */ 028public interface ArchivaConfiguration 029{ 030 /** 031 * Get the configuration. 032 * 033 * @return the configuration 034 */ 035 Configuration getConfiguration(); 036 037 /** 038 * Save any updated configuration. 039 * 040 * @param configuration the configuration to save 041 * @throws org.apache.archiva.redback.components.registry.RegistryException 042 * if there is a problem saving the registry data 043 * @throws IndeterminateConfigurationException 044 * if the configuration cannot be saved because it was read from two sources 045 */ 046 void save( Configuration configuration ) 047 throws RegistryException, IndeterminateConfigurationException; 048 049 /** 050 * Determines if the configuration in use was as a result of a defaulted configuration. 051 * 052 * @return true if the configuration was created from the default-archiva.xml as opposed 053 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or 054 * ${appserver.base}/conf/archiva.xml 055 */ 056 boolean isDefaulted(); 057 058 /** 059 * Add a configuration listener to notify of changes to the configuration. 060 * 061 * @param listener the listener 062 */ 063 void addListener( ConfigurationListener listener ); 064 065 /** 066 * Remove a configuration listener to stop notifications of changes to the configuration. 067 * 068 * @param listener the listener 069 */ 070 void removeListener( ConfigurationListener listener ); 071 072 /** 073 * Add a registry listener to notify of events in spring-registry. 074 * 075 * @param listener the listener 076 * TODO: Remove in future. 077 */ 078 void addChangeListener( RegistryListener listener ); 079 080 void removeChangeListener( RegistryListener listener ); 081 082 /** 083 * reload configuration from file included registry 084 * 085 * @since 1.4-M1 086 */ 087 void reload(); 088} 089