1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.supplier;
20
21 import java.util.HashMap;
22 import java.util.Map;
23 import java.util.function.Supplier;
24
25 import org.apache.maven.model.building.DefaultModelBuilderFactory;
26 import org.apache.maven.model.building.ModelBuilder;
27 import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
28 import org.apache.maven.repository.internal.DefaultModelCacheFactory;
29 import org.apache.maven.repository.internal.DefaultVersionRangeResolver;
30 import org.apache.maven.repository.internal.DefaultVersionResolver;
31 import org.apache.maven.repository.internal.ModelCacheFactory;
32 import org.apache.maven.repository.internal.PluginsMetadataGeneratorFactory;
33 import org.apache.maven.repository.internal.SnapshotMetadataGeneratorFactory;
34 import org.apache.maven.repository.internal.VersionsMetadataGeneratorFactory;
35 import org.eclipse.aether.RepositoryListener;
36 import org.eclipse.aether.RepositorySystem;
37 import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
38 import org.eclipse.aether.impl.ArtifactDescriptorReader;
39 import org.eclipse.aether.impl.ArtifactResolver;
40 import org.eclipse.aether.impl.DependencyCollector;
41 import org.eclipse.aether.impl.Deployer;
42 import org.eclipse.aether.impl.Installer;
43 import org.eclipse.aether.impl.LocalRepositoryProvider;
44 import org.eclipse.aether.impl.MetadataGeneratorFactory;
45 import org.eclipse.aether.impl.MetadataResolver;
46 import org.eclipse.aether.impl.OfflineController;
47 import org.eclipse.aether.impl.RemoteRepositoryFilterManager;
48 import org.eclipse.aether.impl.RemoteRepositoryManager;
49 import org.eclipse.aether.impl.RepositoryConnectorProvider;
50 import org.eclipse.aether.impl.RepositoryEventDispatcher;
51 import org.eclipse.aether.impl.RepositorySystemLifecycle;
52 import org.eclipse.aether.impl.UpdateCheckManager;
53 import org.eclipse.aether.impl.UpdatePolicyAnalyzer;
54 import org.eclipse.aether.impl.VersionRangeResolver;
55 import org.eclipse.aether.impl.VersionResolver;
56 import org.eclipse.aether.internal.impl.DefaultArtifactResolver;
57 import org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider;
58 import org.eclipse.aether.internal.impl.DefaultDeployer;
59 import org.eclipse.aether.internal.impl.DefaultFileProcessor;
60 import org.eclipse.aether.internal.impl.DefaultInstaller;
61 import org.eclipse.aether.internal.impl.DefaultLocalPathComposer;
62 import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory;
63 import org.eclipse.aether.internal.impl.DefaultLocalRepositoryProvider;
64 import org.eclipse.aether.internal.impl.DefaultMetadataResolver;
65 import org.eclipse.aether.internal.impl.DefaultOfflineController;
66 import org.eclipse.aether.internal.impl.DefaultRemoteRepositoryManager;
67 import org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider;
68 import org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher;
69 import org.eclipse.aether.internal.impl.DefaultRepositoryLayoutProvider;
70 import org.eclipse.aether.internal.impl.DefaultRepositorySystem;
71 import org.eclipse.aether.internal.impl.DefaultRepositorySystemLifecycle;
72 import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
73 import org.eclipse.aether.internal.impl.DefaultTransporterProvider;
74 import org.eclipse.aether.internal.impl.DefaultUpdateCheckManager;
75 import org.eclipse.aether.internal.impl.DefaultUpdatePolicyAnalyzer;
76 import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory;
77 import org.eclipse.aether.internal.impl.LocalPathComposer;
78 import org.eclipse.aether.internal.impl.LocalPathPrefixComposerFactory;
79 import org.eclipse.aether.internal.impl.Maven2RepositoryLayoutFactory;
80 import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
81 import org.eclipse.aether.internal.impl.TrackingFileManager;
82 import org.eclipse.aether.internal.impl.checksum.DefaultChecksumAlgorithmFactorySelector;
83 import org.eclipse.aether.internal.impl.checksum.Md5ChecksumAlgorithmFactory;
84 import org.eclipse.aether.internal.impl.checksum.Sha1ChecksumAlgorithmFactory;
85 import org.eclipse.aether.internal.impl.checksum.Sha256ChecksumAlgorithmFactory;
86 import org.eclipse.aether.internal.impl.checksum.Sha512ChecksumAlgorithmFactory;
87 import org.eclipse.aether.internal.impl.checksum.SparseDirectoryTrustedChecksumsSource;
88 import org.eclipse.aether.internal.impl.checksum.SummaryFileTrustedChecksumsSource;
89 import org.eclipse.aether.internal.impl.checksum.TrustedToProvidedChecksumsSourceAdapter;
90 import org.eclipse.aether.internal.impl.collect.DefaultDependencyCollector;
91 import org.eclipse.aether.internal.impl.collect.DependencyCollectorDelegate;
92 import org.eclipse.aether.internal.impl.collect.bf.BfDependencyCollector;
93 import org.eclipse.aether.internal.impl.collect.df.DfDependencyCollector;
94 import org.eclipse.aether.internal.impl.filter.DefaultRemoteRepositoryFilterManager;
95 import org.eclipse.aether.internal.impl.filter.GroupIdRemoteRepositoryFilterSource;
96 import org.eclipse.aether.internal.impl.filter.PrefixesRemoteRepositoryFilterSource;
97 import org.eclipse.aether.internal.impl.resolution.TrustedChecksumsArtifactResolverPostProcessor;
98 import org.eclipse.aether.internal.impl.synccontext.DefaultSyncContextFactory;
99 import org.eclipse.aether.internal.impl.synccontext.named.NameMapper;
100 import org.eclipse.aether.internal.impl.synccontext.named.NameMappers;
101 import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactory;
102 import org.eclipse.aether.internal.impl.synccontext.named.NamedLockFactoryAdapterFactoryImpl;
103 import org.eclipse.aether.internal.impl.version.DefaultVersionSchemeSelector;
104 import org.eclipse.aether.internal.impl.version.GenericVersionSchemeProvider;
105 import org.eclipse.aether.named.NamedLockFactory;
106 import org.eclipse.aether.named.providers.FileLockNamedLockFactory;
107 import org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory;
108 import org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory;
109 import org.eclipse.aether.named.providers.NoopNamedLockFactory;
110 import org.eclipse.aether.spi.checksums.ProvidedChecksumsSource;
111 import org.eclipse.aether.spi.checksums.TrustedChecksumsSource;
112 import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
113 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactory;
114 import org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector;
115 import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
116 import org.eclipse.aether.spi.connector.filter.RemoteRepositoryFilterSource;
117 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory;
118 import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider;
119 import org.eclipse.aether.spi.connector.transport.TransporterFactory;
120 import org.eclipse.aether.spi.connector.transport.TransporterProvider;
121 import org.eclipse.aether.spi.io.FileProcessor;
122 import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
123 import org.eclipse.aether.spi.resolution.ArtifactResolverPostProcessor;
124 import org.eclipse.aether.spi.synccontext.SyncContextFactory;
125 import org.eclipse.aether.spi.version.VersionSchemeSelector;
126 import org.eclipse.aether.transport.apache.ApacheTransporterFactory;
127 import org.eclipse.aether.transport.file.FileTransporterFactory;
128 import org.eclipse.aether.util.version.GenericVersionScheme;
129 import org.eclipse.aether.version.VersionScheme;
130
131
132
133
134
135
136
137
138
139 public class RepositorySystemSupplier implements Supplier<RepositorySystem> {
140 protected FileProcessor getFileProcessor() {
141 return new DefaultFileProcessor();
142 }
143
144 protected TrackingFileManager getTrackingFileManager() {
145 return new DefaultTrackingFileManager();
146 }
147
148 protected LocalPathComposer getLocalPathComposer() {
149 return new DefaultLocalPathComposer();
150 }
151
152 protected LocalPathPrefixComposerFactory getLocalPathPrefixComposerFactory() {
153 return new DefaultLocalPathPrefixComposerFactory();
154 }
155
156 protected RepositorySystemLifecycle getRepositorySystemLifecycle() {
157 return new DefaultRepositorySystemLifecycle();
158 }
159
160 protected OfflineController getOfflineController() {
161 return new DefaultOfflineController();
162 }
163
164 protected UpdatePolicyAnalyzer getUpdatePolicyAnalyzer() {
165 return new DefaultUpdatePolicyAnalyzer();
166 }
167
168 protected ChecksumPolicyProvider getChecksumPolicyProvider() {
169 return new DefaultChecksumPolicyProvider();
170 }
171
172 protected UpdateCheckManager getUpdateCheckManager(
173 TrackingFileManager trackingFileManager, UpdatePolicyAnalyzer updatePolicyAnalyzer) {
174 return new DefaultUpdateCheckManager(trackingFileManager, updatePolicyAnalyzer);
175 }
176
177 protected Map<String, NamedLockFactory> getNamedLockFactories() {
178 HashMap<String, NamedLockFactory> result = new HashMap<>();
179 result.put(NoopNamedLockFactory.NAME, new NoopNamedLockFactory());
180 result.put(LocalReadWriteLockNamedLockFactory.NAME, new LocalReadWriteLockNamedLockFactory());
181 result.put(LocalSemaphoreNamedLockFactory.NAME, new LocalSemaphoreNamedLockFactory());
182 result.put(FileLockNamedLockFactory.NAME, new FileLockNamedLockFactory());
183 return result;
184 }
185
186 protected Map<String, NameMapper> getNameMappers() {
187 HashMap<String, NameMapper> result = new HashMap<>();
188 result.put(NameMappers.STATIC_NAME, NameMappers.staticNameMapper());
189 result.put(NameMappers.GAV_NAME, NameMappers.gavNameMapper());
190 result.put(NameMappers.DISCRIMINATING_NAME, NameMappers.discriminatingNameMapper());
191 result.put(NameMappers.FILE_GAV_NAME, NameMappers.fileGavNameMapper());
192 result.put(NameMappers.FILE_HGAV_NAME, NameMappers.fileHashingGavNameMapper());
193 return result;
194 }
195
196 protected NamedLockFactoryAdapterFactory getNamedLockFactoryAdapterFactory(
197 Map<String, NamedLockFactory> namedLockFactories,
198 Map<String, NameMapper> nameMappers,
199 RepositorySystemLifecycle repositorySystemLifecycle) {
200 return new NamedLockFactoryAdapterFactoryImpl(namedLockFactories, nameMappers, repositorySystemLifecycle);
201 }
202
203 protected SyncContextFactory getSyncContextFactory(NamedLockFactoryAdapterFactory namedLockFactoryAdapterFactory) {
204 return new DefaultSyncContextFactory(namedLockFactoryAdapterFactory);
205 }
206
207 protected Map<String, ChecksumAlgorithmFactory> getChecksumAlgorithmFactories() {
208 HashMap<String, ChecksumAlgorithmFactory> result = new HashMap<>();
209 result.put(Sha512ChecksumAlgorithmFactory.NAME, new Sha512ChecksumAlgorithmFactory());
210 result.put(Sha256ChecksumAlgorithmFactory.NAME, new Sha256ChecksumAlgorithmFactory());
211 result.put(Sha1ChecksumAlgorithmFactory.NAME, new Sha1ChecksumAlgorithmFactory());
212 result.put(Md5ChecksumAlgorithmFactory.NAME, new Md5ChecksumAlgorithmFactory());
213 return result;
214 }
215
216 protected ChecksumAlgorithmFactorySelector getChecksumAlgorithmFactorySelector(
217 Map<String, ChecksumAlgorithmFactory> checksumAlgorithmFactories) {
218 return new DefaultChecksumAlgorithmFactorySelector(checksumAlgorithmFactories);
219 }
220
221 protected Map<String, RepositoryLayoutFactory> getRepositoryLayoutFactories(
222 ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector) {
223 HashMap<String, RepositoryLayoutFactory> result = new HashMap<>();
224 result.put(
225 Maven2RepositoryLayoutFactory.NAME,
226 new Maven2RepositoryLayoutFactory(checksumAlgorithmFactorySelector));
227 return result;
228 }
229
230 protected RepositoryLayoutProvider getRepositoryLayoutProvider(
231 Map<String, RepositoryLayoutFactory> repositoryLayoutFactories) {
232 return new DefaultRepositoryLayoutProvider(repositoryLayoutFactories);
233 }
234
235 protected LocalRepositoryProvider getLocalRepositoryProvider(
236 LocalPathComposer localPathComposer,
237 TrackingFileManager trackingFileManager,
238 LocalPathPrefixComposerFactory localPathPrefixComposerFactory) {
239 HashMap<String, LocalRepositoryManagerFactory> localRepositoryProviders = new HashMap<>(2);
240 localRepositoryProviders.put(
241 SimpleLocalRepositoryManagerFactory.NAME, new SimpleLocalRepositoryManagerFactory(localPathComposer));
242 localRepositoryProviders.put(
243 EnhancedLocalRepositoryManagerFactory.NAME,
244 new EnhancedLocalRepositoryManagerFactory(
245 localPathComposer, trackingFileManager, localPathPrefixComposerFactory));
246 return new DefaultLocalRepositoryProvider(localRepositoryProviders);
247 }
248
249 protected RemoteRepositoryManager getRemoteRepositoryManager(
250 UpdatePolicyAnalyzer updatePolicyAnalyzer, ChecksumPolicyProvider checksumPolicyProvider) {
251 return new DefaultRemoteRepositoryManager(updatePolicyAnalyzer, checksumPolicyProvider);
252 }
253
254 protected Map<String, RemoteRepositoryFilterSource> getRemoteRepositoryFilterSources(
255 RepositorySystemLifecycle repositorySystemLifecycle, RepositoryLayoutProvider repositoryLayoutProvider) {
256 HashMap<String, RemoteRepositoryFilterSource> result = new HashMap<>();
257 result.put(
258 GroupIdRemoteRepositoryFilterSource.NAME,
259 new GroupIdRemoteRepositoryFilterSource(repositorySystemLifecycle));
260 result.put(
261 PrefixesRemoteRepositoryFilterSource.NAME,
262 new PrefixesRemoteRepositoryFilterSource(repositoryLayoutProvider));
263 return result;
264 }
265
266 protected RemoteRepositoryFilterManager getRemoteRepositoryFilterManager(
267 Map<String, RemoteRepositoryFilterSource> remoteRepositoryFilterSources) {
268 return new DefaultRemoteRepositoryFilterManager(remoteRepositoryFilterSources);
269 }
270
271 protected Map<String, RepositoryListener> getRepositoryListeners() {
272 return new HashMap<>();
273 }
274
275 protected RepositoryEventDispatcher getRepositoryEventDispatcher(
276 Map<String, RepositoryListener> repositoryListeners) {
277 return new DefaultRepositoryEventDispatcher(repositoryListeners);
278 }
279
280 protected Map<String, TrustedChecksumsSource> getTrustedChecksumsSources(
281 FileProcessor fileProcessor,
282 LocalPathComposer localPathComposer,
283 RepositorySystemLifecycle repositorySystemLifecycle) {
284 HashMap<String, TrustedChecksumsSource> result = new HashMap<>();
285 result.put(
286 SparseDirectoryTrustedChecksumsSource.NAME,
287 new SparseDirectoryTrustedChecksumsSource(fileProcessor, localPathComposer));
288 result.put(
289 SummaryFileTrustedChecksumsSource.NAME,
290 new SummaryFileTrustedChecksumsSource(localPathComposer, repositorySystemLifecycle));
291 return result;
292 }
293
294 protected Map<String, ProvidedChecksumsSource> getProvidedChecksumsSources(
295 Map<String, TrustedChecksumsSource> trustedChecksumsSources) {
296 HashMap<String, ProvidedChecksumsSource> result = new HashMap<>();
297 result.put(
298 TrustedToProvidedChecksumsSourceAdapter.NAME,
299 new TrustedToProvidedChecksumsSourceAdapter(trustedChecksumsSources));
300 return result;
301 }
302
303 protected Map<String, TransporterFactory> getTransporterFactories() {
304 HashMap<String, TransporterFactory> result = new HashMap<>();
305 result.put(FileTransporterFactory.NAME, new FileTransporterFactory());
306 result.put(ApacheTransporterFactory.NAME, new ApacheTransporterFactory());
307 return result;
308 }
309
310 protected TransporterProvider getTransporterProvider(Map<String, TransporterFactory> transporterFactories) {
311 return new DefaultTransporterProvider(transporterFactories);
312 }
313
314 protected BasicRepositoryConnectorFactory getBasicRepositoryConnectorFactory(
315 TransporterProvider transporterProvider,
316 RepositoryLayoutProvider repositoryLayoutProvider,
317 ChecksumPolicyProvider checksumPolicyProvider,
318 FileProcessor fileProcessor,
319 Map<String, ProvidedChecksumsSource> providedChecksumsSources) {
320 return new BasicRepositoryConnectorFactory(
321 transporterProvider,
322 repositoryLayoutProvider,
323 checksumPolicyProvider,
324 fileProcessor,
325 providedChecksumsSources);
326 }
327
328 protected Map<String, RepositoryConnectorFactory> getRepositoryConnectorFactories(
329 BasicRepositoryConnectorFactory basicRepositoryConnectorFactory) {
330 HashMap<String, RepositoryConnectorFactory> result = new HashMap<>();
331 result.put(BasicRepositoryConnectorFactory.NAME, basicRepositoryConnectorFactory);
332 return result;
333 }
334
335 protected RepositoryConnectorProvider getRepositoryConnectorProvider(
336 Map<String, RepositoryConnectorFactory> repositoryConnectorFactories,
337 RemoteRepositoryFilterManager remoteRepositoryFilterManager) {
338 return new DefaultRepositoryConnectorProvider(repositoryConnectorFactories, remoteRepositoryFilterManager);
339 }
340
341 protected Installer getInstaller(
342 FileProcessor fileProcessor,
343 RepositoryEventDispatcher repositoryEventDispatcher,
344 Map<String, MetadataGeneratorFactory> metadataGeneratorFactories,
345 SyncContextFactory syncContextFactory) {
346 return new DefaultInstaller(
347 fileProcessor, repositoryEventDispatcher, metadataGeneratorFactories, syncContextFactory);
348 }
349
350 @SuppressWarnings("checkstyle:parameternumber")
351 protected Deployer getDeployer(
352 FileProcessor fileProcessor,
353 RepositoryEventDispatcher repositoryEventDispatcher,
354 RepositoryConnectorProvider repositoryConnectorProvider,
355 RemoteRepositoryManager remoteRepositoryManager,
356 UpdateCheckManager updateCheckManager,
357 Map<String, MetadataGeneratorFactory> metadataGeneratorFactories,
358 SyncContextFactory syncContextFactory,
359 OfflineController offlineController) {
360 return new DefaultDeployer(
361 fileProcessor,
362 repositoryEventDispatcher,
363 repositoryConnectorProvider,
364 remoteRepositoryManager,
365 updateCheckManager,
366 metadataGeneratorFactories,
367 syncContextFactory,
368 offlineController);
369 }
370
371 protected Map<String, DependencyCollectorDelegate> getDependencyCollectorDelegates(
372 RemoteRepositoryManager remoteRepositoryManager,
373 ArtifactDescriptorReader artifactDescriptorReader,
374 VersionRangeResolver versionRangeResolver) {
375 HashMap<String, DependencyCollectorDelegate> result = new HashMap<>();
376 result.put(
377 DfDependencyCollector.NAME,
378 new DfDependencyCollector(remoteRepositoryManager, artifactDescriptorReader, versionRangeResolver));
379 result.put(
380 BfDependencyCollector.NAME,
381 new BfDependencyCollector(remoteRepositoryManager, artifactDescriptorReader, versionRangeResolver));
382 return result;
383 }
384
385 protected DependencyCollector getDependencyCollector(
386 Map<String, DependencyCollectorDelegate> dependencyCollectorDelegates) {
387 return new DefaultDependencyCollector(dependencyCollectorDelegates);
388 }
389
390 protected Map<String, ArtifactResolverPostProcessor> getArtifactResolverPostProcessors(
391 ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector,
392 Map<String, TrustedChecksumsSource> trustedChecksumsSources) {
393 HashMap<String, ArtifactResolverPostProcessor> result = new HashMap<>();
394 result.put(
395 TrustedChecksumsArtifactResolverPostProcessor.NAME,
396 new TrustedChecksumsArtifactResolverPostProcessor(
397 checksumAlgorithmFactorySelector, trustedChecksumsSources));
398 return result;
399 }
400
401 @SuppressWarnings("checkstyle:parameternumber")
402 protected ArtifactResolver getArtifactResolver(
403 FileProcessor fileProcessor,
404 RepositoryEventDispatcher repositoryEventDispatcher,
405 VersionResolver versionResolver,
406 UpdateCheckManager updateCheckManager,
407 RepositoryConnectorProvider repositoryConnectorProvider,
408 RemoteRepositoryManager remoteRepositoryManager,
409 SyncContextFactory syncContextFactory,
410 OfflineController offlineController,
411 Map<String, ArtifactResolverPostProcessor> artifactResolverPostProcessors,
412 RemoteRepositoryFilterManager remoteRepositoryFilterManager) {
413 return new DefaultArtifactResolver(
414 fileProcessor,
415 repositoryEventDispatcher,
416 versionResolver,
417 updateCheckManager,
418 repositoryConnectorProvider,
419 remoteRepositoryManager,
420 syncContextFactory,
421 offlineController,
422 artifactResolverPostProcessors,
423 remoteRepositoryFilterManager);
424 }
425
426 protected MetadataResolver getMetadataResolver(
427 RepositoryEventDispatcher repositoryEventDispatcher,
428 UpdateCheckManager updateCheckManager,
429 RepositoryConnectorProvider repositoryConnectorProvider,
430 RemoteRepositoryManager remoteRepositoryManager,
431 SyncContextFactory syncContextFactory,
432 OfflineController offlineController,
433 RemoteRepositoryFilterManager remoteRepositoryFilterManager) {
434 return new DefaultMetadataResolver(
435 repositoryEventDispatcher,
436 updateCheckManager,
437 repositoryConnectorProvider,
438 remoteRepositoryManager,
439 syncContextFactory,
440 offlineController,
441 remoteRepositoryFilterManager);
442 }
443
444 protected Map<String, VersionScheme> getVersionSchemes() {
445 HashMap<String, VersionScheme> result = new HashMap<>();
446 result.put(GenericVersionSchemeProvider.NAME, new GenericVersionScheme());
447 return result;
448 }
449
450 protected VersionSchemeSelector getVersionSchemeSelector(Map<String, VersionScheme> versionSchemes) {
451 return new DefaultVersionSchemeSelector(versionSchemes);
452 }
453
454
455
456 protected Map<String, MetadataGeneratorFactory> getMetadataGeneratorFactories() {
457
458 HashMap<String, MetadataGeneratorFactory> result = new HashMap<>();
459 result.put(PluginsMetadataGeneratorFactory.NAME, new PluginsMetadataGeneratorFactory());
460 result.put(VersionsMetadataGeneratorFactory.NAME, new VersionsMetadataGeneratorFactory());
461 result.put(SnapshotMetadataGeneratorFactory.NAME, new SnapshotMetadataGeneratorFactory());
462 return result;
463 }
464
465 protected ArtifactDescriptorReader getArtifactDescriptorReader(
466 RemoteRepositoryManager remoteRepositoryManager,
467 VersionResolver versionResolver,
468 VersionRangeResolver versionRangeResolver,
469 ArtifactResolver artifactResolver,
470 ModelBuilder modelBuilder,
471 RepositoryEventDispatcher repositoryEventDispatcher,
472 ModelCacheFactory modelCacheFactory) {
473
474 return new DefaultArtifactDescriptorReader(
475 remoteRepositoryManager,
476 versionResolver,
477 versionRangeResolver,
478 artifactResolver,
479 modelBuilder,
480 repositoryEventDispatcher,
481 modelCacheFactory);
482 }
483
484 protected VersionResolver getVersionResolver(
485 MetadataResolver metadataResolver,
486 SyncContextFactory syncContextFactory,
487 RepositoryEventDispatcher repositoryEventDispatcher) {
488
489 return new DefaultVersionResolver(metadataResolver, syncContextFactory, repositoryEventDispatcher);
490 }
491
492 protected VersionRangeResolver getVersionRangeResolver(
493 MetadataResolver metadataResolver,
494 SyncContextFactory syncContextFactory,
495 RepositoryEventDispatcher repositoryEventDispatcher,
496 VersionSchemeSelector versionSchemeSelector) {
497
498
499 return new DefaultVersionRangeResolver(
500 metadataResolver,
501 syncContextFactory,
502 repositoryEventDispatcher,
503 versionSchemeSelector.selectVersionScheme(GenericVersionSchemeProvider.NAME));
504 }
505
506 protected ModelBuilder getModelBuilder() {
507
508 return new DefaultModelBuilderFactory().newInstance();
509 }
510
511 protected ModelCacheFactory getModelCacheFactory() {
512
513 return new DefaultModelCacheFactory();
514 }
515
516 @Override
517 public RepositorySystem get() {
518 FileProcessor fileProcessor = getFileProcessor();
519 TrackingFileManager trackingFileManager = getTrackingFileManager();
520 LocalPathComposer localPathComposer = getLocalPathComposer();
521 LocalPathPrefixComposerFactory localPathPrefixComposerFactory = getLocalPathPrefixComposerFactory();
522 RepositorySystemLifecycle repositorySystemLifecycle = getRepositorySystemLifecycle();
523 OfflineController offlineController = getOfflineController();
524 UpdatePolicyAnalyzer updatePolicyAnalyzer = getUpdatePolicyAnalyzer();
525 ChecksumPolicyProvider checksumPolicyProvider = getChecksumPolicyProvider();
526
527 UpdateCheckManager updateCheckManager = getUpdateCheckManager(trackingFileManager, updatePolicyAnalyzer);
528
529 Map<String, NamedLockFactory> namedLockFactories = getNamedLockFactories();
530 Map<String, NameMapper> nameMappers = getNameMappers();
531 NamedLockFactoryAdapterFactory namedLockFactoryAdapterFactory =
532 getNamedLockFactoryAdapterFactory(namedLockFactories, nameMappers, repositorySystemLifecycle);
533 SyncContextFactory syncContextFactory = getSyncContextFactory(namedLockFactoryAdapterFactory);
534
535 Map<String, ChecksumAlgorithmFactory> checksumAlgorithmFactories = getChecksumAlgorithmFactories();
536 ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector =
537 getChecksumAlgorithmFactorySelector(checksumAlgorithmFactories);
538
539 Map<String, RepositoryLayoutFactory> repositoryLayoutFactories =
540 getRepositoryLayoutFactories(checksumAlgorithmFactorySelector);
541 RepositoryLayoutProvider repositoryLayoutProvider = getRepositoryLayoutProvider(repositoryLayoutFactories);
542
543 LocalRepositoryProvider localRepositoryProvider =
544 getLocalRepositoryProvider(localPathComposer, trackingFileManager, localPathPrefixComposerFactory);
545
546 RemoteRepositoryManager remoteRepositoryManager =
547 getRemoteRepositoryManager(updatePolicyAnalyzer, checksumPolicyProvider);
548 Map<String, RemoteRepositoryFilterSource> remoteRepositoryFilterSources =
549 getRemoteRepositoryFilterSources(repositorySystemLifecycle, repositoryLayoutProvider);
550 RemoteRepositoryFilterManager remoteRepositoryFilterManager =
551 getRemoteRepositoryFilterManager(remoteRepositoryFilterSources);
552
553 Map<String, RepositoryListener> repositoryListeners = getRepositoryListeners();
554 RepositoryEventDispatcher repositoryEventDispatcher = getRepositoryEventDispatcher(repositoryListeners);
555
556 Map<String, TrustedChecksumsSource> trustedChecksumsSources =
557 getTrustedChecksumsSources(fileProcessor, localPathComposer, repositorySystemLifecycle);
558 Map<String, ProvidedChecksumsSource> providedChecksumsSources =
559 getProvidedChecksumsSources(trustedChecksumsSources);
560
561 Map<String, TransporterFactory> transporterFactories = getTransporterFactories();
562 TransporterProvider transporterProvider = getTransporterProvider(transporterFactories);
563
564 BasicRepositoryConnectorFactory basic = getBasicRepositoryConnectorFactory(
565 transporterProvider,
566 repositoryLayoutProvider,
567 checksumPolicyProvider,
568 fileProcessor,
569 providedChecksumsSources);
570 Map<String, RepositoryConnectorFactory> repositoryConnectorFactories = getRepositoryConnectorFactories(basic);
571 RepositoryConnectorProvider repositoryConnectorProvider =
572 getRepositoryConnectorProvider(repositoryConnectorFactories, remoteRepositoryFilterManager);
573
574 Map<String, MetadataGeneratorFactory> metadataGeneratorFactories = getMetadataGeneratorFactories();
575
576 Installer installer =
577 getInstaller(fileProcessor, repositoryEventDispatcher, metadataGeneratorFactories, syncContextFactory);
578 Deployer deployer = getDeployer(
579 fileProcessor,
580 repositoryEventDispatcher,
581 repositoryConnectorProvider,
582 remoteRepositoryManager,
583 updateCheckManager,
584 metadataGeneratorFactories,
585 syncContextFactory,
586 offlineController);
587
588 MetadataResolver metadataResolver = getMetadataResolver(
589 repositoryEventDispatcher,
590 updateCheckManager,
591 repositoryConnectorProvider,
592 remoteRepositoryManager,
593 syncContextFactory,
594 offlineController,
595 remoteRepositoryFilterManager);
596
597 Map<String, VersionScheme> versionSchemes = getVersionSchemes();
598 VersionSchemeSelector versionSchemeSelector = getVersionSchemeSelector(versionSchemes);
599 VersionResolver versionResolver =
600 getVersionResolver(metadataResolver, syncContextFactory, repositoryEventDispatcher);
601 VersionRangeResolver versionRangeResolver = getVersionRangeResolver(
602 metadataResolver, syncContextFactory, repositoryEventDispatcher, versionSchemeSelector);
603
604 Map<String, ArtifactResolverPostProcessor> artifactResolverPostProcessors =
605 getArtifactResolverPostProcessors(checksumAlgorithmFactorySelector, trustedChecksumsSources);
606 ArtifactResolver artifactResolver = getArtifactResolver(
607 fileProcessor,
608 repositoryEventDispatcher,
609 versionResolver,
610 updateCheckManager,
611 repositoryConnectorProvider,
612 remoteRepositoryManager,
613 syncContextFactory,
614 offlineController,
615 artifactResolverPostProcessors,
616 remoteRepositoryFilterManager);
617
618 ModelBuilder modelBuilder = getModelBuilder();
619 ModelCacheFactory modelCacheFactory = getModelCacheFactory();
620
621 ArtifactDescriptorReader artifactDescriptorReader = getArtifactDescriptorReader(
622 remoteRepositoryManager,
623 versionResolver,
624 versionRangeResolver,
625 artifactResolver,
626 modelBuilder,
627 repositoryEventDispatcher,
628 modelCacheFactory);
629
630 Map<String, DependencyCollectorDelegate> dependencyCollectorDelegates = getDependencyCollectorDelegates(
631 remoteRepositoryManager, artifactDescriptorReader, versionRangeResolver);
632 DependencyCollector dependencyCollector = getDependencyCollector(dependencyCollectorDelegates);
633
634 return new DefaultRepositorySystem(
635 versionResolver,
636 versionRangeResolver,
637 artifactResolver,
638 metadataResolver,
639 artifactDescriptorReader,
640 dependencyCollector,
641 installer,
642 deployer,
643 localRepositoryProvider,
644 syncContextFactory,
645 remoteRepositoryManager,
646 repositorySystemLifecycle);
647 }
648 }