1 package com.atlassian.maven.plugins.amps.pdk;
2
3 import com.atlassian.maven.plugins.amps.AbstractProductHandlerAwareMojo;
4 import com.atlassian.maven.plugins.amps.product.ProductHandler;
5 import org.jfrog.maven.annomojo.annotations.MojoParameter;
6
7
8
9
10 public abstract class AbstractPdkMojo extends AbstractProductHandlerAwareMojo
11 {
12
13
14
15 @MojoParameter(expression = "${atlassian.plugin.key}")
16 protected String pluginKey;
17
18
19
20
21 @MojoParameter(expression = "${project.groupId}")
22 protected String groupId;
23
24
25
26
27 @MojoParameter(expression = "${project.artifactId}")
28 protected String artifactId;
29
30
31
32
33 @MojoParameter(expression = "${http.port}")
34 private int httpPort;
35
36
37
38
39 @MojoParameter(expression = "${context.path}")
40 protected String contextPath;
41
42
43
44
45 @MojoParameter(expression = "${username}", defaultValue = "admin")
46 protected String username;
47
48
49
50
51 @MojoParameter(expression = "${password}", defaultValue = "admin")
52 protected String password;
53
54
55
56
57 @MojoParameter(expression = "${server}", defaultValue = "localhost")
58 protected String server;
59
60 protected void ensurePluginKeyExists()
61 {
62 if (pluginKey == null)
63 {
64 pluginKey = groupId + "." + artifactId;
65 }
66 }
67
68 protected int getHttpPort(final ProductHandler handler)
69 {
70 return httpPort == 0 ? handler.getDefaultHttpPort() : httpPort;
71 }
72
73 protected String getContextPath(final ProductHandler handler)
74 {
75 return contextPath == null ? "/" + handler.getId() : contextPath;
76 }
77 }