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.ItemDeleteStatus;
29 import org.apache.archiva.repository.LayoutException;
30 import org.apache.archiva.repository.ManagedRepository;
31 import org.apache.archiva.repository.ManagedRepositoryContent;
32 import org.apache.archiva.repository.content.Artifact;
33 import org.apache.archiva.repository.content.ContentItem;
34 import org.apache.archiva.repository.content.ItemNotFoundException;
35 import org.apache.archiva.repository.content.ItemSelector;
36 import org.apache.archiva.repository.content.Namespace;
37 import org.apache.archiva.repository.content.Project;
38 import org.apache.archiva.repository.content.Version;
39 import org.apache.archiva.repository.storage.StorageAsset;
40 import org.springframework.stereotype.Service;
42 import java.nio.file.Path;
43 import java.util.List;
44 import java.util.function.Consumer;
45 import java.util.stream.Stream;
48 * @author Martin Stockhammer <martin_s@apache.org>
50 @Service("managedRepositoryContent#mock")
51 public class ManagedRepositoryContentMock implements ManagedRepositoryContent
53 private ManagedRepository repository;
56 public VersionedReference toVersion( String groupId, String artifactId, String version )
62 public VersionedReference toVersion( ArtifactReference artifactReference )
68 public void deleteAllItems( ItemSelector selector, Consumer<ItemDeleteStatus> consumer ) throws ContentAccessException, IllegalArgumentException
74 public void deleteItem( ContentItem item ) throws ItemNotFoundException, ContentAccessException
80 public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
86 public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
92 public Project getProject( ItemSelector projectSelector ) throws ContentAccessException, IllegalArgumentException
99 public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException
106 public Version getVersion( ItemSelector versionCoordinates ) throws ContentAccessException, IllegalArgumentException
112 public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException, ContentAccessException
119 public Artifact getArtifact( ItemSelector selector ) throws ContentAccessException
125 public List<? extends Artifact> getArtifacts( ItemSelector selector ) throws ContentAccessException
131 public Stream<? extends Artifact> newArtifactStream( ItemSelector selector ) throws ContentAccessException
137 public Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException
143 public List<? extends Project> getProjects( Namespace namespace ) throws ContentAccessException
149 public List<? extends Project> getProjects( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
155 public List<? extends Version> getVersions( Project project ) throws ContentAccessException
161 public List<? extends Version> getVersions( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
167 public List<? extends Artifact> getArtifacts( ContentItem item ) throws ContentAccessException
173 public Stream<? extends Artifact> newArtifactStream( ContentItem item ) throws ContentAccessException
179 public boolean hasContent( ItemSelector selector )
185 public void addArtifact( Path sourceFile, Artifact destination ) throws IllegalArgumentException
191 public ContentItem toItem( String path ) throws LayoutException
197 public ContentItem toItem( StorageAsset assetPath ) throws LayoutException
204 public void deleteGroupId( String groupId ) throws ContentNotFoundException, ContentAccessException
211 public void deleteProject( String namespace, String projectId ) throws ContentNotFoundException, ContentAccessException
217 public void deleteProject( ProjectReference reference ) throws ContentNotFoundException, ContentAccessException
223 public String getId( )
229 public List<ArtifactReference> getRelatedArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
235 public List<ArtifactReference> getArtifacts( VersionedReference reference ) throws ContentNotFoundException, LayoutException, ContentAccessException
241 public String getRepoRoot( )
247 public ManagedRepository getRepository( )
253 public boolean hasContent( ArtifactReference reference ) throws ContentAccessException
259 public boolean hasContent( VersionedReference reference ) throws ContentAccessException
265 public void setRepository( ManagedRepository repo )
267 this.repository = repo;
271 public StorageAsset toFile( VersionedReference reference )
277 public ArtifactReference toArtifactReference( String path ) throws LayoutException
283 public StorageAsset toFile( ArtifactReference reference )
289 public StorageAsset toFile( ArchivaArtifact reference )
295 public String toMetadataPath( ProjectReference reference )
301 public String toMetadataPath( VersionedReference reference )
307 public String toPath( ArtifactReference reference )
313 public String toPath( ItemSelector selector )
319 public ItemSelector toItemSelector( String path ) throws LayoutException
325 public String toPath( ArchivaArtifact reference )