1 package org.apache.maven.plugins.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 private File file;
41
42 private ArtifactHandler artifactHandler;
43
44 public JarArtifactStub( String basedir, ArtifactHandler artifactHandler )
45 {
46 super( basedir );
47 this.artifactHandler = artifactHandler;
48 }
49
50 public void setGroupId( String id )
51 {
52 groupId = id;
53 }
54
55 public String getGroupId()
56 {
57 if ( groupId != null )
58 {
59 return groupId;
60 }
61 else
62 {
63 return "org.sample.jar";
64 }
65 }
66
67 public String getType()
68 {
69 return "jar";
70 }
71
72 public void setArtifactId( String artifactId )
73 {
74 this.artifactId = artifactId;
75 }
76
77 public String getArtifactId()
78 {
79 if ( artifactId != null )
80 {
81 return artifactId;
82 }
83 else
84 {
85 return "jarartifact";
86 }
87 }
88
89 public String getVersion()
90 {
91 if ( version != null )
92 {
93 return version;
94 }
95 else
96 {
97 return super.getVersion();
98 }
99 }
100
101 public void setVersion( String version )
102 {
103 this.version = version;
104 }
105
106 public boolean isOptional()
107 {
108 return optional;
109 }
110
111 public void setOptional( boolean optional )
112 {
113 this.optional = optional;
114 }
115
116 public String getScope()
117 {
118 if ( scope != null )
119 {
120 return scope;
121 }
122 else
123 {
124 return super.getScope();
125 }
126 }
127
128 public void setScope( String scope )
129 {
130 this.scope = scope;
131 }
132
133 public File getFile()
134 {
135 if ( file == null )
136 {
137 return new File( basedir, "/target/test-classes/unit/sample_wars/simple.jar" );
138 }
139 return file;
140 }
141
142 public void setFile( File file )
143 {
144 this.file = file;
145 }
146
147 public ArtifactHandler getArtifactHandler()
148 {
149 return artifactHandler;
150 }
151 }