]> source.dussan.org Git - archiva.git/blob
063fa4b4bf8c60dbb43c7d115eedcbae39fcdf85
[archiva.git] /
1 package org.apache.archiva.scheduler.indexing.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                     public void updateProject( String repositoryId, ProjectMetadata project )
67                         throws MetadataRepositoryException
68                     {
69                         //To change body of implemented methods use File | Settings | File Templates.
70                     }
71
72                     public void updateArtifact( String repositoryId, String namespace, String projectId,
73                                                 String projectVersion, ArtifactMetadata artifactMeta )
74                         throws MetadataRepositoryException
75                     {
76                         //To change body of implemented methods use File | Settings | File Templates.
77                     }
78
79                     public void updateProjectVersion( String repositoryId, String namespace, String projectId,
80                                                       ProjectVersionMetadata versionMetadata )
81                         throws MetadataRepositoryException
82                     {
83                         //To change body of implemented methods use File | Settings | File Templates.
84                     }
85
86                     public void updateNamespace( String repositoryId, String namespace )
87                         throws MetadataRepositoryException
88                     {
89                         //To change body of implemented methods use File | Settings | File Templates.
90                     }
91
92                     public List<String> getMetadataFacets( String repositoryId, String facetId )
93                         throws MetadataRepositoryException
94                     {
95                         return Collections.emptyList();
96                     }
97
98                     public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
99                         throws MetadataRepositoryException
100                     {
101                         return null;  //To change body of implemented methods use File | Settings | File Templates.
102                     }
103
104                     public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
105                         throws MetadataRepositoryException
106                     {
107                         //To change body of implemented methods use File | Settings | File Templates.
108                     }
109
110                     public void removeMetadataFacets( String repositoryId, String facetId )
111                         throws MetadataRepositoryException
112                     {
113                         //To change body of implemented methods use File | Settings | File Templates.
114                     }
115
116                     public void removeMetadataFacet( String repositoryId, String facetId, String name )
117                         throws MetadataRepositoryException
118                     {
119                         //To change body of implemented methods use File | Settings | File Templates.
120                     }
121
122                     public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
123                                                                            Date endTime )
124                         throws MetadataRepositoryException
125                     {
126                         return null;  //To change body of implemented methods use File | Settings | File Templates.
127                     }
128
129                     public Collection<String> getRepositories()
130                         throws MetadataRepositoryException
131                     {
132                         return null;  //To change body of implemented methods use File | Settings | File Templates.
133                     }
134
135                     public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
136                         throws MetadataRepositoryException
137                     {
138                         return null;  //To change body of implemented methods use File | Settings | File Templates.
139                     }
140
141                     public void removeArtifact( String repositoryId, String namespace, String project, String version,
142                                                 String id )
143                         throws MetadataRepositoryException
144                     {
145                         //To change body of implemented methods use File | Settings | File Templates.
146                     }
147
148                     public void removeRepository( String repositoryId )
149                         throws MetadataRepositoryException
150                     {
151                         //To change body of implemented methods use File | Settings | File Templates.
152                     }
153
154                     public List<ArtifactMetadata> getArtifacts( String repositoryId )
155                         throws MetadataRepositoryException
156                     {
157                         return null;  //To change body of implemented methods use File | Settings | File Templates.
158                     }
159
160                     public ProjectMetadata getProject( String repoId, String namespace, String projectId )
161                         throws MetadataResolutionException
162                     {
163                         return null;  //To change body of implemented methods use File | Settings | File Templates.
164                     }
165
166                     public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
167                                                                      String projectVersion )
168                         throws MetadataResolutionException
169                     {
170                         return null;  //To change body of implemented methods use File | Settings | File Templates.
171                     }
172
173                     public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
174                                                                    String projectVersion )
175                         throws MetadataResolutionException
176                     {
177                         return null;  //To change body of implemented methods use File | Settings | File Templates.
178                     }
179
180                     public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
181                                                                                      String projectId,
182                                                                                      String projectVersion )
183                         throws MetadataResolutionException
184                     {
185                         return null;  //To change body of implemented methods use File | Settings | File Templates.
186                     }
187
188                     public Collection<String> getRootNamespaces( String repoId )
189                         throws MetadataResolutionException
190                     {
191                         return null;  //To change body of implemented methods use File | Settings | File Templates.
192                     }
193
194                     public Collection<String> getNamespaces( String repoId, String namespace )
195                         throws MetadataResolutionException
196                     {
197                         return null;  //To change body of implemented methods use File | Settings | File Templates.
198                     }
199
200                     public Collection<String> getProjects( String repoId, String namespace )
201                         throws MetadataResolutionException
202                     {
203                         return null;  //To change body of implemented methods use File | Settings | File Templates.
204                     }
205
206                     public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
207                         throws MetadataResolutionException
208                     {
209                         return null;  //To change body of implemented methods use File | Settings | File Templates.
210                     }
211
212                     public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
213                                                                       String projectVersion )
214                         throws MetadataResolutionException
215                     {
216                         return null;  //To change body of implemented methods use File | Settings | File Templates.
217                     }
218
219                     public void save()
220                     {
221                         //To change body of implemented methods use File | Settings | File Templates.
222                     }
223
224                     public void close()
225                     {
226                         //To change body of implemented methods use File | Settings | File Templates.
227                     }
228
229                     public void revert()
230                     {
231                         //To change body of implemented methods use File | Settings | File Templates.
232                     }
233
234                     public boolean canObtainAccess( Class<?> aClass )
235                     {
236                         return false;  //To change body of implemented methods use File | Settings | File Templates.
237                     }
238
239                     public Object obtainAccess( Class<?> aClass )
240                     {
241                         return null;  //To change body of implemented methods use File | Settings | File Templates.
242                     }
243                 };
244             }
245         };
246     }
247 }