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.

ManagedRepositoryContent.java 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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.model.ArchivaArtifact;
  21. import org.apache.archiva.model.ArtifactReference;
  22. import org.apache.archiva.model.ProjectReference;
  23. import org.apache.archiva.model.VersionedReference;
  24. import java.nio.file.Path;
  25. import java.util.Set;
  26. /**
  27. * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
  28. * without the need for processing based on filesystem paths, or working with the database.
  29. *
  30. * This interface
  31. */
  32. public interface ManagedRepositoryContent extends RepositoryContent
  33. {
  34. /**
  35. * Delete from the managed repository all files / directories associated with the
  36. * provided version reference.
  37. *
  38. * @param reference the version reference to delete.
  39. * @throws ContentNotFoundException
  40. */
  41. void deleteVersion( VersionedReference reference )
  42. throws ContentNotFoundException;
  43. /**
  44. * delete a specified artifact from the repository
  45. *
  46. * @param artifactReference
  47. * @throws ContentNotFoundException
  48. */
  49. void deleteArtifact( ArtifactReference artifactReference )
  50. throws ContentNotFoundException;
  51. /**
  52. * @param groupId
  53. * @throws ContentNotFoundException
  54. * @since 1.4-M3
  55. */
  56. void deleteGroupId( String groupId )
  57. throws ContentNotFoundException;
  58. /**
  59. *
  60. * @param namespace groupId for maven
  61. * @param projectId artifactId for maven
  62. * @throws ContentNotFoundException
  63. */
  64. void deleteProject( String namespace, String projectId )
  65. throws RepositoryException;
  66. /**
  67. * <p>
  68. * Convenience method to get the repository id.
  69. * </p>
  70. * <p>
  71. * Equivalent to calling <code>.getRepository().getId()</code>
  72. * </p>
  73. *
  74. * @return the repository id.
  75. */
  76. String getId();
  77. /**
  78. * <p>
  79. * Gather up the list of related artifacts to the ArtifactReference provided.
  80. * This typically inclues the pom files, and those things with
  81. * classifiers (such as doc, source code, test libs, etc...)
  82. * </p>
  83. * <p>
  84. * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
  85. * </p>
  86. *
  87. * @param reference the reference to work off of.
  88. * @return the set of ArtifactReferences for related artifacts.
  89. * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
  90. */
  91. Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
  92. throws ContentNotFoundException;
  93. /**
  94. * <p>
  95. * Convenience method to get the repository (on disk) root directory.
  96. * </p>
  97. * <p>
  98. * Equivalent to calling <code>.getRepository().getLocation()</code>
  99. * </p>
  100. *
  101. * @return the repository (on disk) root directory.
  102. */
  103. String getRepoRoot();
  104. /**
  105. * Get the repository configuration associated with this
  106. * repository content.
  107. *
  108. * @return the repository that is associated with this repository content.
  109. */
  110. ManagedRepository getRepository();
  111. /**
  112. * Given a specific {@link ProjectReference}, return the list of available versions for
  113. * that project reference.
  114. *
  115. * @param reference the project reference to work off of.
  116. * @return the list of versions found for that project reference.
  117. * @throws ContentNotFoundException if the project reference does nto exist within the repository.
  118. * @throws LayoutException
  119. */
  120. Set<String> getVersions( ProjectReference reference )
  121. throws ContentNotFoundException, LayoutException;
  122. /**
  123. * <p>
  124. * Given a specific {@link VersionedReference}, return the list of available versions for that
  125. * versioned reference.
  126. * </p>
  127. * <p>
  128. * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
  129. * </p>
  130. *
  131. * @param reference the versioned reference to work off of.
  132. * @return the set of versions found.
  133. * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
  134. */
  135. Set<String> getVersions( VersionedReference reference )
  136. throws ContentNotFoundException;
  137. /**
  138. * Determines if the artifact referenced exists in the repository.
  139. *
  140. * @param reference the artifact reference to check for.
  141. * @return true if the artifact referenced exists.
  142. */
  143. boolean hasContent( ArtifactReference reference );
  144. /**
  145. * Determines if the project referenced exists in the repository.
  146. *
  147. * @param reference the project reference to check for.
  148. * @return true it the project referenced exists.
  149. */
  150. boolean hasContent( ProjectReference reference );
  151. /**
  152. * Determines if the version reference exists in the repository.
  153. *
  154. * @param reference the version reference to check for.
  155. * @return true if the version referenced exists.
  156. */
  157. boolean hasContent( VersionedReference reference );
  158. /**
  159. * Set the repository configuration to associate with this
  160. * repository content.
  161. *
  162. * @param repo the repository to associate with this repository content.
  163. */
  164. void setRepository( org.apache.archiva.repository.ManagedRepository repo );
  165. /**
  166. * Given an {@link ArtifactReference}, return the file reference to the artifact.
  167. *
  168. * @param reference the artifact reference to use.
  169. * @return the relative path to the artifact.
  170. */
  171. Path toFile( ArtifactReference reference );
  172. /**
  173. * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
  174. *
  175. * @param reference the archiva artifact to use.
  176. * @return the relative path to the artifact.
  177. */
  178. Path toFile( ArchivaArtifact reference );
  179. /**
  180. * Given a {@link ProjectReference}, return the path to the metadata for
  181. * the project.
  182. *
  183. * @param reference the reference to use.
  184. * @return the path to the metadata file, or null if no metadata is appropriate.
  185. */
  186. String toMetadataPath( ProjectReference reference );
  187. /**
  188. * Given a {@link VersionedReference}, return the path to the metadata for
  189. * the specific version of the project.
  190. *
  191. * @param reference the reference to use.
  192. * @return the path to the metadata file, or null if no metadata is appropriate.
  193. */
  194. String toMetadataPath( VersionedReference reference );
  195. /**
  196. * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
  197. *
  198. * @param reference the archiva artifact to use.
  199. * @return the relative path to the artifact.
  200. */
  201. String toPath( ArchivaArtifact reference );
  202. }