1 package com.atlassian.maven.plugins.amps;
2
3 import com.atlassian.maven.plugins.amps.util.ArtifactRetriever;
4
5 import java.io.File;
6 import java.util.HashMap;
7 import java.util.List;
8 import java.util.ArrayList;
9 import java.util.Map;
10 import java.util.Properties;
11
12 public class Product
13 {
14
15
16
17 protected String containerId;
18
19
20
21
22 private int httpPort = 0;
23
24
25
26
27 protected String contextPath;
28
29
30
31
32 protected String server;
33
34
35
36
37 protected String version;
38
39
40
41
42 protected String jvmArgs = null;
43
44
45
46
47 protected File log4jProperties;
48
49
50
51
52 protected String productDataVersion;
53
54
55
56
57 protected String productDataPath = "";
58
59
60
61 private List<ProductArtifact> pluginArtifacts = new ArrayList<ProductArtifact>();
62
63
64
65 private List<ProductArtifact> libArtifacts = new ArrayList<ProductArtifact>();
66
67
68
69 private List<ProductArtifact> bundledArtifacts = new ArrayList<ProductArtifact>();
70
71
72
73
74 private String salVersion;
75
76
77
78
79 private String pdkVersion;
80
81
82
83
84 private String restVersion;
85
86
87
88
89 private String webConsoleVersion;
90
91
92
93
94 private String id;
95
96
97
98
99 private String instanceId;
100
101 private ArtifactRetriever artifactRetriever;
102
103
104
105
106 private Boolean installPlugin;
107
108
109
110
111 private Map<String,Object> systemProperties = new HashMap<String,Object>();
112
113
114
115
116 private String output;
117
118
119
120
121 private int jvmDebugPort;
122
123
124
125
126 private int startupTimeout = 0;
127
128
129
130
131 private int shutdownTimeout = 0;
132
133
134
135
136
137
138
139 public Product merge(Product product)
140 {
141 Product prod = new Product();
142 prod.setOutput(output == null ? product.getOutput() : output);
143
144 Map<String,Object> sysProps = new HashMap<String,Object>();
145 sysProps.putAll(product.getSystemPropertyVariables());
146 sysProps.putAll(systemProperties);
147 prod.setSystemPropertyVariables(sysProps);
148
149 prod.setInstallPlugin(installPlugin == null ? product.isInstallPlugin() : installPlugin);
150 prod.setArtifactRetriever(artifactRetriever == null ? product.getArtifactRetriever() : artifactRetriever);
151 prod.setId(id == null ? product.getId() : id);
152 prod.setInstanceId(instanceId == null ? product.getInstanceId() : instanceId);
153 prod.setWebConsoleVersion(webConsoleVersion == null ? product.getWebConsoleVersion() : webConsoleVersion);
154 prod.setRestVersion(restVersion == null ? product.getRestVersion() : restVersion);
155 prod.setPdkVersion(pdkVersion == null ? product.getPdkVersion() : pdkVersion);
156 prod.setSalVersion(salVersion == null ? product.getSalVersion() : salVersion);
157
158 prod.setBundledArtifacts(bundledArtifacts.isEmpty() ? product.getBundledArtifacts() : bundledArtifacts);
159 prod.setPluginArtifacts(pluginArtifacts.isEmpty() ? product.getPluginArtifacts() : pluginArtifacts);
160 prod.setLibArtifacts(libArtifacts.isEmpty() ? product.getLibArtifacts() : libArtifacts);
161
162 prod.setDataPath(productDataPath.length() == 0 ? product.getDataPath() : productDataPath);
163 prod.setDataVersion(productDataVersion == null ? product.getDataVersion() : productDataVersion);
164 prod.setLog4jProperties(log4jProperties == null ? product.getLog4jProperties() : log4jProperties);
165 prod.setJvmArgs(jvmArgs == null ? product.getJvmArgs() : jvmArgs);
166 prod.setVersion(version == null ? product.getVersion() : version);
167
168 prod.setServer(server == null ? product.getServer() : server);
169 prod.setContextPath(contextPath == null ? product.getContextPath() : contextPath);
170 prod.setContainerId(containerId == null ? product.getContainerId() : containerId);
171 prod.setHttpPort(httpPort == 0 ? product.getHttpPort() : httpPort);
172 prod.setJvmDebugPort(jvmDebugPort == 0 ? product.getJvmDebugPort() : jvmDebugPort);
173
174 prod.setStartupTimeout(startupTimeout == 0 ? product.getStartupTimeout() : startupTimeout);
175 prod.setShutdownTimeout(shutdownTimeout == 0 ? product.getShutdownTimeout() : shutdownTimeout);
176
177 return prod;
178 }
179
180 public String getContainerId()
181 {
182 return containerId;
183 }
184
185 public void setContainerId(String containerId)
186 {
187 this.containerId = containerId;
188 }
189
190 public String getServer()
191 {
192 return server;
193 }
194
195 public void setServer(String server)
196 {
197 this.server = server;
198 }
199
200 public int getHttpPort()
201 {
202 return httpPort;
203 }
204
205 public void setHttpPort(int httpPort)
206 {
207 this.httpPort = httpPort;
208 }
209
210 public String getContextPath()
211 {
212 return contextPath;
213 }
214
215 public void setContextPath(String contextPath)
216 {
217 this.contextPath = contextPath;
218 }
219
220 public String getJvmArgs()
221 {
222 return jvmArgs;
223 }
224
225 public void setJvmArgs(String jvmArgs)
226 {
227 this.jvmArgs = jvmArgs;
228 }
229
230 public ArtifactRetriever getArtifactRetriever()
231 {
232 return artifactRetriever;
233 }
234
235 public void setArtifactRetriever(ArtifactRetriever artifactRetriever)
236 {
237 this.artifactRetriever = artifactRetriever;
238 }
239
240 public String getVersion()
241 {
242 return version;
243 }
244
245 public void setVersion(String version)
246 {
247 this.version = version;
248 }
249
250 public String getDataVersion()
251 {
252 return productDataVersion;
253 }
254
255 public void setDataVersion(String productDataVersion)
256 {
257 this.productDataVersion = productDataVersion;
258 }
259
260
261
262
263 public String getProductDataVersion()
264 {
265 return productDataVersion;
266 }
267
268
269
270
271 public void setProductDataVersion(String productDataVersion)
272 {
273 this.productDataVersion = productDataVersion;
274 }
275
276 public String getDataPath()
277 {
278 return productDataPath;
279 }
280
281 public void setDataPath(String productDataPath)
282 {
283 this.productDataPath = productDataPath;
284 }
285
286
287
288
289 public String getProductDataPath()
290 {
291 return productDataPath;
292 }
293
294
295
296
297 public void setProductDataPath(String productDataPath)
298 {
299 this.productDataPath = productDataPath;
300 }
301
302 public List<ProductArtifact> getPluginArtifacts()
303 {
304 return pluginArtifacts;
305 }
306
307 public void setPluginArtifacts(List<ProductArtifact> pluginArtifacts)
308 {
309 this.pluginArtifacts = pluginArtifacts;
310 }
311
312 public List<ProductArtifact> getLibArtifacts()
313 {
314 return libArtifacts;
315 }
316
317 public void setLibArtifacts(List<ProductArtifact> libArtifacts)
318 {
319 this.libArtifacts = libArtifacts;
320 }
321
322 public List<ProductArtifact> getBundledArtifacts()
323 {
324 return bundledArtifacts;
325 }
326
327 public void setBundledArtifacts(List<ProductArtifact> bundledArtifacts)
328 {
329 this.bundledArtifacts = bundledArtifacts;
330 }
331
332 public File getLog4jProperties()
333 {
334 return log4jProperties;
335 }
336
337 public void setLog4jProperties(File log4jProperties)
338 {
339 this.log4jProperties = log4jProperties;
340 }
341
342 public String getRestVersion()
343 {
344 return restVersion;
345 }
346
347 public void setRestVersion(String restVersion)
348 {
349 this.restVersion = restVersion;
350 }
351
352 public String getSalVersion()
353 {
354 return salVersion;
355 }
356
357 public void setSalVersion(String salVersion)
358 {
359 this.salVersion = salVersion;
360 }
361
362 public String getPdkVersion()
363 {
364 return pdkVersion;
365 }
366
367 public void setPdkVersion(String pdkVersion)
368 {
369 this.pdkVersion = pdkVersion;
370 }
371
372 public String getId()
373 {
374 return id;
375 }
376
377 public void setId(String id)
378 {
379 this.id = id;
380 }
381
382 public String getInstanceId()
383 {
384 return instanceId;
385 }
386
387 public void setInstanceId(String instanceId)
388 {
389 this.instanceId = instanceId;
390 }
391
392 public Boolean isInstallPlugin()
393 {
394 return installPlugin;
395 }
396
397 public void setInstallPlugin(final Boolean installPlugin)
398 {
399 this.installPlugin = installPlugin;
400 }
401
402 public String getWebConsoleVersion()
403 {
404 return webConsoleVersion;
405 }
406
407 public void setWebConsoleVersion(String webConsoleVersion)
408 {
409 this.webConsoleVersion = webConsoleVersion;
410 }
411
412
413
414
415 public void setSystemProperties(Properties systemProperties)
416 {
417 this.systemProperties.putAll((Map) systemProperties);
418 }
419
420
421
422
423 public Properties getSystemProperties()
424 {
425 Properties props = new Properties();
426 props.putAll(systemProperties);
427 return props;
428 }
429
430 public void setSystemPropertyVariables(Map<String,Object> systemProperties)
431 {
432 this.systemProperties = systemProperties;
433 }
434
435 public Map<String,Object> getSystemPropertyVariables()
436 {
437 return systemProperties;
438 }
439
440 public String getOutput()
441 {
442 return output;
443 }
444
445 public void setOutput(String output)
446 {
447 this.output = output;
448 }
449
450 public int getJvmDebugPort()
451 {
452 return jvmDebugPort;
453 }
454
455 public void setJvmDebugPort(int jvmDebugPort)
456 {
457 this.jvmDebugPort = jvmDebugPort;
458 }
459
460 public int getStartupTimeout()
461 {
462 return startupTimeout;
463 }
464
465 public void setStartupTimeout(int startupTimeout)
466 {
467 this.startupTimeout = startupTimeout;
468 }
469
470 public int getShutdownTimeout()
471 {
472 return shutdownTimeout;
473 }
474
475 public void setShutdownTimeout(int shutdownTimeout)
476 {
477 this.shutdownTimeout = shutdownTimeout;
478 }
479 }