1 package org.eclipse.aether.internal.impl;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Objects;
23
24 import javax.inject.Inject;
25 import javax.inject.Named;
26 import javax.inject.Singleton;
27
28 import org.eclipse.aether.RepositorySystemSession;
29 import org.eclipse.aether.repository.LocalRepository;
30 import org.eclipse.aether.repository.LocalRepositoryManager;
31 import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
32 import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
33 import org.eclipse.aether.spi.locator.Service;
34 import org.eclipse.aether.spi.locator.ServiceLocator;
35
36
37
38
39
40
41
42
43 @Singleton
44 @Named( "enhanced" )
45 public class EnhancedLocalRepositoryManagerFactory
46 implements LocalRepositoryManagerFactory, Service
47 {
48 private float priority = 10.0f;
49
50 private TrackingFileManager trackingFileManager;
51
52 public EnhancedLocalRepositoryManagerFactory()
53 {
54
55 }
56
57 @Inject
58 public EnhancedLocalRepositoryManagerFactory( final TrackingFileManager trackingFileManager )
59 {
60 this.trackingFileManager = Objects.requireNonNull( trackingFileManager );
61 }
62
63 @Override
64 public void initService( final ServiceLocator locator )
65 {
66 this.trackingFileManager = Objects.requireNonNull( locator.getService( TrackingFileManager.class ) );
67 }
68
69 public LocalRepositoryManager newInstance( RepositorySystemSession session, LocalRepository repository )
70 throws NoLocalRepositoryManagerException
71 {
72 if ( "".equals( repository.getContentType() ) || "default".equals( repository.getContentType() ) )
73 {
74 return new EnhancedLocalRepositoryManager( repository.getBasedir(), session, trackingFileManager );
75 }
76 else
77 {
78 throw new NoLocalRepositoryManagerException( repository );
79 }
80 }
81
82 public float getPriority()
83 {
84 return priority;
85 }
86
87
88
89
90
91
92
93 public EnhancedLocalRepositoryManagerFactory setPriority( float priority )
94 {
95 this.priority = priority;
96 return this;
97 }
98
99 }