This project has retired. For details please refer to its
Attic page.
LegacyRepositoryLayout xref
1 package org.apache.archiva.converter.artifact;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.maven.artifact.Artifact;
22 import org.apache.maven.artifact.handler.ArtifactHandler;
23 import org.apache.maven.artifact.metadata.ArtifactMetadata;
24 import org.apache.maven.artifact.repository.ArtifactRepository;
25 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
26
27
28
29
30 public class LegacyRepositoryLayout
31 implements ArtifactRepositoryLayout
32 {
33
34 private static final String PATH_SEPARATOR = "/";
35
36 public String getId()
37 {
38 return "legacy";
39 }
40
41 @Override
42 public String pathOf( Artifact artifact )
43 {
44 ArtifactHandler artifactHandler = artifact.getArtifactHandler();
45
46 StringBuilder path = new StringBuilder( 128 );
47
48 path.append( artifact.getGroupId() ).append( '/' );
49 path.append( artifactHandler.getDirectory() ).append( '/' );
50 path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
51
52 if ( artifact.hasClassifier() )
53 {
54 path.append( '-' ).append( artifact.getClassifier() );
55 }
56
57 if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
58 {
59 path.append( '.' ).append( artifactHandler.getExtension() );
60 }
61
62 return path.toString();
63 }
64
65 @Override
66 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
67 {
68 return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
69 }
70
71 private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename )
72 {
73 StringBuilder path = new StringBuilder( 128 );
74
75 path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
76
77 path.append( filename );
78
79 return path.toString();
80 }
81
82 @Override
83 public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
84 {
85 return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
86 }
87
88 }