1 package org.eclipse.aether.internal.transport.wagon;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static java.util.Objects.requireNonNull;
23
24 import org.apache.maven.wagon.Wagon;
25 import org.codehaus.plexus.PlexusContainer;
26 import org.eclipse.aether.transport.wagon.WagonProvider;
27
28 import javax.inject.Inject;
29 import javax.inject.Named;
30 import javax.inject.Singleton;
31
32
33
34
35 @Named( "plexus" )
36 @Singleton
37 public class PlexusWagonProvider
38 implements WagonProvider
39 {
40 private final PlexusContainer container;
41
42
43
44
45
46
47 @Inject
48 public PlexusWagonProvider( final PlexusContainer container )
49 {
50 this.container = requireNonNull( container, "plexus container cannot be null" );
51 }
52
53 public Wagon lookup( String roleHint )
54 throws Exception
55 {
56 return container.lookup( Wagon.class, roleHint );
57 }
58
59 public void release( Wagon wagon )
60 {
61 try
62 {
63 if ( wagon != null )
64 {
65 container.release( wagon );
66 }
67 }
68 catch ( Exception e )
69 {
70
71 }
72 }
73
74 }