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.

Repository.java 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. package org.apache.archiva.repository;
  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.indexer.ArchivaIndexingContext;
  21. import org.apache.archiva.repository.storage.RepositoryStorage;
  22. import org.apache.archiva.repository.features.RepositoryFeature;
  23. import org.apache.archiva.repository.storage.StorageAsset;
  24. import java.net.URI;
  25. import java.nio.file.Path;
  26. import java.util.Locale;
  27. import java.util.Set;
  28. /**
  29. *
  30. * Base interface for repositories.
  31. *
  32. * Created by Martin Stockhammer on 21.09.17.
  33. */
  34. public interface Repository extends RepositoryEventHandler, RepositoryStorage {
  35. /**
  36. * Return the identifier of the repository. Repository identifier should be unique at least
  37. * for the same type.
  38. * @return The identifier.
  39. */
  40. String getId();
  41. /**
  42. * This is the display name of the repository. This string is presented in the user interface.
  43. *
  44. * @return The display name of the repository
  45. */
  46. String getName();
  47. /**
  48. * Returns the name in the given locale.
  49. * @param locale
  50. * @return
  51. */
  52. String getName(Locale locale);
  53. /**
  54. * Returns a description of this repository.
  55. * @return The description.
  56. */
  57. String getDescription();
  58. /**
  59. * Returns the description for the given locale.
  60. * @param locale
  61. * @return
  62. */
  63. String getDescription(Locale locale);
  64. /**
  65. * This identifies the type of repository. Archiva does only support certain types of repositories.
  66. *
  67. * @return A unique identifier for the repository type.
  68. */
  69. RepositoryType getType();
  70. /**
  71. * Returns the location of this repository. For local repositories this might be a file URI, for
  72. * remote repositories a http URL or some very repository specific schemes.
  73. * Each repository has only one unique location.
  74. *
  75. * @return The repository location.
  76. */
  77. URI getLocation();
  78. /**
  79. * Returns a storage representation to the local data stored for this repository.
  80. * The repository implementation may not store the real artifacts in this path. The directory structure
  81. * is completely implementation dependant.
  82. *
  83. */
  84. StorageAsset getLocalPath();
  85. /**
  86. * A repository may allow additional locations that can be used, if the primary location is not available.
  87. * @return
  88. */
  89. Set<URI> getFailoverLocations();
  90. /**
  91. * True, if this repository is scanned regularly.
  92. */
  93. boolean isScanned();
  94. /**
  95. * Returns the definition, when the repository jobs are executed.
  96. * This must return a valid a cron string.
  97. *
  98. * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
  99. *
  100. * @return
  101. */
  102. String getSchedulingDefinition();
  103. /**
  104. * Returns true, if this repository has a index available
  105. * @return
  106. */
  107. boolean hasIndex();
  108. /**
  109. * Returns a layout definition. The returned string may be implementation specific and is not
  110. * standardized.
  111. *
  112. * @return
  113. */
  114. String getLayout();
  115. /**
  116. * Returns the capabilities of the repository implementation.
  117. * @return
  118. */
  119. RepositoryCapabilities getCapabilities();
  120. /**
  121. * Extension method that allows to provide different features that are not supported by all
  122. * repository types.
  123. *
  124. * @param clazz The feature class that is requested
  125. * @param <T> This is the class of the feature
  126. * @return The feature implementation for this repository instance, if it is supported
  127. * @throws UnsupportedFeatureException if the feature is not supported by this repository type
  128. */
  129. <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
  130. /**
  131. * Returns true, if the requested feature is supported by this repository.
  132. *
  133. * @param clazz The requested feature class
  134. * @param <T> The requested feature class
  135. * @return True, if the feature is supported, otherwise false.
  136. */
  137. <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
  138. /**
  139. * Returns a indexing context.
  140. * @return
  141. * @throws UnsupportedOperationException
  142. */
  143. ArchivaIndexingContext getIndexingContext();
  144. /**
  145. * Closes all resources that are opened by this repository.
  146. */
  147. void close();
  148. }