1 package org.apache.archiva.repository;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.archiva.model.ArchivaArtifact;
23 import org.apache.archiva.model.ArtifactReference;
24 import org.apache.archiva.model.ProjectReference;
25 import org.apache.archiva.model.VersionedReference;
26 import org.apache.archiva.repository.content.StorageAsset;
31 * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
32 * without the need for processing based on filesystem paths, or working with the database.
36 public interface ManagedRepositoryContent extends RepositoryContent
42 * Delete from the managed repository all files / directories associated with the
43 * provided version reference.
45 * @param reference the version reference to delete.
46 * @throws ContentNotFoundException
48 void deleteVersion( VersionedReference reference )
49 throws ContentNotFoundException;
52 * delete a specified artifact from the repository
54 * @param artifactReference
55 * @throws ContentNotFoundException
57 void deleteArtifact( ArtifactReference artifactReference )
58 throws ContentNotFoundException;
62 * @throws ContentNotFoundException
65 void deleteGroupId( String groupId )
66 throws ContentNotFoundException;
70 * @param namespace groupId for maven
71 * @param projectId artifactId for maven
72 * @throws ContentNotFoundException
74 void deleteProject( String namespace, String projectId )
75 throws RepositoryException;
79 * Convenience method to get the repository id.
82 * Equivalent to calling <code>.getRepository().getId()</code>
85 * @return the repository id.
91 * Gather up the list of related artifacts to the ArtifactReference provided.
92 * This typically inclues the pom files, and those things with
93 * classifiers (such as doc, source code, test libs, etc...)
96 * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
99 * @param reference the reference to work off of.
100 * @return the set of ArtifactReferences for related artifacts.
101 * @throws ContentNotFoundException if the initial artifact reference does not exist within the repository.
103 Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
104 throws ContentNotFoundException;
108 * Convenience method to get the repository (on disk) root directory.
111 * Equivalent to calling <code>.getRepository().getLocation()</code>
114 * @return the repository (on disk) root directory.
116 String getRepoRoot();
119 * Get the repository configuration associated with this
120 * repository content.
122 * @return the repository that is associated with this repository content.
124 ManagedRepository getRepository();
127 * Given a specific {@link ProjectReference}, return the list of available versions for
128 * that project reference.
130 * @param reference the project reference to work off of.
131 * @return the list of versions found for that project reference.
132 * @throws ContentNotFoundException if the project reference does nto exist within the repository.
133 * @throws LayoutException
135 Set<String> getVersions( ProjectReference reference )
136 throws ContentNotFoundException, LayoutException;
140 * Given a specific {@link VersionedReference}, return the list of available versions for that
141 * versioned reference.
144 * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
147 * @param reference the versioned reference to work off of.
148 * @return the set of versions found.
149 * @throws ContentNotFoundException if the versioned reference does not exist within the repository.
151 Set<String> getVersions( VersionedReference reference )
152 throws ContentNotFoundException;
155 * Determines if the artifact referenced exists in the repository.
157 * @param reference the artifact reference to check for.
158 * @return true if the artifact referenced exists.
160 boolean hasContent( ArtifactReference reference );
163 * Determines if the project referenced exists in the repository.
165 * @param reference the project reference to check for.
166 * @return true it the project referenced exists.
168 boolean hasContent( ProjectReference reference );
171 * Determines if the version reference exists in the repository.
173 * @param reference the version reference to check for.
174 * @return true if the version referenced exists.
176 boolean hasContent( VersionedReference reference );
179 * Set the repository configuration to associate with this
180 * repository content.
182 * @param repo the repository to associate with this repository content.
184 void setRepository( org.apache.archiva.repository.ManagedRepository repo );
187 * Given an {@link ArtifactReference}, return the file reference to the artifact.
189 * @param reference the artifact reference to use.
190 * @return the relative path to the artifact.
192 StorageAsset toFile( ArtifactReference reference );
195 * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
197 * @param reference the archiva artifact to use.
198 * @return the relative path to the artifact.
200 StorageAsset toFile( ArchivaArtifact reference );
203 * Given a {@link ProjectReference}, return the path to the metadata for
206 * @param reference the reference to use.
207 * @return the path to the metadata file, or null if no metadata is appropriate.
209 String toMetadataPath( ProjectReference reference );
212 * Given a {@link VersionedReference}, return the path to the metadata for
213 * the specific version of the project.
215 * @param reference the reference to use.
216 * @return the path to the metadata file, or null if no metadata is appropriate.
218 String toMetadataPath( VersionedReference reference );
221 * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
223 * @param reference the archiva artifact to use.
224 * @return the relative path to the artifact.
226 String toPath( ArchivaArtifact reference );