This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.repository;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.model.ArchivaArtifact;
023import org.apache.archiva.model.ArtifactReference;
024import org.apache.archiva.model.ProjectReference;
025import org.apache.archiva.model.VersionedReference;
026import org.apache.archiva.repository.storage.StorageAsset;
027
028import java.util.Set;
029
030/**
031 * ManagedRepositoryContent interface for interacting with a managed repository in an abstract way,
032 * without the need for processing based on filesystem paths, or working with the database.
033 *
034 * This interface
035 */
036public interface ManagedRepositoryContent extends RepositoryContent
037{
038
039
040
041    /**
042     * Delete from the managed repository all files / directories associated with the
043     * provided version reference.
044     *
045     * @param reference the version reference to delete.
046     * @throws ContentNotFoundException
047     */
048    void deleteVersion( VersionedReference reference )
049        throws ContentNotFoundException;
050
051    /**
052     * delete a specified artifact from the repository
053     *
054     * @param artifactReference
055     * @throws ContentNotFoundException
056     */
057    void deleteArtifact( ArtifactReference artifactReference )
058        throws ContentNotFoundException;
059
060    /**
061     * @param groupId
062     * @throws ContentNotFoundException
063     * @since 1.4-M3
064     */
065    void deleteGroupId( String groupId )
066        throws ContentNotFoundException;
067
068    /**
069     *
070     * @param namespace groupId for maven
071     * @param projectId artifactId for maven
072     * @throws ContentNotFoundException
073     */
074    void deleteProject( String namespace, String projectId )
075        throws RepositoryException;
076
077    /**
078     * <p>
079     * Convenience method to get the repository id.
080     * </p>
081     * <p>
082     * Equivalent to calling <code>.getRepository().getId()</code>
083     * </p>
084     *
085     * @return the repository id.
086     */
087    String getId();
088
089    /**
090     * <p>
091     * Gather up the list of related artifacts to the ArtifactReference provided.
092     * This typically inclues the pom files, and those things with
093     * classifiers (such as doc, source code, test libs, etc...)
094     * </p>
095     * <p>
096     * <strong>NOTE:</strong> Some layouts (such as maven 1 "legacy") are not compatible with this query.
097     * </p>
098     *
099     * @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.
102     */
103    Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference )
104        throws ContentNotFoundException;
105
106    /**
107     * <p>
108     * Convenience method to get the repository (on disk) root directory.
109     * </p>
110     * <p>
111     * Equivalent to calling <code>.getRepository().getLocation()</code>
112     * </p>
113     *
114     * @return the repository (on disk) root directory.
115     */
116    String getRepoRoot();
117
118    /**
119     * Get the repository configuration associated with this
120     * repository content.
121     *
122     * @return the repository that is associated with this repository content.
123     */
124    ManagedRepository getRepository();
125
126    /**
127     * Given a specific {@link ProjectReference}, return the list of available versions for
128     * that project reference.
129     *
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
134     */
135    Set<String> getVersions( ProjectReference reference )
136        throws ContentNotFoundException, LayoutException;
137
138    /**
139     * <p>
140     * Given a specific {@link VersionedReference}, return the list of available versions for that
141     * versioned reference.
142     * </p>
143     * <p>
144     * <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs.
145     * </p>
146     *
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.
150     */
151    Set<String> getVersions( VersionedReference reference )
152        throws ContentNotFoundException;
153
154    /**
155     * Determines if the artifact referenced exists in the repository.
156     *
157     * @param reference the artifact reference to check for.
158     * @return true if the artifact referenced exists.
159     */
160    boolean hasContent( ArtifactReference reference );
161
162    /**
163     * Determines if the project referenced exists in the repository.
164     *
165     * @param reference the project reference to check for.
166     * @return true it the project referenced exists.
167     */
168    boolean hasContent( ProjectReference reference );
169
170    /**
171     * Determines if the version reference exists in the repository.
172     *
173     * @param reference the version reference to check for.
174     * @return true if the version referenced exists.
175     */
176    boolean hasContent( VersionedReference reference );
177
178    /**
179     * Set the repository configuration to associate with this
180     * repository content.
181     *
182     * @param repo the repository to associate with this repository content.
183     */
184    void setRepository( org.apache.archiva.repository.ManagedRepository repo );
185
186    /**
187     * Given an {@link ArtifactReference}, return the file reference to the artifact.
188     *
189     * @param reference the artifact reference to use.
190     * @return the relative path to the artifact.
191     */
192    StorageAsset toFile( ArtifactReference reference );
193
194    /**
195     * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
196     *
197     * @param reference the archiva artifact to use.
198     * @return the relative path to the artifact.
199     */
200    StorageAsset toFile( ArchivaArtifact reference );
201
202    /**
203     * Given a {@link ProjectReference}, return the path to the metadata for
204     * the project.
205     *
206     * @param reference the reference to use.
207     * @return the path to the metadata file, or null if no metadata is appropriate.
208     */
209    String toMetadataPath( ProjectReference reference );
210
211    /**
212     * Given a {@link VersionedReference}, return the path to the metadata for
213     * the specific version of the project.
214     *
215     * @param reference the reference to use.
216     * @return the path to the metadata file, or null if no metadata is appropriate.
217     */
218    String toMetadataPath( VersionedReference reference );
219
220    /**
221     * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
222     *
223     * @param reference the archiva artifact to use.
224     * @return the relative path to the artifact.
225     */
226    String toPath( ArchivaArtifact reference );
227
228
229}