1 package org.apache.archiva.configuration;
2
3 /*
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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
19 * under the License.
20 */
21
22 import org.apache.archiva.redback.components.registry.RegistryException;
23 import org.apache.archiva.redback.components.registry.RegistryListener;
24
25 /**
26 * Configuration holder for the model read from the registry.
27 */
28 public interface ArchivaConfiguration
29 {
30 /**
31 * Get the configuration.
32 *
33 * @return the configuration
34 */
35 Configuration getConfiguration();
36
37 /**
38 * Save any updated configuration.
39 *
40 * @param configuration the configuration to save
41 * @throws org.apache.archiva.redback.components.registry.RegistryException
42 * if there is a problem saving the registry data
43 * @throws IndeterminateConfigurationException
44 * if the configuration cannot be saved because it was read from two sources
45 */
46 void save( Configuration configuration )
47 throws RegistryException, IndeterminateConfigurationException;
48
49 /**
50 * Determines if the configuration in use was as a result of a defaulted configuration.
51 *
52 * @return true if the configuration was created from the default-archiva.xml as opposed
53 * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
54 * ${appserver.base}/conf/archiva.xml
55 */
56 boolean isDefaulted();
57
58 /**
59 * Add a configuration listener to notify of changes to the configuration.
60 *
61 * @param listener the listener
62 */
63 void addListener( ConfigurationListener listener );
64
65 /**
66 * Remove a configuration listener to stop notifications of changes to the configuration.
67 *
68 * @param listener the listener
69 */
70 void removeListener( ConfigurationListener listener );
71
72 /**
73 * Add a registry listener to notify of events in spring-registry.
74 *
75 * @param listener the listener
76 * TODO: Remove in future.
77 */
78 void addChangeListener( RegistryListener listener );
79
80 void removeChangeListener( RegistryListener listener );
81
82 /**
83 * reload configuration from file included registry
84 *
85 * @since 1.4-M1
86 */
87 void reload();
88 }
89