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 ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
91 public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
97 public Project getProject( ItemSelector projectSelector ) throws ContentAccessException, IllegalArgumentException
104 public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException
111 public Version getVersion( ItemSelector versionCoordinates ) throws ContentAccessException, IllegalArgumentException
117 public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException, ContentAccessException
124 public Artifact getArtifact( ItemSelector selector ) throws ContentAccessException
130 public List<? extends Artifact> getArtifacts( ItemSelector selector ) throws ContentAccessException
136 public Stream<? extends Artifact> newArtifactStream( ItemSelector selector ) throws ContentAccessException
142 public List<? extends Project> getProjects( Namespace namespace ) throws ContentAccessException
148 public List<? extends Project> getProjects( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
154 public List<? extends Version> getVersions( Project project ) throws ContentAccessException
160 public List<? extends Version> getVersions( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
166 public List<? extends Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
172 public Stream<? extends Artifact> newArtifactStream( ContentItem item ) throws ContentAccessException
178 public boolean hasContent( ItemSelector selector )
184 public void addArtifact( Path sourceFile, Artifact destination ) throws IllegalArgumentException
190 public ContentItem toItem( String path ) throws LayoutException
196 public ContentItem toItem( StorageAsset assetPath ) throws LayoutException
203 public void deleteGroupId( String groupId ) throws ContentNotFoundException, ContentAccessException
210 public void deleteProject( String namespace, String projectId ) throws ContentNotFoundException, ContentAccessException
216 public void deleteProject( ProjectReference reference ) throws ContentNotFoundException, ContentAccessException
222 public String getId( )
228 public List<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
234 public List<ArtifactReference> getRelatedArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
240 public List<StorageAsset> getRelatedAssets( ArtifactReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
246 public List<ArtifactReference> getArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
252 public String getRepoRoot( )
258 public ManagedRepository getRepository( )
264 public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException, LayoutException
270 public boolean hasContent( ArtifactReference reference ) throws ContentAccessException
276 public boolean hasContent( VersionedReference reference ) throws ContentAccessException
282 public void setRepository( ManagedRepository repo )
284 this.repository = repo;
288 public StorageAsset toFile( VersionedReference reference )
294 public ArtifactReference toArtifactReference( String path ) throws LayoutException
300 public StorageAsset toFile( ArtifactReference reference )
306 public StorageAsset toFile( ArchivaArtifact reference )
312 public String toMetadataPath( ProjectReference reference )
318 public String toMetadataPath( VersionedReference reference )
324 public String toPath( ArtifactReference reference )
330 public String toPath( ItemSelector selector )
336 public ItemSelector toItemSelector( String path ) throws LayoutException
342 public String toPath( ArchivaArtifact reference )