This project has retired. For details please refer to its Attic page.
ArchivaConfiguration xref
View Javadoc
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.components.registry.RegistryException;
23  import org.apache.archiva.components.registry.RegistryListener;
24  
25  import java.nio.file.Path;
26  import java.util.List;
27  import java.util.Locale;
28  
29  /**
30   * Configuration holder for the model read from the registry.
31   */
32  public interface ArchivaConfiguration
33  {
34  
35  
36      String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
37      String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
38  
39      /**
40       * Get the configuration.
41       *
42       * @return the configuration
43       */
44      Configuration getConfiguration();
45  
46      /**
47       * Save any updated configuration.
48       *
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
54       */
55      void save( Configuration configuration )
56          throws RegistryException, IndeterminateConfigurationException;
57  
58      /**
59       * Determines if the configuration in use was as a result of a defaulted configuration.
60       *
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
64       */
65      boolean isDefaulted();
66  
67      /**
68       * Add a configuration listener to notify of changes to the configuration.
69       *
70       * @param listener the listener
71       */
72      void addListener( ConfigurationListener listener );
73  
74      /**
75       * Remove a configuration listener to stop notifications of changes to the configuration.
76       *
77       * @param listener the listener
78       */
79      void removeListener( ConfigurationListener listener );
80  
81      /**
82       * Add a registry listener to notify of events in spring-registry.
83       *
84       * @param listener the listener
85       *                 TODO: Remove in future.
86       */
87      void addChangeListener( RegistryListener listener );
88  
89      void removeChangeListener( RegistryListener listener );
90  
91      /**
92       * reload configuration from file included registry
93       *
94       * @since 1.4-M1
95       */
96      void reload();
97  
98      public Locale getDefaultLocale();
99  
100     public List<Locale.LanguageRange> getLanguagePriorities();
101 
102     public Path getAppServerBaseDir();
103 
104     /**
105      * Returns the base directory for repositories that have a relative location path set.
106      * @return
107      */
108     public Path getRepositoryBaseDir();
109 
110     /**
111      * Returns the base directory for remote repositories
112      * @return
113      */
114     public Path getRemoteRepositoryBaseDir();
115 
116     /**
117      * Returns the base directory for repository group files.
118      * @return
119      */
120     public Path getRepositoryGroupBaseDir();
121 
122     /**
123      * Returns the data directory where repositories and metadata reside
124      * @return
125      */
126     public Path getDataDirectory();
127 }
128