1 package org.apache.maven.plugin.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.plugin.dependency.fromConfiguration.ArtifactItem;
25 import org.apache.maven.plugin.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 = null;
39 if ( this.artifactItem == null
40 || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
41 && StringUtils.isEmpty( this.artifactItem.getExcludes() ) ) )
42 {
43 markerFile = 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, this.artifact.getId().replace( ':', '-' ) + includeExcludeHash );
60 }
61
62 return markerFile;
63 }
64 }