1 package com.atlassian.maven.plugins.amps;
2
3 import com.atlassian.maven.plugins.amps.product.studio.StudioProductHandler;
4 import com.atlassian.maven.plugins.amps.product.studio.StudioProperties;
5 import com.atlassian.maven.plugins.amps.util.ArtifactRetriever;
6
7 import java.io.File;
8 import java.util.HashMap;
9 import java.util.List;
10 import java.util.ArrayList;
11 import java.util.Map;
12 import java.util.Properties;
13
14 import org.apache.maven.surefire.shade.org.apache.commons.lang.StringUtils;
15
16 public class Product
17 {
18
19
20
21 protected String containerId;
22
23
24
25
26 protected int httpPort = 0;
27
28
29
30
31 protected String contextPath;
32
33
34
35
36 protected String server;
37
38
39
40
41 protected String version;
42
43
44
45
46 protected String jvmArgs = null;
47
48
49
50
51 protected File log4jProperties;
52
53
54
55
56 protected String productDataVersion;
57
58
59
60
61
62 protected String productDataPath = "";
63
64
65
66
67
68 protected String dataHome = "";
69
70
71
72 private List<ProductArtifact> pluginArtifacts = new ArrayList<ProductArtifact>();
73
74
75
76 private List<ProductArtifact> libArtifacts = new ArrayList<ProductArtifact>();
77
78
79
80 private List<ProductArtifact> bundledArtifacts = new ArrayList<ProductArtifact>();
81
82
83
84
85 private String salVersion;
86
87
88
89
90 private String pdkVersion;
91
92
93
94
95 private String restVersion;
96
97
98
99
100 private String webConsoleVersion;
101
102
103
104
105 private Boolean enableFastdev;
106
107
108
109
110 private String fastdevVersion;
111
112
113
114
115 private Boolean enableDevToolbox;
116
117
118
119
120 private String devToolboxVersion;
121
122
123
124
125 private Boolean enablePde;
126
127
128
129
130 private String pdeVersion;
131
132
133
134
135 protected String id;
136
137
138
139
140 protected String instanceId;
141
142 private ArtifactRetriever artifactRetriever;
143
144
145
146
147 private Boolean installPlugin;
148
149
150
151
152 private Map<String,Object> systemProperties = new HashMap<String,Object>();
153
154
155
156
157 private String output;
158
159
160
161
162 private int jvmDebugPort;
163
164
165
166
167 private int startupTimeout = 0;
168
169
170
171
172 private int shutdownTimeout = 0;
173
174
175
176
177
178
179
180
181
182 private Boolean synchronousStartup;
183
184
185
186
187 private String groupId;
188
189
190
191
192 private String artifactId;
193
194
195
196
197
198
199
200
201
202
203 protected StudioProperties studioProperties;
204
205
206
207
208
209
210
211 protected List<String> instanceIds = new ArrayList<String>();
212
213
214
215
216
217 protected String gappsEnabled;
218
219
220
221
222
223 protected String gappsDomain;
224
225
226
227
228
229 protected Boolean shutdownEnabled;
230
231
232
233
234
235
236
237
238
239 public Product merge(Product product)
240 {
241 Product prod = new Product();
242 prod.setOutput(output == null ? product.getOutput() : output);
243
244 Map<String,Object> sysProps = new HashMap<String,Object>();
245 sysProps.putAll(product.getSystemPropertyVariables());
246 sysProps.putAll(systemProperties);
247 prod.setSystemPropertyVariables(sysProps);
248
249 prod.setInstallPlugin(installPlugin == null ? product.isInstallPlugin() : installPlugin);
250 prod.setArtifactRetriever(artifactRetriever == null ? product.getArtifactRetriever() : artifactRetriever);
251 prod.setId(id == null ? product.getId() : id);
252 prod.setInstanceId(instanceId == null ? product.getInstanceId() : instanceId);
253 prod.setWebConsoleVersion(webConsoleVersion == null ? product.getWebConsoleVersion() : webConsoleVersion);
254 prod.setEnableFastdev(enableFastdev == null ? product.isEnableFastdev() : enableFastdev);
255 prod.setFastdevVersion(fastdevVersion == null ? product.getFastdevVersion() : fastdevVersion);
256 prod.setEnableDevToolbox(enableDevToolbox == null ? product.isEnableDevToolbox() : enableDevToolbox);
257 prod.setDevToolboxVersion(devToolboxVersion == null ? product.getDevToolboxVersion() : devToolboxVersion);
258 prod.setEnablePde(enablePde == null ? product.isEnablePde() : enablePde);
259 prod.setPdeVersion(pdeVersion == null ? product.getPdeVersion() : pdeVersion);
260 prod.setRestVersion(restVersion == null ? product.getRestVersion() : restVersion);
261 prod.setPdkVersion(pdkVersion == null ? product.getPdkVersion() : pdkVersion);
262 prod.setSalVersion(salVersion == null ? product.getSalVersion() : salVersion);
263
264 prod.setBundledArtifacts(bundledArtifacts.isEmpty() ? product.getBundledArtifacts() : bundledArtifacts);
265 prod.setPluginArtifacts(pluginArtifacts.isEmpty() ? product.getPluginArtifacts() : pluginArtifacts);
266 prod.setLibArtifacts(libArtifacts.isEmpty() ? product.getLibArtifacts() : libArtifacts);
267
268 prod.setDataPath(StringUtils.isBlank(productDataPath) ? product.getDataPath() : productDataPath);
269 prod.setDataVersion(productDataVersion == null ? product.getDataVersion() : productDataVersion);
270 prod.setDataHome(dataHome == null ? product.getDataHome() : dataHome);
271 prod.setLog4jProperties(log4jProperties == null ? product.getLog4jProperties() : log4jProperties);
272 prod.setJvmArgs(jvmArgs == null ? product.getJvmArgs() : jvmArgs);
273 prod.setGroupId(groupId == null ? product.getGroupId() : groupId);
274 prod.setArtifactId(artifactId == null ? product.getArtifactId() : artifactId);
275 prod.setVersion(version == null ? product.getVersion() : version);
276
277 prod.setServer(server == null ? product.getServer() : server);
278 prod.setContextPath(contextPath == null ? product.getContextPath() : contextPath);
279 prod.setContainerId(containerId == null ? product.getContainerId() : containerId);
280 prod.setHttpPort(httpPort == 0 ? product.getHttpPort() : httpPort);
281 prod.setJvmDebugPort(jvmDebugPort == 0 ? product.getJvmDebugPort() : jvmDebugPort);
282
283 prod.setStartupTimeout(startupTimeout == 0 ? product.getStartupTimeout() : startupTimeout);
284 prod.setShutdownTimeout(shutdownTimeout == 0 ? product.getShutdownTimeout() : shutdownTimeout);
285 prod.setSynchronousStartup(synchronousStartup == null ? product.getSynchronousStartup() : synchronousStartup);
286
287
288 prod.setStudioProperties(studioProperties == null ? product.getStudioProperties() : studioProperties);
289 prod.setInstanceIds(instanceIds == null ? product.getInstanceIds() : instanceIds);
290 prod.setShutdownEnabled(shutdownEnabled == null ? product.getShutdownEnabled() : shutdownEnabled);
291
292 return prod;
293 }
294
295 public String getContainerId()
296 {
297 return containerId;
298 }
299
300 public void setContainerId(String containerId)
301 {
302 this.containerId = containerId;
303 }
304
305 public String getServer()
306 {
307 return server;
308 }
309
310 public void setServer(String server)
311 {
312 this.server = server;
313 }
314
315 public int getHttpPort()
316 {
317 return httpPort;
318 }
319
320 public void setHttpPort(int httpPort)
321 {
322 this.httpPort = httpPort;
323 }
324
325 public String getContextPath()
326 {
327 return contextPath;
328 }
329
330 public void setContextPath(String contextPath)
331 {
332 this.contextPath = contextPath;
333 }
334
335 public String getJvmArgs()
336 {
337 return jvmArgs;
338 }
339
340 public void setJvmArgs(String jvmArgs)
341 {
342 this.jvmArgs = jvmArgs;
343 }
344
345 public ArtifactRetriever getArtifactRetriever()
346 {
347 return artifactRetriever;
348 }
349
350 public void setArtifactRetriever(ArtifactRetriever artifactRetriever)
351 {
352 this.artifactRetriever = artifactRetriever;
353 }
354
355 public String getVersion()
356 {
357 return version;
358 }
359
360 public void setVersion(String version)
361 {
362 this.version = version;
363 }
364
365 public String getDataVersion()
366 {
367 return productDataVersion;
368 }
369
370 public void setDataVersion(String productDataVersion)
371 {
372 this.productDataVersion = productDataVersion;
373 }
374
375
376
377
378 public String getProductDataVersion()
379 {
380 return productDataVersion;
381 }
382
383
384
385
386 public void setProductDataVersion(String productDataVersion)
387 {
388 this.productDataVersion = productDataVersion;
389 }
390
391
392
393
394
395 public String getDataPath()
396 {
397 return productDataPath;
398 }
399
400
401
402
403
404 public void setDataPath(String productDataPath)
405 {
406 this.productDataPath = productDataPath;
407 }
408
409
410
411
412 public String getProductDataPath()
413 {
414 return productDataPath;
415 }
416
417
418
419
420 public void setProductDataPath(String productDataPath)
421 {
422 this.productDataPath = productDataPath;
423 }
424
425 public List<ProductArtifact> getPluginArtifacts()
426 {
427 return pluginArtifacts;
428 }
429
430 public void setPluginArtifacts(List<ProductArtifact> pluginArtifacts)
431 {
432 this.pluginArtifacts = pluginArtifacts;
433 }
434
435 public List<ProductArtifact> getLibArtifacts()
436 {
437 return libArtifacts;
438 }
439
440 public void setLibArtifacts(List<ProductArtifact> libArtifacts)
441 {
442 this.libArtifacts = libArtifacts;
443 }
444
445 public List<ProductArtifact> getBundledArtifacts()
446 {
447 return bundledArtifacts;
448 }
449
450 public void setBundledArtifacts(List<ProductArtifact> bundledArtifacts)
451 {
452 this.bundledArtifacts = bundledArtifacts;
453 }
454
455 public File getLog4jProperties()
456 {
457 return log4jProperties;
458 }
459
460 public void setLog4jProperties(File log4jProperties)
461 {
462 this.log4jProperties = log4jProperties;
463 }
464
465 public String getRestVersion()
466 {
467 return restVersion;
468 }
469
470 public void setRestVersion(String restVersion)
471 {
472 this.restVersion = restVersion;
473 }
474
475 public String getSalVersion()
476 {
477 return salVersion;
478 }
479
480 public void setSalVersion(String salVersion)
481 {
482 this.salVersion = salVersion;
483 }
484
485 public String getPdkVersion()
486 {
487 return pdkVersion;
488 }
489
490 public void setPdkVersion(String pdkVersion)
491 {
492 this.pdkVersion = pdkVersion;
493 }
494
495 public String getId()
496 {
497 return id;
498 }
499
500 public void setId(String id)
501 {
502 this.id = id;
503 }
504
505 public String getInstanceId()
506 {
507 return instanceId;
508 }
509
510 public void setInstanceId(String instanceId)
511 {
512 this.instanceId = instanceId;
513 }
514
515 public Boolean isInstallPlugin()
516 {
517 return installPlugin;
518 }
519
520 public void setInstallPlugin(final Boolean installPlugin)
521 {
522 this.installPlugin = installPlugin;
523 }
524
525 public String getWebConsoleVersion()
526 {
527 return webConsoleVersion;
528 }
529
530 public Boolean isEnableFastdev()
531 {
532 return enableFastdev;
533 }
534
535 public void setEnableFastdev(final Boolean enableFastdev)
536 {
537 this.enableFastdev = enableFastdev;
538 }
539
540 public String getFastdevVersion()
541 {
542 return fastdevVersion;
543 }
544
545 public void setFastdevVersion(String fastdevVersion)
546 {
547 this.fastdevVersion = fastdevVersion;
548 }
549
550 public Boolean isEnableDevToolbox()
551 {
552 return enableDevToolbox;
553 }
554
555 public void setEnableDevToolbox(final Boolean enableDevToolbox)
556 {
557 this.enableDevToolbox = enableDevToolbox;
558 }
559
560 public String getDevToolboxVersion()
561 {
562 return devToolboxVersion;
563 }
564
565 public void setDevToolboxVersion(String devToolboxVersion)
566 {
567 this.devToolboxVersion = devToolboxVersion;
568 }
569
570 public Boolean isEnablePde()
571 {
572 return enablePde;
573 }
574
575 public void setEnablePde(Boolean enablePde)
576 {
577 this.enablePde = enablePde;
578 }
579
580 public String getPdeVersion()
581 {
582 return pdeVersion;
583 }
584
585 public void setPdeVersion(String pdeVersion)
586 {
587 this.pdeVersion = pdeVersion;
588 }
589
590 public void setWebConsoleVersion(String webConsoleVersion)
591 {
592 this.webConsoleVersion = webConsoleVersion;
593 }
594
595
596
597
598 public void setSystemProperties(Properties systemProperties)
599 {
600 this.systemProperties.putAll((Map) systemProperties);
601 }
602
603
604
605
606 public Properties getSystemProperties()
607 {
608 Properties props = new Properties();
609 props.putAll(systemProperties);
610 return props;
611 }
612
613 public void setSystemPropertyVariables(Map<String,Object> systemProperties)
614 {
615 this.systemProperties = systemProperties;
616 }
617
618 public Map<String,Object> getSystemPropertyVariables()
619 {
620 return systemProperties;
621 }
622
623 public String getOutput()
624 {
625 return output;
626 }
627
628 public void setOutput(String output)
629 {
630 this.output = output;
631 }
632
633 public int getJvmDebugPort()
634 {
635 return jvmDebugPort;
636 }
637
638 public void setJvmDebugPort(int jvmDebugPort)
639 {
640 this.jvmDebugPort = jvmDebugPort;
641 }
642
643 public int getStartupTimeout()
644 {
645 return startupTimeout;
646 }
647
648 public void setStartupTimeout(int startupTimeout)
649 {
650 this.startupTimeout = startupTimeout;
651 }
652
653 public int getShutdownTimeout()
654 {
655 return shutdownTimeout;
656 }
657
658 public void setShutdownTimeout(int shutdownTimeout)
659 {
660 this.shutdownTimeout = shutdownTimeout;
661 }
662
663 public String getGroupId()
664 {
665 return groupId;
666 }
667
668 public void setGroupId(String groupId)
669 {
670 this.groupId = groupId;
671 }
672
673 public String getArtifactId()
674 {
675 return artifactId;
676 }
677
678 public void setArtifactId(String artifactId)
679 {
680 this.artifactId = artifactId;
681 }
682
683 public StudioProperties getStudioProperties()
684 {
685 return studioProperties;
686 }
687
688 public void setStudioProperties(StudioProperties studioProperties)
689 {
690 this.studioProperties = studioProperties;
691 }
692
693 public List<String> getInstanceIds()
694 {
695 return instanceIds;
696 }
697
698 public void setInstanceIds(List<String> instanceIds)
699 {
700 this.instanceIds = instanceIds;
701 }
702
703 public String getGappsEnabled()
704 {
705 return gappsEnabled;
706 }
707
708 public void setGappsEnabled(String gappsEnabled)
709 {
710 this.gappsEnabled = gappsEnabled;
711 }
712
713 public String getGappsDomain()
714 {
715 return gappsDomain;
716 }
717
718 public void setGappsDomain(String gappsDomain)
719 {
720 this.gappsDomain = gappsDomain;
721 }
722
723 public void setSystemProperties(Map<String, Object> systemProperties)
724 {
725 this.systemProperties = systemProperties;
726 }
727
728 public Boolean getShutdownEnabled()
729 {
730 return shutdownEnabled;
731 }
732
733 public void setShutdownEnabled(Boolean shutdownEnabled)
734 {
735 this.shutdownEnabled = shutdownEnabled;
736 }
737
738 public Boolean getSynchronousStartup()
739 {
740 return synchronousStartup;
741 }
742
743 public void setSynchronousStartup(Boolean synchronousStartup)
744 {
745 this.synchronousStartup = synchronousStartup;
746 }
747
748
749 public String getDataHome()
750 {
751 return dataHome;
752 }
753
754
755
756
757
758 public void setDataHome(String dataHome)
759 {
760 this.dataHome = dataHome;
761 }
762
763 @Override
764 public String toString()
765 {
766 return "Product " + id + " [instanceId=" + instanceId + ", localhost:" + httpPort + contextPath + "]";
767 }
768
769 }