]> source.dussan.org Git - archiva.git/blob
0fd0ae27b0834ac032772434bfb59fed10af7207
[archiva.git] /
1 package org.apache.archiva.indexer.search.mock;
2 /*
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
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
18  * under the License.
19  */
20
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;
32
33 import java.util.Collection;
34 import java.util.Collections;
35 import java.util.Date;
36 import java.util.List;
37
38 /**
39  * @author Olivier Lamy
40  */
41 @Service( "repositorySessionFactory#mock" )
42 public class MockRepositorySessionFactory
43     implements RepositorySessionFactory
44 {
45     public RepositorySession createSession()
46     {
47         return new RepositorySession( null, null )
48         {
49             @Override
50             public void close()
51             {
52                 return;
53             }
54
55             @Override
56             public void save()
57             {
58                 // no op
59             }
60
61             @Override
62             public MetadataRepository getRepository()
63             {
64                 return new MetadataRepository()
65                 {
66
67                     public boolean hasMetadataFacet( String repositoryId, String facetId )
68                         throws MetadataRepositoryException
69                     {
70                         return false;
71                     }
72
73                     public void removeArtifact( String repositoryId, String namespace, String project,
74                                                 String projectVersion, MetadataFacet metadataFacet )
75                         throws MetadataRepositoryException
76                     {
77
78                     }
79
80                     public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
81                         throws MetadataRepositoryException
82                     {
83                         throw new UnsupportedOperationException();
84                     }
85
86                     public void updateProject( String repositoryId, ProjectMetadata project )
87                         throws MetadataRepositoryException
88                     {
89                         //To change body of implemented methods use File | Settings | File Templates.
90                     }
91
92                     public void updateArtifact( String repositoryId, String namespace, String projectId,
93                                                 String projectVersion, ArtifactMetadata artifactMeta )
94                         throws MetadataRepositoryException
95                     {
96                         //To change body of implemented methods use File | Settings | File Templates.
97                     }
98
99                     public void updateProjectVersion( String repositoryId, String namespace, String projectId,
100                                                       ProjectVersionMetadata versionMetadata )
101                         throws MetadataRepositoryException
102                     {
103                         //To change body of implemented methods use File | Settings | File Templates.
104                     }
105
106                     public void updateNamespace( String repositoryId, String namespace )
107                         throws MetadataRepositoryException
108                     {
109                         //To change body of implemented methods use File | Settings | File Templates.
110                     }
111
112                     public List<String> getMetadataFacets( String repositoryId, String facetId )
113                         throws MetadataRepositoryException
114                     {
115                         return Collections.emptyList();
116                     }
117
118                     public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
119                         throws MetadataRepositoryException
120                     {
121                         return null;  //To change body of implemented methods use File | Settings | File Templates.
122                     }
123
124                     public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
125                         throws MetadataRepositoryException
126                     {
127                         //To change body of implemented methods use File | Settings | File Templates.
128                     }
129
130                     public void removeMetadataFacets( String repositoryId, String facetId )
131                         throws MetadataRepositoryException
132                     {
133                         //To change body of implemented methods use File | Settings | File Templates.
134                     }
135
136                     public void removeMetadataFacet( String repositoryId, String facetId, String name )
137                         throws MetadataRepositoryException
138                     {
139                         //To change body of implemented methods use File | Settings | File Templates.
140                     }
141
142                     public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
143                                                                            Date endTime )
144                         throws MetadataRepositoryException
145                     {
146                         return null;  //To change body of implemented methods use File | Settings | File Templates.
147                     }
148
149                     public Collection<String> getRepositories()
150                         throws MetadataRepositoryException
151                     {
152                         return null;  //To change body of implemented methods use File | Settings | File Templates.
153                     }
154
155                     public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
156                         throws MetadataRepositoryException
157                     {
158                         return null;  //To change body of implemented methods use File | Settings | File Templates.
159                     }
160
161                     public void removeArtifact( String repositoryId, String namespace, String project, String version,
162                                                 String id )
163                         throws MetadataRepositoryException
164                     {
165                         //To change body of implemented methods use File | Settings | File Templates.
166                     }
167
168                     public void removeRepository( String repositoryId )
169                         throws MetadataRepositoryException
170                     {
171                         //To change body of implemented methods use File | Settings | File Templates.
172                     }
173
174                     public List<ArtifactMetadata> getArtifacts( String repositoryId )
175                         throws MetadataRepositoryException
176                     {
177                         return null;  //To change body of implemented methods use File | Settings | File Templates.
178                     }
179
180                     public ProjectMetadata getProject( String repoId, String namespace, String projectId )
181                         throws MetadataResolutionException
182                     {
183                         return null;  //To change body of implemented methods use File | Settings | File Templates.
184                     }
185
186                     public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
187                                                                      String projectVersion )
188                         throws MetadataResolutionException
189                     {
190                         return null;  //To change body of implemented methods use File | Settings | File Templates.
191                     }
192
193                     public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
194                                                                    String projectVersion )
195                         throws MetadataResolutionException
196                     {
197                         return null;  //To change body of implemented methods use File | Settings | File Templates.
198                     }
199
200                     public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
201                                                                                      String projectId,
202                                                                                      String projectVersion )
203                         throws MetadataResolutionException
204                     {
205                         return null;  //To change body of implemented methods use File | Settings | File Templates.
206                     }
207
208                     public Collection<String> getRootNamespaces( String repoId )
209                         throws MetadataResolutionException
210                     {
211                         return null;  //To change body of implemented methods use File | Settings | File Templates.
212                     }
213
214                     public Collection<String> getNamespaces( String repoId, String namespace )
215                         throws MetadataResolutionException
216                     {
217                         return null;  //To change body of implemented methods use File | Settings | File Templates.
218                     }
219
220                     public Collection<String> getProjects( String repoId, String namespace )
221                         throws MetadataResolutionException
222                     {
223                         return null;  //To change body of implemented methods use File | Settings | File Templates.
224                     }
225
226                     public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
227                         throws MetadataResolutionException
228                     {
229                         return null;  //To change body of implemented methods use File | Settings | File Templates.
230                     }
231
232                     public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
233                                                                       String projectVersion )
234                         throws MetadataResolutionException
235                     {
236                         return null;  //To change body of implemented methods use File | Settings | File Templates.
237                     }
238
239                     public void save()
240                     {
241                         //To change body of implemented methods use File | Settings | File Templates.
242                     }
243
244                     public void close()
245                     {
246                         //To change body of implemented methods use File | Settings | File Templates.
247                     }
248
249                     public void revert()
250                     {
251                         //To change body of implemented methods use File | Settings | File Templates.
252                     }
253
254                     public boolean canObtainAccess( Class<?> aClass )
255                     {
256                         return false;  //To change body of implemented methods use File | Settings | File Templates.
257                     }
258
259                     public <T>T obtainAccess( Class<T> aClass )
260                     {
261                         return null;  //To change body of implemented methods use File | Settings | File Templates.
262                     }
263
264                     public void removeNamespace( String repositoryId, String namespace )
265                         throws MetadataRepositoryException
266                     {
267
268                     }
269
270                     public void removeProjectVersion( String repoId, String namespace, String projectId,
271                                                       String projectVersion )
272                         throws MetadataRepositoryException
273                     {
274
275                     }
276
277                     public void removeProject( String repositoryId, String namespace, String projectId )
278                         throws MetadataRepositoryException
279                     {
280                         throw new UnsupportedOperationException();
281                     }
282
283                 };
284             }
285         };
286     }
287 }