1 package org.apache.maven.repository;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.artifact.metadata.ArtifactMetadata;
26 import org.apache.maven.artifact.repository.ArtifactRepository;
27
28
29
30
31 public class UserLocalArtifactRepository
32 extends LocalArtifactRepository
33 {
34 private ArtifactRepository localRepository;
35
36 public UserLocalArtifactRepository( ArtifactRepository localRepository )
37 {
38 this.localRepository = localRepository;
39 setLayout( localRepository.getLayout() );
40 }
41
42 @Override
43 public Artifact find( Artifact artifact )
44 {
45 File artifactFile = new File( localRepository.getBasedir(), pathOf( artifact ) );
46
47
48
49 artifact.setFile( artifactFile );
50
51 return artifact;
52 }
53
54 @Override
55 public String getId()
56 {
57 return localRepository.getId();
58 }
59
60 @Override
61 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
62 {
63 return localRepository.pathOfLocalRepositoryMetadata( metadata, repository );
64 }
65
66 @Override
67 public String pathOf( Artifact artifact )
68 {
69 return localRepository.pathOf( artifact );
70 }
71
72 @Override
73 public boolean hasLocalMetadata()
74 {
75 return true;
76 }
77 }