1 package org.apache.archiva.admin.mock;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.archiva.metadata.model.ArtifactMetadata;
22 import org.apache.archiva.metadata.model.MetadataFacet;
23 import org.apache.archiva.metadata.model.ProjectMetadata;
24 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
25 import org.apache.archiva.metadata.model.ProjectVersionReference;
26 import org.apache.archiva.metadata.repository.MetadataRepository;
27 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
28 import org.apache.archiva.metadata.repository.MetadataResolutionException;
29 import org.apache.archiva.metadata.repository.RepositorySession;
30 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
31 import org.springframework.stereotype.Service;
33 import java.util.Collection;
34 import java.util.Collections;
35 import java.util.Date;
36 import java.util.List;
39 * @author Olivier Lamy
41 @Service( "RepositorySessionFactory#mock" )
42 public class MockRepositorySessionFactory
43 implements RepositorySessionFactory
45 public RepositorySession createSession()
47 return new RepositorySession( null, null )
62 public MetadataRepository getRepository()
64 return new MetadataRepository()
67 public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
68 throws MetadataRepositoryException
70 throw new UnsupportedOperationException();
73 public void removeArtifact( String repositoryId, String namespace, String project,
74 String projectVersion, MetadataFacet metadataFacet )
75 throws MetadataRepositoryException
77 throw new UnsupportedOperationException();
80 public void updateProject( String repositoryId, ProjectMetadata project )
81 throws MetadataRepositoryException
83 //To change body of implemented methods use File | Settings | File Templates.
86 public void updateArtifact( String repositoryId, String namespace, String projectId,
87 String projectVersion, ArtifactMetadata artifactMeta )
88 throws MetadataRepositoryException
90 //To change body of implemented methods use File | Settings | File Templates.
93 public void updateProjectVersion( String repositoryId, String namespace, String projectId,
94 ProjectVersionMetadata versionMetadata )
95 throws MetadataRepositoryException
97 //To change body of implemented methods use File | Settings | File Templates.
100 public void updateNamespace( String repositoryId, String namespace )
101 throws MetadataRepositoryException
103 //To change body of implemented methods use File | Settings | File Templates.
106 public List<String> getMetadataFacets( String repositoryId, String facetId )
107 throws MetadataRepositoryException
109 return Collections.emptyList();
112 public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
113 throws MetadataRepositoryException
115 return null; //To change body of implemented methods use File | Settings | File Templates.
118 public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
119 throws MetadataRepositoryException
121 //To change body of implemented methods use File | Settings | File Templates.
124 public void removeMetadataFacets( String repositoryId, String facetId )
125 throws MetadataRepositoryException
127 //To change body of implemented methods use File | Settings | File Templates.
130 public void removeMetadataFacet( String repositoryId, String facetId, String name )
131 throws MetadataRepositoryException
133 //To change body of implemented methods use File | Settings | File Templates.
136 public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
138 throws MetadataRepositoryException
140 return null; //To change body of implemented methods use File | Settings | File Templates.
143 public Collection<String> getRepositories()
144 throws MetadataRepositoryException
146 return null; //To change body of implemented methods use File | Settings | File Templates.
149 public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
150 throws MetadataRepositoryException
152 return null; //To change body of implemented methods use File | Settings | File Templates.
155 public void removeArtifact( String repositoryId, String namespace, String project, String version,
157 throws MetadataRepositoryException
159 //To change body of implemented methods use File | Settings | File Templates.
162 public void removeRepository( String repositoryId )
163 throws MetadataRepositoryException
165 //To change body of implemented methods use File | Settings | File Templates.
168 public List<ArtifactMetadata> getArtifacts( String repositoryId )
169 throws MetadataRepositoryException
171 return null; //To change body of implemented methods use File | Settings | File Templates.
174 public ProjectMetadata getProject( String repoId, String namespace, String projectId )
175 throws MetadataResolutionException
177 return null; //To change body of implemented methods use File | Settings | File Templates.
180 public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
181 String projectVersion )
182 throws MetadataResolutionException
184 return null; //To change body of implemented methods use File | Settings | File Templates.
187 public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
188 String projectVersion )
189 throws MetadataResolutionException
191 return null; //To change body of implemented methods use File | Settings | File Templates.
194 public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
196 String projectVersion )
197 throws MetadataResolutionException
199 return null; //To change body of implemented methods use File | Settings | File Templates.
202 public Collection<String> getRootNamespaces( String repoId )
203 throws MetadataResolutionException
205 return null; //To change body of implemented methods use File | Settings | File Templates.
208 public Collection<String> getNamespaces( String repoId, String namespace )
209 throws MetadataResolutionException
211 return null; //To change body of implemented methods use File | Settings | File Templates.
214 public Collection<String> getProjects( String repoId, String namespace )
215 throws MetadataResolutionException
217 return null; //To change body of implemented methods use File | Settings | File Templates.
220 public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
221 throws MetadataResolutionException
223 return null; //To change body of implemented methods use File | Settings | File Templates.
226 public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
227 String projectVersion )
228 throws MetadataResolutionException
230 return null; //To change body of implemented methods use File | Settings | File Templates.
235 //To change body of implemented methods use File | Settings | File Templates.
240 //To change body of implemented methods use File | Settings | File Templates.
245 //To change body of implemented methods use File | Settings | File Templates.
248 public boolean canObtainAccess( Class<?> aClass )
250 return false; //To change body of implemented methods use File | Settings | File Templates.
253 public Object obtainAccess( Class<?> aClass )
255 return null; //To change body of implemented methods use File | Settings | File Templates.