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