1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.war.stub;
20
21 import java.io.File;
22
23 import org.apache.maven.artifact.handler.ArtifactHandler;
24
25 public class JarArtifactStub extends AbstractArtifactStub {
26
27 protected String groupId;
28
29 protected String artifactId;
30
31 protected String version;
32
33 protected boolean optional = false;
34
35 protected String scope;
36
37 private File file;
38
39 private ArtifactHandler artifactHandler;
40
41 public JarArtifactStub(String basedir, ArtifactHandler artifactHandler) {
42 super(basedir);
43 this.artifactHandler = artifactHandler;
44 }
45
46 public void setGroupId(String id) {
47 groupId = id;
48 }
49
50 public String getGroupId() {
51 if (groupId != null) {
52 return groupId;
53 } else {
54 return "org.sample.jar";
55 }
56 }
57
58 public String getType() {
59 return "jar";
60 }
61
62 public void setArtifactId(String artifactId) {
63 this.artifactId = artifactId;
64 }
65
66 public String getArtifactId() {
67 if (artifactId != null) {
68 return artifactId;
69 } else {
70 return "jarartifact";
71 }
72 }
73
74 public String getVersion() {
75 if (version != null) {
76 return version;
77 } else {
78 return super.getVersion();
79 }
80 }
81
82 public void setVersion(String version) {
83 this.version = version;
84 }
85
86 public boolean isOptional() {
87 return optional;
88 }
89
90 public void setOptional(boolean optional) {
91 this.optional = optional;
92 }
93
94 public String getScope() {
95 if (scope != null) {
96 return scope;
97 } else {
98 return super.getScope();
99 }
100 }
101
102 public void setScope(String scope) {
103 this.scope = scope;
104 }
105
106 public File getFile() {
107 if (file == null) {
108 return new File(basedir, "/target/test-classes/unit/sample_wars/simple.jar");
109 }
110 return file;
111 }
112
113 public void setFile(File file) {
114 this.file = file;
115 }
116
117 public ArtifactHandler getArtifactHandler() {
118 return artifactHandler;
119 }
120 }