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 import org.codehaus.plexus.component.annotations.Component;
27
28
29
30
31 @Component( role = ArtifactRepositoryLayout.class, hint = "legacy")
32 public class LegacyRepositoryLayout
33 implements ArtifactRepositoryLayout
34 {
35
36 private static final String PATH_SEPARATOR = "/";
37
38 public String getId()
39 {
40 return "legacy";
41 }
42
43 @Override
44 public String pathOf( Artifact artifact )
45 {
46 ArtifactHandler artifactHandler = artifact.getArtifactHandler();
47
48 StringBuilder path = new StringBuilder( 128 );
49
50 path.append( artifact.getGroupId() ).append( '/' );
51 path.append( artifactHandler.getDirectory() ).append( '/' );
52 path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
53
54 if ( artifact.hasClassifier() )
55 {
56 path.append( '-' ).append( artifact.getClassifier() );
57 }
58
59 if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
60 {
61 path.append( '.' ).append( artifactHandler.getExtension() );
62 }
63
64 return path.toString();
65 }
66
67 @Override
68 public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
69 {
70 return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
71 }
72
73 private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename )
74 {
75 StringBuilder path = new StringBuilder( 128 );
76
77 path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
78
79 path.append( filename );
80
81 return path.toString();
82 }
83
84 @Override
85 public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
86 {
87 return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
88 }
89
90 }