1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.resolver.examples.sisu;
20
21 import javax.inject.Inject;
22 import javax.inject.Named;
23 import javax.inject.Provider;
24
25 import com.google.inject.Guice;
26 import com.google.inject.Module;
27 import org.apache.maven.model.building.DefaultModelBuilderFactory;
28 import org.apache.maven.model.building.ModelBuilder;
29 import org.eclipse.aether.RepositorySystem;
30 import org.eclipse.aether.util.version.GenericVersionScheme;
31 import org.eclipse.aether.version.VersionScheme;
32 import org.eclipse.sisu.launch.Main;
33 import org.eclipse.sisu.space.BeanScanning;
34
35
36
37
38 @Named
39 public class SisuRepositorySystemFactory {
40 @Inject
41 private RepositorySystem repositorySystem;
42
43 public static RepositorySystem newRepositorySystem() {
44 final Module app = Main.wire(BeanScanning.INDEX, new SisuRepositorySystemDemoModule());
45 return Guice.createInjector(app).getInstance(SisuRepositorySystemFactory.class).repositorySystem;
46 }
47
48 @Named
49 private static class ModelBuilderProvider implements Provider<ModelBuilder> {
50 public ModelBuilder get() {
51 return new DefaultModelBuilderFactory().newInstance();
52 }
53 }
54
55 @Named
56 private static class VersionSchemeProvider implements Provider<VersionScheme> {
57 public VersionScheme get() {
58 return new GenericVersionScheme();
59 }
60 }
61 }