Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Repository.java 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.event.EventSource;
  22. import org.apache.archiva.repository.storage.RepositoryStorage;
  23. import org.apache.archiva.repository.features.RepositoryFeature;
  24. import org.apache.archiva.repository.storage.StorageAsset;
  25. import java.net.URI;
  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 EventSource, 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. * A repository may allow additional locations that can be used, if the primary location is not available.
  80. * @return
  81. */
  82. Set<URI> getFailoverLocations();
  83. /**
  84. * True, if this repository is scanned regularly.
  85. */
  86. boolean isScanned();
  87. /**
  88. * Returns the definition, when the repository jobs are executed.
  89. * This must return a valid a cron string.
  90. *
  91. * @See http://www.quartz-scheduler.org/api/2.2.1/org/quartz/CronExpression.html
  92. *
  93. * @return
  94. */
  95. String getSchedulingDefinition();
  96. /**
  97. * Returns true, if this repository has a index available
  98. * @return
  99. */
  100. boolean hasIndex();
  101. /**
  102. * Returns a layout definition. The returned string may be implementation specific and is not
  103. * standardized.
  104. *
  105. * @return
  106. */
  107. String getLayout();
  108. /**
  109. * Returns the capabilities of the repository implementation.
  110. * @return
  111. */
  112. RepositoryCapabilities getCapabilities();
  113. /**
  114. * Extension method that allows to provide different features that are not supported by all
  115. * repository types.
  116. *
  117. * @param clazz The feature class that is requested
  118. * @param <T> This is the class of the feature
  119. * @return The feature implementation for this repository instance, if it is supported
  120. * @throws UnsupportedFeatureException if the feature is not supported by this repository type
  121. */
  122. <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException;
  123. /**
  124. * Returns true, if the requested feature is supported by this repository.
  125. *
  126. * @param clazz The requested feature class
  127. * @param <T> The requested feature class
  128. * @return True, if the feature is supported, otherwise false.
  129. */
  130. <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz);
  131. /**
  132. * Returns a indexing context.
  133. * @return
  134. * @throws UnsupportedOperationException
  135. */
  136. ArchivaIndexingContext getIndexingContext();
  137. /**
  138. * Closes all resources that are opened by this repository.
  139. */
  140. void close();
  141. /**
  142. * Returns the current status of this repository.
  143. *
  144. * @return <code>true</code>, if repository has not been closed, otherwise <code>false</code>
  145. */
  146. boolean isOpen();
  147. /**
  148. * Returns the last state of this repository instance. As multiple repository instances may point to the
  149. * same repository, this is only a representation of the last state, when this particular instance was
  150. * used by the registry.
  151. *
  152. * @return the last known state of this repository instance
  153. */
  154. default RepositoryState getLastState() {
  155. return RepositoryState.CREATED;
  156. }
  157. }