You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ArchivaConfiguration.java 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package org.apache.archiva.configuration;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import org.apache.archiva.components.registry.Registry;
  21. import org.apache.archiva.components.registry.RegistryException;
  22. import org.apache.archiva.components.registry.RegistryListener;
  23. import java.nio.file.Path;
  24. import java.util.List;
  25. import java.util.Locale;
  26. /**
  27. * Configuration holder for the model read from the registry.
  28. */
  29. public interface ArchivaConfiguration
  30. {
  31. String USER_CONFIG_PROPERTY = "archiva.user.configFileName";
  32. String USER_CONFIG_ENVVAR = "ARCHIVA_USER_CONFIG_FILE";
  33. /**
  34. * Get the configuration.
  35. *
  36. * @return the configuration
  37. */
  38. Configuration getConfiguration();
  39. /**
  40. * Save any updated configuration.
  41. *
  42. * @param configuration the configuration to save
  43. * @throws org.apache.archiva.components.registry.RegistryException
  44. * if there is a problem saving the registry data
  45. * @throws IndeterminateConfigurationException
  46. * if the configuration cannot be saved because it was read from two sources
  47. */
  48. void save( Configuration configuration )
  49. throws RegistryException, IndeterminateConfigurationException;
  50. /**
  51. * Save any updated configuration. This method allows to add a tag to the thrown event.
  52. * This allows to verify the origin if the caller is the same as the listener.
  53. *
  54. * @param configuration the configuration to save
  55. * @param eventTag the tag to add to the thrown event
  56. * @throws org.apache.archiva.components.registry.RegistryException
  57. * if there is a problem saving the registry data
  58. * @throws IndeterminateConfigurationException
  59. * if the configuration cannot be saved because it was read from two sources
  60. */
  61. void save( Configuration configuration, String eventTag )
  62. throws RegistryException, IndeterminateConfigurationException;
  63. /**
  64. * Determines if the configuration in use was as a result of a defaulted configuration.
  65. *
  66. * @return true if the configuration was created from the default-archiva.xml as opposed
  67. * to being loaded from the usual locations of ${user.home}/.m2/archiva.xml or
  68. * ${appserver.base}/conf/archiva.xml
  69. */
  70. boolean isDefaulted();
  71. /**
  72. * Add a configuration listener to notify of changes to the configuration.
  73. *
  74. * @param listener the listener
  75. */
  76. void addListener( ConfigurationListener listener );
  77. /**
  78. * Remove a configuration listener to stop notifications of changes to the configuration.
  79. *
  80. * @param listener the listener
  81. */
  82. void removeListener( ConfigurationListener listener );
  83. /**
  84. * Add a registry listener to notify of events in spring-registry.
  85. *
  86. * @param listener the listener
  87. * TODO: Remove in future.
  88. */
  89. void addChangeListener( RegistryListener listener );
  90. void removeChangeListener( RegistryListener listener );
  91. /**
  92. * reload configuration from file included registry
  93. *
  94. * @since 1.4-M1
  95. */
  96. void reload();
  97. public Locale getDefaultLocale();
  98. public List<Locale.LanguageRange> getLanguagePriorities();
  99. public Path getAppServerBaseDir();
  100. /**
  101. * Returns the base directory for repositories that have a relative location path set.
  102. * @return
  103. */
  104. public Path getRepositoryBaseDir();
  105. /**
  106. * Returns the base directory for remote repositories
  107. * @return
  108. */
  109. public Path getRemoteRepositoryBaseDir();
  110. /**
  111. * Returns the base directory for repository group files.
  112. * @return
  113. */
  114. public Path getRepositoryGroupBaseDir();
  115. /**
  116. * Returns the data directory where repositories and metadata reside
  117. * @return
  118. */
  119. public Path getDataDirectory();
  120. /**
  121. * Return the used configuration registry
  122. * @return
  123. */
  124. Registry getRegistry( );
  125. }