1 package org.apache.archiva.repository.mock;
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.ContentAccessException;
27 import org.apache.archiva.repository.ContentNotFoundException;
28 import org.apache.archiva.repository.LayoutException;
29 import org.apache.archiva.repository.ManagedRepository;
30 import org.apache.archiva.repository.ManagedRepositoryContent;
31 import org.apache.archiva.repository.content.Artifact;
32 import org.apache.archiva.repository.content.ContentItem;
33 import org.apache.archiva.repository.content.ItemNotFoundException;
34 import org.apache.archiva.repository.content.ItemSelector;
35 import org.apache.archiva.repository.content.Namespace;
36 import org.apache.archiva.repository.content.Project;
37 import org.apache.archiva.repository.content.Version;
38 import org.apache.archiva.repository.storage.StorageAsset;
39 import org.springframework.stereotype.Service;
41 import java.nio.file.Path;
42 import java.util.List;
44 import java.util.stream.Stream;
47 * @author Martin Stockhammer <martin_s@apache.org>
49 @Service("managedRepositoryContent#mock")
50 public class ManagedRepositoryContentMock implements ManagedRepositoryContent
52 private ManagedRepository repository;
55 public VersionedReference toVersion( String groupId, String artifactId, String version )
61 public VersionedReference toGenericVersion( ArtifactReference artifactReference )
67 public VersionedReference toVersion( ArtifactReference artifactReference )
73 public ArtifactReference toArtifact( String groupId, String artifactId, String version, String type, String classifier )
79 public void deleteItem( ContentItem item ) throws ItemNotFoundException, ContentAccessException
85 public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
91 public Project getProject( ItemSelector projectSelector ) throws ContentAccessException, IllegalArgumentException
98 public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException
105 public Version getVersion( ItemSelector versionCoordinates ) throws ContentAccessException, IllegalArgumentException
111 public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException, ContentAccessException
118 public Artifact getArtifact( ItemSelector selector ) throws ContentAccessException
124 public List<Artifact> getAllArtifacts( ItemSelector selector ) throws ContentAccessException
130 public Stream<Artifact> getAllArtifactStream( ItemSelector selector ) throws ContentAccessException
136 public List<Project> getProjects( Namespace namespace ) throws ContentAccessException
142 public List<Version> getVersions( Project project ) throws ContentAccessException
148 public List<Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
154 public List<Artifact> getArtifactsStartingWith( Namespace namespace ) throws ContentAccessException
160 public Stream<Artifact> getArtifactStream( ContentItem item ) throws ContentAccessException
166 public Stream<Artifact> getArtifactStreamStartingWith( Namespace namespace ) throws ContentAccessException
172 public boolean hasContent( ItemSelector selector )
178 public void copyArtifact( Path sourceFile, ItemSelector destination ) throws IllegalArgumentException
185 public void deleteGroupId( String groupId ) throws ContentNotFoundException, ContentAccessException
192 public void deleteProject( String namespace, String projectId ) throws ContentNotFoundException, ContentAccessException
198 public void deleteProject( ProjectReference reference ) throws ContentNotFoundException, ContentAccessException
204 public String getId( )
210 public List<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
216 public List<ArtifactReference> getRelatedArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
222 public List<StorageAsset> getRelatedAssets( ArtifactReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
228 public List<ArtifactReference> getArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
234 public String getRepoRoot( )
240 public ManagedRepository getRepository( )
246 public Set<String> getVersions( ProjectReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
252 public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException, LayoutException
258 public boolean hasContent( ArtifactReference reference ) throws ContentAccessException
264 public boolean hasContent( ProjectReference reference ) throws ContentAccessException
270 public boolean hasContent( VersionedReference reference ) throws ContentAccessException
276 public void setRepository( ManagedRepository repo )
278 this.repository = repo;
282 public StorageAsset toFile( VersionedReference reference )
288 public ArtifactReference toArtifactReference( String path ) throws LayoutException
294 public StorageAsset toFile( ArtifactReference reference )
300 public StorageAsset toFile( ArchivaArtifact reference )
306 public String toMetadataPath( ProjectReference reference )
312 public String toMetadataPath( VersionedReference reference )
318 public String toPath( ArtifactReference reference )
324 public String toPath( ItemSelector selector )
330 public ItemSelector toItemSelector( String path ) throws LayoutException
336 public String toPath( ArchivaArtifact reference )