1 package org.apache.maven.plugins.dependency.testUtils.stubs;
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.plugins.dependency.fromConfiguration.ArtifactItem;
25 import org.apache.maven.plugins.dependency.utils.markers.UnpackFileMarkerHandler;
26 import org.codehaus.plexus.util.StringUtils;
27
28 public class StubUnpackFileMarkerHandler
29 extends UnpackFileMarkerHandler
30 {
31 public StubUnpackFileMarkerHandler( ArtifactItem artifactItem, File markerFilesDirectory )
32 {
33 super( artifactItem, markerFilesDirectory );
34 }
35
36 protected File getMarkerFile()
37 {
38 File markerFile;
39 if ( this.artifactItem == null || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
40 && StringUtils.isEmpty( this.artifactItem.getExcludes() ) ) )
41 {
42 markerFile =
43 new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + ".marker" );
44 }
45 else
46 {
47 int includeExcludeHash = 0;
48
49 if ( StringUtils.isNotEmpty( this.artifactItem.getIncludes() ) )
50 {
51 includeExcludeHash += this.artifactItem.getIncludes().hashCode();
52 }
53
54 if ( StringUtils.isNotEmpty( this.artifactItem.getExcludes() ) )
55 {
56 includeExcludeHash += this.artifactItem.getExcludes().hashCode();
57 }
58
59 markerFile = new StubMarkerFile( this.markerFilesDirectory,
60 this.artifact.getId().replace( ':', '-' ) + includeExcludeHash );
61 }
62
63 return markerFile;
64 }
65 }