1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.dependency.utils.markers;
20
21 import java.io.File;
22
23 import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;
24 import org.apache.maven.plugins.dependency.utils.StringUtils;
25
26
27
28
29 public class UnpackFileMarkerHandler extends DefaultFileMarkerHandler {
30
31
32
33 protected ArtifactItem artifactItem;
34
35
36
37
38 public UnpackFileMarkerHandler(File markerFilesDirectory) {
39 super(markerFilesDirectory);
40 }
41
42
43
44
45
46 public UnpackFileMarkerHandler(ArtifactItem artifactItem, File markerFilesDirectory) {
47 this(markerFilesDirectory);
48 setArtifactItem(artifactItem);
49 }
50
51 @Override
52 protected File getMarkerFile() {
53
54
55
56
57
58 File markerFile;
59 if (this.artifactItem == null
60 || (StringUtils.isEmpty(this.artifactItem.getIncludes())
61 && StringUtils.isEmpty(this.artifactItem.getExcludes()))) {
62 markerFile = super.getMarkerFile();
63 } else {
64 int includeExcludeHash = 0;
65
66 if (StringUtils.isNotEmpty(this.artifactItem.getIncludes())) {
67 includeExcludeHash += this.artifactItem.getIncludes().hashCode();
68 }
69
70 if (StringUtils.isNotEmpty(this.artifactItem.getExcludes())) {
71 includeExcludeHash += this.artifactItem.getExcludes().hashCode();
72 }
73
74 markerFile =
75 new File(this.markerFilesDirectory, this.artifact.getId().replace(':', '-') + includeExcludeHash);
76 }
77
78 return markerFile;
79 }
80
81
82
83
84 public void setArtifactItem(ArtifactItem artifactItem) {
85 this.artifactItem = artifactItem;
86
87 if (this.artifactItem != null) {
88 setArtifact(this.artifactItem.getArtifact());
89 }
90 }
91
92
93
94
95 public ArtifactItem getArtifactItem() {
96 return this.artifactItem;
97 }
98 }