1 package org.apache.maven.plugin.dependency.testUtils.stubs;
2
3 import java.io.File;
4
5 import org.apache.maven.plugin.dependency.fromConfiguration.ArtifactItem;
6 import org.apache.maven.plugin.dependency.utils.markers.UnpackFileMarkerHandler;
7 import org.codehaus.plexus.util.StringUtils;
8
9 public class StubUnpackFileMarkerHandler
10 extends UnpackFileMarkerHandler
11 {
12 public StubUnpackFileMarkerHandler( ArtifactItem artifactItem, File markerFilesDirectory )
13 {
14 super( artifactItem, markerFilesDirectory );
15 }
16
17 protected File getMarkerFile()
18 {
19 File markerFile = null;
20 if ( this.artifactItem == null
21 || ( StringUtils.isEmpty( this.artifactItem.getIncludes() )
22 && StringUtils.isEmpty( this.artifactItem.getExcludes() ) ) )
23 {
24 markerFile = new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + ".marker" );
25 }
26 else
27 {
28 int includeExcludeHash = 0;
29
30 if ( StringUtils.isNotEmpty( this.artifactItem.getIncludes() ) )
31 {
32 includeExcludeHash += this.artifactItem.getIncludes().hashCode();
33 }
34
35 if ( StringUtils.isNotEmpty( this.artifactItem.getExcludes() ) )
36 {
37 includeExcludeHash += this.artifactItem.getExcludes().hashCode();
38 }
39
40 markerFile = new StubMarkerFile( this.markerFilesDirectory, this.artifact.getId().replace( ':', '-' ) + includeExcludeHash );
41 }
42
43 return markerFile;
44 }
45 }